本文整理汇总了PHP中s::start方法的典型用法代码示例。如果您正苦于以下问题:PHP s::start方法的具体用法?PHP s::start怎么用?PHP s::start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类s
的用法示例。
在下文中一共展示了s::start方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
s::start();
c::set('home.keepurl', true);
// auto-detect the url if it is not set
if (!c::get('url')) {
c::set('url', c::get('scheme') . server::get('http_host'));
}
// setup the thumb plugin
c::set('thumb.cache.root', c::get('root') . '/thumbs');
c::set('thumb.cache.url', c::get('url') . '/thumbs');
c::set('url', c::get('url') . '/' . c::get('panel.folder'));
// remove the panel folder name from the uri
c::set('subfolder', ltrim(c::get('subfolder') . '/' . c::get('panel.folder'), '/'));
// attach the uri after caching
$this->uri = new paneluri();
if (c::get('lang.support')) {
$path = $this->uri->path->toArray();
$first = array_shift($path);
if (!in_array($first, c::get('lang.available', array()))) {
$first = c::get('lang.default');
}
// set the current language
c::set('lang.current', $first);
$this->uri->path = new uriPath($path);
}
// get the first set of pages
$this->rootPages();
// get the additional site info from content/site.txt
$this->siteInfo();
}
示例2: flush
/**
* Remove old values from the Session’s flash data.
*/
public static function flush()
{
// Make sure the session is started
s::start();
// Retrieve the flash data
$registry = s::get(self::$namespace);
// Clean up registry
if (!empty($registry)) {
foreach ($registry as $key => $expiry) {
$expiry++;
// Remove all old values from the session
if ($expiry > 1) {
s::remove($key);
unset($registry[$key]);
} else {
$registry[$key] = $expiry;
}
}
// Write registry back to session
if (!empty($registry)) {
s::set(self::$namespace, $registry);
} else {
s::remove(self::$namespace);
}
}
}
示例3: __construct
/**
* Make sure the session is started within the constructor
*/
public function __construct()
{
s::start();
if (!isset($_SESSION['_cache'])) {
$_SESSION['_cache'] = array();
}
}
示例4: __construct
public function __construct()
{
$roots = array('tests' => dirname(__DIR__), 'panel' => dirname(dirname(__DIR__)), 'index' => dirname(dirname(dirname(__DIR__))), 'kirby' => dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'kirby', 'dummy' => dirname(__DIR__) . DIRECTORY_SEPARATOR . 'dummy');
// load kirby
require_once $roots['kirby'] . DIRECTORY_SEPARATOR . 'bootstrap.php';
// make sure to start a session
s::start();
// create the dummy content directory
dir::make($roots['dummy'] . DS . 'content');
// create the roots object
$this->roots = new Obj($roots);
// load the panel
require_once $roots['panel'] . DS . 'app' . DS . 'bootstrap.php';
// initiate kirby
$this->kirby = new Kirby();
$this->kirby->roots->content = $this->roots->dummy . DS . 'content';
$this->kirby->roots->site = $this->roots->dummy . DS . 'site';
// initiate the panel
$this->panel = new Panel($this->kirby, $this->roots->panel);
// store the site instance
$this->site = $this->panel->site();
}
示例5: __construct
function __construct()
{
s::start();
$this->urlSetup();
// setup the thumb plugin
c::set('thumb.cache.root', c::get('root') . '/thumbs');
c::set('thumb.cache.url', dirname(c::get('url')) . '/thumbs');
// set the rewrite mode
$rewrite = c::get('rewrite');
$config = c::get();
if (isset($config['panel.rewrite'])) {
$rewrite = $config['panel.rewrite'];
}
c::set('panel.rewrite', $rewrite);
// attach the uri after caching
$this->uri = new paneluri();
if (c::get('lang.support')) {
$path = $this->uri->path->toArray();
$first = array_shift($path);
if (!in_array($first, c::get('lang.available', array()))) {
if (empty($first)) {
$first = c::get('lang.default');
} else {
go(c::get('panel.url'));
}
}
// set the current language
c::set('lang.current', $first);
$this->uri->path = new uriPath($path);
// mark if this is a translated version or the default version
c::get('lang.current') != c::get('lang.default') ? c::set('lang.translated', true) : c::set('lang.translated', false);
}
// get the first set of pages
$this->rootPages();
// get the additional site info from content/site.txt
$this->info();
}
示例6: csrf
/**
* Checks / returns a csrf token
*
* @param string $check Pass a token here to compare it to the one in the session
* @return mixed Either the token or a boolean check result
*/
function csrf($check = null)
{
// make sure a session is started
s::start();
if (is_null($check)) {
$token = str::random(64);
s::set('csrf', $token);
return $token;
}
return $check === s::get('csrf') ? true : false;
}
示例7: getCart
public static function getCart()
{
s::start();
$data = s::get('cart', []);
return new self($data);
}
示例8: define
<?php
if (!defined('KIRBY')) {
define('KIRBY', true);
}
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
// load the kirby toolkit
include_once __DIR__ . DS . 'toolkit' . DS . 'bootstrap.php';
// start a session
s::start();
// load all core classes
load(array('kirby' => __DIR__ . DS . 'kirby.php', 'kirby\\roots' => __DIR__ . DS . 'kirby' . DS . 'roots.php', 'kirby\\urls' => __DIR__ . DS . 'kirby' . DS . 'urls.php', 'kirby\\component' => __DIR__ . DS . 'kirby' . DS . 'component.php', 'kirby\\registry' => __DIR__ . DS . 'kirby' . DS . 'registry.php', 'kirby\\request' => __DIR__ . DS . 'kirby' . DS . 'request.php', 'kirby\\request\\params' => __DIR__ . DS . 'kirby' . DS . 'request' . DS . 'params.php', 'kirby\\request\\query' => __DIR__ . DS . 'kirby' . DS . 'request' . DS . 'query.php', 'kirby\\request\\path' => __DIR__ . DS . 'kirby' . DS . 'request' . DS . 'path.php', 'kirby\\component\\template' => __DIR__ . DS . 'kirby' . DS . 'component' . DS . 'template.php', 'kirby\\component\\thumb' => __DIR__ . DS . 'kirby' . DS . 'component' . DS . 'thumb.php', 'kirby\\component\\markdown' => __DIR__ . DS . 'kirby' . DS . 'component' . DS . 'markdown.php', 'kirby\\component\\smartypants' => __DIR__ . DS . 'kirby' . DS . 'component' . DS . 'smartypants.php', 'kirby\\component\\snippet' => __DIR__ . DS . 'kirby' . DS . 'component' . DS . 'snippet.php', 'kirby\\component\\css' => __DIR__ . DS . 'kirby' . DS . 'component' . DS . 'css.php', 'kirby\\component\\js' => __DIR__ . DS . 'kirby' . DS . 'component' . DS . 'js.php', 'kirby\\component\\tinyurl' => __DIR__ . DS . 'kirby' . DS . 'component' . DS . 'tinyurl.php', 'kirby\\component\\response' => __DIR__ . DS . 'kirby' . DS . 'component' . DS . 'response.php', 'kirby\\traits\\image' => __DIR__ . DS . 'kirby' . DS . 'traits' . DS . 'image.php', 'assetabstract' => __DIR__ . DS . 'core' . DS . 'asset.php', 'avatarabstract' => __DIR__ . DS . 'core' . DS . 'avatar.php', 'pagesabstract' => __DIR__ . DS . 'core' . DS . 'pages.php', 'childrenabstract' => __DIR__ . DS . 'core' . DS . 'children.php', 'contentabstract' => __DIR__ . DS . 'core' . DS . 'content.php', 'fieldabstract' => __DIR__ . DS . 'core' . DS . 'field.php', 'fileabstract' => __DIR__ . DS . 'core' . DS . 'file.php', 'filesabstract' => __DIR__ . DS . 'core' . DS . 'files.php', 'kirbytextabstract' => __DIR__ . DS . 'core' . DS . 'kirbytext.php', 'kirbytagabstract' => __DIR__ . DS . 'core' . DS . 'kirbytag.php', 'pageabstract' => __DIR__ . DS . 'core' . DS . 'page.php', 'roleabstract' => __DIR__ . DS . 'core' . DS . 'role.php', 'rolesabstract' => __DIR__ . DS . 'core' . DS . 'roles.php', 'siteabstract' => __DIR__ . DS . 'core' . DS . 'site.php', 'usersabstract' => __DIR__ . DS . 'core' . DS . 'users.php', 'userabstract' => __DIR__ . DS . 'core' . DS . 'user.php', 'pageextension' => __DIR__ . DS . 'lib' . DS . 'pageextension.php', 'structure' => __DIR__ . DS . 'lib' . DS . 'structure.php', 'parsedown' => __DIR__ . DS . 'vendors' . DS . 'parsedown.php', 'parsedownextra' => __DIR__ . DS . 'vendors' . DS . 'parsedownextra.php', 'smartypantstypographer_parser' => __DIR__ . DS . 'vendors' . DS . 'smartypants.php'));
// load all helper functions
include __DIR__ . DS . 'helpers.php';
示例9: setUp
function setUp()
{
s::start();
s::set('key', 'value');
}
示例10: session
public function session()
{
// setup the session
s::$timeout = $this->kirby->option('panel.session.timeout', 120);
s::$cookie['lifetime'] = $this->kirby->option('panel.session.lifetime', 0);
// start the session
s::start();
}
示例11: get_cart
function get_cart()
{
s::start();
$cart = s::get('cart', array());
return $cart;
}