/** * Get the base URL of the application. * * @return string */ public static function base() { if (isset(static::$base)) { return static::$base; } $base = 'http://localhost'; // If the application URL configuration is set, we will just use that // instead of trying to guess the URL from the $_SERVER array's host // and script variables as this is more reliable. if (($url = Config::get('application.url')) !== '') { $base = $url; } elseif (isset($_SERVER['HTTP_HOST'])) { $protocol = Request::secure() ? 'https://' : 'http://'; // Basically, by removing the basename, we are removing everything after the // and including the front controller from the request URI. Leaving us with // the path in which the framework is installed. $script = $_SERVER['SCRIPT_NAME']; $path = str_replace(basename($script), '', $script); // Now that we have the base URL, all we need to do is attach the protocol // and the HTTP_HOST to build the full URL for the application. We also // trim off trailing slashes to clean the URL. $base = rtrim($protocol . $_SERVER['HTTP_HOST'] . $path, '/'); } return static::$base = $base; }
/** * Create a new instance of the MailboxStoreSelector class * * @param Link The Link to a directory server to operate on */ public function __construct(Link $link) { parent::__construct($link); // Make sure we are searching for the mailbox databases in the Configuration Naming Context, otherwise // we might not find anything... static::$base = $this->link->rootDSE->configurationNamingContext(0); }
/** * Clears all stored routes definitions to pristine conditions. * @return void */ public static function reset() { static::$routes = []; static::$base = ''; static::$prefix = []; static::$group = []; static::$optimized_tree = []; }
public static function load($config_file = null, $config_data = null) { if (!empty($config_file) && Helper::checkFile($config_file) && !($yaml = file_get_contents($config_file))) { throw new \Exception("Failed to read config file {$config_file}"); } if (empty($config_data) && !($data = Yaml::parse($yaml))) { throw new \Exception("Failed to parse config file {$config_file}"); } static::$data = static::$base = array_merge(static::$data, $data); self::$cache = array(); }
/** * Get the base URL of the application. * * @return string */ public static function base() { if (isset(static::$base)) { return static::$base; } $conf = Registry::get('conf'); $url = $conf['app']['url']; if ($url !== '') { $base = $url; } else { $base = Registry::get('env')->getUrl(); } return static::$base = $base; }
public function __construct() { // Because some hosts are complete // idiotic pieces of shit, let's // strip slashes from input. if (get_magic_quotes_gpc()) { $php_is_the_worst_language_ever_because_of_this = function (&$value) { $value = stripslashes($value); }; array_walk_recursive($_GET, $php_is_the_worst_language_ever_because_of_this); array_walk_recursive($_POST, $php_is_the_worst_language_ever_because_of_this); array_walk_recursive($_COOKIE, $php_is_the_worst_language_ever_because_of_this); array_walk_recursive($_REQUEST, $php_is_the_worst_language_ever_because_of_this); } // Set query string static::$query = (isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null); // Set request scheme static::$scheme = static::isSecure() ? 'https' : 'http'; // Set host static::$host = strtolower(preg_replace('/:\d+$/', '', trim($_SERVER['SERVER_NAME']))); // Set base url static::$base = static::baseUrl(); // Set the request path static::$request_uri = static::requestPath(); // Set relative uri without query string $uri = explode('?', str_replace(static::$base, '', static::$request_uri)); static::$uri = $uri[0]; // Request segments static::$segments = explode('/', trim(static::$uri, '/')); // Set the request method static::$method = strtolower($_SERVER['REQUEST_METHOD']); // Requested with static::$requested_with = @$_SERVER['HTTP_X_REQUESTED_WITH']; // _REQUEST static::$request = $_REQUEST; // _POST static::$post = $_POST; }
/** * Get the base URL of the application. * * @return string */ public static function base() { if (isset(static::$base)) { return static::$base; } $base = 'http://localhost'; // If the application's URL configuration is set, we will just use that // instead of trying to guess the URL from the $_SERVER array's host // and script variables as this is a more reliable method. if (($url = Config::get('application.url')) !== '') { $base = $url; } else { $base = Request::foundation()->getRootUrl(); } return static::$base = $base; }
/** * Get the base URL of the application. * * @return string */ public static function base() { if (isset(static::$base)) { return static::$base; } $base = 'http://localhost'; // If the application URL configuration is set, we will just use that // instead of trying to guess the URL from the $_SERVER array's host // and script variables as this is more reliable. if (($url = Config::get('application.url')) !== '') { $base = $url; } elseif (isset($_SERVER['HTTP_HOST'])) { $base = static::guess(); } return static::$base = $base; }
function __construct() { // TODO: simplified if (!isset(static::$base)) { static::$base = new SplFixedArray(32); $const = SplFixedArray::fromArray(include "base.php", false); for ($i = 0; $i < 32; ++$i) { static::$base[$i] = new SplFixedArray(8); for ($j = 0; $j < 8; ++$j) { static::$base[$i][$j] = new GePrecomp($const[$i][$j][0], $const[$i][$j][1], $const[$i][$j][2]); } } } if (!isset(static::$Bi)) { static::$Bi = new SplFixedArray(8); $const = SplFixedArray::fromArray(include "base2.php", false); for ($i = 0; $i < 8; ++$i) { static::$Bi[$i] = new GePrecomp($const[$i][0], $const[$i][1], $const[$i][2]); } } }
/** * Initialize the URI class. * * @return void */ public static function initialize() { // We need to get the different sections from the URI to process the // correct route. // Standard request in the browser? if (isset($_SERVER['REQUEST_URI'])) { // Get the active URI. $request = $_SERVER['REQUEST_URI']; $host = $_SERVER['HTTP_HOST']; $protocol = 'http' . (Request::https() ? 's' : ''); $base = $protocol . '//' . $host; $uri = $base . $request; // Build the URI segments. $length = strlen($base); $str = (string) substr($uri, $length); $arr = (array) explode('/', trim($str, '/')); $segments = []; foreach ($arr as $segment) { if ($segment !== '') { array_push($segments, $segment); } } // Assign properties. static::$base = $base; static::$uri = $uri; static::$segments = $segments; } else { if (isset($_SERVER['argv'])) { $segments = []; foreach ($_SERVER['argv'] as $arg) { if ($arg !== $_SERVER['SCRIPT_NAME']) { array_push($segments, $arg); } } static::$segments = $segments; } } }
/** * 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 = ''; }
/** * Set base API url * @param string $base */ public static function setBase($base) { static::$base = $base; }
/** * Execute the command. * * @param Application $app The application instance * * @return mixed */ public static function execute(Application $app) { static::$base = dirname(__DIR__) . '/templates/help/'; $help = new static($app->command ?: 'help'); $help->render(); }
private static function generateBaseUri() { $config = Registry::getInstance()->config['uri']; $base = $config['scheme'] != null ? $config['scheme'] : 'http'; $base .= '://'; $base .= $config['host'] != null ? $config['host'] : $_SERVER['HTTP_HOST']; if ($config['port'] != null) { $base .= ':' . $config['port']; } $base .= rtrim('/' . ltrim($config['path'], '/'), '/') . '/'; static::$base = $base; }
public static function activateModule($module) { static::$base = \Uri::create('/admin/' . $module); static::$current_module = $module; static::$sidebar_config_path = "cmf.admin.modules.{$module}.sidebar"; }
/** * Get the base URL of the application. * * @return string */ public static function base() { if (isset(static::$base)) { return static::$base; } $url = Config::get('app.url'); if ($url !== '') { $base = $url; } else { $base = self::$url; } return static::$base = $base; }
public static function mount($path) { static::$base = $path; }
public static function base() { if (isset(static::$base)) { return static::$base; } $base = 'http://localhost'; if (($url = Config::get('application.url')) !== '') { $base = $url; } else { $base = Request::foundation()->getRootUrl(); } return static::$base = $base; }