/** * 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'); }
public static function setCurrent($locale) { if (!isset(static::$registered[$locale])) { throw new Exception("Locale [{$locale}] is not registered"); } static::$current = static::$registered[$locale]; }
public static function getCurrent() { if (null === static::$current) { static::$current = new Request(null); } return static::$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'); }
public static function current() { if (static::$current === null) { static::$current = static::instance('current'); } return static::$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; }
/** * Get the current uri string * * @return string */ public static function current() { if (is_null(static::$current)) { static::$current = static::detect(); } return static::$current; }
protected static function createInstance() { if (static::$current !== null) { return; } static::$current = new RequestItem(); static::$current->populateFromGlobals(); }
/** * 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; }
/** * 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); } }
/** * @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; }
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; }
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(); } }
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); }
/** * 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'); } }
public function __construct($count = 0, $count_per_page = NULL, $page_get_param = NULL) { $this->_count = $count; if ($count_per_page !== NULL) { $this->_count_per_page = max(1, $count_per_page); } if ($page_get_param !== NULL) { $this->_page_get_param = $page_get_param; } $this->_page_count = ceil($this->_count / $this->_count_per_page); $this->_current_page = min(max(1, (int) Arr::get($_GET, $this->_page_get_param, 1)), $this->_page_count); $this->_current_offset = min(max(0, ($this->_current_page - 1) * $this->_count_per_page), $this->_count); $this->_next_page = $this->_current_page + 1; $this->_prev_page = $this->_current_page - 1; if ($this->_next_page > $this->_page_count) { $this->_next_page = NULL; } if ($this->_prev_page < 1) { $this->_prev_page = NULL; } if ($this->_page_count <= 10) { for ($i = 1; $i <= $this->_page_count; $i++) { $this->_pages_range[$i] = $i; } } else { $first = max(2, $this->_current_page - 4); $last = min($first + 8, $this->_page_count - 1); if ($last - $first < 9) { $first -= 8 - ($last - $first); } $this->_pages_range[$first - 1] = $first - 1 === 1 ? '1' : '...'; for ($i = $first; $i <= $last; $i++) { $this->_pages_range[$i] = $i; } $this->_pages_range[$last + 1] = $last + 1 < $this->_page_count ? '...' : $this->_page_count; } static::$current = $this; }
/** * Store a group runner in the groups array. * * @param Runner $group The group to store */ public function registerGroup(Runner $group, Closure $callback) { static::$current = $group; $this->groups[$group->name] = $group; $callback(); static::$current = $this; }
/** * Sets current global tenant connection. */ public function setCurrent() { static::$current = $this->name; Config::set(sprintf('database.connections.%s', static::tenantConnectionName()), $this->config()); }
/** * Get or set menu item subitems * @return $this|MenuItem[] */ public function items() { $old = static::$current; static::$current = $this; static::$current = $old; return $this; }
/** * Returns the current request * * @return PCRequest */ public static function currentRequest() { if (static::$current == null) { static::$current = static::parseRequestFromServer(); } return static::$current; }
public static function current() { if (static::$current) { return static::$current; } $context = static::getLoginContext(); do { if (!($id = $context->get('id'))) { break; } if (!($user = static::find($id))) { break; } return static::$current = $user; } while (false); return static::$current = new static(); }
/** * Get or set menu item subitems * @param Closure|null $callback * @return $this|MenuItem[] */ public function items($callback = null) { if (is_null($callback)) { return $this->subItems; } $old = static::$current; static::$current = $this; call_user_func($callback); static::$current = $old; return $this; }
/** * Display view list content * * @param string $list List name * @param array $arguments List common arguments OPTIONAL * * @return void */ protected function displayViewListContent($list, array $arguments = array()) { if ($this->isMarkTemplates()) { $templateId = static::$templateId++; $current = new \XLite\Core\CommonGraph($list); $data = new \XLite\Core\CommonCell(); $data->templateId = $templateId; $data->isList = true; $current->setData($data); static::$current->addChild($current); static::$current = $current; } parent::displayViewListContent($list, $arguments); if ($this->isMarkTemplates()) { static::$current = static::$current->getParent(); } }
/** * Load a new Issue into $current, based on the $id * * @param int $id * @return Issue */ public static function load_issue($id) { static::$current = static::find($id); return static::$current; }
public static function turn($disk) { $instance = static::getInstance(); static::$current = $disk; return $instance; }
/** * @param $callback * @return $this */ public function form($callback) { $old = static::$current; static::$current = $this; call_user_func($callback); static::$current = $old; return $this; }
public static function setCurrent($id) { static::$current = $id; }
/** * Sets the current LDAP attribute schema. * * @param SchemaInterface $schema */ public static function set(SchemaInterface $schema) { static::$current = $schema; }
/** * Method to reset class static members for testing and other various issues. * * @return void * * @since 11.1 */ public static function reset() { static::$instances = array(); static::$base = array(); static::$root = array(); static::$current = ''; }
/** * Load a new Project into $current, based on the $id * * @param int $id * @return void */ public static function load_project($id) { static::$current = static::find($id); }