當前位置: 首頁>>代碼示例>>PHP>>正文


PHP static::current方法代碼示例

本文整理匯總了PHP中static::current方法的典型用法代碼示例。如果您正苦於以下問題:PHP static::current方法的具體用法?PHP static::current怎麽用?PHP static::current使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在static的用法示例。


在下文中一共展示了static::current方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: current

 /**
  * Returns the current url with all bells and whistles
  *
  * @return string
  */
 public static function current()
 {
     if (!is_null(static::$current)) {
         return static::$current;
     }
     return static::$current = static::scheme() . '://' . server::get('HTTP_HOST') . server::get('REQUEST_URI');
 }
開發者ID:chrishiam,項目名稱:LVSL,代碼行數:12,代碼來源:url.php

示例2: setCurrent

 public static function setCurrent($locale)
 {
     if (!isset(static::$registered[$locale])) {
         throw new Exception("Locale [{$locale}] is not registered");
     }
     static::$current = static::$registered[$locale];
 }
開發者ID:nirix,項目名稱:traq-lite,代碼行數:7,代碼來源:Language.php

示例3: getCurrent

 public static function getCurrent()
 {
     if (null === static::$current) {
         static::$current = new Request(null);
     }
     return static::$current;
 }
開發者ID:iplox,項目名稱:iplox,代碼行數:7,代碼來源:Request.php

示例4: current

 /**
  * Returns the current url with all bells and whistles
  *
  * @return string
  */
 public static function current()
 {
     if (!is_null(static::$current)) {
         return static::$current;
     }
     return static::$current = static::base() . server::get('REQUEST_URI');
 }
開發者ID:LucasFyl,項目名稱:korakia,代碼行數:12,代碼來源:url.php

示例5: current

 public static function current()
 {
     if (static::$current === null) {
         static::$current = static::instance('current');
     }
     return static::$current;
 }
開發者ID:nerdsrescueme,項目名稱:Core,代碼行數:7,代碼來源:url.php

示例6: current

 /**
  * Gets/sets current environment's object
  *
  * @param $set_current mixed
  * @return Current
  */
 public static function current($set_current = null)
 {
     $called_class = get_called_class();
     // set current (ignore Reflection_Property : to enable use of @default Class::current)
     if ($set_current && !is_a($set_current, Reflection_Property::class)) {
         static::$current = $set_current;
         if (!is_a($called_class, Plugin::class, true)) {
             Session::current()->set($set_current, Builder::current()->sourceClassName($called_class));
         }
     } elseif (!isset(static::$current)) {
         // get current plugin from plugins manager
         if (is_a($called_class, Plugin::class, true)) {
             if ($called_class === Builder::class) {
                 static::$current = new Builder();
             } else {
                 $plugin = Session::current()->plugins->get(Builder::current()->sourceClassName($called_class));
                 if (!isset(static::$current)) {
                     static::$current = $plugin;
                 }
             }
         } else {
             static::$current = Session::current()->get($called_class);
         }
     }
     return static::$current;
 }
開發者ID:TuxBoy,項目名稱:Demo-saf,代碼行數:32,代碼來源:Current.php

示例7: current

 /**
  * Get the current uri string
  *
  * @return string
  */
 public static function current()
 {
     if (is_null(static::$current)) {
         static::$current = static::detect();
     }
     return static::$current;
 }
開發者ID:gautamkrishnar,項目名稱:Anchor-CMS-openshift-quickstart,代碼行數:12,代碼來源:uri.php

示例8: createInstance

 protected static function createInstance()
 {
     if (static::$current !== null) {
         return;
     }
     static::$current = new RequestItem();
     static::$current->populateFromGlobals();
 }
開發者ID:andrixh,項目名稱:rotor,代碼行數:8,代碼來源:Request.php

示例9: instance

 /**
  * Returns the current user instance.
  * 
  * @return \WordPress\Model\User\User
  */
 public static function instance()
 {
     if (!isset(static::$current)) {
         if (!is_user_logged_in()) {
             return null;
         }
         static::$current = static::forgeObject(wp_get_current_user());
     }
     return static::$current;
 }
開發者ID:wells5609,項目名稱:wp-app,代碼行數:15,代碼來源:User.php

示例10: __construct

 /**
  * MenuItem constructor.
  */
 public function __construct($id)
 {
     $this->id = $id;
     if (is_null(static::$current)) {
         static::$current = $this;
         $this->level(0);
     } else {
         static::$current = addItem($this);
         $this->level(static::$current->level() + 1);
     }
 }
開發者ID:OscarDuranX,項目名稱:MenuWithAuthentication,代碼行數:14,代碼來源:MenuItem.php

示例11: getCurrent

 /**
  * @return Language
  */
 public static function getCurrent()
 {
     if (static::$current === null) {
         $languages = self::getLanguageModels();
         foreach ($languages as $language) {
             if ($language->locale == Yii::$app->language) {
                 return static::$current = $language;
             }
         }
     }
     return static::$current;
 }
開發者ID:tolik505,項目名稱:bl,代碼行數:15,代碼來源:LanguageHelper.php

示例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;
 }
開發者ID:andrixh,項目名稱:rotor,代碼行數:12,代碼來源:Environment.php

示例13: set_current

 private static function set_current()
 {
     static::$current = '/' . str_replace(Url::$application, '', URL_CURRENT);
     if (is_int(strpos(static::$current, '?'))) {
         static::$current = explode('?', static::$current);
         unset(static::$current[count(static::$current) - 1]);
         static::$current = implode('/', static::$current);
     }
     if (static::is()) {
         static::set_controller_and_action();
     }
 }
開發者ID:xtiurti,項目名稱:web-service-lavanderia-encoder,代碼行數:12,代碼來源:route.php

示例14: __construct

 public function __construct()
 {
     static::$current = $this;
     $this->logger = new Logger('Order');
     $handler = new StreamHandler('php://stdout', Logger::DEBUG);
     $handler->setFormatter(new ColoredLineFormatter(null, "[%level_name%] %message% %context% %extra%\n"));
     $this->logger->pushHandler($handler);
     $this->collection = new Collection($this->logger);
     $this->dossier = new Collector();
     $this->logger->addDebug('Runtime constructed');
     $this->twigLoader = new \Twig_Loader_Filesystem([]);
     $this->twigEnvironment = new \Twig_Environment($this->twigLoader);
     $function = new \Twig_SimpleFunction('config', function ($name) {
         return $this->config->get($name);
     });
     $this->twigEnvironment->addFunction($function);
 }
開發者ID:EaterOfCode,項目名稱:Order,代碼行數:17,代碼來源:Runtime.php

示例15: resolve

 /**
  * The resolve function gets the current route object, it initializes the Input capture
  * and triggers the required controller based on the route config file.
  *
  * @return void
  * @author Dan Cox
  */
 public static function resolve()
 {
     $route = static::$router->match(static::$request->getPathInfo(), $_SERVER);
     Input::init(static::$request->request);
     // Load the old input if there
     Input::loadOld();
     if ($route) {
         $params = $route->params;
         // Set as the current route;
         static::$current = $route;
         $action = $params['action'];
         unset($params['action']);
         $controller = explode('@', $action);
         // Load the controller
         require_once dirname(__DIR__) . '/controllers/' . $controller[0] . '.php';
         $class = new $controller[0]();
         call_user_func_array(array($class, $controller[1]), $params);
     } else {
         // No matching route
         throw new \Exception('No matching routes found');
     }
 }
開發者ID:Danzabar,項目名稱:schedules,代碼行數:29,代碼來源:Route.php


注:本文中的static::current方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。