本文整理汇总了PHP中CComponentEngine::addGreedyPart方法的典型用法代码示例。如果您正苦于以下问题:PHP CComponentEngine::addGreedyPart方法的具体用法?PHP CComponentEngine::addGreedyPart怎么用?PHP CComponentEngine::addGreedyPart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComponentEngine
的用法示例。
在下文中一共展示了CComponentEngine::addGreedyPart方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$arParams["SEARCH_FILTER_NAME"] = "sonet_search_filter";
}
if (!array_key_exists("SEARCH_FILTER_DATE_NAME", $arParams)) {
$arParams["SEARCH_FILTER_DATE_NAME"] = "sonet_search_filter_date";
}
}
$arCustomPagesPath = array();
if ($arParams["SEF_MODE"] == "Y") {
$arVariables = array();
$events = GetModuleEvents("socialnetwork", "OnParseSocNetComponentPath");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array(&$arDefaultUrlTemplates404, &$arCustomPagesPath, $arParams));
}
$engine = new CComponentEngine($this);
if ($diskEnabled) {
$engine->addGreedyPart("#PATH#");
$engine->addGreedyPart("#FILE_PATH#");
$engine->addGreedyPart("#TRASH_PATH#");
$engine->addGreedyPart("#TRASH_FILE_PATH#");
$engine->setResolveCallback(array(\Bitrix\Disk\Driver::getInstance()->getUrlManager(), "resolveSocNetPathComponentEngine"));
}
$arUrlTemplates = CComponentEngine::MakeComponentUrlTemplates($arDefaultUrlTemplates404, $arParams["SEF_URL_TEMPLATES"]);
/* This code is needed to use short paths in WebDAV */
$arUrlTemplates["group_files_short"] = str_replace("#path#", $arDefaultUrlTemplates404["group_files_short"], $arUrlTemplates["group_files"]);
/* / This code is needed to use short paths in WebDAV */
$arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases404, $arParams["VARIABLE_ALIASES"]);
$componentPage = $engine->guessComponentPath($arParams["SEF_FOLDER"], $arUrlTemplates, $arVariables);
// $componentPage = CComponentEngine::ParseComponentPath($arParams["SEF_FOLDER"], $arUrlTemplates, $arVariables);
if (array_key_exists($arVariables["page"], $arDefaultUrlTemplates404)) {
$componentPage = $arVariables["page"];
}
示例2: array
if ($arParams["FILTER_NAME"] === '' || !preg_match("/^[A-Za-z_][A-Za-z01-9_]*\$/", $arParams["FILTER_NAME"])) {
$arParams["FILTER_NAME"] = "arrFilter";
}
} else {
$arParams["FILTER_NAME"] = "";
}
$smartBase = $arParams["SEF_URL_TEMPLATES"]["section"] ? $arParams["SEF_URL_TEMPLATES"]["section"] : "#SECTION_ID#/";
$arDefaultUrlTemplates404 = array("sections" => "", "section" => "#SECTION_ID#/", "element" => "#SECTION_ID#/#ELEMENT_ID#/", "compare" => "compare.php?action=COMPARE", "smart_filter" => $smartBase . "filter/#SMART_FILTER_PATH#/apply/");
$arDefaultVariableAliases404 = array();
$arDefaultVariableAliases = array();
$arComponentVariables = array("SECTION_ID", "SECTION_CODE", "ELEMENT_ID", "ELEMENT_CODE", "action");
if ($arParams["SEF_MODE"] == "Y") {
$arVariables = array();
$engine = new CComponentEngine($this);
if (\Bitrix\Main\Loader::includeModule('iblock')) {
$engine->addGreedyPart("#SECTION_CODE_PATH#");
$engine->addGreedyPart("#SMART_FILTER_PATH#");
$engine->setResolveCallback(array("CIBlockFindTools", "resolveComponentEngine"));
}
$arUrlTemplates = CComponentEngine::MakeComponentUrlTemplates($arDefaultUrlTemplates404, $arParams["SEF_URL_TEMPLATES"]);
$arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases404, $arParams["VARIABLE_ALIASES"]);
$componentPage = $engine->guessComponentPath($arParams["SEF_FOLDER"], $arUrlTemplates, $arVariables);
if ($componentPage === "smart_filter") {
$componentPage = "section";
}
if (!$componentPage && isset($_REQUEST["q"])) {
$componentPage = "search";
}
$b404 = false;
if (!$componentPage) {
$componentPage = "sections";
示例3: while
$rsSections->SetUrlTemplates("", $arParams["SECTION_URL"]);
} else {
$rsSections->SetUrlTemplates("", $arParams["SEF_BASE_URL"] . $arParams["SECTION_PAGE_URL"]);
}
while ($arSection = $rsSections->GetNext()) {
$arResult["SECTIONS"][] = array("ID" => $arSection["ID"], "DEPTH_LEVEL" => $arSection["DEPTH_LEVEL"], "~NAME" => $arSection["~NAME"], "~SECTION_PAGE_URL" => $arSection["~SECTION_PAGE_URL"]);
$arResult["ELEMENT_LINKS"][$arSection["ID"]] = array();
}
$this->EndResultCache();
}
}
//In "SEF" mode we'll try to parse URL and get ELEMENT_ID from it
if ($arParams["IS_SEF"] === "Y") {
$engine = new CComponentEngine($this);
if (CModule::IncludeModule('iblock')) {
$engine->addGreedyPart("#SECTION_CODE_PATH#");
$engine->setResolveCallback(array("CIBlockFindTools", "resolveComponentEngine"));
}
$componentPage = $engine->guessComponentPath($arParams["SEF_BASE_URL"], array("section" => $arParams["SECTION_PAGE_URL"], "detail" => $arParams["DETAIL_PAGE_URL"]), $arVariables);
if ($componentPage === "detail") {
CComponentEngine::InitComponentVariables($componentPage, array("SECTION_ID", "ELEMENT_ID"), array("section" => array("SECTION_ID" => "SECTION_ID"), "detail" => array("SECTION_ID" => "SECTION_ID", "ELEMENT_ID" => "ELEMENT_ID")), $arVariables);
$arParams["ID"] = intval($arVariables["ELEMENT_ID"]);
}
}
if ($arParams["ID"] > 0 && intval($arVariables["SECTION_ID"]) <= 0 && CModule::IncludeModule("iblock")) {
$arSelect = array("ID", "IBLOCK_ID", "DETAIL_PAGE_URL", "IBLOCK_SECTION_ID");
$arFilter = array("ID" => $arParams["ID"], "ACTIVE" => "Y", "IBLOCK_ID" => $arParams["IBLOCK_ID"]);
$rsElements = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect);
if ($arParams["IS_SEF"] === "Y" && strlen($arParams["DETAIL_PAGE_URL"]) > 0) {
$rsElements->SetUrlTemplates($arParams["SEF_BASE_URL"] . $arParams["DETAIL_PAGE_URL"]);
}
示例4: getSEF_Settings
/**
* Инициализирует ЧПУ из настроек компонента
* @return bool
*/
protected function getSEF_Settings()
{
if ($this->arParams['SEF_MODE'] == 'Y') {
$engine = new \CComponentEngine($this);
foreach ($this->arParams['GREEDY_PARTS'] as $part) {
$engine->addGreedyPart($part);
}
$this->arUrlTemplates = \CComponentEngine::MakeComponentUrlTemplates(array(), $this->arParams["SEF_URL_TEMPLATES"]);
$this->arVariableAliases = \CComponentEngine::MakeComponentVariableAliases(array(), $this->arParams["VARIABLE_ALIASES"]);
$this->componentRoute = $engine->guessComponentPath($this->arParams["SEF_FOLDER"], $this->arUrlTemplates, $this->arVariables);
$this->parseGreedyPartsVariables();
if (!$this->componentRoute) {
if (static::isPathsEqual($this->request->getRequestedPageDirectory(), $this->arParams["SEF_FOLDER"])) {
$this->genCallable(true);
return true;
} else {
return false;
}
} else {
\CComponentEngine::InitComponentVariables($this->componentRoute, $this->arComponentVariables, $this->arVariableAliases, $this->arVariables);
//переставляем переменные в том порядке, к вотором они должны попасть в функцию
$componentParameters = $this->getComponentParameters();
if (isset($componentParameters['PARAMETERS']['SEF_MODE'][$this->componentRoute]['VARIABLES'])) {
$parametersVars = $componentParameters['PARAMETERS']['SEF_MODE'][$this->componentRoute]['VARIABLES'];
foreach ($parametersVars as $varName) {
if (isset($this->arVariables[$varName])) {
$this->componentRouteVariables[] = $this->arVariables[$varName];
} else {
$this->componentRouteVariables[] = null;
}
}
}
$this->genCallable();
return true;
}
} else {
$this->genCallable(true);
return true;
}
}