本文整理汇总了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')));
}
示例2: started
/**
* Returns a bool, whether or not the session has been started.
*
* @return bool
*/
public function started()
{
return Session::started();
}
示例3: started
/**
* Returns a bool, whether or not the session has been started.
*
* @return bool
*/
public function started()
{
return $this->_session->started();
}
示例4: testStarted
/**
* testStarted method
*
* @return void
*/
public function testStarted()
{
$session = new Session();
$this->assertFalse($session->started());
$this->assertTrue($session->start());
$this->assertTrue($session->started());
}
示例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;
}