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