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


PHP Path::getDirectory方法代碼示例

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


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

示例1: getRequestedPageDirectory

 public function getRequestedPageDirectory()
 {
     if ($this->requestedFileDirectory != null) {
         return $this->requestedFileDirectory;
     }
     $requestedFile = $this->getRequestedPage();
     return $this->requestedFileDirectory = IO\Path::getDirectory($requestedFile);
 }
開發者ID:k-kalashnikov,項目名稱:geekcon_new,代碼行數:8,代碼來源:request.php

示例2: getRequestedPageDirectory

 public function getRequestedPageDirectory()
 {
     if ($this->requestedPageDirectory === null) {
         $requestedPage = $this->getRequestedPage();
         $this->requestedPageDirectory = IO\Path::getDirectory($requestedPage);
     }
     return $this->requestedPageDirectory;
 }
開發者ID:Satariall,項目名稱:izurit,代碼行數:8,代碼來源:request.php

示例3: loadLanguageFile

 /**
  * Loads language messages for specified file
  *
  * @param string $file
  * @param string $language
  * @return array
  */
 public static function loadLanguageFile($file, $language = null)
 {
     if ($language === null) {
         $language = self::getCurrentLang();
     }
     if (!isset(self::$messages[$language])) {
         self::$messages[$language] = array();
     }
     //first time call only for lang
     if (self::$customMessages === null) {
         self::$customMessages = self::loadCustomMessages($language);
     }
     $path = Path::getDirectory($file);
     static $langDirCache = array();
     if (isset($langDirCache[$path])) {
         $langDir = $langDirCache[$path];
         $fileName = substr($file, strlen($langDir) - 5);
     } else {
         //let's find language folder
         $langDir = $fileName = "";
         $filePath = $file;
         while (($slashPos = strrpos($filePath, "/")) !== false) {
             $filePath = substr($filePath, 0, $slashPos);
             $langPath = $filePath . "/lang";
             if (is_dir($langPath)) {
                 $langDir = $langPath;
                 $fileName = substr($file, $slashPos);
                 $langDirCache[$path] = $langDir;
                 break;
             }
         }
     }
     $mess = array();
     if ($langDir != "") {
         //load messages for default lang first
         $defaultLang = self::getDefaultLang($language);
         if ($defaultLang != $language) {
             $langFile = $langDir . "/" . $defaultLang . $fileName;
             if (file_exists($langFile)) {
                 $mess = self::includeFile($langFile);
             }
         }
         //then load messages for specified lang
         $langFile = $langDir . "/" . $language . $fileName;
         if (file_exists($langFile)) {
             $mess = array_merge($mess, self::includeFile($langFile));
         }
         foreach ($mess as $key => $val) {
             self::$messages[$language][$key] = $val;
         }
     }
     return $mess;
 }
開發者ID:rasuldev,項目名稱:torino,代碼行數:60,代碼來源:loc.php

示例4: includeLangFiles

 private static function includeLangFiles($file, $language)
 {
     static $langDirCache = array();
     $path = Path::getDirectory($file);
     if (isset($langDirCache[$path])) {
         $langDir = $langDirCache[$path];
         $fileName = substr($file, strlen($langDir) - 5);
     } else {
         //let's find language folder
         $langDir = $fileName = "";
         $filePath = $file;
         while (($slashPos = strrpos($filePath, "/")) !== false) {
             $filePath = substr($filePath, 0, $slashPos);
             $langPath = $filePath . "/lang";
             if (is_dir($langPath)) {
                 $langDir = $langPath;
                 $fileName = substr($file, $slashPos);
                 $langDirCache[$path] = $langDir;
                 break;
             }
         }
     }
     $mess = array();
     if ($langDir != "") {
         //load messages for default lang first
         $defaultLang = self::getDefaultLang($language);
         if ($defaultLang != $language) {
             $langFile = $langDir . "/" . $defaultLang . $fileName;
             if (file_exists($langFile)) {
                 $mess = self::includeFile($langFile);
             }
         }
         //then load messages for specified lang
         $langFile = $langDir . "/" . $language . $fileName;
         if (file_exists($langFile)) {
             $mess = array_merge($mess, self::includeFile($langFile));
         }
     }
     return $mess;
 }
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:40,代碼來源:loc.php

示例5: download

 /**
  * Downloads and saves a file.
  *
  * @param string $url URI to download
  * @param string $filePath Absolute file path
  * @return bool
  */
 public function download($url, $filePath)
 {
     $dir = IO\Path::getDirectory($filePath);
     IO\Directory::createDirectory($dir);
     $file = new IO\File($filePath);
     $handler = $file->open("w+");
     if ($handler !== false) {
         $this->setOutputStream($handler);
         $res = $this->query(self::HTTP_GET, $url);
         fclose($handler);
         return $res;
     }
     return false;
 }
開發者ID:mrdeadmouse,項目名稱:u136006,代碼行數:21,代碼來源:httpclient.php

示例6: fixCssIncludes

 /**
  * Replace path to includes in css
  * @param $content
  * @param $path
  * @return mixed
  */
 public static function fixCssIncludes($content, $path)
 {
     $path = IO\Path::getDirectory($path);
     $content = preg_replace_callback('#([;\\s:]*(?:url|@import)\\s*\\(\\s*)(\'|"|)(.+?)(\\2)\\s*\\)#si', create_function('$matches', 'return $matches[1].Bitrix\\Main\\Page\\Asset::replaceUrlCSS($matches[3], $matches[2], "' . addslashes($path) . '").")";'), $content);
     $content = preg_replace_callback('#(\\s*@import\\s*)([\'"])([^\'"]+)(\\2)#si', create_function('$matches', 'return $matches[1].Bitrix\\Main\\Page\\Asset::replaceUrlCSS($matches[3], $matches[2],"' . addslashes($path) . '");'), $content);
     return $content;
 }
開發者ID:ASDAFF,項目名稱:1C_Bitrix_info_site,代碼行數:13,代碼來源:asset.php

示例7: generateSourceMap

 /**
  * Generates source map content
  * @param $fileName
  * @param $content
  * @return string
  */
 private static function generateSourceMap($fileName, $content)
 {
     $files = self::getFilesInfo($content);
     $sections = "";
     foreach ($files as $file) {
         if (!isset($file["map"]) || strlen($file["map"]) < 1) {
             continue;
         }
         $filePath = Main\Loader::getDocumentRoot() . $file["map"];
         if (file_exists($filePath) && ($content = file_get_contents($filePath)) !== false) {
             if ($sections !== "") {
                 $sections .= ",";
             }
             $dirPath = IO\Path::getDirectory($file["source"]);
             $sourceName = IO\Path::getName($file["source"]);
             $minName = IO\Path::getName($file["min"]);
             $sourceMap = str_replace(array($sourceName, $minName), array($dirPath . "/" . $sourceName, $dirPath . "/" . $minName), $content);
             $sections .= '{"offset": { "line": ' . $file["line"] . ', "column": 0 }, "map": ' . $sourceMap . '}';
         }
     }
     return '{"version":3, "file":"' . $fileName . '", "sections": [' . $sections . ']}';
 }
開發者ID:andy-profi,項目名稱:bxApiDocs,代碼行數:28,代碼來源:asset.php

示例8: getDirectoryName

 public function getDirectoryName()
 {
     return Path::getDirectory($this->path);
 }
開發者ID:rasuldev,項目名稱:torino,代碼行數:4,代碼來源:filesystementry.php


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