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


PHP Path::normalize方法代码示例

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


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

示例1: onBeforeHTMLEditorScriptRuns

 public static function onBeforeHTMLEditorScriptRuns()
 {
     $asset = Asset::getInstance();
     $asset->addJs('/bitrix/js/newkaliningrad.typografru/typograf.js');
     $messages = Loc::loadLanguageFile(Path::normalize(__FILE__));
     $asset->addString(sprintf('<script>BX.message(%s)</script>', Json::encode($messages, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE)));
 }
开发者ID:askew-,项目名称:bitrix-typograf,代码行数:7,代码来源:typograf.php

示例2: acrit_exportpro

 function acrit_exportpro()
 {
     require __DIR__ . '/version.php';
     $path = str_replace("\\", "/", __FILE__);
     $path = substr($path, 0, strlen($path) - strlen("/index.php"));
     include $path . "/version.php";
     if (is_array($arModuleVersion) && array_key_exists("VERSION", $arModuleVersion)) {
         $this->MODULE_VERSION = $arModuleVersion["VERSION"];
         $this->MODULE_VERSION_DATE = $arModuleVersion["VERSION_DATE"];
     }
     $this->MODULE_NAME = GetMessage('ACRIT_EXPORTPRO_MODULE_NAME');
     $this->MODULE_DESCRIPTION = GetMessage('ACRIT_EXPORTPRO_MODULE_DESC');
     $this->PARTNER_NAME = GetMessage("ACRIT_EXPORTPRO_PARTNER_NAME");
     $this->PARTNER_URI = GetMessage("ACRIT_EXPORTPRO_PARTNER_URI");
     $app = \Bitrix\Main\Application::getInstance();
     $dbSite = \Bitrix\Main\SiteTable::getList();
     while ($arSite = $dbSite->Fetch()) {
         if (!$arSite['DOC_ROOT']) {
             $this->siteArray[$arSite['LID']] = $app->getDocumentRoot() . $arSite['DIR'];
         } else {
             $this->siteArray[$arSite['LID']] = $arSite['DOC_ROOT'];
         }
         $this->siteArray[$arSite['LID']] = \Bitrix\Main\IO\Path::normalize($this->siteArray[$arSite['LID']]);
     }
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:25,代码来源:index.php

示例3: getRequestedPage

 public function getRequestedPage()
 {
     if ($this->requestedFile != null) {
         return $this->requestedFile;
     }
     $page = $this->getScriptName();
     $page = IO\Path::normalize($page);
     if (IO\Path::validate($page)) {
         return $this->requestedFile = $page;
     }
     throw new SystemException("Script name is not valid");
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:12,代码来源:request.php

示例4: saveRules

 private static function saveRules($siteId, array $arUrlRewrite)
 {
     $site = SiteTable::getRow(array("filter" => array("LID" => $siteId)));
     $docRoot = $site["DOC_ROOT"];
     if (!empty($docRoot)) {
         $docRoot = IO\Path::normalize($docRoot);
     } else {
         $docRoot = Application::getDocumentRoot();
     }
     $data = var_export($arUrlRewrite, true);
     IO\File::putFileContents($docRoot . "/urlrewrite.php", "<" . "?php\n\$arUrlRewrite=" . $data . ";\n");
     Application::resetAccelerator();
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:13,代码来源:urlrewriter.php

示例5: getRequestedPage

 public function getRequestedPage()
 {
     if ($this->requestedPage === null) {
         $page = $this->getScriptName();
         if (!empty($page)) {
             $page = IO\Path::normalize($page);
             if (substr($page, 0, 1) !== "/" && !preg_match("#^[a-z]:[/\\\\]#i", $page)) {
                 $page = "/" . $page;
             }
         }
         $this->requestedPage = $page;
     }
     return $this->requestedPage;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:14,代码来源:request.php

示例6: rename

 public function rename($newPath)
 {
     $newPathNormalized = Path::normalize($newPath);
     $success = true;
     if ($this->isExists()) {
         $success = rename($this->getPhysicalPath(), Path::convertLogicalToPhysical($newPathNormalized));
     }
     if ($success) {
         $this->originalPath = $newPath;
         $this->path = $newPathNormalized;
         $this->pathPhysical = null;
     }
     return $success;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:14,代码来源:filesystementry.php

示例7: convertToPath

 public function convertToPath()
 {
     if ($this->uriType != UriType::RELATIVE) {
         $path = $this->parse(UriPart::PATH);
     } else {
         $path = $this->uri;
         $p = strpos($path, "?");
         if ($p !== false) {
             $path = substr($path, 0, $p);
         }
     }
     if (substr($path, -1, 1) === "/") {
         $path = self::addDirectoryIndex($path);
     }
     $path = IO\Path::normalize($path);
     return $path;
 }
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:17,代码来源:uri.php

示例8: convertToPath

 public function convertToPath()
 {
     if ($this->uriType != UriType::RELATIVE) {
         $path = $this->parse(UriPart::PATH);
     } else {
         $path = $this->uri;
         $p = strpos($path, "?");
         if ($p !== false) {
             $path = substr($path, 0, $p);
         }
     }
     if (substr($path, -1, 1) === "/") {
         $path = self::addDirectoryIndex($path);
     }
     $path = IO\Path::normalize($path);
     if (IO\Path::validate($path)) {
         return $path;
     }
     throw new \Bitrix\Main\SystemException("Uri is not valid");
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:20,代码来源:uri.php

示例9: getLangMessages

 /**
  * Gets lang messages
  * @return array
  */
 public function getLangMessages()
 {
     return Loc::loadLanguageFile(Path::normalize(__FILE__));
 }
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:8,代码来源:configmap.php

示例10: transferUri

 private function transferUri($url)
 {
     $url = IO\Path::normalize($url);
     $urlTmp = trim($url, " \t\n\r\v\\/");
     if (empty($urlTmp)) {
         throw new ArgumentNullException("url");
     }
     $ext = IO\Path::getExtension($url);
     if (strtolower($ext) != "php") {
         throw new SystemException("Only php files are allowable for url rewriting");
     }
     $arUrl = explode("/", $url);
     $rootDirName = "";
     while (!empty($arUrl) && ($rootDirName = array_shift($arUrl)) === "") {
     }
     $rootDirName = strtolower(str_replace(".", "", $rootDirName));
     if (in_array($rootDirName, array("bitrix", "local", "upload"))) {
         throw new SystemException(sprintf("Can not use path '%s' for url rewriting", $url));
     }
     if (!IO\Path::validate($url)) {
         throw new SystemException(sprintf("Path '%s' is not valid", $url));
     }
     $absUrl = IO\Path::convertRelativeToAbsolute($url);
     if (!IO\File::isFileExists($absUrl)) {
         throw new SystemException(sprintf("Path '%s' is not found", $url));
     }
     $absUrlPhysical = IO\Path::convertLogicalToPhysical($absUrl);
     global $APPLICATION, $USER, $DB;
     include_once $absUrlPhysical;
     die;
 }
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:31,代码来源:application.php

示例11: normalize

 protected static function normalize($path)
 {
     if (substr($path, -1, 1) === "/") {
         $path .= "index.php";
     }
     $path = IO\Path::normalize($path);
     return $path;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:8,代码来源:httprequest.php

示例12: repackDocument

 /**
  * Repacks exported document from Google.Drive, which has wrong order files in archive to show preview
  * in Google.Viewer. In Google.Viewer document should have file '[Content_Types].xml' on first position in archive.
  * @param FileData $fileData
  * @return FileData
  * @throws IO\FileNotFoundException
  * @throws IO\InvalidPathException
  * @internal
  */
 public function repackDocument(FileData $fileData)
 {
     if (!extension_loaded('zip')) {
         return null;
     }
     if (!TypeFile::isDocument($fileData->getName())) {
         return null;
     }
     $file = new IO\File($fileData->getSrc());
     if (!$file->isExists() || $file->getSize() > 15 * 1024 * 1024) {
         return null;
     }
     unset($file);
     $ds = DIRECTORY_SEPARATOR;
     $targetDir = \CTempFile::getDirectoryName(2, 'disk_repack' . $ds . md5(uniqid('di', true)));
     checkDirPath($targetDir);
     $targetDir = IO\Path::normalize($targetDir) . $ds;
     $zipOrigin = new \ZipArchive();
     if (!$zipOrigin->open($fileData->getSrc())) {
         return null;
     }
     if ($zipOrigin->getNameIndex(0) === '[Content_Types].xml') {
         $zipOrigin->close();
         return null;
     }
     if (!$zipOrigin->extractTo($targetDir)) {
         $zipOrigin->close();
         return null;
     }
     $zipOrigin->close();
     unset($zipOrigin);
     if (is_dir($targetDir) !== true) {
         return null;
     }
     $newName = md5(uniqid('di', true));
     $newFilepath = $targetDir . '..' . $ds . $newName;
     $repackedZip = new \ZipArchive();
     if (!$repackedZip->open($newFilepath, \ZipArchive::CREATE)) {
         return null;
     }
     $source = realpath($targetDir);
     $repackedZip->addFile($source . $ds . '[Content_Types].xml', '[Content_Types].xml');
     $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
     foreach ($files as $file) {
         if ($file->getBasename() === '[Content_Types].xml') {
             continue;
         }
         $file = str_replace('\\', '/', $file);
         $file = realpath($file);
         if (is_dir($file) === true) {
             $repackedZip->addEmptyDir(str_replace('\\', '/', str_replace($source . $ds, '', $file . $ds)));
         } elseif (is_file($file) === true) {
             $repackedZip->addFile($file, str_replace('\\', '/', str_replace($source . $ds, '', $file)));
         }
     }
     $repackedZip->close();
     $newFileData = new FileData();
     $newFileData->setSrc($newFilepath);
     return $newFileData;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:69,代码来源:googlehandler.php

示例13: convertToPath

 protected function convertToPath($path)
 {
     $p = strpos($path, "?");
     if ($p !== false) {
         $path = substr($path, 0, $p);
     }
     if (substr($path, -1, 1) === "/") {
         $path .= "index.php";
     }
     $path = IO\Path::normalize($path);
     return $path;
 }
开发者ID:spas-viktor,项目名称:books,代码行数:12,代码来源:httprequest.php

示例14: convertUriToPath

 /**
  * Converts request uri into path safe file with .html extention.
  * Returns empty string if fails.
  *
  * @param string $Uri
  * @return string
  */
 public static function convertUriToPath($Uri, $host = "")
 {
     $match = array();
     if (preg_match("#^(/.+?)\\.php\\?([^\\\\/]*)#", $Uri, $match) > 0) {
         $PageFile = $match[1] . "@" . $match[2];
     } elseif (preg_match("#^(/.+)\\.php\$#", $Uri, $match) > 0) {
         $PageFile = $match[1] . "@";
     } elseif (preg_match("#^(/.+?|)/\\?([^\\\\/]*)#", $Uri, $match) > 0) {
         $PageFile = $match[1] . "/index@" . $match[2];
     } elseif (preg_match("#^(/.+|)/\$#", $Uri, $match) > 0) {
         $PageFile = $match[1] . "/index@";
     } else {
         return "";
     }
     if (strlen($host) > 0) {
         $host = "/" . $host;
         $host = preg_replace("/:(\\d+)\$/", "-\\1", $host);
     }
     $PageFile = $host . str_replace(".", "_", $PageFile) . ".html";
     if (!Main\IO\Path::validate($PageFile)) {
         return "";
     }
     if (Main\IO\Path::normalize($PageFile) !== $PageFile) {
         return "";
     }
     return $PageFile;
 }
开发者ID:spas-viktor,项目名称:books,代码行数:34,代码来源:statichtmlcache.php

示例15: loadLazy

 private static function loadLazy($code, $language)
 {
     if ($code == '') {
         return;
     }
     $trace = Main\Diag\Helper::getBackTrace(4, DEBUG_BACKTRACE_IGNORE_ARGS);
     $currentFile = null;
     for ($i = 3; $i >= 1; $i--) {
         if (stripos($trace[$i]["function"], "GetMessage") === 0) {
             $currentFile = Path::normalize($trace[$i]["file"]);
             break;
         }
     }
     if ($currentFile !== null && isset(self::$lazyLoadFiles[$currentFile])) {
         //in most cases we know the file containing the "code" - load it directly
         self::loadLanguageFile($currentFile, $language);
         unset(self::$lazyLoadFiles[$currentFile]);
     }
     if (!isset(self::$messages[$language][$code])) {
         //we still don't know which file contains the "code" - go through the files in the reverse order
         $unset = array();
         if (($file = end(self::$lazyLoadFiles)) !== false) {
             do {
                 self::loadLanguageFile($file, $language);
                 $unset[] = $file;
                 if (isset(self::$messages[$language][$code])) {
                     if (defined("BX_MESS_LOG") && $currentFile !== null) {
                         file_put_contents(BX_MESS_LOG, 'CTranslateUtils::CopyMessage("' . $code . '", "' . $file . '", "' . $currentFile . '");' . "\n", FILE_APPEND);
                     }
                     break;
                 }
             } while (($file = prev(self::$lazyLoadFiles)) !== false);
         }
         foreach ($unset as $file) {
             unset(self::$lazyLoadFiles[$file]);
         }
     }
 }
开发者ID:spas-viktor,项目名称:books,代码行数:38,代码来源:loc.php


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