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


PHP static::init方法代码示例

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


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

示例1: get

 /**
  * @return static
  */
 public static function get()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new static();
         self::$_instance->init();
     }
     return self::$_instance;
 }
开发者ID:kadet1090,项目名称:KeyLighter,代码行数:11,代码来源:Singleton.php

示例2: instance

 /**
  * @return static
  */
 public static function instance()
 {
     if (null === static::$instance) {
         static::$instance = new static();
         static::$instance->init();
     }
     return static::$instance;
 }
开发者ID:selvinortiz,项目名称:wafers,代码行数:11,代码来源:Jar.php

示例3: init

 /**
  *  初始化
  */
 static function init()
 {
     if (!isset(static::$init)) {
         static::$init = new Static();
     }
     return static::$init;
 }
开发者ID:sunkangtaichi,项目名称:PHPAPPLISTION_START,代码行数:10,代码来源:Lang.php

示例4: init

 protected static function init()
 {
     static::$latin_map[' '] = '-';
     static::$latin_map['/'] = '-';
     static::$latin_map["'"] = '';
     static::$latin_map['&'] = '';
     static::$replace_map = array("search" => array_keys(static::$latin_map), "replace" => array_values(static::$latin_map));
     static::$init = true;
 }
开发者ID:acarist,项目名称:slugify,代码行数:9,代码来源:SlugIt.php

示例5: Initialize

 public static function Initialize()
 {
     static $instance = NULL;
     if ($instance === NULL) {
         $instance = new static();
         $instance->init();
     }
     return $instance;
 }
开发者ID:serebrov,项目名称:so-questions,代码行数:9,代码来源:parent.php

示例6: getInstance

 public static function getInstance($control)
 {
     if (empty(static::$modules)) {
         $_Instance = new static();
         if (is_callable(array($_Instance, 'init'))) {
             $_Instance->init();
         }
         static::$modules =& M();
     }
     return $_Instance;
 }
开发者ID:laiello,项目名称:ffphp,代码行数:11,代码来源:controlSys.php

示例7: create

 /**
  * A method for generating a free-form enum at runtime.
  * Simply pass this method a list of values and BAM you have an enum.
  * No need for all that class extending nonsense here.
  *
  * @param string This accepts multiple arguments
  * @return Enum instance
  */
 public static function create($val)
 {
     $c = new static();
     $c->enum = [];
     $c->values = [];
     foreach (func_get_args() as $v) {
         if (!in_array($v, $c->enum)) {
             $c->enum[] = $v;
         }
     }
     $c->init();
     return $c;
 }
开发者ID:sheepguru,项目名称:php-enum-set,代码行数:21,代码来源:Enum.php

示例8: getById

 /**
  * @param $post
  * @return static
  */
 public static function getById($post)
 {
     $instance = new static($post);
     if (is_numeric($post)) {
         $instance->id = absint($post);
         $instance->post = get_post($instance->id);
     } elseif ($post instanceof WA_Project) {
         $instance->id = absint($post->id);
         $instance->post = $post;
     } elseif ($post instanceof WP_Post || isset($post->ID)) {
         $instance->id = absint($post->ID);
         $instance->post = $post;
     }
     $instance->init();
     return $instance;
 }
开发者ID:vunnu,项目名称:post-image-multiupload,代码行数:20,代码来源:Singleton.php

示例9: init

 /**
  * Ensure the session data is loaded into cache.
  *
  * @return void
  */
 protected static function init()
 {
     if (static::$init) {
         return;
     }
     static::$init = true;
     if (!static::$name) {
         throw new \Exception("Cannot start session, no name has been specified");
     }
     session_cache_limiter(false);
     session_name(static::$name);
     session_start();
     # Grab the sessions data to respond to get()
     static::$data = $_SESSION;
     # Remove the lock from the session file
     session_write_close();
 }
开发者ID:Masterfion,项目名称:plugin-sonos,代码行数:22,代码来源:Session.php

示例10: clearEventsCache

 public static function clearEventsCache($iblockId)
 {
     $ec = new static();
     $ec->init(array());
     $ec->ClearCache($ec->cachePath . 'events/' . intval($iblockId) . '/');
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:6,代码来源:event_calendar.php

示例11: finalize

 public static function finalize()
 {
     // Make sure the autoloader is initialized
     if (!static::isInit()) {
         return true;
     }
     // Unregister the autoloader function
     if (spl_autoload_unregister(__CLASS__ . '::loadClass') === false) {
         return false;
     }
     // Clear the list of loaders
     static::removeAllLoaders();
     // Set the initialization flag, return the result
     static::$init = false;
     return true;
 }
开发者ID:timvisee,项目名称:MohicanenPieGuesser,代码行数:16,代码来源:Autoloader.php

示例12: factory

 /**
  * Factory
  */
 public static function factory()
 {
     $instance = new static();
     $instance->init();
     return $instance;
 }
开发者ID:Geekathon,项目名称:Selective-Tweets,代码行数:9,代码来源:BaseApp.php

示例13: init

 /**
  * Set core initialization status
  * 
  * @return void
  */
 public function init()
 {
     static::$init = TRUE;
 }
开发者ID:parkeragee,项目名称:Old-Codeigniter-App,代码行数:9,代码来源:core.php

示例14: launch

 /**
  * Launches an app actor
  * @param integer  $id
  * @param callable $handler
  * @param array    $config
  */
 public static function launch($id, callable $handler, array $config = [])
 {
     $app = new static($id, $handler, $config);
     $app->init();
     $app->run();
 }
开发者ID:elnoro,项目名称:phactor,代码行数:12,代码来源:App.php

示例15: init

 /**
  * Load settings.
  */
 protected static function init()
 {
     if (!static::$init) {
         // Make sure session counting is initialised, even if we don't listen to
         // any request init event (conf session_counters).
         static::sessionCounters();
         // Find real path, and document root (if possible), for removal from
         // absolute paths.
         // The reason document root may differ from real path is symbolic links.
         if ($paths = static::configGet('inspect', 'paths')) {
             // Last bucket is path length.
             static::$pathLength = array_pop($paths);
             static::$paths = $paths;
         } else {
             $docRoot = '';
             $le0 = static::mb_strlen($realPath = static::docRoot());
             // getcwd().
             $le1 = !empty($_SERVER['SCRIPT_FILENAME']) ? static::mb_strlen($docRoot = dirname($_SERVER['SCRIPT_FILENAME'])) : 0;
             // Find longest path.
             $osNix = DIRECTORY_SEPARATOR == '/';
             // And remove drive C:, for Windows.
             static::$pathLength = ($le0 < $le1 ? $le0 : $le1) - ($osNix ? 0 : 2);
             static::$paths = $paths = array($osNix ? '/^' . preg_quote($realPath, '/') . '\\//' : '/^(' . $realPath[0] . '\\:)?' . str_replace('/', '[\\\\\\/]', preg_quote(str_replace('\\', '/', static::mb_substr($realPath, 2)))) . '[\\\\\\/]/i');
             if ($le1 && $docRoot != $realPath) {
                 static::$paths[] = $osNix ? '/^' . preg_quote($docRoot, '/') . '\\//' : '/^(' . $docRoot[0] . '\\:)?' . str_replace('/', '[\\\\\\/]', preg_quote(str_replace('\\', '/', static::mb_substr($docRoot, 2)))) . '[\\\\\\/]/i';
             }
             // Save, they are kind of expensive to establish.
             $paths[] = static::$pathLength;
             static::configSet('inspect', 'paths', $paths);
         }
         unset($paths);
         // Establish output max length.
         static::$outputMax = static::outputMax();
         // Establish request time start.
         $t = static::requestTimeMilli();
         // Establish max execution time abort - if any max at all.
         if (static::$maxExecTime = $max = ini_get('max_execution_time')) {
             static::$maxExecTimeout = floor($t / 1000) + floor($max * static::configGet('inspect', 'exectime_percent', 90) / 100);
         } else {
             static::$maxExecTimeout = -1;
         }
         // Prepare default options - make get options equal file options if CLI
         // request.
         if (PHP_SAPI === 'cli') {
             // Array append.
             static::$defaultsByTarget['get'] += static::$defaultsByTarget['file'];
         }
         static::$init = TRUE;
     }
 }
开发者ID:simplecomplex,项目名称:inspect,代码行数:53,代码来源:Inspect.php


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