本文整理汇总了PHP中Nette\Http\Session::getSection方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::getSection方法的具体用法?PHP Session::getSection怎么用?PHP Session::getSection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Http\Session
的用法示例。
在下文中一共展示了Session::getSection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: invoke
/**
* @return AjaxFileUploaderControl
*/
public function invoke($basePath)
{
$control = new AjaxFileUploaderControl($this->ajaxDir, $basePath . $this->getRelativeAjaxPath(), $this->session->getSection('ajaxFileUploader'));
$control->onFileUpload[] = $this->handleFileUpload;
$control->onAfterFileUpload[] = $this->handleFileUploadUnlink;
return $control;
}
示例2: setDebugMode
/**
* Sets debug mode.
* @param boolean $debugMode
*/
public function setDebugMode($debugMode)
{
$this->debugMode = $debugMode;
if ($debugMode === true) {
$this->sessionStorage = $this->session->getSection(Gettext::$namespace);
}
}
示例3: getSection
/**
* @param $section
* @return Mesour\Components\Session\ISessionSection
* @throws Mesour\InvalidArgumentException
*/
public function getSection($section)
{
if (!Mesour\Components\Utils\Helpers::validateKeyName($section)) {
throw new Mesour\InvalidArgumentException('SessionSection name must be integer or string, ' . gettype($section) . ' given.');
}
$this->sections[$section] = $section;
return new SessionSection($this->session->getSection($section));
}
示例4: getPassage
/**
* Get web passage uri from session if any
* @return mixed
*/
public function getPassage($size = NULL, $include_host = TRUE)
{
$url = $this->request->url->scheme . '://' . $this->request->url->host;
$passage = $this->session->getSection('web_passage')->web_passage ?: [];
if ($size) {
$passage = array_slice($passage, 0, $size);
}
if (!$include_host) {
$passage = array_map(function ($item) use($url) {
return str_replace($url, '', $item);
}, $passage);
}
return $passage;
}
示例5: __construct
/**
* @param \Nette\ComponentModel\IContainer $ajaxDir
* @param string $ajaxPath
* @param \Nette\Http\Session $session
*/
public function __construct($ajaxDir, $ajaxPath, Session $session)
{
parent::__construct();
$this->ajaxDir = $ajaxDir;
$this->ajaxPath = $ajaxPath;
$this->sessionSection = $session->getSection('ajaxUploader-' . $this->getName());
}
示例6: __construct
public function __construct(EntityManager $entityManager, Session $session, AdministrationManager $administrationManager)
{
$this->roleRepository = $entityManager->getRepository(Role::class);
$this->permissionRepository = $entityManager->getRepository(Permission::class);
$this->session = $session->getSection(self::SESSION_SECTION);
$this->administrationManager = $administrationManager;
}
示例7: __construct
/**
* @param PresenterFactory $presenterFactory
* @param BaseRepository $roleRepository
* @param Session $session
*/
public function __construct(PresenterFactory $presenterFactory, BaseRepository $roleRepository, Session $session, Callback $checkConnection)
{
$this->presenterFactory = $presenterFactory;
$this->roleRepository = $roleRepository;
$this->session = $session->getSection(self::SESSION_SECTION);
$this->checkConnection = $checkConnection;
}
示例8: getSession
/**
* @param string
* @return Nette\Http\Session|Nette\Http\SessionSection
*/
public function getSession($namespace = NULL)
{
if (!$this->session) {
throw new Nette\InvalidStateException('Service Session has not been set.');
}
return $namespace === NULL ? $this->session : $this->session->getSection($namespace);
}
示例9: getFlashSession
/**
* Returns session namespace provided to pass temporary data between redirects.
* @return Nette\Http\SessionSection
*/
public function getFlashSession()
{
if (empty($this->params[self::FLASH_KEY])) {
$this->params[self::FLASH_KEY] = Nette\Utils\Strings::random(4);
}
return $this->session->getSection('Nette.Application.Flash/' . $this->params[self::FLASH_KEY]);
}
示例10: getStateSession
/**
* @return \Nette\Http\SessionSection
*/
protected function getStateSession()
{
if (is_null($this->session)) {
throw new \Nette\InvalidStateException('Session is not set! Use \'setSession\' to set session!');
}
return $this->session->getSection('VisualPaginator/' . $this->lookupPath('Nette\\ComponentModel\\IComponent', FALSE) ?: $this->getName() . '/states');
}
示例11: authenticate
/**
* @throws AuthenticationException
* @param array $credentials
* @return Identity
*/
public function authenticate(array $credentials)
{
list($code, $state) = $credentials;
$session = $this->session->getSection(AuthPresenterTrait::$OAUTH_SESSION);
if (empty($session->state) || $session->state !== $state) {
throw new AuthenticationException('Invalid state.');
}
try {
$accessToken = $this->provider->getAccessToken('authorization_code', ['code' => $code]);
/* @var $data AngelcamUser */
$data = $this->provider->getResourceOwner($accessToken);
} catch (\Exception $e) {
$invalidToken = $e instanceof ClientException && $e->getResponse()->getStatusCode() === 401;
throw new AuthenticationException($invalidToken ? 'Invalid token' : 'Authentication failed', 0, $e);
}
return new Identity($data->getId(), $data, $accessToken);
}
示例12: __construct
public function __construct(Kdyby\Doctrine\EntityManager $em, Zax\Utils\AppDir $appDir, Nette\Http\Session $session)
{
$this->em = $em;
$this->schemaTool = new Doctrine\ORM\Tools\SchemaTool($this->em);
$cacheStorage = new Nette\Caching\Storages\FileStorage($appDir . '/modules/Install/components/Install/installSchema');
$this->cache = new Nette\Caching\Cache($cacheStorage);
$this->sessionSection = $session->getSection('ZaxCMS.DatabaseGenerator');
}
示例13: __construct
public function __construct(\Nette\Http\Session $session, \Fabian\Linkedin\Configuration $config)
{
$this->session = $session->getSection('linkedin');
if (isset($this->session->access_token)) {
$this->accessToken = $this->session->access_token;
}
$this->config = $config;
}
示例14: getSecurityToken
/**
* Get security token
* @return string
*/
public function getSecurityToken()
{
$session = $this->session->getSection(__CLASS__ . '-' . __METHOD__);
if (empty($session->securityToken)) {
$session->securityToken = md5(uniqid(mt_rand(), true));
}
return $session->securityToken;
}
示例15: __construct
public function __construct(EntityManager $entityManager, Session $session, IBrowserControlFactory $browserFactory)
{
parent::__construct();
$this->entityManager = $entityManager;
$this->fileRepository = $entityManager->getRepository(File::class);
$this->dirRepository = $entityManager->getRepository(Dir::class);
$this->session = $session->getSection('Venne.Content.filesSide');
$this->browserFactory = $browserFactory;
}