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


PHP Application::getDocumentRoot方法代码示例

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


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

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

示例2: modifyDbconn

 public static function modifyDbconn($DBHost, $DBName, $DBLogin, $DBPassword)
 {
     if (strlen($DBHost) <= 0) {
         throw new \Bitrix\Main\ArgumentNullException("DBHost");
     }
     if (strlen($DBName) <= 0) {
         throw new \Bitrix\Main\ArgumentNullException("DBName");
     }
     if (strlen($DBLogin) <= 0) {
         throw new \Bitrix\Main\ArgumentNullException("DBLogin");
     }
     $filename = \Bitrix\Main\Application::getDocumentRoot() . "/bitrix/php_interface/dbconn.php";
     $file = new \Bitrix\Main\IO\File($filename);
     if (!$file->isExists()) {
         return false;
     }
     $content = file_get_contents($filename);
     if (strlen($content) <= 0) {
         return false;
     }
     file_put_contents(\Bitrix\Main\Application::getDocumentRoot() . "/bitrix/php_interface/dbconn.php.bak", $content);
     $content = preg_replace('/(\\$DBHost\\s*=\\s*(\\"|\')+)(.*)((\\"|\')+;)/', '${1}' . $DBHost . '${4}', $content);
     $content = preg_replace('/(\\$DBName\\s*=\\s*(\\"|\')+)(.*)((\\"|\')+;)/', '${1}' . $DBName . '${4}', $content);
     $content = preg_replace('/(\\$DBLogin\\s*=\\s*(\\"|\')+)(.*)((\\"|\')+;)/', '${1}' . $DBLogin . '${4}', $content);
     $content = preg_replace('/(\\$DBPassword\\s*=\\s*(\\"|\')+)(.*)((\\"|\')+;)/', '${1}' . $DBPassword . '${4}', $content);
     return file_put_contents($filename, $content);
 }
开发者ID:Satariall,项目名称:izurit,代码行数:27,代码来源:helper.php

示例3: getMap

 private static function getMap()
 {
     if (empty(self::$map)) {
         self::$map = (include Application::getDocumentRoot() . "/bitrix/modules/mobileapp/maps/resources.php");
     }
     return self::$map;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:7,代码来源:appresource.php

示例4: getList

 /**
  * @param string $dbName
  * @return array List of all sites & their params
  */
 public static function getList($dbName = false)
 {
     if (!$dbName) {
         $connection = \Bitrix\Main\Application::getConnection();
         $dbName = $connection->getDbName();
     }
     $result = array();
     $shellAdapter = new ShellAdapter();
     $execRes = $shellAdapter->syncExec("sudo -u root /opt/webdir/bin/bx-sites -o json -a list -d " . $dbName);
     $sitesData = $shellAdapter->getLastOutput();
     if ($execRes) {
         $arData = json_decode($sitesData, true);
         if (isset($arData["params"])) {
             $result = $arData["params"];
         }
         $rsSite = \Bitrix\Main\SiteTable::getList();
         while ($site = $rsSite->fetch()) {
             foreach ($result as $siteId => $siteInfo) {
                 $docRoot = strlen($site["DOC_ROOT"]) > 0 ? $site["DOC_ROOT"] : \Bitrix\Main\Application::getDocumentRoot();
                 if ($siteInfo["DocumentRoot"] == $docRoot) {
                     $result[$siteId]["NAME"] = $site["NAME"] . " (" . $site["LID"] . ") ";
                 } else {
                     $result[$siteId]["NAME"] = $siteId;
                 }
             }
         }
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:33,代码来源:sitesdata.php

示例5: UnInstallFiles

 function UnInstallFiles()
 {
     $rootDir = Application::getDocumentRoot() . '/' . Application::getPersonalRoot();
     $adminGatewayFile = '/admin/ws_tools.php';
     unlink($rootDir . $adminGatewayFile);
     return true;
 }
开发者ID:Under5,项目名称:bitrix-module-tools,代码行数:7,代码来源:index.php

示例6: UnInstallFiles

 public function UnInstallFiles()
 {
     $files = array('js' => '/js/' . $this->MODULE_ID, 'img' => '/images/' . $this->MODULE_ID, 'request' => '/tools/' . $this->MODULE_ID);
     $rootDir = Application::getDocumentRoot() . '/' . ltrim(Application::getPersonalRoot(), '/');
     foreach ($files as $file) {
         Directory::deleteDirectory($rootDir . $file);
     }
 }
开发者ID:askew-,项目名称:bitrix-typograf,代码行数:8,代码来源:index.php

示例7: setOptions

 /**
  * @param array $options
  */
 public function setOptions(array $options)
 {
     parent::setOptions($options);
     $this->file = new File(Application::getDocumentRoot() . $this->options['path']);
     if (!$this->file->isFile()) {
         throw new \Shantilab\BxEcho\Exceptions\InvalidFilePathException(Application::getDocumentRoot() . $this->options['path']);
     }
 }
开发者ID:SidiGi,项目名称:shantilab.bxeco,代码行数:11,代码来源:FilePrinter.php

示例8: getPath

 public function getPath($notDocumentRoot = false)
 {
     $drName = dirname(__DIR__);
     if ($notDocumentRoot) {
         return str_replace(Application::getDocumentRoot(), '', $drName);
     }
     return $drName;
 }
开发者ID:SidiGi,项目名称:shantilab.yandexdirect,代码行数:8,代码来源:index.php

示例9: GetPath

 /**
  * @param bool $notDocumentRoot
  * @return mixed|string
  */
 public function GetPath($notDocumentRoot = false)
 {
     if ($notDocumentRoot) {
         return str_ireplace(Application::getDocumentRoot(), '', dirname(__DIR__));
     } else {
         return dirname(__DIR__);
     }
     // текущая папка с полным путем можем узнать с помощью константы __DIR__ а путь то родительского каталога узнаем ф-ей dirname()
 }
开发者ID:Orendev,项目名称:bitrx.local,代码行数:13,代码来源:index.php

示例10: saveConfiguration

 public function saveConfiguration()
 {
     $path = \Bitrix\Main\Application::getDocumentRoot() . self::CONFIGURATION_FILE_PATH;
     $path = preg_replace("'[\\\\/]+'", "/", $path);
     $data = var_export($this->data, true);
     if (!is_writable($path)) {
         @chmod($path, 0600);
     }
     file_put_contents($path, "<" . "?php\n\$data=" . $data . ";\n");
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:10,代码来源:configuration.php

示例11: __construct

 public function __construct($path)
 {
     if (empty($path)) {
         throw new InvalidPathException($path);
     }
     $this->originalPath = $path;
     $this->path = Path::normalize($path);
     $this->documentRoot = \Bitrix\Main\Application::getDocumentRoot();
     if (empty($this->path)) {
         throw new InvalidPathException($path);
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:12,代码来源:filesystementry.php

示例12: initialize

 public function initialize(array $options)
 {
     $this->logFile = static::DEFAULT_LOG_FILE;
     if (isset($options["file"]) && !empty($options["file"])) {
         $this->logFile = $options["file"];
     }
     $this->logFile = preg_replace("'[\\\\/]+'", "/", $this->logFile);
     if (substr($this->logFile, 0, 1) !== "/" && !preg_match("#^[a-z]:/#", $this->logFile)) {
         $this->logFile = Main\Application::getDocumentRoot() . "/" . $this->logFile;
     }
     $this->logFileHistory = $this->logFile . ".old";
     $this->maxLogSize = static::MAX_LOG_SIZE;
     if (isset($options["log_size"]) && $options["log_size"] > 0) {
         $this->maxLogSize = intval($options["log_size"]);
     }
 }
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:16,代码来源:fileexceptionhandlerlog.php

示例13: __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

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

示例15: __construct

 private function __construct()
 {
     // Initialize Twig template engine
     $documentRoot = Application::getDocumentRoot();
     $cacheStoragePathOption = \COption::GetOptionString("wlbl.twigrix", "cache_storage_path");
     if ($cacheStoragePathOption == "") {
         $cacheStoragePath = $documentRoot . BX_PERSONAL_ROOT . "/cache/twig";
     } else {
         $cacheStoragePath = $documentRoot . $cacheStoragePathOption;
     }
     $debugModeOptionValue = \COption::GetOptionString("wlbl.twigrix", "debug_mode");
     $debugMode = $debugModeOptionValue == "Y" ? true : false;
     $loader = new \Twig_Loader_Filesystem($documentRoot);
     $this->environment = new \Twig_Environment($loader, ['autoescape' => false, 'cache' => $cacheStoragePath, 'debug' => $debugMode]);
     $this->addExtensions();
     self::$instance = $this;
 }
开发者ID:wlbl,项目名称:twigrix,代码行数:17,代码来源:templateengine.php


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