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


PHP SiteTable::getDocumentRoot方法代码示例

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


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

示例1: __construct

	public function __construct($fileName, $settings)
	{
		$this->settings = array(
			'SITE_ID' => $settings['SITE_ID'],
			'PROTOCOL' => $settings['PROTOCOL'] == 'https' ? 'https' : 'http',
			'DOMAIN' => $settings['DOMAIN'],
		);

		$site = SiteTable::getRow(array("filter" => array("LID" => $this->settings['SITE_ID'])));

		$this->siteRoot = Path::combine(
			SiteTable::getDocumentRoot($this->settings['SITE_ID']),
			$site['DIR']
		);

		if(substr($fileName, -strlen(self::FILE_EXT)) != self::FILE_EXT)
		{
			$fileName .= self::FILE_EXT;
		}

		if($this->partFile == '')
		{
			$this->partFile = $fileName;
		}

		$this->pathPhysical = null; // hack for object reconstuct during file splitting

		parent::__construct($this->siteRoot.'/'.$fileName, $this->settings['SITE_ID']);

		$this->partChanged = $this->isExists() && !$this->isSplitNeeded();
	}
开发者ID:nycmic,项目名称:bittest,代码行数:31,代码来源:sitemapfile.php

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

示例3: getRewriteRules

 /**
  * Returns urlrewrite array
  *
  * @param string $site Site ID.
  * @return array
  */
 private static function getRewriteRules($site)
 {
     $docRoot = rtrim(\Bitrix\Main\SiteTable::getDocumentRoot($site), '/');
     $rewriteRules = array();
     $arUrlRewrite =& $rewriteRules;
     $rewriteFile = new IO\File($docRoot . '/urlrewrite.php');
     if ($rewriteFile->isExists()) {
         include $rewriteFile->getPath();
     }
     return $rewriteRules;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:17,代码来源:adminhelper.php

示例4: __construct

 public function __construct($path, $siteId = null)
 {
     if (empty($path)) {
         throw new InvalidPathException($path);
     }
     $this->originalPath = $path;
     $this->path = Path::normalize($path);
     if ($siteId === null) {
         $this->documentRoot = Main\Application::getDocumentRoot();
     } else {
         $this->documentRoot = Main\SiteTable::getDocumentRoot($siteId);
     }
     if (empty($this->path)) {
         throw new InvalidPathException($path);
     }
 }
开发者ID:rasuldev,项目名称:torino,代码行数:16,代码来源:filesystementry.php

示例5: __construct

 public function __construct($siteId)
 {
     $this->siteId = $siteId;
     $this->documentRoot = SiteTable::getDocumentRoot($this->siteId);
     parent::__construct(IO\Path::combine($this->documentRoot, self::ROBOTS_FILE_NAME));
 }
开发者ID:Satariall,项目名称:izurit,代码行数:6,代码来源:robotsfile.php

示例6: convertSiteRelativeToAbsolute

 public static function convertSiteRelativeToAbsolute($relativePath, $site = null)
 {
     if (!is_string($relativePath) || $relativePath == "") {
         $site = SITE_ID;
     }
     $basePath = Main\SiteTable::getDocumentRoot($site);
     return self::combine($basePath, $relativePath);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:8,代码来源:path.php

示例7: getDocumentRoot

 protected static function getDocumentRoot($siteId)
 {
     if ($siteId === null) {
         $documentRoot = Main\Application::getDocumentRoot();
     } else {
         $documentRoot = Main\SiteTable::getDocumentRoot($siteId);
     }
     return $documentRoot;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:9,代码来源:filesystementry.php

示例8: getMessage

     $error = getMessage('ABTEST_AJAX_ERROR');
 }
 if (!in_array($type, array('page'))) {
     $error = getMessage('ABTEST_AJAX_ERROR');
 }
 if (!in_array($site, $arSites)) {
     $error = getMessage('ABTEST_AJAX_ERROR');
 }
 if ($error === false) {
     $source = Bitrix\Main\Text\Encoding::convertEncodingToCurrent($source);
     $source = Bitrix\ABTest\AdminHelper::getRealPath($site, $source);
     if (empty($source)) {
         $error = getMessage('ABTEST_UNKNOWN_PAGE');
     }
     if ($error === false) {
         $docRoot = rtrim(\Bitrix\Main\SiteTable::getDocumentRoot($site), '/');
         $source = new Bitrix\Main\IO\File($docRoot . $source);
         $k = 0;
         do {
             $targetPath = BX_ROOT . '/abtest/' . date('Ymd') . '/' . sprintf('%u', crc32(rand() . time())) . $source->getName();
             $target = new Bitrix\Main\IO\File($docRoot . $targetPath);
         } while ($target->isExists() && $k++ < 10);
         if ($target->isExists()) {
             $error = getMessage('ABTEST_AJAX_ERROR');
         } else {
             $success = copyDirFiles($source->getPath(), $target->getPath(), false, false, false);
             if ($success) {
                 $result = $targetPath;
             } else {
                 $error = getMessage('ABTEST_AJAX_ERROR');
             }
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:abtest_ajax.php

示例9: ShowError

    $APPLICATION->AuthForm(Loc::getMessage("ACCESS_DENIED"));
}
if (!Main\Loader::includeModule('seo')) {
    require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
    ShowError(Loc::getMessage("SEO_ERROR_NO_MODULE"));
    require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
}
$errors = '';
$siteId = isset($_REQUEST['site_id']) ? $_REQUEST['site_id'] : '';
$arCurrentSite = array();
$arDefaultSite = array();
$arSites = array();
$dbSites = Bitrix\Main\SiteTable::getList(array('order' => array('DEF' => 'DESC', 'NAME' => 'ASC'), 'select' => array('LID', 'NAME', 'DEF', 'DIR', 'DOC_ROOT', 'SERVER_NAME')));
while ($arRes = $dbSites->fetch(Converter::getHtmlConverter())) {
    if ($arRes['DOC_ROOT'] == '') {
        $arRes['DOC_ROOT'] = Converter::getHtmlConverter()->encode(Main\SiteTable::getDocumentRoot($arRes['LID']));
    }
    if ($arRes['DEF'] == 'Y') {
        $arDefaultSite = $arRes;
    }
    $arSites[$arRes['LID']] = $arRes;
}
$arCurrentSite = isset($arSites[$siteId]) ? $arSites[$siteId] : $arDefaultSite;
$siteId = $arCurrentSite['LID'];
$arRobotsConfig = array('common' => array(array('*', Loc::getMessage('SEO_ROBOTS_COMMON'))), 'yandex' => array(array('Yandex', Loc::getMessage('SEO_ROBOTS_YANDEX')), array('YandexBot', Loc::getMessage('SEO_ROBOTS_YANDEXBOT')), array('YandexMedia', Loc::getMessage('SEO_ROBOTS_YANDEXMEDIA')), array('YandexImages', Loc::getMessage('SEO_ROBOTS_YANDEXIMAGES')), array('YandexBlogs', Loc::getMessage('SEO_ROBOTS_YANDEXBLOGS')), array('YandexNews', Loc::getMessage('SEO_ROBOTS_YANDEXNEWS')), array('YandexMetrika', Loc::getMessage('SEO_ROBOTS_YANDEXMETRIKA')), array('YandexMarket', Loc::getMessage('SEO_ROBOTS_YANDEXMARKET'))), 'google' => array(array('Googlebot', Loc::getMessage('SEO_ROBOTS_GOOGLEBOT')), array('Googlebot-News', Loc::getMessage('SEO_ROBOTS_GOOGLEBOT_NEWS')), array('Googlebot-Image', Loc::getMessage('SEO_ROBOTS_GOOGLEBOT_IMAGE')), array('Googlebot-Video', Loc::getMessage('SEO_ROBOTS_GOOGLEBOT_VIDEO')), array('Googlebot-Mobile', Loc::getMessage('SEO_ROBOTS_GOOGLEBOT_MOBILE'))));
$bVendor = COption::GetOptionString('main', 'vendor', '') == '1c_bitrix';
if (!$bVendor) {
    unset($arRobotsConfig['yandex']);
}
$aTabs = array();
foreach ($arRobotsConfig as $key => $arConfig) {
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:seo_robots.php


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