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


PHP Session::started方法代码示例

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


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

示例1: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->View = new View();
     $this->Session = new SessionHelper($this->View);
     Session::start();
     if (!Session::started()) {
         Session::start();
     }
     $_SESSION = array('test' => 'info', 'Message' => array('flash' => array('element' => 'default', 'params' => array(), 'message' => 'This is a calling'), 'notification' => array('element' => 'session_helper', 'params' => array('title' => 'Notice!', 'name' => 'Alert!'), 'message' => 'This is a test of the emergency broadcasting system'), 'classy' => array('element' => 'default', 'params' => array('class' => 'positive'), 'message' => 'Recorded'), 'bare' => array('element' => null, 'message' => 'Bare message', 'params' => array())), 'Deeply' => array('nested' => array('key' => 'value')));
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:16,代码来源:SessionHelperTest.php

示例2: started

 /**
  * Returns a bool, whether or not the session has been started.
  *
  * @return bool
  */
 public function started()
 {
     return Session::started();
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:9,代码来源:SessionComponent.php

示例3: started

 /**
  * Returns a bool, whether or not the session has been started.
  *
  * @return bool
  */
 public function started()
 {
     return $this->_session->started();
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:9,代码来源:SessionComponent.php

示例4: testStarted

 /**
  * testStarted method
  *
  * @return void
  */
 public function testStarted()
 {
     $session = new Session();
     $this->assertFalse($session->started());
     $this->assertTrue($session->start());
     $this->assertTrue($session->started());
 }
开发者ID:Slayug,项目名称:castor,代码行数:12,代码来源:SessionTest.php

示例5: translate

 /**
  * Used by the translation functions in basics.php
  * Returns a translated string based on current language and translation files stored in locale folder
  *
  * @param string $singular String to translate
  * @param string $plural Plural string (if any)
  * @param string $domain Domain The domain of the translation. Domains are often used by plugin translations.
  *    If null, the default domain will be used.
  * @param int $category Category The integer value of the category to use.
  * @param int $count Count Count is used with $plural to choose the correct plural form.
  * @param string $language Language to translate string to.
  *    If null it checks for language in session followed by Config.language configuration variable.
  * @return string translated string.
  * @throws \Cake\Error\Exception When '' is provided as a domain.
  */
 public static function translate($singular, $plural = null, $domain = null, $category = self::LC_MESSAGES, $count = null, $language = null)
 {
     $_this = I18n::getInstance();
     if (strpos($singular, "\r\n") !== false) {
         $singular = str_replace("\r\n", "\n", $singular);
     }
     if ($plural !== null && strpos($plural, "\r\n") !== false) {
         $plural = str_replace("\r\n", "\n", $plural);
     }
     if (is_numeric($category)) {
         $_this->category = $_this->_categories[$category];
     }
     if (empty($language)) {
         if (Session::started()) {
             $language = Session::read('Config.language');
         }
         if (empty($language)) {
             $language = Configure::read('Config.language');
         }
     }
     if ($_this->_lang && $_this->_lang !== $language || !$_this->_lang) {
         $lang = $_this->l10n->get($language);
         $_this->_lang = $lang;
     }
     if ($domain === null) {
         $domain = static::$defaultDomain;
     }
     if ($domain === '') {
         throw new Exception('You cannot use "" as a domain.');
     }
     $_this->domain = $domain . '_' . $_this->l10n->lang;
     if (!isset($_this->_domains[$domain][$_this->_lang])) {
         $_this->_domains[$domain][$_this->_lang] = [];
         $_this->_domains[$domain][$_this->_lang] = Cache::read($_this->domain, '_cake_core_');
     }
     if (!isset($_this->_domains[$domain][$_this->_lang][$_this->category])) {
         $_this->_bindTextDomain($domain);
         Cache::write($_this->domain, $_this->_domains[$domain][$_this->_lang], '_cake_core_');
     }
     if ($_this->category === 'LC_TIME') {
         return $_this->_translateTime($singular, $domain);
     }
     if (!isset($count)) {
         $plurals = 0;
     } elseif (!empty($_this->_domains[$domain][$_this->_lang][$_this->category]["%plural-c"]) && $_this->_noLocale === false) {
         $header = $_this->_domains[$domain][$_this->_lang][$_this->category]["%plural-c"];
         $plurals = $_this->_pluralGuess($header, $count);
     } else {
         if ($count != 1) {
             $plurals = 1;
         } else {
             $plurals = 0;
         }
     }
     if (!empty($_this->_domains[$domain][$_this->_lang][$_this->category][$singular])) {
         if (($trans = $_this->_domains[$domain][$_this->_lang][$_this->category][$singular]) || $plurals && ($trans = $_this->_domains[$domain][$_this->_lang][$_this->category][$plural])) {
             if (is_array($trans)) {
                 if (isset($trans[$plurals])) {
                     $trans = $trans[$plurals];
                 } else {
                     trigger_error(sprintf('Missing plural form translation for "%s" in "%s" domain, "%s" locale. ' . ' Check your po file for correct plurals and valid Plural-Forms header.', $singular, $domain, $_this->_lang), E_USER_WARNING);
                     $trans = $trans[0];
                 }
             }
             if (strlen($trans)) {
                 return $trans;
             }
         }
     }
     if (!empty($plurals)) {
         return $plural;
     }
     return $singular;
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:89,代码来源:I18n.php


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