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


PHP static::path方法代碼示例

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


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

示例1: path

 /**
  * Returns the path to the library
  * @return string
  */
 public static function path()
 {
     if (static::$path === null) {
         static::$path = __DIR__ . DIRECTORY_SEPARATOR;
     }
     return static::$path;
 }
開發者ID:nooshin-mirzadeh,項目名稱:web_2.0_benchmark,代碼行數:11,代碼來源:WideImage.php

示例2: usePath

 /**
  * Set the root path to use in the path methods.
  *
  * @param int|string $path Either one of the PATH class constants or an actual path to a directory that exists, and is readable
  *
  * @return void
  */
 public static function usePath($path)
 {
     # Use the document root normally set via apache
     if ($path === self::PATH_DOCUMENT_ROOT) {
         if (empty($_SERVER["DOCUMENT_ROOT"]) || !is_dir($_SERVER["DOCUMENT_ROOT"])) {
             throw new \InvalidArgumentException("DOCUMENT_ROOT not defined");
         }
         static::$path = $_SERVER["DOCUMENT_ROOT"];
         return;
     }
     # Get the full path of the running script and use it's directory
     if ($path === self::PATH_PHP_SELF) {
         if (empty($_SERVER["PHP_SELF"]) || !($path = realpath($_SERVER["PHP_SELF"]))) {
             throw new \InvalidArgumentException("PHP_SELF not defined");
         }
         static::$path = pathinfo($path, PATHINFO_DIRNAME);
         return;
     }
     # Calculate the parent of the vendor directory and use that
     if ($path === self::PATH_VENDOR_PARENT) {
         static::$path = realpath(__DIR__ . "/../../../..");
         return;
     }
     if (is_dir($path)) {
         static::$path = $path;
     } else {
         throw new \InvalidArgumentException("Invalid path specified");
     }
 }
開發者ID:Masterfion,項目名稱:plugin-sonos,代碼行數:36,代碼來源:Env.php

示例3: path

 public static function path($path = '')
 {
     if (empty($path)) {
         return static::$path;
     }
     static::$path = $path;
 }
開發者ID:rubenvincenten,項目名稱:anchor-site,代碼行數:7,代碼來源:template.php

示例4: path

 public static function path($path = null)
 {
     if (!empty($path)) {
         static::$path = $path;
     }
     return static::$path;
 }
開發者ID:TorbenKoehn,項目名稱:lok,代碼行數:7,代碼來源:view.php

示例5: _verify_directory_paths

 /**
  * Verify that the specified directory paths exist and
  * attempts to create them if not.
  * @throws \Exception
  */
 private static function _verify_directory_paths()
 {
     // Clean strings.
     static::$path = trim(static::$path);
     static::$cache_path = trim(static::$cache_path);
     // Verify that the path is not empty.
     if (static::$path == '') {
         throw new \Exception('No view path specified...');
     }
     // Verify that the cache path is not empty.
     if (static::$cache_path == '') {
         throw new \Exception('No cache path specified...');
     }
     if (!is_dir(static::$base_path . static::$path)) {
         // Attempt to create directory.
         mkdir(static::$base_path . static::$path);
         if (!is_dir(static::$base_path . static::$path)) {
             throw new \Exception('"' . static::$base_path . static::$path . '" does not exist."');
         }
     }
     if (!is_dir(static::$base_path . static::$cache_path)) {
         // Attempt to create directory.
         mkdir(static::$base_path . static::$cache_path);
         if (!is_dir(static::$base_path . static::$cache_path)) {
             throw new \Exception('"' . static::$base_path . static::$cache_path . '" does not exist."');
         }
     }
 }
開發者ID:zawntech,項目名稱:wp-support,代碼行數:33,代碼來源:Template.php

示例6: route

 public static function route($routepath = null, $root = null)
 {
     // Calculate root (parameter -> global const -> guessed)
     static::$root = $root ?: ROOT ?: dirname($_SERVER['DOCUMENT_ROOT']);
     if (substr(static::$root, -1) != DIRECTORY_SEPARATOR) {
         static::$root .= DIRECTORY_SEPARATOR;
     }
     // Get path to route
     static::$path = $routepath ?: $_REQUEST['routepath'];
     static::$path = str_replace(chr(0), '', static::$path);
     // Protect against poison null byte attacks
     // Split the url on '/'
     static::$parts = array_filter(explode('/', static::$path));
     if (!static::$parts[0]) {
         static::$parts[0] = static::$default;
     }
     // If first part is empty, replace with default
     // Keep popping file path tokens from static::$parts until we find a routable target, or run out of parts
     while (count(static::$parts)) {
         // Build filename
         foreach (static::$route_prefix as $pre) {
             $path = static::$root . $pre . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, static::$parts);
             // If file exists, then include controller and return.
             if (file_exists($path . static::$extension)) {
                 return static::$filename = $path . static::$extension;
             }
         }
         // Pop the next token off the path, and prepend it to the list of unrouteable parts
         array_unshift(static::$unrouted_parts, array_pop(static::$parts));
     }
     // Could not find a page to route to - throw exception
     throw new HTTP\NotFound();
 }
開發者ID:brokencube,項目名稱:hodgepodge,代碼行數:33,代碼來源:Router.php

示例7: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     static::$path = realpath(__DIR__ . '/Tmpl/plates');
     if (!static::$path) {
         throw new \RuntimeException('Path not exists');
     }
     $this->instance = new PlatesRenderer(static::$path);
 }
開發者ID:im286er,項目名稱:windwalker,代碼行數:14,代碼來源:PlatesRendererTest.php

示例8: __construct

 public function __construct(Request $request)
 {
     static::$path = $request->path();
     foreach (static::$paths as $k => $v) {
         if (strpos(static::$path, $k) !== false) {
             return $this->table = $v;
         }
     }
 }
開發者ID:avil13,項目名稱:ModelResorces,代碼行數:9,代碼來源:ModelResorcesController.php

示例9: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     static::$path = realpath(__DIR__ . '/Tmpl/blade');
     if (!static::$path) {
         throw new \RuntimeException('Path not exists');
     }
     Folder::create(__DIR__ . '/cache');
     $this->instance = new BladeRenderer(static::$path, array('cache_path' => __DIR__ . '/cache'));
 }
開發者ID:im286er,項目名稱:windwalker,代碼行數:15,代碼來源:BladeRendererTest.php

示例10: generate

 /**
  * Method for generating Main configuration file
  * 
  * @param array $filesList
  * @param int $poller_id
  * @param string $path
  * @param string $filename
  * @param int $testing
  */
 public static function generate(&$filesList, $poller_id, $path, $filename, $testing = 0)
 {
     static::$path = rtrim($path, '/');
     /* Get Content */
     $content = static::getContent($poller_id, $filesList, $testing);
     /* Write Check-Command configuration file */
     WriteConfigFile::writeParamsFile($content, $path . $poller_id . "/" . $filename, $filesList, $user = "API");
     unset($content);
 }
開發者ID:NicolasLarrouy,項目名稱:centreon,代碼行數:18,代碼來源:ConfigGenerateMainRepository.php

示例11: __construct

 /**
  * WPLogger constructor.
  * インスタンスの初期化
  */
 private function __construct()
 {
     static::$path = get_template_directory() . '/logs/debug.log';
     static::$logger = new Logger('wptheme');
     $output = "[%datetime%] %level_name%: %message% %context% %extra%\n";
     $formatter = new LineFormatter($output);
     $stream = new StreamHandler(static::$path, Logger::DEBUG);
     $stream->setFormatter($formatter);
     static::$logger->pushHandler($stream);
 }
開發者ID:1shiharat,項目名稱:wp-debugging,代碼行數:14,代碼來源:class-wp-logger.php

示例12: path

 public static function path($filename = '')
 {
     if (static::$path === null) {
         $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http';
         $server = $_SERVER['SERVER_NAME'];
         $directory = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/');
         static::$path = sprintf("%s://%s%s/", $protocol, $server, $directory);
     }
     return static::$path . $filename;
 }
開發者ID:dragonee,項目名稱:php-silverplate,代碼行數:10,代碼來源:app.php

示例13: __construct

 public function __construct($identifier, $config)
 {
     $this->config = isset($config['file']) ? $config['file'] : array();
     // check for an expiration override
     $this->expiration = $this->_validate_config('expiration', isset($this->config['expiration']) ? $this->config['expiration'] : $this->expiration);
     // determine the file cache path
     static::$path = !empty($this->config['path']) ? $this->config['path'] : APPPATH . 'cache' . DS;
     if (!is_dir(static::$path) || !is_writable(static::$path)) {
         throw new \Cache_Exception('Cache directory does not exist or is not writable.');
     }
     parent::__construct($identifier, $config);
 }
開發者ID:netspencer,項目名稱:fuel,代碼行數:12,代碼來源:file.php

示例14: init

 public static function init()
 {
     static::$path = J_APPPATH . "storage" . DS . "cache" . DS;
     if (Request::isLocal()) {
         if (!File::exists(static::$path)) {
             trigger_error("Directory <b>" . static::$path . "</b> doesn't exists.");
         } else {
             if (!is_writable(static::$path)) {
                 trigger_error("Directory <b>" . static::$path . "</b> is not writable.");
             }
         }
     }
 }
開發者ID:jura-php,項目名稱:jura,代碼行數:13,代碼來源:Cache.php

示例15: _init

 /**
  * static init
  *
  * @return void
  */
 public static function _init()
 {
     if (!($path = CCConfig::create("Packtacular::packtacular")->path)) {
         throw new CCException("CCPacktacular - please set your packtacular path!");
     }
     // is there a cache dir?
     if (!is_dir(PUBLICPATH . $path)) {
         if (!mkdir(PUBLICPATH . $path, 0755, true)) {
             throw new CCException("CCPacktacular - could not create Packtacular folder at: {$path}");
         }
     }
     static::$path = '/' . $path;
 }
開發者ID:clancats,項目名稱:framework,代碼行數:18,代碼來源:Packtacular.php


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