/** * Add paths * @param Array|String $path */ public static function path($path) { if (!is_array($path)) { $path = array($path); } static::$paths = static::$paths + $path; }
/** * Adds a template path to search in. * * @param string|array $path */ public static function addPath($path, $prepend = false) { if ($prepend) { static::$paths = array_merge([$path], static::$paths); } else { static::$paths[] = $path; } }
public static function set_path($name, $value = null) { if (is_array($name)) { static::$paths = array_replace(static::$paths, $name); } else { static::$paths[$name] = $value; } }
public static function initialize($paths, $baseNamespace = 'App') { static::$baseNamespace = rtrim($baseNamespace, '\\') . '\\'; static::$config = new Config(APP_LOCAL ? $paths['config'] . 'local/' : $paths['config']); static::$paths = $paths; static::$loader = new Loader(); static::$loader->registerNamespaces([static::$baseNamespace . 'Assets' => $paths['assets'], static::$baseNamespace . 'Bootstrap' => $paths['bootstrap'], static::$baseNamespace . 'Components' => $paths['components'], static::$baseNamespace . 'Helpers' => $paths['helpers'], static::$baseNamespace . 'Libraries' => $paths['libraries'], static::$baseNamespace . 'Models' => $paths['models'], static::$baseNamespace . 'Modules' => $paths['modules']]); static::$loader->register(); }
protected static function initialize() { if (static::$initialized) { return; } static::$initialized = true; static::$parentPath = __FILE__; for ($i = substr_count(get_class(), static::$nsChar); $i >= 0; $i--) { static::$parentPath = dirname(static::$parentPath); } static::$paths = array(); static::$files = array(__FILE__); }
/** * @param string $type * * @return bool|array|string */ private static function getPath($type = null) { if (null === static::$paths) { $rootDir = getcwd(); $appDir = $rootDir . '/app'; $srcDir = $rootDir . '/src'; $venDir = $rootDir . '/vendor'; static::$paths = array('root' => $rootDir, 'app' => $appDir, 'config' => $appDir . '/config', 'cache' => $appDir . '/cache', 'source' => $srcDir, 'vendor' => $venDir); } if (null === $type) { return static::$paths; } if (!isset(static::$paths[$type])) { return false; } return static::$paths[$type]; }
/** * Set the application root directory. * * @param string $rootPath Path of the application's root. */ public function setAppRootPath($rootPath = null) { $root = $this->removeTrailingSlash($rootPath === null ? getcwd() : $rootPath); static::$paths = array_merge(static::$paths, ['app' => $root, 'web' => "{$root}/Web", 'vendor' => "{$root}/vendor", 'config' => "{$root}/Config", 'layouts' => "{$root}/Layouts", 'modules' => "{$root}/Modules"]); return $this; }
static function paths($paths) { static::$paths = static::norm_paths($paths); }
/** * @return void */ public static function reset() { static::$paths = array(__DIR__); static::$exts = array('php'); }
public static function setPaths($options) { static::$paths = $options; }
/** * @param $paths * @return $this */ protected function setPaths($paths) { static::$paths = $paths; return $this; }
/** * Static init load the paths and urls from the configuration * * @return void */ public static function _init() { static::$paths = ClanCats::$config->get('storage.paths'); static::$urls = ClanCats::$config->get('storage.urls'); }
/** * Run loader * * @param array $paths autoload directories * * @return boolean */ public static function run(array $paths = array()) { static::$paths = array_merge(static::$paths, $paths); return spl_autoload_register('Chochan\\Autoload\\Loader::load'); }
/** * 设置paths */ protected static function set_paths($name = null) { if (is_null($name)) { $name = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : ''; } if (!empty($name)) { $paths = trim($name, '/'); if ($paths !== '') { static::$paths = explode('/', $paths); } } }
/** * Add paths * * @param string|array $path */ public static function add_path($path) { static::$paths = array_merge(static::$paths, (array) $path); }
/** * 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; } }