本文整理汇总了PHP中static::initialized方法的典型用法代码示例。如果您正苦于以下问题:PHP static::initialized方法的具体用法?PHP static::initialized怎么用?PHP static::initialized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static
的用法示例。
在下文中一共展示了static::initialized方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public static function init()
{
if (!static::$initialized) {
$sessionTimeLimit = 20 * 60;
session_set_cookie_params($sessionTimeLimit);
session_start();
// Verify if session already is valid
$keyDiscardTime = '___discard_after___';
$now = time();
if (isset($_SESSION[$keyDiscardTime]) && $now > $_SESSION[$keyDiscardTime]) {
// this session has worn out its welcome; kill it and start a brand new one
session_unset();
session_destroy();
session_start();
}
// either new or old, it should live at most for another hour
$_SESSION[$keyDiscardTime] = $now + $sessionTimeLimit;
static::$initialized = true;
//Clear all old flash data
foreach ($_SESSION as $k => $v) {
if (Str::contains($k, ":old:")) {
static::clear($k);
}
}
//Set all new flash data as old, to be cleared on the next request
foreach ($_SESSION as $k => $v) {
$parts = explode(":new:", $k);
if (is_array($parts) && count($parts) == 2) {
$newKey = "flash:old:" . $parts[1];
static::set($newKey, $v);
static::clear($k);
}
}
}
}
示例2: initialize
/**
* Define internal static values.
* @codeCoverageIgnore
*/
public static function initialize()
{
if (!static::$initialized) {
static::$initialized = true;
static::$placeholder = new \stdClass();
}
}
示例3: _init
/**
* Init
*
* Loads in the config and sets the variables
*
* @access public
* @return void
*/
public static function _init()
{
// Prevent multiple initializations
if (static::$initialized)
{
return;
}
\Config::load('asset', true);
$paths = \Config::get('asset.paths');
foreach($paths as $path)
{
static::add_path($path);
}
static::$_asset_url = \Config::get('asset.url');
static::$_folders = array(
'css' => \Config::get('asset.css_dir'),
'js' => \Config::get('asset.js_dir'),
'img' => \Config::get('asset.img_dir')
);
static::$initialized = true;
}
示例4: init
/**
* Initialization function.
* Here a config array must be passed with the client configuration
* Sensible values are set by default, but further configuration could also
* be set.
*
* A list of required fields is also set (with no default value set)
*/
public static function init($config = array())
{
$default = array('base_url' => '{scheme}://{hostname}:{port}/api/{version}/{client_endpoint}', 'scheme' => 'http', 'hostname' => 'localhost', 'port' => 9292, 'version' => 'v1', 'includes_json_root' => true, 'json_root' => 'subject');
$required = array('client_endpoint', 'subclient_endpoint');
$config = Collection::fromConfig($config, $default, $required);
static::$client = new Client($config->get('base_url'), $config);
static::$initialized = true;
}
示例5: initializeContext
/**
* setup the wordpress environment / stack if the context is a wordpress context
*
* @param Context $context
*/
public function initializeContext(Context $context)
{
if (static::$initialized) {
return;
}
static::$initialized = true;
$this->prepareEnvironment();
$this->loadStack();
}
示例6: initialize
protected static function initialize()
{
if (static::$initialized) {
return;
}
static::$initialized = true;
static::start();
static::setCsrfToken();
}
示例7: init
public static function init()
{
if (static::$initialized) {
return;
}
static::$profiler = new PhpQuickProfiler(FUEL_START_TIME);
static::$profiler->queries = array();
static::$profiler->queryCount = 0;
static::$initialized = true;
}
示例8: Init
public static function Init()
{
if (static::$initialized) {
return;
}
self::$headers = array();
self::$status = self::STATUS_200;
self::$headers[static::HEADER_CONTENT_TYPE] = Mimes::getExtension('html');
self::$autoHeaders = true;
static::$initialized = true;
}
示例9: initialize
protected function initialize()
{
if (\Staq::App() && \Staq::App()->isInitialized()) {
static::$cacheFile = reset($this->extensions) . '/cache/autoload.php';
if (\is_file(static::$cacheFile)) {
require_once static::$cacheFile;
}
static::$initialized = TRUE;
}
return $this;
}
示例10: initialize
/**
* Initializes properties.
*
* @return boolean Returns the `$initialized` property w/ a TRUE value.
*
* @note Sets some class properties & registers class alias.
*/
public static final function initialize()
{
if (static::$initialized) {
return TRUE;
}
// Initialized already.
if (!class_exists(stub::$core_ns_stub . '__instance')) {
class_alias(__CLASS__, stub::$core_ns_stub . '__instance');
}
return static::$initialized = TRUE;
}
示例11: configure
public static function configure()
{
if (static::$initialized === false) {
// loop over all settings and set them
foreach (static::$initSettings as $key => $value) {
ini_set("xdebug.{$key}", $value);
}
}
// set initialized status flag
static::$initialized = true;
}
示例12: Init
protected static function Init()
{
if (static::$initialized) {
return;
}
if (preg_match("#local\$#", $_SERVER['SERVER_NAME'])) {
static::$current = static::DEV;
} else {
static::$current = static::PROD;
}
static::$initialized = true;
}
示例13: initialize
protected static function initialize()
{
if (static::$initialized) {
return;
}
static::$initialized = true;
static::$parentPath = __FILE__;
for ($i = substr_count(get_class(), static::$nsChar); $i >= 0; $i--) {
static::$parentPath = dirname(static::$parentPath);
}
static::$paths = array();
static::$files = array(__FILE__);
}
示例14: __construct
/**
* Sets the initial Ftp filename and local data.
*
* @param array The settings
* @return void
*/
public function __construct(array $config)
{
// Prep the hostname
$this->_hostname = preg_replace('|.+?://|', '', $config['hostname']);
$this->_username = $config['username'];
$this->_password = $config['password'];
$this->_timeout = isset($config['timeout']) ? (int) $config['timeout'] : $this->_timeout;
$this->_port = isset($config['port']) ? (int) $config['port'] : $this->_port;
$this->_passive = isset($config['passive']) ? (bool) $config['passive'] : $this->_passive;
$this->_ssl = isset($config['ssl']) ? (bool) $config['ssl'] : $this->_ssl;
$this->_debug = isset($config['debug']) ? (bool) $config['debug'] : $this->_debug;
static::$initialized = true;
}
示例15: initialize
protected function initialize()
{
if ($path = \Staq::App()->getPath('cache/', TRUE)) {
static::$cacheFile = $path . '/setting.' . \Staq::App()->getPlatform() . '.php';
if (is_file(static::$cacheFile) && is_readable(static::$cacheFile)) {
@(include static::$cacheFile);
if (isset($cache) && is_array($cache)) {
static::$cache = $cache;
}
}
}
static::$initialized = TRUE;
return $this;
}