當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。