本文整理汇总了PHP中JSession::set方法的典型用法代码示例。如果您正苦于以下问题:PHP JSession::set方法的具体用法?PHP JSession::set怎么用?PHP JSession::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSession
的用法示例。
在下文中一共展示了JSession::set方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetToken
/**
* Test...
*
* @covers JSession::getToken
*
* @return void
*/
public function testGetToken()
{
$this->object->set('session.token', 'abc');
$this->assertEquals('abc', $this->object->getToken(), 'Token should be abc');
$this->object->set('session.token', null);
$token = $this->object->getToken();
$this->assertEquals(32, strlen($token), 'Line: ' . __LINE__ . ' Token should be length 32');
$token2 = $this->object->getToken(true);
$this->assertNotEquals($token, $token2, 'Line: ' . __LINE__ . ' New token should be different');
}
示例2: setReturn
/**
* Sets the return value
*
* @param type $Itemid
* @return type
*/
protected function setReturn($Itemid = null, $message = '')
{
if (empty($Itemid)) {
return;
}
$newUrl = base64_encode(urlencode(JRoute::_($this->getMenuitemUrl($Itemid), false)));
$this->input->set('return', $newUrl);
if (!empty($message)) {
$this->session->set('asar.message', $message);
}
}
示例3: testIsNew
/**
* Test isNew
*
* @return void
*/
public function testIsNew()
{
$this->object->set('session.counter', 1);
$this->assertEquals(true, $this->object->isNew(), '$isNew should be true.');
}
示例4: clearGroup
/**
* {@inheritdoc}
*/
public function clearGroup($group = self::GROUP_DFAULT)
{
$this->_session->set($group, null, $this->_namespace);
}
示例5: randomClassName
/**
* Creates a valid, random name for the class selector
*
* @param JSession $session
*
* @return string
*/
private static function randomClassName($session)
{
$characters = range('a', 'z');
$class_name = $characters[mt_rand(0, count($characters) - 1)];
$class_name_length = mt_rand(6, 12);
$class_name .= @JUserHelper::genRandomPassword($class_name_length);
$head_data = '<style type="text/css">div.' . $class_name . '{text-align: center; border: 1px solid #DD87A2; border-radius: 2px; padding: 5px; background-color: #F9CAD9; font-size: 120%; margin: 10px 0;}</style>';
EasyJoomlaBackupHelper::addHeadData($head_data);
$session->set('field_value_head', $head_data, 'krdonationcodecheck_footer');
return $class_name;
}
示例6: getTotalRecords
/**
* Get the total number of records in the table
*
* @return int total number of records
*/
public function getTotalRecords()
{
$package = $this->app->getUserState('com_fabrik.package', 'fabrik');
// $$$ rob ensure that the limits are set - otherwise can create monster query
$this->setLimits();
$context = 'com_' . $package . '.list' . $this->getRenderContext() . '.total';
if (isset($this->totalRecords)) {
$this->session->set($context, $this->totalRecords);
return $this->totalRecords;
}
// $$$ rob getData() should always be run first
if (!isset($this->data) || is_null($this->data)) {
$this->getData();
return $this->totalRecords;
}
if ($this->mergeJoinedData()) {
$this->totalRecords = $this->getJoinMergeTotalRecords();
$this->session->set($context, $this->totalRecords);
return $this->totalRecords;
}
}
示例7: setQueue
/**
* Set the queue.
*
* @param array $queue The queue.
*
* @return void
*/
public function setQueue(array $queue)
{
$this->session->set($this->sessionVariable, $queue, 'rbrowser');
}
示例8: clearValue
/**
* Clear value in group
* @param $key
* @param string $group
* @return mixed
*/
public function clearValue($key, $group = 'default')
{
return $this->_session->set($key, null, $group);
}
示例9: afterSessionStart
/**
* Event listener for the `onAfterSessionStart` event.
*
* @param JSession $session Session object
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function afterSessionStart(JSession $session)
{
if ($session->isNew()) {
$session->set('registry', new Registry('session'));
}
}
示例10: store
/**
* Store the data to cache by id and group
*
* @param string $key The cache data id
* @param string $group The cache data group
* @param string $data The data to store in cache
*
* @return boolean True on success, false otherwise
*/
public function store($key, $group = null, $data = null)
{
$data = json_decode(json_encode($data));
$this->session->set('cache.' . $group . '.' . $key, $data);
return $this;
}