当前位置: 首页>>代码示例>>PHP>>正文


PHP Phing::importPaths方法代码示例

本文整理汇总了PHP中Phing::importPaths方法的典型用法代码示例。如果您正苦于以下问题:PHP Phing::importPaths方法的具体用法?PHP Phing::importPaths怎么用?PHP Phing::importPaths使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phing的用法示例。


在下文中一共展示了Phing::importPaths方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getResourcePath

 /**
  * Looks on include path for specified file.
  *
  * @param string $path
  *
  * @return string File found (null if no file found).
  */
 public static function getResourcePath($path)
 {
     if (self::$importPaths === null) {
         self::$importPaths = self::explodeIncludePath();
     }
     $path = str_replace('\\', DIRECTORY_SEPARATOR, $path);
     $path = str_replace('/', DIRECTORY_SEPARATOR, $path);
     foreach (self::$importPaths as $prefix) {
         $testPath = $prefix . DIRECTORY_SEPARATOR . $path;
         if (file_exists($testPath)) {
             return $testPath;
         }
     }
     // Check for the property phing.home
     $homeDir = self::getProperty(self::PHING_HOME);
     if ($homeDir) {
         $testPath = $homeDir . DIRECTORY_SEPARATOR . $path;
         if (file_exists($testPath)) {
             return $testPath;
         }
     }
     // Check for the phing home of phar archive
     if (strpos(self::$importPaths[0], 'phar://') === 0) {
         $testPath = self::$importPaths[0] . '/../' . $path;
         if (file_exists($testPath)) {
             return $testPath;
         }
     }
     // If we are using this via PEAR then check for the file in the data dir
     // This is a bit of a hack, but works better than previous solution of assuming
     // data_dir is on the include_path.
     $dataDir = '@DATA-DIR@';
     if ($dataDir[0] != '@') {
         // if we're using PEAR then the @ DATA-DIR @ token will have been substituted.
         if (!file_exists($dataDir)) {
             self::log("The PEAR data_dir setting is incorrect: {$dataDir}.", Project::MSG_ERR);
             self::log("Please edit using 'pear config-set data_dir ...' and re-install Phing.", Project::MSG_ERR);
             return null;
         }
         $testPath = $dataDir . DIRECTORY_SEPARATOR . $path;
         if (file_exists($testPath)) {
             return $testPath;
         }
     } else {
         // We're not using PEAR, so do one additional check based on path of
         // current file (Phing.php)
         $maybeHomeDir = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..');
         $testPath = $maybeHomeDir . DIRECTORY_SEPARATOR . $path;
         if (file_exists($testPath)) {
             return $testPath;
         }
     }
     return null;
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:61,代码来源:Phing.php

示例2: getResourcePath

 /**
  * Looks on include path for specified file.
  * @return string File found (null if no file found).
  */
 public static function getResourcePath($path)
 {
     if (self::$importPaths === null) {
         $paths = get_include_path();
         self::$importPaths = explode(PATH_SEPARATOR, ini_get("include_path"));
     }
     $path = str_replace('\\', DIRECTORY_SEPARATOR, $path);
     $path = str_replace('/', DIRECTORY_SEPARATOR, $path);
     foreach (self::$importPaths as $prefix) {
         $testPath = $prefix . DIRECTORY_SEPARATOR . $path;
         if (file_exists($testPath)) {
             return $testPath;
         }
     }
     // Check for the property phing.home
     $homeDir = self::getProperty('phing.home');
     if ($homeDir) {
         $testPath = $homeDir . DIRECTORY_SEPARATOR . $path;
         if (file_exists($testPath)) {
             return $testPath;
         }
     }
     // If we are using this via PEAR then check for the file in the data dir
     // This is a bit of a hack, but works better than previous solution of assuming
     // data_dir is on the include_path.
     $dataDir = '@DATA-DIR@';
     if ($dataDir[0] != '@') {
         // if we're using PEAR then the @ DATA-DIR @ token will have been substituted.
         $testPath = $dataDir . DIRECTORY_SEPARATOR . $path;
         if (file_exists($testPath)) {
             return $testPath;
         }
     } else {
         // We're not using PEAR, so do one additional check based on path of
         // current file (Phing.php)
         $maybeHomeDir = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..');
         $testPath = $maybeHomeDir . DIRECTORY_SEPARATOR . $path;
         if (file_exists($testPath)) {
             return $testPath;
         }
     }
     return null;
 }
开发者ID:hkilter,项目名称:OpenSupplyChains,代码行数:47,代码来源:phing.php

示例3: getResourcePath

 /**
  * Looks on include path for specified file.
  * @return string File found (null if no file found).
  */
 public static function getResourcePath($path)
 {
     if (self::$importPaths === null) {
         $paths = ini_get("include_path");
         self::$importPaths = explode(PATH_SEPARATOR, ini_get("include_path"));
     }
     $path = str_replace('\\', DIRECTORY_SEPARATOR, $path);
     $path = str_replace('/', DIRECTORY_SEPARATOR, $path);
     foreach (self::$importPaths as $prefix) {
         $foo_path = $prefix . DIRECTORY_SEPARATOR . $path;
         if (file_exists($foo_path)) {
             return $foo_path;
         }
     }
     // Check for the property phing.home
     $home_dir = self::getProperty('phing.home');
     if ($home_dir) {
         $home_path = $home_dir . DIRECTORY_SEPARATOR . $path;
         if (file_exists($home_path)) {
             return $home_path;
         }
     }
     // If we are using this via PEAR then check for the file in the data dir
     // This is a bit of a hack, but works better than previous solution of assuming
     // data_dir is on the include_path.
     $data_dir = '@DATA-DIR@';
     if ($data_dir[0] != '@') {
         // if we're using PEAR then the @ DATA-DIR @ token will have been substituted.
         $data_path = $data_dir . DIRECTORY_SEPARATOR . $path;
         if (file_exists($data_path)) {
             return $data_path;
         }
     }
     return null;
 }
开发者ID:domenypl,项目名称:symfony1-legacy,代码行数:39,代码来源:Phing.php


注:本文中的Phing::importPaths方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。