本文整理汇总了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;
}
示例2: getSession
/**
* Returns session handler.
* @return Nette\Web\Session
*/
protected function getSession()
{
return Environment::getSession();
}
示例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;
}
示例4: getSession
/**
* @return Nette\Http\Session
*/
protected function getSession()
{
if (!$this->httpRequest) {
$this->httpRequest = Nette\Environment::getHttpRequest();
}
return Nette\Environment::getSession();
}
示例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;
}
示例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)!");
}
示例7: getSession
/**
* @return Nette\Web\Session
*/
public function getSession($namespace = NULL)
{
return Environment::getSession($namespace);
}
示例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;
}
示例9: getSession
/**
* @return Nette\Web\Session
*/
protected function getSession($namespace = NULL)
{
return Environment::getSession($namespace);
}
示例10: __construct
/**
* @param string namespace
*/
public function __construct($namespace)
{
$this->namespace = $namespace;
$this->session = Environment::getSession($namespace);
}
示例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())");
}
示例12: getSession
/**
* @return Session
*/
private static function getSession()
{
return Environment::getSession('RequestButtonStorage');
}
示例13: getSession
/**
* Get session - unique for each component
*/
public function getSession()
{
$this->gridSession = Environment::getSession('Component/Grid/' . $this->name);
}