本文整理汇总了PHP中Loader::includeModule方法的典型用法代码示例。如果您正苦于以下问题:PHP Loader::includeModule方法的具体用法?PHP Loader::includeModule怎么用?PHP Loader::includeModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader::includeModule方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public function get($name)
{
if (isset($this->tools[$name]) && count($this->tools[$name]) > 0) {
$obj = $this->tools[$name][0];
if (is_object($obj)) {
return $obj;
} elseif (is_string($obj) && class_exists($obj)) {
$this->tools[$name][0] = new $obj();
return $this->tools[$name][0];
} elseif (is_array($obj) && isset($obj[0]) && isset($obj[1]) && is_string($obj[0]) && is_string($obj[1])) {
if (Loader::includeModule($obj[0]) && class_exists($obj[1])) {
$this->tools[$name][0] = new $obj[1]();
return $this->tools[$name][0];
}
throw new LoaderException(sprintf("Class name '%s' is not found in module '%s'", htmlspecialchars($obj[1]), htmlspecialchars($obj[0])));
}
throw new SystemException(sprintf("Tool '%s' is not found", htmlspecialchars($obj)));
}
return null;
}
示例2: sendToEventHandler
private function sendToEventHandler(array $handler, Event $event)
{
try {
$result = true;
$event->addDebugInfo($handler);
if (isset($handler["MODULE_ID"]) && !empty($handler["MODULE_ID"])) {
$result = Loader::includeModule($handler["MODULE_ID"]);
} elseif (isset($handler["PATH"]) && !empty($handler["PATH"])) {
$path = ltrim($handler["PATH"], "/");
if ($path = Loader::getLocal($path)) {
$result = (include_once $path);
}
} elseif (isset($handler["INCLUDE_FILE"]) && !empty($handler["INCLUDE_FILE"]) && \Bitrix\Main\IO\File::isFileExists($handler["INCLUDE_FILE"])) {
$result = (include_once $handler["INCLUDE_FILE"]);
}
$event->addDebugInfo($result);
if (isset($handler["METHOD_ARG"]) && is_array($handler["METHOD_ARG"]) && count($handler["METHOD_ARG"])) {
$args = $handler["METHOD_ARG"];
} else {
$args = array();
}
if ($handler["VERSION"] > 1) {
$args[] = $event;
} else {
$args = array_merge($args, array_values($event->getParameters()));
}
$callback = null;
if (array_key_exists("CALLBACK", $handler)) {
$callback = $handler["CALLBACK"];
} elseif (!empty($handler["CLASS"]) && !empty($handler["METHOD"]) && class_exists($handler["CLASS"])) {
$callback = array($handler["CLASS"], $handler["METHOD"]);
}
if ($callback != null) {
$result = call_user_func_array($callback, $args);
}
if ($result != null && !$result instanceof EventResult) {
$result = new EventResult(EventResult::UNDEFINED, $result, $handler["MODULE_ID"]);
}
$event->addDebugInfo($result);
if ($result != null) {
$event->addResult($result);
}
} catch (\Exception $ex) {
if ($event->isDebugOn()) {
$event->addException($ex);
} else {
throw $ex;
}
}
}
示例3: isset
$isVerticalFilter = 'Y' == $arParams['USE_FILTER'] && $arParams["FILTER_VIEW_MODE"] == "VERTICAL";
$isSidebar = $arParams["SIDEBAR_SECTION_SHOW"] == "Y" && isset($arParams["SIDEBAR_PATH"]) && !empty($arParams["SIDEBAR_PATH"]);
$isFilter = $arParams['USE_FILTER'] == 'Y';
if ($isFilter) {
$arFilter = array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE" => "Y", "GLOBAL_ACTIVE" => "Y");
if (0 < intval($arResult["VARIABLES"]["SECTION_ID"])) {
$arFilter["ID"] = $arResult["VARIABLES"]["SECTION_ID"];
} elseif ('' != $arResult["VARIABLES"]["SECTION_CODE"]) {
$arFilter["=CODE"] = $arResult["VARIABLES"]["SECTION_CODE"];
}
$obCache = new CPHPCache();
if ($obCache->InitCache(36000, serialize($arFilter), "/iblock/catalog")) {
$arCurSection = $obCache->GetVars();
} elseif ($obCache->StartDataCache()) {
$arCurSection = array();
if (Loader::includeModule("iblock")) {
$dbRes = CIBlockSection::GetList(array(), $arFilter, false, array("ID"));
if (defined("BX_COMP_MANAGED_CACHE")) {
global $CACHE_MANAGER;
$CACHE_MANAGER->StartTagCache("/iblock/catalog");
if ($arCurSection = $dbRes->Fetch()) {
$CACHE_MANAGER->RegisterTag("iblock_id_" . $arParams["IBLOCK_ID"]);
}
$CACHE_MANAGER->EndTagCache();
} else {
if (!($arCurSection = $dbRes->Fetch())) {
$arCurSection = array();
}
}
}
$obCache->EndDataCache($arCurSection);