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


PHP IO\Path类代码示例

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


在下文中一共展示了Path类的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: showTab

    public static function showTab($div, $iblockElementInfo)
    {
        $engineList = array();
        if (Option::get('main', 'vendor', '') == '1c_bitrix') {
            $engineList[] = array("DIV" => "yandex_direct", "TAB" => Loc::getMessage("SEO_ADV_YANDEX_DIRECT"), "TITLE" => Loc::getMessage("SEO_ADV_YANDEX_DIRECT_TITLE"), "HANDLER" => IO\Path::combine(Application::getDocumentRoot(), BX_ROOT, "/modules/seo/admin/tab/seo_search_yandex_direct.php"));
        }
        if (count($engineList) > 0) {
            $engineTabControl = new \CAdminViewTabControl("engineTabControl", $engineList);
            ?>
<tr>
	<td colspan="2">
<?php 
            $engineTabControl->begin();
            foreach ($engineList as $engineTab) {
                $engineTabControl->beginNextTab();
                $file = new IO\File($engineTab["HANDLER"]);
                if ($file->isExists()) {
                    require $file->getPath();
                }
            }
            $engineTabControl->end();
            ?>
	</td>
</tr>
<?php 
        }
    }
开发者ID:webgksupport,项目名称:alpina,代码行数:27,代码来源:advtabengine.php

示例4: isRequestedUriExists

 private function isRequestedUriExists()
 {
     /** @var $request HttpRequest */
     $request = $this->getContext()->getRequest();
     $absUrl = IO\Path::convertRelativeToAbsolute($request->getRequestedPage());
     return IO\File::isFileExists($absUrl);
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:7,代码来源:httpapplication.php

示例5: 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

示例6: 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

示例7: seoSitemapGetFilesData

function seoSitemapGetFilesData($PID, $arSitemap, $arCurrentDir, $sitemapFile)
{
    global $NS;
    $arDirList = array();
    if ($arCurrentDir['ACTIVE'] == SitemapRuntimeTable::ACTIVE) {
        $list = \CSeoUtils::getDirStructure($arSitemap['SETTINGS']['logical'] == 'Y', $arSitemap['SITE_ID'], $arCurrentDir['ITEM_PATH']);
        foreach ($list as $dir) {
            $dirKey = "/" . ltrim($dir['DATA']['ABS_PATH'], "/");
            if ($dir['TYPE'] == 'F') {
                if (!isset($arSitemap['SETTINGS']['FILE'][$dirKey]) || $arSitemap['SETTINGS']['FILE'][$dirKey] == 'Y') {
                    if (preg_match($arSitemap['SETTINGS']['FILE_MASK_REGEXP'], $dir['FILE'])) {
                        $f = new IO\File($dir['DATA']['PATH'], $arSitemap['SITE_ID']);
                        $sitemapFile->addFileEntry($f);
                        $NS['files_count']++;
                    }
                }
            } else {
                if (!isset($arSitemap['SETTINGS']['DIR'][$dirKey]) || $arSitemap['SETTINGS']['DIR'][$dirKey] == 'Y') {
                    $arDirList[] = $dirKey;
                }
            }
        }
    } else {
        $len = strlen($arCurrentDir['ITEM_PATH']);
        if (!empty($arSitemap['SETTINGS']['DIR'])) {
            foreach ($arSitemap['SETTINGS']['DIR'] as $dirKey => $checked) {
                if ($checked == 'Y') {
                    if (strncmp($arCurrentDir['ITEM_PATH'], $dirKey, $len) === 0) {
                        $arDirList[] = $dirKey;
                    }
                }
            }
        }
        if (!empty($arSitemap['SETTINGS']['FILE'])) {
            foreach ($arSitemap['SETTINGS']['FILE'] as $dirKey => $checked) {
                if ($checked == 'Y') {
                    if (strncmp($arCurrentDir['ITEM_PATH'], $dirKey, $len) === 0) {
                        $fileName = IO\Path::combine(SiteTable::getDocumentRoot($arSitemap['SITE_ID']), $dirKey);
                        if (!is_dir($fileName)) {
                            $f = new IO\File($fileName, $arSitemap['SITE_ID']);
                            if ($f->isExists() && !$f->isSystem() && preg_match($arSitemap['SETTINGS']['FILE_MASK_REGEXP'], $f->getName())) {
                                $sitemapFile->addFileEntry($f);
                                $NS['files_count']++;
                            }
                        }
                    }
                }
            }
        }
    }
    if (count($arDirList) > 0) {
        foreach ($arDirList as $dirKey) {
            $arRuntimeData = array('PID' => $PID, 'ITEM_PATH' => $dirKey, 'PROCESSED' => SitemapRuntimeTable::UNPROCESSED, 'ACTIVE' => SitemapRuntimeTable::ACTIVE, 'ITEM_TYPE' => SitemapRuntimeTable::ITEM_TYPE_DIR);
            SitemapRuntimeTable::add($arRuntimeData);
        }
    }
    SitemapRuntimeTable::update($arCurrentDir['ID'], array('PROCESSED' => SitemapRuntimeTable::PROCESSED));
}
开发者ID:Satariall,项目名称:izurit,代码行数:58,代码来源:seo_sitemap_run.php

示例8: finish

 public function finish()
 {
     foreach ($this->partList as $key => $partName) {
         $f = new File(Path::combine($this->getDirectoryName(), $partName));
         $f->rename(str_replace($this->getPrefix(), '', $f->getPath()));
         $this->partList[$key] = $f->getName();
     }
     if ($this->isCurrentPartNotEmpty()) {
         $this->addFooter();
         $this->rename(str_replace($this->getPrefix(), '', $this->getPath()));
     }
 }
开发者ID:supertest223,项目名称:bitrixtest,代码行数:12,代码来源:sitemapruntime.php

示例9: 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:DarneoStudio,项目名称:bitrix,代码行数:14,代码来源:filesystementry.php

示例10: getCurrentTemplateId

 public static function getCurrentTemplateId($siteId)
 {
     $cacheFlags = Config\Configuration::getValue("cache_flags");
     $ttl = isset($cacheFlags["site_template"]) ? $cacheFlags["site_template"] : 0;
     $connection = Application::getConnection();
     $sqlHelper = $connection->getSqlHelper();
     $field = $connection->getType() === "mysql" ? "`CONDITION`" : "CONDITION";
     $path2templates = IO\Path::combine(Application::getDocumentRoot(), Application::getPersonalRoot(), "templates");
     if ($ttl === false) {
         $sql = "\n\t\t\t\tSELECT " . $field . ", TEMPLATE\n\t\t\t\tFROM b_site_template\n\t\t\t\tWHERE SITE_ID = '" . $sqlHelper->forSql($siteId) . "'\n\t\t\t\tORDER BY IF(LENGTH(" . $field . ") > 0, 1, 2), SORT\n\t\t\t\t";
         $recordset = $connection->query($sql);
         while ($record = $recordset->fetch()) {
             $condition = trim($record["CONDITION"]);
             if ($condition != '' && !@eval("return " . $condition . ";")) {
                 continue;
             }
             if (IO\Directory::isDirectoryExists($path2templates . "/" . $record["TEMPLATE"])) {
                 return $record["TEMPLATE"];
             }
         }
     } else {
         $managedCache = Application::getInstance()->getManagedCache();
         if ($managedCache->read($ttl, "b_site_template")) {
             $arSiteTemplateBySite = $managedCache->get("b_site_template");
         } else {
             $arSiteTemplateBySite = array();
             $sql = "\n\t\t\t\t\tSELECT " . $field . ", TEMPLATE, SITE_ID\n\t\t\t\t\tFROM b_site_template\n\t\t\t\t\tWHERE SITE_ID = '" . $sqlHelper->forSql($siteId) . "'\n\t\t\t\t\tORDER BY SITE_ID, IF(LENGTH(" . $field . ") > 0, 1, 2), SORT\n\t\t\t\t\t";
             $recordset = $connection->query($sql);
             while ($record = $recordset->fetch()) {
                 $arSiteTemplateBySite[$record['SITE_ID']][] = $record;
             }
             $managedCache->set("b_site_template", $arSiteTemplateBySite);
         }
         if (is_array($arSiteTemplateBySite[$siteId])) {
             foreach ($arSiteTemplateBySite[$siteId] as $record) {
                 $condition = trim($record["CONDITION"]);
                 if ($condition != '' && !@eval("return " . $condition . ";")) {
                     continue;
                 }
                 if (IO\Directory::isDirectoryExists($path2templates . "/" . $record["TEMPLATE"])) {
                     return $record["TEMPLATE"];
                 }
             }
         }
     }
     return ".default";
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:47,代码来源:sitetemplate.php

示例11: 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

示例12: getSrcWithResize

 public static function getSrcWithResize($file = array(), $size = array())
 {
     $file1 = \CFile::ResizeImageGet($file["ID"], $size, BX_RESIZE_IMAGE_PROPORTIONAL, false);
     $src = $file1['src'];
     if ($file['HANDLER_ID'] > 0) {
         $src = "/" . \COption::GetOptionString("main", "upload_dir", "upload") . "/" . $file["SUBDIR"] . "/" . $file["FILE_NAME"];
         $path = $_SERVER["DOCUMENT_ROOT"] . $src;
         if (!(is_file($path) && file_exists($path))) {
             $sign = new Signer();
             $s = $sign->sign($file["ID"] . "x" . $size["width"] . "x" . $size["height"], self::$salt);
             $src = \COption::GetOptionString("main.fileinput", "entryPointUrl", "/bitrix/tools/upload.php") . "?" . http_build_query(array("action" => "uncloud", "mode" => "resize", "file" => $file["ID"], "width" => $size["width"], "height" => $size["height"], "signature" => $s));
         }
     } else {
         $src = \Bitrix\Main\IO\Path::convertLogicalToUri($src);
     }
     return $src;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:17,代码来源:fileinputunclouder.php

示例13: renderExceptionMessage

 function renderExceptionMessage(\Exception $exception, $debug = false)
 {
     if ($debug) {
         echo ExceptionHandlerFormatter::format($exception, true);
     } else {
         $p = Main\IO\Path::convertRelativeToAbsolute("/error.php");
         if (Main\IO\File::isFileExists($p)) {
             include $p;
         } else {
             $context = Main\Application::getInstance();
             if ($context) {
                 echo Main\Localization\Loc::getMessage("eho_render_exception_message");
             } else {
                 echo "A error occurred during execution of this script. You can turn on extended error reporting in .settings.php file.";
             }
         }
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:18,代码来源:httpexceptionhandleroutput.php

示例14: getDocumentRoot

 public static function getDocumentRoot($siteId = null)
 {
     if ($siteId === null) {
         $context = Application::getInstance()->getContext();
         $siteId = $context->getSite();
     }
     if (!isset(self::$documentRootCache[$siteId])) {
         $ar = SiteTable::getRow(array("filter" => array("LID" => $siteId)));
         if ($ar && ($docRoot = $ar["DOC_ROOT"]) && strlen($docRoot) > 0) {
             if (!IO\Path::isAbsolute($docRoot)) {
                 $docRoot = IO\Path::combine(Application::getDocumentRoot(), $docRoot);
             }
             self::$documentRootCache[$siteId] = $docRoot;
         } else {
             self::$documentRootCache[$siteId] = Application::getDocumentRoot();
         }
     }
     return self::$documentRootCache[$siteId];
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:19,代码来源:site.php

示例15: 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


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