当前位置: 首页>>代码示例>>PHP>>正文


PHP Environment::getSession方法代码示例

本文整理汇总了PHP中Nette\Environment::getSession方法的典型用法代码示例。如果您正苦于以下问题:PHP Environment::getSession方法的具体用法?PHP Environment::getSession怎么用?PHP Environment::getSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Environment的用法示例。


在下文中一共展示了Environment::getSession方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getFilters

 public function getFilters()
 {
     $stored = \Nette\Environment::getSession($this->getParent()->getName());
     $res = null;
     //      dump($stored->filter);
     //      foreach ($stored->filter as $key => $value) {
     //         dump($key);
     //         if($key != 'like' and $key !='boolean')
     //            $res[] = '['.eregi_replace('__','.',$key).'] LIKE "%'.$value.'%"';
     //      }
     return $res;
 }
开发者ID:soundake,项目名称:pd,代码行数:12,代码来源:FilterControl.php

示例2: getSession

 /**
  * Returns session handler.
  * @return Nette\Web\Session
  */
 protected function getSession()
 {
     return Environment::getSession();
 }
开发者ID:jakubkulhan,项目名称:nette,代码行数:8,代码来源:User.php

示例3: getSecurityToken

 /**
  * Get security token
  * @return string
  */
 public function getSecurityToken()
 {
     $session = Environment::getSession(__CLASS__ . "-" . __METHOD__);
     if (empty($session->securityToken)) {
         $session->securityToken = md5(uniqid(mt_rand(), true));
     }
     return $session->securityToken;
 }
开发者ID:v6ak,项目名称:Gridito,代码行数:12,代码来源:Grid.php

示例4: getSession

 /**
  * @return Nette\Http\Session
  */
 protected function getSession()
 {
     if (!$this->httpRequest) {
         $this->httpRequest = Nette\Environment::getHttpRequest();
     }
     return Nette\Environment::getSession();
 }
开发者ID:ppwalks33,项目名称:cleansure,代码行数:10,代码来源:Form.php

示例5: onShutdown

 /**
  * @param $presenter Presenter
  * @param $response PresenterResponse
  * @internal
  */
 public function onShutdown($presenter, $response)
 {
     $this->response = $response;
     $application = Environment::getApplication();
     $presenter = $application->getPresenter();
     $request = $presenter->getRequest();
     $httpRequest = Environment::getHttpRequest();
     $entry = array();
     if ($signal = $presenter->getSignal()) {
         $receiver = empty($signal[0]) ? $presenter->name : $signal[0];
         $signal = $receiver . " :: " . $signal[1];
     }
     if ($response !== NULL) {
         $rInfo = get_class($response);
         if ($response->getReflection()->hasMethod('getCode')) {
             $rInfo .= ' (' . $response->code . ')';
         }
     }
     $entry['info']['presenter'] = $presenter->backlink();
     $entry['info']['response'] = $response === NULL ? 'NO RESPONSE' : $rInfo;
     $entry['info']['uri'] = $httpRequest->getUrl();
     $entry['info']['uriPath'] = $httpRequest->getUrl()->path;
     $entry['info']['request'] = $request->getMethod();
     $entry['info']['signal'] = $signal;
     $entry['info']['time'] = number_format((microtime(TRUE) - Debugger::$time) * 1000, 1, '.', ' ');
     $entry['dumps']['HttpRequest'] = Helpers::clickableDump($httpRequest);
     $entry['dumps']['PresenterRequest'] = Helpers::clickableDump($request);
     $entry['dumps']['Presenter'] = Helpers::clickableDump($presenter);
     $entry['dumps']['PresenterResponse'] = Helpers::clickableDump($response);
     foreach (self::$dumps as $key => $dump) {
         if (is_numeric($key)) {
             $entry['dumps'][] = $dump;
         } else {
             $entry['dumps'][$key] = $dump;
         }
     }
     $session = Environment::getSession('debug/RequestsPanel');
     if (!isset($session->logs)) {
         $session->logs = array();
     }
     $session->logs[] = $entry;
 }
开发者ID:jasir,项目名称:RequestsPanel,代码行数:47,代码来源:RequestsPanel.php

示例6: download

 /**
  * Download the file!
  * @param IDownloader $downloader
  */
 function download(IDownloader $downloader = null)
 {
     $req = Environment::getHttpRequest();
     $res = Environment::getHttpResponse();
     if (self::$closeSession) {
         $ses = Environment::getSession();
         if ($ses->isStarted()) {
             $ses->close();
         }
     }
     if ($this->getContentDisposition() == "inline" and is_null($this->enableBrowserCache)) {
         $this->enableBrowserCache = true;
     } else {
         $this->enableBrowserCache = false;
     }
     if ($downloader === null) {
         $downloaders = self::getFileDownloaders();
     } else {
         $downloaders = array($downloader);
     }
     if (count($downloaders) <= 0) {
         throw new InvalidStateException("There is no registred downloader!");
     }
     krsort($downloaders);
     $lastException = null;
     foreach ($downloaders as $downloader) {
         if ($downloader instanceof IDownloader and $downloader->isCompatible($this)) {
             try {
                 FDTools::clearHeaders($res);
                 // Delete all headers
                 $this->transferredBytes = 0;
                 $this->onBeforeDownloaderStarts($this, $downloader);
                 $downloader->download($this);
                 // Start download
                 $this->onComplete($this, $downloader);
                 die;
                 // If all gone ok -> die
             } catch (FDSkypeMeException $e) {
                 if ($res->isSent()) {
                     throw new InvalidStateException("Headers are already sent! Can't skip downloader.");
                 } else {
                     continue;
                 }
             } catch (Exception $e) {
                 if (!$res->isSent()) {
                     FDTools::clearHeaders($res);
                 }
                 throw $e;
             }
         }
     }
     // Pokud se soubor nějakým způsobem odešle - toto už se nespustí
     if ($lastException instanceof Exception) {
         FDTools::clearHeaders(Environment::getHttpResponse(), TRUE);
         throw $lastException;
     }
     if ($req->getHeader("Range")) {
         FDTools::_HTTPError(416);
     } else {
         $res->setCode(500);
     }
     throw new InvalidStateException("There is no compatible downloader (all downloader returns downloader->isComplatible()=false or was skipped)!");
 }
开发者ID:OCC2,项目名称:occ2pacs,代码行数:67,代码来源:BaseFileDownload.php

示例7: getSession

 /**
  * @return Nette\Web\Session
  */
 public function getSession($namespace = NULL)
 {
     return Environment::getSession($namespace);
 }
开发者ID:jff15,项目名称:travelbot,代码行数:7,代码来源:Presenter.php

示例8: checkCsrfLinkToken

 /**
  * Checks CSRF token passed by link.
  *
  * @return boolean TRUE if passed CSRF token equals with token in session.
  */
 private function checkCsrfLinkToken()
 {
     $sess = Environment::getSession(self::CSRF_IDENTIFIER);
     if ($sess->csrfLinkToken !== $this->getParam(self::CSRF_IDENTIFIER)) {
         return FALSE;
     }
     return TRUE;
 }
开发者ID:petak23,项目名称:echo-msz,代码行数:13,代码来源:Pollie.php

示例9: getSession

 /**
  * @return Nette\Web\Session
  */
 protected function getSession($namespace = NULL)
 {
     return Environment::getSession($namespace);
 }
开发者ID:nella,项目名称:ActiveMapper,代码行数:7,代码来源:Presenter.php

示例10: __construct

 /**
  * @param  string namespace
  */
 public function __construct($namespace)
 {
     $this->namespace = $namespace;
     $this->session = Environment::getSession($namespace);
 }
开发者ID:soundake,项目名称:pd,代码行数:8,代码来源:Model.php

示例11: denyVotingForUser

 /**
  * Disables voting for the user who had currently voted.
  */
 private function denyVotingForUser()
 {
     $sess = Environment::getSession(self::SESSION_NAMESPACE);
     $sess->poll[$this->id] = TRUE;
     $this->connection->query("INSERT INTO pollie_votes (questionId, ip, date) VALUES ({$this->id}, '{$_SERVER['REMOTE_ADDR']}', NOW())");
 }
开发者ID:petak23,项目名称:echo-msz,代码行数:9,代码来源:ModelImpl.php

示例12: getSession

 /**
  * @return Session
  */
 private static function getSession()
 {
     return Environment::getSession('RequestButtonStorage');
 }
开发者ID:soundake,项目名称:requestbutton,代码行数:7,代码来源:RequestButtonStorage.php

示例13: getSession

 /**
  * Get session - unique for each component
  */
 public function getSession()
 {
     $this->gridSession = Environment::getSession('Component/Grid/' . $this->name);
 }
开发者ID:ricco24,项目名称:DataGrid,代码行数:7,代码来源:DataGrid.php


注:本文中的Nette\Environment::getSession方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。