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


PHP Loader::getLocal方法代码示例

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


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

示例1: onPresetTemplateList

 /**
  * @return array
  * @throws \Bitrix\Main\ArgumentException
  */
 public static function onPresetTemplateList()
 {
     $resultList = array();
     $localPathOfIcon = static::LOCAL_DIR_IMG . 'my.png';
     $fullPathOfIcon = \Bitrix\Main\Loader::getLocal($localPathOfIcon);
     $templateDb = static::getList(array('filter' => array('ACTIVE' => 'Y')));
     while ($template = $templateDb->fetch()) {
         $resultList[] = array('TYPE' => 'USER', 'NAME' => $template['NAME'], 'ICON' => !empty($fullPathOfIcon) ? '/bitrix' . $localPathOfIcon : '', 'HTML' => $template['CONTENT']);
     }
     return $resultList;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:15,代码来源:template.php

示例2: runInitScripts

 public static function runInitScripts()
 {
     if (($includePath = \Bitrix\Main\Loader::getLocal("init.php")) !== false) {
         require_once $includePath;
     }
     if (($includePath = \Bitrix\Main\Loader::getPersonal("php_interface/init.php")) !== false) {
         require_once $includePath;
     }
     if (($includePath = \Bitrix\Main\Loader::getPersonal("php_interface/" . SITE_ID . "/init.php")) !== false) {
         require_once $includePath;
     }
 }
开发者ID:rasuldev,项目名称:torino,代码行数:12,代码来源:compatiblestrategy.php

示例3: renderControl

 /**
  * @param FieldType $fieldType
  * @param array $field
  * @param mixed $value
  * @param bool $allowSelection
  * @param int $renderMode
  * @return string
  */
 protected static function renderControl(FieldType $fieldType, array $field, $value, $allowSelection, $renderMode)
 {
     $name = static::generateControlName($field);
     $renderResult = '';
     if ($renderMode & FieldType::RENDER_MODE_ADMIN) {
         require_once Loader::getLocal('/modules/main/interface/init_admin.php');
         $renderResult = \CAdminCalendar::calendarDate($name, $value, 19, static::getType() == FieldType::DATETIME);
     } else {
         ob_start();
         global $APPLICATION;
         $APPLICATION->includeComponent('bitrix:main.calendar', '', array('SHOW_INPUT' => 'Y', 'FORM_NAME' => $field['Form'], 'INPUT_NAME' => $name, 'INPUT_VALUE' => $value, 'SHOW_TIME' => static::getType() == FieldType::DATETIME ? 'Y' : 'N'), false, array('HIDE_ICONS' => 'Y'));
         $renderResult = ob_get_contents();
         ob_end_clean();
     }
     return $renderResult;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:24,代码来源:date.php

示例4: onPresetTemplateList

 /**
  * Handler of event that return array of templates
  *
  * @param string|null $templateType
  * @param string|null $templateId
  * @return array
  * @throws \Bitrix\Main\ArgumentException
  */
 public static function onPresetTemplateList($templateType = null, $templateId = null)
 {
     $resultList = array();
     if ($templateType && $templateType !== 'USER') {
         return $resultList;
     }
     $localPathOfIcon = static::LOCAL_DIR_IMG . 'my.png';
     $fullPathOfIcon = \Bitrix\Main\Loader::getLocal($localPathOfIcon);
     // return only active templates, but if requested template by id return any
     $filter = array();
     if ($templateId) {
         $filter['ID'] = $templateId;
     } else {
         $filter['ACTIVE'] = 'Y';
     }
     $templateDb = static::getList(array('filter' => $filter, 'order' => array('ID' => 'DESC')));
     while ($template = $templateDb->fetch()) {
         $resultList[] = array('TYPE' => 'USER', 'ID' => $template['ID'], 'NAME' => $template['NAME'], 'ICON' => !empty($fullPathOfIcon) ? '/bitrix' . $localPathOfIcon : '', 'HTML' => $template['CONTENT']);
     }
     return $resultList;
 }
开发者ID:Hawkart,项目名称:megatv,代码行数:29,代码来源:template.php

示例5: sendToEventHandler

 private function sendToEventHandler(array $handler, Event $event)
 {
     try {
         $result = true;
         $event->addDebugInfo($handler);
         if (isset($handler["TO_MODULE_ID"]) && !empty($handler["TO_MODULE_ID"]) && $handler["TO_MODULE_ID"] != 'main') {
             $result = Loader::includeModule($handler["TO_MODULE_ID"]);
         } elseif (isset($handler["TO_PATH"]) && !empty($handler["TO_PATH"])) {
             $path = ltrim($handler["TO_PATH"], "/");
             if (($path = Loader::getLocal($path)) !== false) {
                 $result = (include_once $path);
             }
         } elseif (isset($handler["FULL_PATH"]) && !empty($handler["FULL_PATH"]) && IO\File::isFileExists($handler["FULL_PATH"])) {
             $result = (include_once $handler["FULL_PATH"]);
         }
         $event->addDebugInfo($result);
         if (isset($handler["TO_METHOD_ARG"]) && is_array($handler["TO_METHOD_ARG"]) && !empty($handler["TO_METHOD_ARG"])) {
             $args = $handler["TO_METHOD_ARG"];
         } else {
             $args = array();
         }
         if ($handler["VERSION"] > 1) {
             $args[] = $event;
         } else {
             $args = array_merge($args, array_values($event->getParameters()));
         }
         $callback = null;
         if (isset($handler["CALLBACK"])) {
             $callback = $handler["CALLBACK"];
         } elseif (!empty($handler["TO_CLASS"]) && !empty($handler["TO_METHOD"]) && class_exists($handler["TO_CLASS"])) {
             $callback = array($handler["TO_CLASS"], $handler["TO_METHOD"]);
         }
         if ($callback != null) {
             $result = call_user_func_array($callback, $args);
         }
         if ($result != null && !$result instanceof EventResult) {
             $result = new EventResult(EventResult::UNDEFINED, $result, $handler["TO_MODULE_ID"]);
         }
         $event->addDebugInfo($result);
         if ($result != null) {
             $event->addResult($result);
         }
     } catch (\Exception $ex) {
         if ($event->isDebugOn()) {
             $event->addException($ex);
         } else {
             throw $ex;
         }
     }
 }
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:50,代码来源:eventmanager.php

示例6: createCacheEngine

 public static function createCacheEngine()
 {
     $cacheEngine = null;
     // Events can't be used here because events use cache
     $cacheType = "files";
     $v = Config\Configuration::getValue("cache");
     if ($v != null && isset($v["type"]) && !empty($v["type"])) {
         $cacheType = $v["type"];
     }
     if (is_array($cacheType)) {
         if (isset($cacheType["class_name"])) {
             if (!isset($cacheType["extension"]) || extension_loaded($cacheType["extension"])) {
                 if (isset($cacheType["required_file"]) && ($requiredFile = Main\Loader::getLocal($cacheType["required_file"])) !== false) {
                     require_once $requiredFile;
                 }
                 if (isset($cacheType["required_remote_file"])) {
                     require_once $cacheType["required_remote_file"];
                 }
                 $className = $cacheType["class_name"];
                 if (class_exists($className)) {
                     $cacheEngine = new $className();
                 }
             }
         }
     } else {
         switch ($cacheType) {
             case "memcache":
                 if (extension_loaded('memcache')) {
                     $cacheEngine = new CacheEngineMemcache();
                 }
                 break;
             case "eaccelerator":
                 if (extension_loaded('eaccelerator')) {
                     $cacheEngine = new CacheEngineEAccelerator();
                 }
                 break;
             case "apc":
                 if (extension_loaded('apc')) {
                     $cacheEngine = new CacheEngineApc();
                 }
                 break;
             case "xcache":
                 if (extension_loaded('xcache')) {
                     $cacheEngine = new CacheEngineXCache();
                 }
                 break;
             case "files":
                 $cacheEngine = new CacheEngineFiles();
                 break;
             case "none":
                 $cacheEngine = new CacheEngineNone();
                 break;
             default:
                 break;
         }
     }
     if ($cacheEngine == null) {
         $cacheEngine = new CacheEngineNone();
         trigger_error("Cache engine is not found", E_USER_WARNING);
     }
     if (!$cacheEngine->isAvailable()) {
         $cacheEngine = new CacheEngineNone();
         trigger_error("Cache engine is not available", E_USER_WARNING);
     }
     return $cacheEngine;
 }
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:66,代码来源:cache.php

示例7: runInitScripts

 protected function runInitScripts()
 {
     if (!$this->dispatcher instanceof Dispatcher) {
         throw new \Exception();
     }
     if (($includePath = Loader::getLocal("init_d7.php")) !== false) {
         require_once $includePath;
     }
     if (($includePath = Loader::getPersonal("php_interface/init_d7.php")) !== false) {
         require_once $includePath;
     }
     // константы после init.php
     define("BX_CRONTAB_SUPPORT", defined("BX_CRONTAB"));
     if (!defined("BX_FILE_PERMISSIONS")) {
         define("BX_FILE_PERMISSIONS", 0644);
     }
     if (!defined("BX_DIR_PERMISSIONS")) {
         define("BX_DIR_PERMISSIONS", 0755);
     }
 }
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:20,代码来源:application.php

示例8: loadTriggers

 private static function loadTriggers($moduleId)
 {
     static $triggersCache = array();
     if (isset($triggersCache[$moduleId])) {
         return;
     }
     if (preg_match("#[^a-zA-Z0-9._]#", $moduleId)) {
         throw new Main\ArgumentOutOfRangeException("moduleId");
     }
     $triggersCache[$moduleId] = true;
     $path = Main\Loader::getLocal("modules/" . $moduleId . "/option_triggers.php");
     if ($path === false) {
         return;
     }
     include $path;
 }
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:16,代码来源:option.php

示例9: update

 /**
  * @param $templateName
  * @param $html
  * @return bool|int
  */
 public static function update($templateName, $html)
 {
     $result = false;
     $fullPathOfFile = \Bitrix\Main\Loader::getLocal(static::LOCAL_DIR_TMPL . bx_basename($templateName) . '.php');
     if ($fullPathOfFile) {
         $result = File::putFileContents($fullPathOfFile, $html);
     }
     return $result;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:14,代码来源:template.php

示例10: createExceptionHandlerLog

 public static function createExceptionHandlerLog()
 {
     $exceptionHandling = Config\Configuration::getValue("exception_handling");
     if ($exceptionHandling === null || !is_array($exceptionHandling) || !isset($exceptionHandling["log"]) || !is_array($exceptionHandling["log"])) {
         return null;
     }
     $options = $exceptionHandling["log"];
     $log = null;
     if (isset($options["class_name"]) && !empty($options["class_name"])) {
         if (isset($options["extension"]) && !empty($options["extension"]) && !extension_loaded($options["extension"])) {
             return null;
         }
         if (isset($options["required_file"]) && !empty($options["required_file"]) && ($requiredFile = Loader::getLocal($options["required_file"])) !== false) {
             require_once $requiredFile;
         }
         $className = $options["class_name"];
         if (!class_exists($className)) {
             return null;
         }
         $log = new $className();
     } elseif (isset($options["settings"]) && is_array($options["settings"])) {
         $log = new Diag\FileExceptionHandlerLog();
     } else {
         return null;
     }
     $log->initialize(isset($options["settings"]) && is_array($options["settings"]) ? $options["settings"] : array());
     return $log;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:28,代码来源:application.php

示例11: doActions

 protected function doActions()
 {
     switch ($this->action) {
         case self::ACTION_STOP:
             /** @noinspection PhpIncludeInspection */
             include Loader::getLocal('/admin/security_403.php');
             die;
             break;
         case self::ACTION_REDIRECT:
             localRedirect($this->actionOptions['host'], true);
             break;
         default:
             trigger_error('Unknown action', E_USER_WARNING);
     }
 }
开发者ID:spas-viktor,项目名称:books,代码行数:15,代码来源:hostrestriction.php

示例12: createInstance

 /**
  * @return Cache
  */
 public static function createInstance()
 {
     $cacheEngine = null;
     // Events can't be used here because events use cache
     $cacheType = "files";
     $v = \Bitrix\Main\Config\Configuration::getValue("cache");
     if ($v != null && isset($v["type"]) && !empty($v["type"])) {
         $cacheType = $v["type"];
     }
     if (is_array($cacheType)) {
         if (isset($cacheType["class_name"])) {
             if (!isset($cacheType["extension"]) || extension_loaded($cacheType["extension"])) {
                 if (isset($cacheType["required_file"]) && ($requiredFile = \Bitrix\Main\Loader::getLocal($cacheType["required_file"]))) {
                     require_once $requiredFile;
                 }
                 $className = $cacheType["class_name"];
                 if (class_exists($className)) {
                     $cacheEngine = new $className();
                 }
             }
         }
     } else {
         switch ($cacheType) {
             case "memcache":
                 if (extension_loaded('memcache')) {
                     $cacheEngine = new CacheEngineMemcache();
                 }
                 break;
             case "eaccelerator":
                 if (extension_loaded('eaccelerator')) {
                     $cacheEngine = new CacheEngineEAccelerator();
                 }
                 break;
             case "apc":
                 if (extension_loaded('apc')) {
                     $cacheEngine = new CacheEngineApc();
                 }
                 break;
             case "files":
                 $cacheEngine = new CacheEngineFiles();
                 break;
             default:
                 break;
         }
     }
     if ($cacheEngine == null) {
         throw new \Bitrix\Main\Config\ConfigurationException("Cache engine is not found");
     }
     if (!$cacheEngine->isAvailable()) {
         throw new \Bitrix\Main\SystemException("Cache engine is not available");
     }
     /*
     $v = \Bitrix\Main\Config\Configuration::getValue("cache");
     if ($v != null && isset($v["type"]))
     {
     	$cacheType = $v["type"];
     	if (is_array($cacheType))
     	{
     		if (isset($cacheType["class_name"]))
     		{
     			if (!isset($cacheType["extension"]) || extension_loaded($cacheType["extension"]))
     			{
     				if (isset($cacheType["required_file"]) && ($requiredFile = \Bitrix\Main\Loader::getLocal($cacheType["required_file"])))
     					require_once($requiredFile);
     
     				$className = $cacheType["class_name"];
     				if (class_exists($className))
     					$cacheEngine = new $className();
     			}
     		}
     	}
     	else
     	{
     		switch ($cacheType)
     		{
     			case "memcache":
     				if (extension_loaded('memcache'))
     					$cacheEngine = new CacheEngineMemcache();
     				break;
     			case "eaccelerator":
     				if (extension_loaded('eaccelerator'))
     					$cacheEngine = new CacheEngineEAccelerator();
     				break;
     			case "apc":
     				if (extension_loaded('apc'))
     					$cacheEngine = new CacheEngineApc();
     				break;
     			default:
     				break;
     		}
     	}
     
     	if (($cacheEngine != null) && !$cacheEngine->isAvailable())
     		$cacheEngine = null;
     }
     
     if ($cacheEngine == null)
//.........这里部分代码省略.........
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:cache.php


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