當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。