当前位置: 首页>>代码示例>>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;未经允许,请勿转载。