getSession() public method

get item from session
Since: 2.2.0
public getSession ( string $key = null ) : string
$key string key of the item
return string
 /**
  * log
  *
  * @since 2.2.0
  *
  * @return array
  */
 protected static function _log()
 {
     $root = Registry::get('root');
     $fullRoute = Registry::get('fullRoute');
     $recentView = Request::getSession($root . '/recent_view');
     /* handle recent view */
     if ($fullRoute && current($recentView) !== $fullRoute) {
         if (!is_array($recentView)) {
             $recentView = array();
         }
         array_unshift($recentView, $fullRoute);
         Request::setSession($root . '/recent_view', $recentView);
     }
     $output = $recentView;
     return $output;
 }
Exemplo n.º 2
0
 /**
  * init the class
  *
  * @since 2.1.0
  */
 public function init()
 {
     $this->_detect(array('query' => Request::getQuery('l'), 'session' => Request::getSession($this->_registry->get('root') . '/language'), 'contents' => $this->_registry->get('lastTable') ? Db::forPrefixTable($this->_registry->get('lastTable'))->where('id', $this->_registry->get('lastId'))->findOne()->language : null, 'settings' => Db::getSettings('language'), 'browser' => substr(Request::getServer('HTTP_ACCEPT_LANGUAGE'), 0, 2), 'fallback' => 'en'), 'language', 'languages/{value}.json');
 }
Exemplo n.º 3
0
 /**
  * init the class
  *
  * @since 2.1.0
  */
 public function init()
 {
     $this->_detect(array('query' => Request::getQuery('t'), 'session' => Request::getSession($this->_registry->get('root') . '/template'), 'contents' => $this->_registry->get('lastTable') ? Db::forPrefixTable($this->_registry->get('lastTable'))->where('id', $this->_registry->get('lastId'))->findOne()->template : null, 'settings' => Db::getSettings('template'), 'fallback' => 'default'), 'template', 'templates/{value}/index.phtml');
 }
Exemplo n.º 4
0
 /**
  * testSession
  *
  * @since 2.2.0
  */
 public function testSession()
 {
     /* setup */
     Request::setSession('testKey', 'testValue');
     /* result */
     $result = Request::getSession('testKey');
     /* compare */
     $this->assertEquals('testValue', $result);
 }