10 public static function PrepareContent(
$filesrc)
27 if (str_starts_with($src,
"<?php"))
28 $src = substr($src, 5);
30 $src = substr($src, 2);
31 $src = substr($src, 0, -2);
34 $isComponent2Begin =
false;
35 $arIncludeComponentFunctionStrings = PHPParser::getComponentFunctionStrings();
36 foreach($arIncludeComponentFunctionStrings as $functionName)
38 $comp2_begin = mb_strtoupper($functionName).
'(';
39 if(mb_strtoupper(mb_substr($src, 0, mb_strlen($comp2_begin))) == $comp2_begin)
41 $isComponent2Begin =
true;
45 if ($isComponent2Begin)
46 $new_filesrc .= $arPHP[
$n][2];
48 $new_filesrc .=
'#PHP'.str_pad(++$php_count, 4,
"0", STR_PAD_LEFT).
'#';
50 $new_filesrc .= mb_substr(
$filesrc, $end);
57 public static function Process(
$filesrc =
false, $old_filesrc =
false)
74 $new_filesrc .= self::EncodePHPTags(mb_substr(
$filesrc, $end,
$start - $end));
79 if (str_starts_with($src,
"<?php"))
80 $src =
'<?'.substr($src, 5);
83 $isComponent2Begin =
false;
84 $component2FunctionName =
'';
85 $arIncludeComponentFunctionStrings = PHPParser::getComponentFunctionStrings();
86 foreach($arIncludeComponentFunctionStrings as $functionName)
88 $comp2_begin =
'<?'.mb_strtoupper($functionName).
'(';
89 if(mb_strtoupper(mb_substr($src, 0, mb_strlen($comp2_begin))) == $comp2_begin)
91 $isComponent2Begin =
true;
92 $component2FunctionName = $functionName;
97 if ($isComponent2Begin)
102 $comp_name =
$arRes[
'COMPONENT_NAME'];
103 $template_name =
$arRes[
'TEMPLATE_NAME'];
105 $arPHPparams =
array();
106 self::ComponentChecker(
$arParams, $arPHPparams);
107 $len =
count($arPHPparams);
109 $code = $component2FunctionName.
'('.$br.
119 $arParameters =
array();
120 if (isset($arCompParams[
"PARAMETERS"]) && is_array($arCompParams[
"PARAMETERS"]))
121 $arParameters = $arParameters + $arCompParams[
"PARAMETERS"];
122 if (is_array($arTemplParams))
123 $arParameters = $arParameters + $arTemplParams;
126 for ($e = 0; $e < $len; $e++)
128 $par_name = $arPHPparams[$e];
129 $arParams[$par_name] = $arParameters[$par_name][
'DEFAULT'] ??
'';
138 $code .=
"\t".
'array()';
140 $parent_comp =
$arRes[
'PARENT_COMP'];
141 $arExParams_ =
$arRes[
'FUNCTION_PARAMS'];
143 $bEx = isset($arExParams_) && is_array($arExParams_) && !empty($arExParams_);
145 if (!$parent_comp || mb_strtolower($parent_comp) ==
'false')
146 $parent_comp =
false;
149 if ($parent_comp ==
'true' || is_numeric($parent_comp))
150 $code .=
','.$br.
"\t".$parent_comp;
157 $code .=
','.$br.
"\tfalse";
159 $arExParams =
array();
160 foreach ($arExParams_ as
$k => $v)
164 if (
$k <> '' && $v <>
'')
165 $arExParams[
$k] = $v;
167 $exParams = PHPParser::ReturnPHPStr2($arExParams);
168 $code .=
','.$br.
"\tarray(".$exParams.
')';
171 $code =
'<?'.$code.
'?>';
172 $new_filesrc .=
$code;
176 $new_filesrc .= self::EncodePHPTags(mb_substr(
$filesrc, $end));
184 if (str_contains(
$filesrc,
'#PHP') && $old_filesrc !==
false)
188 $arPHPscripts =
array();
194 $src = $arPHP[
$n][2];
195 $src = substr($src, (str_starts_with($src,
"<?php"))? 5 : 2, -2);
197 $isComponent2Begin =
false;
198 $arIncludeComponentFunctionStrings = PHPParser::getComponentFunctionStrings();
199 foreach($arIncludeComponentFunctionStrings as $functionName)
201 $comp2_begin = mb_strtoupper($functionName).
'(';
202 if(mb_strtoupper(mb_substr($src, 0, mb_strlen($comp2_begin))) == $comp2_begin)
204 $isComponent2Begin =
true;
208 if (!$isComponent2Begin)
209 $arPHPscripts[] = $src;
218 $php_fr_num = intval(mb_substr(
$filesrc, $php_begin + 4, 4)) - 1;
220 if (isset($arPHPscripts[$php_fr_num]))
222 $code =
'<?'.$arPHPscripts[$php_fr_num].
'?>';
235 public static function EncodePHPTags(
$str)
237 $str = str_replace(
array(
"<?",
"?>",
"<%",
"%>"),
array(
"<?",
"?>",
"<%",
"%>"),
$str);
239 static $pattern =
"/(<script[^>]*language\\s*=\\s*)('|\"|)php('|\"|)([^>]*>)/i";
245 public static function ComponentChecker(&
$arParams, &$arPHPparams, $parentParamName =
false)
248 foreach (
$arParams as $param_name => $paramval)
250 if (str_starts_with($param_name,
'={') && str_ends_with($param_name,
'}'))
252 $key = substr($param_name, 2, -1);
259 if (is_array($paramval))
261 self::ComponentChecker($paramval, $arPHPparams, ($parentParamName !==
false? $parentParamName : $param_name));
264 elseif (str_starts_with($paramval,
'={') && str_ends_with($paramval,
'}'))
266 $arPHPparams[] = ($parentParamName !==
false? $parentParamName : $param_name);
static _ReplaceNonLatin($str)
static GetTemplateProps($componentName, $templateName, $siteTemplate="", $arCurrentValues=array())
static GetComponentProps($componentName, $arCurrentValues=array(), $templateProperties=array())
static CheckForComponent2($str)
static ParseFile($filesrc, $limit=false)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
EscapePHPString($str, $encloser='"')
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
if(!Loader::includeModule('sale')) $pattern