本文整理汇总了PHP中CComponentEngine::guessComponentPath方法的典型用法代码示例。如果您正苦于以下问题:PHP CComponentEngine::guessComponentPath方法的具体用法?PHP CComponentEngine::guessComponentPath怎么用?PHP CComponentEngine::guessComponentPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComponentEngine
的用法示例。
在下文中一共展示了CComponentEngine::guessComponentPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ExecuteModuleEventEx
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"];
}
if (empty($componentPage) || !array_key_exists($componentPage, $arDefaultUrlTemplates404)) {
//if (strlen($componentPage) <= 0)
$componentPage = "index";
}
CComponentEngine::InitComponentVariables($componentPage, $arComponentVariables, $arVariableAliases, $arVariables);
foreach ($arUrlTemplates as $url => $value) {
$arResult["PATH_TO_" . strToUpper($url)] = $arParams["SEF_FOLDER"] . $value;
}
if ($_REQUEST["auth"] == "Y") {
$componentPage = "auth";
}
示例2: while
}
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"]);
}
while ($arElement = $rsElements->GetNext()) {
$arResult["ELEMENT_LINKS"][$arElement["IBLOCK_SECTION_ID"]][] = $arElement["~DETAIL_PAGE_URL"];
}
示例3: rtrim
if (!$currentPageUrl || $currentPageUrl == 'index.php') {
if ($arParams["SEF_FOLDER"]) {
$arParams["SEF_FOLDER"] = rtrim($arParams["SEF_FOLDER"], '/');
}
LocalRedirect($arParams["SEF_FOLDER"] . '/path/');
}
$arParams['STORAGE'] = $diskStorage;
$componentPage = '';
$arVariablesD = array();
$engine = new CComponentEngine($this);
$engine->addGreedyPart("#PATH#");
$engine->addGreedyPart("#FILE_PATH#");
$engine->addGreedyPart("#TRASH_PATH#");
$engine->addGreedyPart("#TRASH_FILE_PATH#");
$engine->setResolveCallback(array(\Bitrix\Disk\Driver::getInstance()->getUrlManager(), "resolvePathComponentEngine"));
$componentPage = $engine->guessComponentPath($arParams["SEF_FOLDER"], array("trashcan_list" => "trashcan/#TRASH_PATH#", "trashcan_file_view" => "trash/file/#TRASH_FILE_PATH#", "folder_list" => "path/#PATH#", "folder_view" => "folder/#PATH#", "file_view" => "file/#FILE_PATH#", "external_link_list" => "external", "disk_help" => "help", "disk_bizproc_workflow_admin" => "bp/", "disk_bizproc_workflow_edit" => "bp_edit/#ID#/", "disk_start_bizproc" => "bp_start/#ELEMENT_ID#/", "disk_task" => "bp_task/#ID#/", "disk_task_list" => "bp_task_list/"), $arVariablesD);
if (!empty($componentPage)) {
$APPLICATION->IncludeComponent("bitrix:disk.common", ".default", array('STORAGE' => $diskStorage, 'SEF_MODE' => 'Y', 'SEF_FOLDER' => $arParams['SEF_FOLDER']), false, array("HIDE_ICONS" => "Y"));
return;
} else {
if ($arParams["SEF_FOLDER"]) {
$arParams["SEF_FOLDER"] = rtrim($arParams["SEF_FOLDER"], '/');
}
$needToRedirectPageUrl = $arParams["SEF_FOLDER"] . '/path/';
}
}
}
} else {
if (strlen(trim($arParams["FOLDER"])) <= 0 || str_replace(array("///", "//"), "/", trim($arParams["FOLDER"])) == '/') {
ShowError(GetMessage("WD_FOLDER_EMPTY"));
return 0;
示例4: parseComponentPath
/**
* Finds match between requestURL and on of the url templates.
*
* @param string $folder404
* @param array[string]string $arUrlTemplates
* @param array[string]string &$arVariables
* @param string|bool $requestURL
* @return string
*
*/
public static function parseComponentPath($folder404, $arUrlTemplates, &$arVariables, $requestURL = false)
{
$engine = new CComponentEngine();
return $engine->guessComponentPath($folder404, $arUrlTemplates, $arVariables, $requestURL);
}
示例5: 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;
}
}