本文整理汇总了PHP中JUser::getParam方法的典型用法代码示例。如果您正苦于以下问题:PHP JUser::getParam方法的具体用法?PHP JUser::getParam怎么用?PHP JUser::getParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUser
的用法示例。
在下文中一共展示了JUser::getParam方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getParam
/**
* Get param from user storage
* @param string $key
* @param mixed $default
* @return mixed
*/
public function getParam($key, $default = null)
{
$params = (array) $this->_user->getParam(self::PARAM_NAMESPACE, array());
if (isset($params[$key])) {
return $params[$key];
}
return $default;
}
示例2: testParameter
/**
* Tests JUser Parameter setting and retrieval.
*
* @return void
*
* @since 12.1
*
* @covers JUser::defParam
* @covers JUser::getParam
* @covers JUser::setParam
*/
public function testParameter()
{
$this->assertThat($this->object->getParam('holy', 'fred'), $this->equalTo('fred'));
$this->object->defParam('holy', 'batman');
$this->assertThat($this->object->getParam('holy', 'fred'), $this->equalTo('batman'));
$this->object->setParam('holy', 'batman');
$this->assertThat($this->object->getParam('holy', 'fred'), $this->equalTo('batman'));
}
示例3: getParam
/**
* Method to get a parameter value from CMS user object
*
* @param string $key Parameter key
* @param mixed $default Parameter default value
* @param string $type [optional] Default: GetterInterface::RAW. Or const int GetterInterface::COMMAND|GetterInterface::INT|... or array( const ) or array( $key => const )
* @return mixed The value or the default if it did not exist
*/
public function getParam($key, $default = null, $type = GetterInterface::RAW)
{
return Get::clean($this->cmsOwnUser->getParam($key, $default), $type);
}
示例4: published
function published($publish)
{
$db = JFactory::getDBO();
$ids = JRequest::getVar('cid', array());
$ids = implode(',', $ids);
$query = "UPDATE #__jav_items" . " SET published = " . intval($publish) . " WHERE id IN ( {$ids} )";
$db->setQuery($query);
if (!$db->query()) {
return false;
}
foreach (JRequest::getVar('cid', array()) as $id) {
$item = $this->getItem(array($id));
$logs = $this->getLogs(" and item_id={$id}");
if ($logs) {
foreach ($logs as $log) {
$user = JFactory::getUser($log->user_id);
$user_no_session = new JUser($log->user_id);
$total_voted = (int) $user_no_session->getParam('total-voted-' . $item->voice_types_id);
if ($publish == 0) {
$total_voted = (int) ($total_voted - abs($log->votes));
} else {
$total_voted = (int) ($total_voted + abs($log->votes));
}
if ($total_voted < 0) {
$total_voted = 0;
}
$user_no_session->setParam('total-voted-' . $item->voice_types_id, $total_voted);
$user_no_session->save();
}
}
}
return true;
}