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