當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。