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


PHP CComponentEngine::GetComponent方法代码示例

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


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

示例1: resolveComponentEngine

 public static function resolveComponentEngine(CComponentEngine $engine, $pageCandidates, &$arVariables)
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION, $CACHE_MANAGER;
     $component = $engine->GetComponent();
     if ($component) {
         $iblock_id = intval($component->arParams["IBLOCK_ID"]);
     } else {
         $iblock_id = 0;
     }
     $requestURL = $APPLICATION->GetCurPage(true);
     $cacheId = $requestURL . implode("|", array_keys($pageCandidates));
     $cache = new CPHPCache();
     if ($cache->startDataCache(3600, $cacheId, "iblock_find")) {
         if (defined("BX_COMP_MANAGED_CACHE")) {
             $CACHE_MANAGER->StartTagCache("iblock_find");
             CIBlock::registerWithTagCache($iblock_id);
         }
         foreach ($pageCandidates as $pageID => $arVariablesTmp) {
             if ($arVariablesTmp["SECTION_CODE_PATH"] != "" && (isset($arVariablesTmp["ELEMENT_ID"]) || isset($arVariablesTmp["ELEMENT_CODE"]))) {
                 if (CIBlockFindTools::checkElement($iblock_id, $arVariablesTmp)) {
                     $arVariables = $arVariablesTmp;
                     if (defined("BX_COMP_MANAGED_CACHE")) {
                         $CACHE_MANAGER->EndTagCache();
                     }
                     $cache->endDataCache(array($pageID, $arVariablesTmp));
                     return $pageID;
                 }
             }
         }
         foreach ($pageCandidates as $pageID => $arVariablesTmp) {
             if ($arVariablesTmp["SECTION_CODE_PATH"] != "" && (!isset($arVariablesTmp["ELEMENT_ID"]) && !isset($arVariablesTmp["ELEMENT_CODE"]))) {
                 if (CIBlockFindTools::checkSection($iblock_id, $arVariablesTmp)) {
                     $arVariables = $arVariablesTmp;
                     if (defined("BX_COMP_MANAGED_CACHE")) {
                         $CACHE_MANAGER->EndTagCache();
                     }
                     $cache->endDataCache(array($pageID, $arVariablesTmp));
                     return $pageID;
                 }
             }
         }
         if (defined("BX_COMP_MANAGED_CACHE")) {
             $CACHE_MANAGER->AbortTagCache();
         }
         $cache->abortDataCache();
     } else {
         $vars = $cache->getVars();
         $pageID = $vars[0];
         $arVariables = $vars[1];
         return $pageID;
     }
     list($pageID, $arVariables) = each($pageCandidates);
     return $pageID;
 }
开发者ID:spas-viktor,项目名称:books,代码行数:55,代码来源:comp_findtools.php

示例2: resolveComponentEngine

 public static function resolveComponentEngine(CComponentEngine $engine, $pageCandidates, &$arVariables)
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION, $CACHE_MANAGER;
     static $aSearch = array("<", ">", """, "'");
     static $aReplace = array("<", ">", "\"", "'");
     $component = $engine->GetComponent();
     if ($component) {
         $iblock_id = intval($component->arParams["IBLOCK_ID"]);
     } else {
         $iblock_id = 0;
     }
     //To fix GetPagePath security hack for SMART_FILTER_PATH
     foreach ($pageCandidates as $pageID => $arVariablesTmp) {
         foreach ($arVariablesTmp as $variableName => $variableValue) {
             if ($variableName === "SMART_FILTER_PATH") {
                 $pageCandidates[$pageID][$variableName] = str_replace($aSearch, $aReplace, $variableValue);
             }
         }
     }
     $requestURL = $APPLICATION->GetCurPage(true);
     $cacheId = $requestURL . implode("|", array_keys($pageCandidates)) . "|" . SITE_ID;
     $cache = new CPHPCache();
     if ($cache->startDataCache(3600, $cacheId, "iblock_find")) {
         if (defined("BX_COMP_MANAGED_CACHE")) {
             $CACHE_MANAGER->StartTagCache("iblock_find");
             CIBlock::registerWithTagCache($iblock_id);
         }
         foreach ($pageCandidates as $pageID => $arVariablesTmp) {
             if ($arVariablesTmp["SECTION_CODE_PATH"] != "" && (isset($arVariablesTmp["ELEMENT_ID"]) || isset($arVariablesTmp["ELEMENT_CODE"]))) {
                 if (CIBlockFindTools::checkElement($iblock_id, $arVariablesTmp)) {
                     $arVariables = $arVariablesTmp;
                     if (defined("BX_COMP_MANAGED_CACHE")) {
                         $CACHE_MANAGER->EndTagCache();
                     }
                     $cache->endDataCache(array($pageID, $arVariablesTmp));
                     return $pageID;
                 }
             }
         }
         foreach ($pageCandidates as $pageID => $arVariablesTmp) {
             if ($arVariablesTmp["SECTION_CODE_PATH"] != "" && (!isset($arVariablesTmp["ELEMENT_ID"]) && !isset($arVariablesTmp["ELEMENT_CODE"]))) {
                 if (CIBlockFindTools::checkSection($iblock_id, $arVariablesTmp)) {
                     $arVariables = $arVariablesTmp;
                     if (defined("BX_COMP_MANAGED_CACHE")) {
                         $CACHE_MANAGER->EndTagCache();
                     }
                     $cache->endDataCache(array($pageID, $arVariablesTmp));
                     return $pageID;
                 }
             }
         }
         if (defined("BX_COMP_MANAGED_CACHE")) {
             $CACHE_MANAGER->AbortTagCache();
         }
         $cache->abortDataCache();
     } else {
         $vars = $cache->getVars();
         $pageID = $vars[0];
         $arVariables = $vars[1];
         return $pageID;
     }
     reset($pageCandidates);
     list($pageID, $arVariables) = each($pageCandidates);
     return $pageID;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:66,代码来源:comp_findtools.php


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