本文整理汇总了PHP中CComponentEngine::MakeComponentVariableAliases方法的典型用法代码示例。如果您正苦于以下问题:PHP CComponentEngine::MakeComponentVariableAliases方法的具体用法?PHP CComponentEngine::MakeComponentVariableAliases怎么用?PHP CComponentEngine::MakeComponentVariableAliases使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComponentEngine
的用法示例。
在下文中一共展示了CComponentEngine::MakeComponentVariableAliases方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPage
/**
* Set type of the page
*/
protected function setPage()
{
$urlTemplates = [];
if ($this->arParams['SEF_MODE'] === 'Y') {
$variables = [];
$urlTemplates = \CComponentEngine::MakeComponentUrlTemplates($this->defaultUrlTemplates404, $this->arParams['SEF_URL_TEMPLATES']);
$variableAliases = \CComponentEngine::MakeComponentVariableAliases($this->defaultUrlTemplates404, $this->arParams['VARIABLE_ALIASES']);
$this->templatePage = \CComponentEngine::ParseComponentPath($this->arParams['SEF_FOLDER'], $urlTemplates, $variables);
if (!$this->templatePage) {
if ($this->arParams['SET_404'] === 'Y') {
$folder404 = str_replace('\\', '/', $this->arParams['SEF_FOLDER']);
if ($folder404 != '/') {
$folder404 = '/' . trim($folder404, "/ \t\n\r\v") . "/";
}
if (substr($folder404, -1) == '/') {
$folder404 .= 'index.php';
}
if ($folder404 != Main\Context::getCurrent()->getRequest()->getRequestedPage()) {
$this->return404();
}
}
$this->templatePage = $this->defaultSefPage;
}
if ($this->isSearchRequest() && $this->arParams['USE_SEARCH'] === 'Y') {
$this->templatePage = 'search';
}
\CComponentEngine::InitComponentVariables($this->templatePage, $this->componentVariables, $variableAliases, $variables);
} else {
$this->templatePage = $this->defaultPage;
}
$this->sefFolder = $this->arParams['SEF_FOLDER'];
$this->urlTemplates = $urlTemplates;
$this->variables = $variables;
$this->variableAliases = $variableAliases;
}
示例2: getResult
/**
* получение результатов
*/
protected function getResult()
{
$urlTemplates = array();
if ($this->arParams['SEF_MODE'] == 'Y') {
$variables = array();
$urlTemplates = \CComponentEngine::MakeComponentUrlTemplates($this->defaultUrlTemplates404, $this->arParams['SEF_URL_TEMPLATES']);
$variableAliases = \CComponentEngine::MakeComponentVariableAliases($this->defaultUrlTemplates404, $this->arParams['VARIABLE_ALIASES']);
$this->page = \CComponentEngine::ParseComponentPath($this->arParams['SEF_FOLDER'], $urlTemplates, $variables);
if (strlen($this->page) <= 0) {
$this->page = 'index';
}
\CComponentEngine::InitComponentVariables($this->page, $this->componentVariables, $variableAliases, $variables);
} else {
$this->page = 'index';
}
$this->arResult = array('FOLDER' => $this->arParams['SEF_FOLDER'], 'URL_TEMPLATES' => $urlTemplates, 'VARIABLES' => $variables, 'ALIASES' => $variableAliases);
}
示例3: array
}
$arDefaultUrlTemplates404 = array("list" => "profile_list.php", "detail" => "profile_detail.php?ID=#ID#");
$arDefaultVariableAliases404 = array();
$arDefaultVariableAliases = array();
$arComponentVariables = array("ID", "del_id");
$componentPage = "";
$arVariables = array();
$this->setFramemode(false);
if ($arParams["SEF_MODE"] == "Y") {
$arUrlTemplates = CComponentEngine::MakeComponentUrlTemplates($arDefaultUrlTemplates404, $arParams["SEF_URL_TEMPLATES"]);
$arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases404, $arParams["VARIABLE_ALIASES"]);
$componentPage = CComponentEngine::ParseComponentPath($arParams["SEF_FOLDER"], $arUrlTemplates, $arVariables);
CComponentEngine::InitComponentVariables($componentPage, $arComponentVariables, $arVariableAliases, $arVariables);
foreach ($arUrlTemplates as $url => $value) {
$arResult["PATH_TO_" . ToUpper($url)] = $arParams["SEF_FOLDER"] . $value;
}
if ($componentPage != "detail") {
$componentPage = "list";
}
$arResult = array_merge(array("SEF_FOLDER" => $arParams["SEF_FOLDER"], "URL_TEMPLATES" => $arUrlTemplates, "VARIABLES" => $arVariables, "ALIASES" => $arVariableAliases), $arResult);
} else {
$arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases404, $arParams["VARIABLE_ALIASES"]);
CComponentEngine::InitComponentVariables(false, $arComponentVariables, $arVariableAliases, $arVariables);
if (IntVal($_REQUEST["ID"]) > 0) {
$componentPage = "detail";
} else {
$componentPage = "list";
}
$arResult = array("VARIABLES" => $arVariables, "ALIASES" => $arVariableAliases);
}
$this->IncludeComponentTemplate($componentPage);
示例4: array
}
CSaleBasket::UpdateBasketPrices(CSaleBasket::GetBasketUserID(), SITE_ID);
$bShowReady = False;
$bShowDelay = False;
$bShowSubscribe = False;
$bShowNotAvail = False;
$allSum = 0;
$allWeight = 0;
$allCurrency = CSaleLang::GetLangCurrency(SITE_ID);
$allVATSum = 0;
$arResult["ITEMS"]["AnDelCanBuy"] = array();
$arResult["ITEMS"]["DelDelCanBuy"] = array();
$arResult["ITEMS"]["nAnCanBuy"] = array();
$arResult["ITEMS"]["ProdSubscribe"] = array();
$DISCOUNT_PRICE_ALL = 0;
$arVariableAliases = CComponentEngine::MakeComponentVariableAliases(array(), $arParams["VARIABLE_ALIASES"]);
$arBasketItems = array();
$arBasketItemsTmp = array();
$dbBasketItems = CSaleBasket::GetList(array("NAME" => "ASC", "ID" => "ASC"), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "LID" => SITE_ID, "ORDER_ID" => "NULL"), false, false, array("ID", "NAME", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "PRICE", "WEIGHT", "DETAIL_PAGE_URL", "NOTES", "CURRENCY", "VAT_RATE", "CATALOG_XML_ID", "PRODUCT_XML_ID", "SUBSCRIBE", "DISCOUNT_PRICE", "PRODUCT_PROVIDER_CLASS"));
$arItemsIDs = array();
$arItemsInBasketIDs = array();
while ($arItems = $dbBasketItems->GetNext()) {
$arItemsIDs[] = $arItems["PRODUCT_ID"];
$arItemsInBasketIDs[$arItems["PRODUCT_ID"]] = $arItems["ID"];
$arItems['QUANTITY'] = $arParams['QUANTITY_FLOAT'] == 'Y' ? number_format(DoubleVal($arItems['QUANTITY']), 2, '.', '') : IntVal($arItems['QUANTITY']);
$arItems["PROPS"] = array();
if (in_array("PROPS", $arParams["COLUMNS_LIST"])) {
$dbProp = CSaleBasket::GetPropsList(array("SORT" => "ASC", "ID" => "ASC"), array("BASKET_ID" => $arItems["ID"], "!CODE" => array("CATALOG.XML_ID", "PRODUCT.XML_ID")));
while ($arProp = $dbProp->GetNext()) {
$arItems["PROPS"][] = $arProp;
}
示例5: array
$arParams['STORAGE'] = \Bitrix\Disk\Storage::loadById((int) $arParams['STORAGE_ID'], array('ROOT_OBJECT'));
}
if (empty($arParams['STORAGE'])) {
//necessary
return;
}
if ($arParams['SEF_MODE'] == 'Y') {
$arVariables = 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"));
$arUrlTemplates = CComponentEngine::MakeComponentUrlTemplates($arDefaultUrlTemplates404, isset($arParams["SEF_URL_TEMPLATES"]) ? $arParams["SEF_URL_TEMPLATES"] : array());
$arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases404, isset($arParams["VARIABLE_ALIASES"]) ? $arParams["VARIABLE_ALIASES"] : array());
$componentPage = $engine->guessComponentPath($arParams["SEF_FOLDER"], $arUrlTemplates, $arVariables);
if (empty($componentPage) || !array_key_exists($componentPage, $arDefaultUrlTemplates404)) {
/** @var \Bitrix\Disk\Storage $arParams['STORAGE'] */
$componentPage = 'folder_list';
if ($arParams['STORAGE'] instanceof \Bitrix\Disk\Storage) {
$arVariables = array('STORAGE' => $arParams['STORAGE'], 'FOLDER_ID' => $arParams['STORAGE']->getRootObjectId(), 'RELATIVE_PATH' => '/', 'RELATIVE_ITEMS' => array());
}
}
CComponentEngine::InitComponentVariables($componentPage, $arComponentVariables, $arVariableAliases, $arVariables);
$arParams['SEF_FOLDER'] = rtrim($arParams['SEF_FOLDER'], '/') . '/';
foreach ($arUrlTemplates as $url => $value) {
if (empty($arParams['PATH_TO_' . strtoupper($url)])) {
$arResult['PATH_TO_' . strtoupper($url)] = $arParams['SEF_FOLDER'] . $value;
} elseif (is_string($arParams['PATH_TO_' . strtoupper($url)])) {
$arResult['PATH_TO_' . strtoupper($url)] = $arParams['PATH_TO_' . strtoupper($url)];
示例6: 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;
}
}