/** * 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'); }
/** * 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); } }
/** * Test isNew * * @return void */ public function testIsNew() { $this->object->set('session.counter', 1); $this->assertEquals(true, $this->object->isNew(), '$isNew should be true.'); }
/** * {@inheritdoc} */ public function clearGroup($group = self::GROUP_DFAULT) { $this->_session->set($group, null, $this->_namespace); }
/** * 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; }
/** * 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; } }
/** * Set the queue. * * @param array $queue The queue. * * @return void */ public function setQueue(array $queue) { $this->session->set($this->sessionVariable, $queue, 'rbrowser'); }
/** * Clear value in group * @param $key * @param string $group * @return mixed */ public function clearValue($key, $group = 'default') { return $this->_session->set($key, null, $group); }
/** * 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')); } }
/** * 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; }