本文整理汇总了PHP中unknown_type::getVar方法的典型用法代码示例。如果您正苦于以下问题:PHP unknown_type::getVar方法的具体用法?PHP unknown_type::getVar怎么用?PHP unknown_type::getVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unknown_type
的用法示例。
在下文中一共展示了unknown_type::getVar方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createPollName
/**
* Create a unique identifier for a poll.
* @param unknown_type $user
* @return unknown_type
*/
public static function createPollName($user)
{
$t = self::table(__CLASS__);
if ($user === false) {
$uid = 0;
$uname = '_x_guest';
} else {
$uid = $user->getVar('user_id');
$uname = '_y_' . $user->getVar('user_name');
}
if (false === ($name = $t->selectVar('vm_name', "vm_uid={$uid}", 'vm_date DESC'))) {
$count = 1;
} else {
if (1 === preg_match('/^_(?:x|y)_.+_(\\d+)$/D', $name, $matches)) {
$count = $matches[1] + 1;
} else {
$count = 1;
}
}
// $count = $t->countRows("vm_uid=$uid") + 1;
return $uname . '_' . $count;
}
示例2: fakeLink
/**
* @param unknown_type $user
* @param unknown_type $href
* @param unknown_type $descr
* @param unknown_type $descr2
* @param unknown_type $tags
* @param unknown_type $score
* @param unknown_type $gid
* @param unknown_type $sticky
* @param unknown_type $in_moderation
* @param unknown_type $unafiliate
* @param unknown_type $memberlink
* @return GWF_Links
*/
public static function fakeLink($user, $href, $descr, $descr2, $tags = '', $score = 0, $gid = 0, $sticky = false, $in_moderation = false, $unafiliate = false, $memberlink = false, $private = false, $langid = 1)
{
$options = 0;
$options |= $sticky ? self::STICKY : 0;
$options |= $in_moderation ? self::IN_MODERATION : 0;
$options |= $unafiliate ? self::UNAFILIATE : 0;
$options |= $memberlink ? self::MEMBER_LINK : 0;
$options |= $private ? self::ONLY_PRIVATE : 0;
return new self(array('link_id' => 0, 'link_user' => $user, 'link_gid' => $gid, 'link_score' => $score, 'link_date' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'link_href' => $href, 'link_descr' => $descr, 'link_descr2' => $descr2, 'link_clicks' => 0, 'link_favcount' => 0, 'link_options' => $options, 'link_voteid' => 0, 'link_readby' => $user === false ? ':' : ':' . $user->getVar('user_id') . ':', 'link_tags' => $tags, 'link_popular' => 0, 'link_lang' => $langid));
}
示例3: insert
/**
* Save a icms_view_block_Object Object
*
* Overwrited Method
*
* @param unknown_type $obj
* @param unknown_type $force
* @param unknown_type $checkObject
* @param unknown_type $debug
* @return unknown
*/
public function insert(&$obj, $force = false, $checkObject = true, $debug = false)
{
$new = $obj->isNew();
$obj->setVar('last_modified', time());
$obj->setVar('isactive', true);
if (!$new) {
$sql = sprintf("DELETE FROM %s WHERE block_id = '%u'", $this->db->prefix('block_module_link'), (int) $obj->getVar('bid'));
if (false != $force) {
$this->db->queryF($sql);
} else {
$this->db->query($sql);
}
} else {
icms_loadLanguageFile('system', 'blocksadmin', true);
if ($obj->getVar('block_type') == 'K') {
$obj->setVar('name', _AM_CLONE);
} else {
switch ($obj->getVar('c_type')) {
case 'H':
$obj->setVar('name', _AM_CUSTOMHTML);
break;
case 'P':
$obj->setVar('name', _AM_CUSTOMPHP);
break;
case 'S':
$obj->setVar('name', _AM_CUSTOMSMILE);
break;
case 'T':
$obj->setVar('name', _AM_CUSTOMNOSMILE);
break;
default:
break;
}
}
}
$status = parent::insert($obj, $force, $checkObject, $debug);
// TODO: Make something to no query here... implement IPF for block_module_link
$page = $obj->getVar('visiblein', 'e');
if (!empty($page)) {
if (is_array($obj->getVar('visiblein', 'e'))) {
foreach ($obj->getVar('visiblein', 'e') as $bmid) {
$page = explode('-', $bmid);
$mid = $page[0];
$pageid = $page[1];
$sql = "INSERT INTO " . $this->db->prefix('block_module_link') . " (block_id, module_id, page_id) VALUES ('" . (int) $obj->getVar("bid") . "', '" . (int) $mid . "', '" . (int) $pageid . "')";
if (false != $force) {
$this->db->queryF($sql);
} else {
$this->db->query($sql);
}
}
} else {
$page = explode('-', $obj->getVar('visiblein', 'e'));
$mid = $page[0];
$pageid = $page[1];
$sql = "INSERT INTO " . $this->db->prefix('block_module_link') . " (block_id, module_id, page_id) VALUES ('" . (int) $obj->getVar("bid") . "', '" . (int) $mid . "', '" . (int) $pageid . "')";
if (false != $force) {
$this->db->queryF($sql);
} else {
$this->db->query($sql);
}
}
}
return $status;
}
示例4: fakeThread
/**
* Create a new thread that can be used as a fake thread.
* You can also call insert() on it, and it becomes a real row.
* @param unknown_type $user GWF_User or false
* @param unknown_type $title string
* @param unknown_type $boardid int
* @param unknown_type $groupid int
* @param unknown_type $postcount int
* @param unknown_type $options int
* @return GWF_ForumThread
*/
public static function fakeThread($user = false, $title, $boardid = 0, $groupid = 0, $postcount = 1, $options = 0, $date = true)
{
if ($user === false) {
$userid = 0;
$username = '';
} else {
$userid = $user->getID();
$username = $user->getVar('user_name');
}
$date = is_bool($date) ? GWF_Time::getDate(GWF_Date::LEN_SECOND) : $date;
return new self(array('thread_tid' => 0, 'thread_bid' => $boardid, 'thread_gid' => $groupid, 'thread_uid' => $userid, 'thread_firstposter' => $username, 'thread_firstdate' => $date, 'thread_lastpost' => 0, 'thread_lastposter' => $username, 'thread_lastdate' => $date, 'thread_title' => $title, 'thread_options' => $options, 'thread_postcount' => $postcount, 'thread_viewcount' => 0, 'thread_watchers' => 0, 'thread_thanks' => 0, 'thread_votes_up' => 0, 'thread_votes_down' => 0, 'thread_unread' => $user === false ? ':' : ':' . $user->getID() . ':', 'thread_pollid' => 0, 'thread_force_unread' => ':'));
}