本文整理汇总了PHP中CMain::LPAComponentChecker方法的典型用法代码示例。如果您正苦于以下问题:PHP CMain::LPAComponentChecker方法的具体用法?PHP CMain::LPAComponentChecker怎么用?PHP CMain::LPAComponentChecker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMain
的用法示例。
在下文中一共展示了CMain::LPAComponentChecker方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _RenderAllComponents
function _RenderAllComponents($arParams, $bLPA)
{
global $APPLICATION, $USER;
$s = '';
$arPHP = PHPParser::ParseFile($arParams['source']);
$l = count($arPHP);
if ($l > 0) {
$new_source = '';
$end = 0;
$comp_count = 0;
ob_start();
for ($n = 0; $n < $l; $n++) {
//Trim php tags
$src = $arPHP[$n][2];
if (SubStr($src, 0, 5) == "<?" . "php") {
$src = SubStr($src, 5);
} else {
$src = SubStr($src, 2);
}
$src = SubStr($src, 0, -2);
$comp2_begin = '$APPLICATION->INCLUDECOMPONENT(';
if (strtoupper(substr($src, 0, strlen($comp2_begin))) != $comp2_begin) {
continue;
}
$arRes = PHPParser::CheckForComponent2($arPHP[$n][2]);
if ($arRes) {
$comp_name = CMain::_ReplaceNonLatin($arRes['COMPONENT_NAME']);
$template_name = CMain::_ReplaceNonLatin($arRes['TEMPLATE_NAME']);
$arParams = $arRes['PARAMS'];
$arParams['BX_EDITOR_RENDER_MODE'] = 'Y';
if ($bLPA) {
$arPHPparams = array();
CMain::LPAComponentChecker($arParams, $arPHPparams);
$len = count($arPHPparams);
}
$br = "\r\n";
$code = '$APPLICATION->IncludeComponent(' . $br . "\t" . '"' . $comp_name . '",' . $br . "\t" . '"' . $template_name . '",' . $br;
// If exist at least one parameter with php code inside
if (count($arParams) > 0) {
// Get array with description of component params
$arCompParams = CComponentUtil::GetComponentProps($comp_name);
$arTemplParams = CComponentUtil::GetTemplateProps($comp_name, $template_name, $template);
$arParameters = array();
if (isset($arCompParams["PARAMETERS"]) && is_array($arCompParams["PARAMETERS"])) {
$arParameters = $arParameters + $arCompParams["PARAMETERS"];
}
if (is_array($arTemplParams)) {
$arParameters = $arParameters + $arTemplParams;
}
if ($bLPA) {
// Replace values from 'DEFAULT'
for ($e = 0; $e < $len; $e++) {
$par_name = $arPHPparams[$e];
$arParams[$par_name] = isset($arParameters[$par_name]['DEFAULT']) ? $arParameters[$par_name]['DEFAULT'] : '';
}
}
foreach ($arParams as $key => $val) {
if ($key != addslashes($key)) {
unset($arParams[$key]);
} else {
$arParams[$key] = addslashes($val);
}
}
//ReturnPHPStr
$params = PHPParser::ReturnPHPStr2($arParams, $arParameters);
$code .= "\t" . 'Array(' . $br . "\t" . $params . $br . "\t" . ')';
} else {
$code .= "\t" . 'Array()';
}
$parent_comp = CMain::_ReplaceNonLatin($arRes['PARENT_COMP']);
$arExParams_ = $arRes['FUNCTION_PARAMS'];
$bEx = isset($arExParams_) && is_array($arExParams_) && count($arExParams_) > 0;
if (!$parent_comp || strtolower($parent_comp) == 'false') {
$parent_comp = false;
}
if ($parent_comp) {
if ($parent_comp == 'true' || intVal($parent_comp) == $parent_comp) {
$code .= ',' . $br . "\t" . $parent_comp;
} else {
$code .= ',' . $br . "\t\"" . $parent_comp . '"';
}
}
if ($bEx) {
if (!$parent_comp) {
$code .= ',' . $br . "\tfalse";
}
$arExParams = array();
foreach ($arExParams_ as $k => $v) {
$k = CMain::_ReplaceNonLatin($k);
$v = CMain::_ReplaceNonLatin($v);
if (strlen($k) > 0 && strlen($v) > 0) {
$arExParams[$k] = $v;
}
}
$exParams = PHPParser::ReturnPHPStr2($arExParams);
$code .= ',' . $br . "\tArray(" . $exParams . ')';
}
$code .= $br . ');';
echo '#BX_RENDERED_COMPONENT_' . $comp_count . '#';
eval($code);
//.........这里部分代码省略.........
示例2: LPAComponentChecker
function LPAComponentChecker(&$arParams, &$arPHPparams, $parentParamName = false)
{
//all php fragments wraped by ={}
foreach ($arParams as $param_name => $paramval) {
if (substr($param_name, 0, 2) == '={' && substr($param_name, -1) == '}') {
$key = substr($param_name, 2, -1);
if (strval($key) !== strval(intval($key))) {
unset($arParams[$param_name]);
continue;
}
}
if (is_array($paramval)) {
CMain::LPAComponentChecker($paramval, $arPHPparams, $param_name);
$arParams[$param_name] = $paramval;
} elseif (substr($paramval, 0, 2) == '={' && substr($paramval, -1) == '}') {
$arPHPparams[] = $parentParamName ? $parentParamName : $param_name;
}
}
}