本文整理匯總了PHP中MarkupEscape函數的典型用法代碼示例。如果您正苦於以下問題:PHP MarkupEscape函數的具體用法?PHP MarkupEscape怎麽用?PHP MarkupEscape使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了MarkupEscape函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Qualify
function Qualify($pagename, $text) {
global $QualifyPatterns, $KeepToken, $KPV, $tmp_qualify;
if (!@$QualifyPatterns) return $text;
$text = MarkupEscape($text);
$group = $tmp_qualify['group'] = PageVar($pagename, '$Group');
$name = $tmp_qualify['name'] = PageVar($pagename, '$Name');
$tmp_qualify['pagename'] = $pagename;
$text = PPRA((array)$QualifyPatterns, $text);
return MarkupRestore($text);
}
示例2: FPLTemplateLoad
function FPLTemplateLoad($pagename, $matches, $opt, &$tparts){
global $Cursor, $FPLTemplatePageFmt, $RASPageName, $PageListArgPattern;
SDV($FPLTemplatePageFmt, array('{$FullName}',
'{$SiteGroup}.LocalTemplates', '{$SiteGroup}.PageListTemplates'));
$template = @$opt['template'];
if (!$template) $template = @$opt['fmt'];
$ttext = RetrieveAuthSection($pagename, $template, $FPLTemplatePageFmt);
$ttext = PVSE(Qualify($RASPageName, $ttext));
## save any escapes
$ttext = MarkupEscape($ttext);
## remove any anchor markups to avoid duplications
$ttext = preg_replace('/\\[\\[#[A-Za-z][-.:\\w]*\\]\\]/', '', $ttext);
## extract portions of template
$tparts = preg_split('/\\(:(template)\\s+([-!]?)\\s*(\\w+)\\s*(.*?):\\)/i',
$ttext, -1, PREG_SPLIT_DELIM_CAPTURE);
}
示例3: FPLTemplate
function FPLTemplate($pagename, &$matches, $opt)
{
global $Cursor, $FPLTemplatePageFmt, $RASPageName, $PageListArgPattern;
SDV($FPLTemplatePageFmt, array('{$FullName}', '{$SiteGroup}.LocalTemplates', '{$SiteGroup}.PageListTemplates'));
StopWatch("FPLTemplate begin");
$template = @$opt['template'];
if (!$template) {
$template = @$opt['fmt'];
}
$ttext = RetrieveAuthSection($pagename, $template, $FPLTemplatePageFmt);
$ttext = PVSE(Qualify($RASPageName, $ttext));
## save any escapes
$ttext = MarkupEscape($ttext);
## remove any anchor markups to avoid duplications
$ttext = preg_replace('/\\[\\[#[A-Za-z][-.:\\w]*\\]\\]/', '', $ttext);
## extract portions of template
$tparts = preg_split('/\\(:(template)\\s+(\\w+)\\s*(.*?):\\)/i', $ttext, -1, PREG_SPLIT_DELIM_CAPTURE);
## handle (:template defaults:)
$i = 0;
while ($i < count($tparts)) {
if ($tparts[$i] != 'template') {
$i++;
continue;
}
if ($tparts[$i + 1] != 'defaults' && $tparts[$i + 1] != 'default') {
$i += 4;
continue;
}
$opt = array_merge(ParseArgs($tparts[$i + 2], $PageListArgPattern), $opt);
array_splice($tparts, $i, 3);
}
SDVA($opt, array('class' => 'fpltemplate', 'wrap' => 'div'));
## get the list of pages
$matches = array_values(MakePageList($pagename, $opt, 0));
## extract page subset according to 'count=' parameter
if (@$opt['count']) {
list($r0, $r1) = CalcRange($opt['count'], count($matches));
if ($r1 < $r0) {
$matches = array_reverse(array_slice($matches, $r1 - 1, $r0 - $r1 + 1));
} else {
$matches = array_slice($matches, $r0 - 1, $r1 - $r0 + 1);
}
}
$savecursor = $Cursor;
$pagecount = 0;
$groupcount = 0;
$grouppagecount = 0;
$pseudovars = array('{$$PageCount}' => &$pagecount, '{$$GroupCount}' => &$groupcount, '{$$GroupPageCount}' => &$grouppagecount);
foreach (preg_grep('/^[\\w$]/', array_keys($opt)) as $k) {
if (!is_array($opt[$k])) {
$pseudovars["{\$\${$k}}"] = htmlspecialchars($opt[$k], ENT_NOQUOTES);
}
}
$vk = array_keys($pseudovars);
$vv = array_values($pseudovars);
$lgroup = '';
$out = '';
foreach ($matches as $i => $pn) {
$group = PageVar($pn, '$Group');
if ($group != $lgroup) {
$groupcount++;
$grouppagecount = 0;
$lgroup = $group;
}
$grouppagecount++;
$pagecount++;
$t = 0;
while ($t < count($tparts)) {
if ($tparts[$t] != 'template') {
$item = $tparts[$t];
$t++;
} else {
list($when, $control, $item) = array_slice($tparts, $t + 1, 3);
$t += 4;
if (!$control) {
if ($when == 'first' && $i != 0) {
continue;
}
if ($when == 'last' && $i != count($matches) - 1) {
continue;
}
} else {
if ($when == 'first' || !isset($last[$t])) {
$Cursor['<'] = $Cursor['<'] = (string) @$matches[$i - 1];
$Cursor['='] = $pn;
$Cursor['>'] = $Cursor['>'] = (string) @$matches[$i + 1];
$curr = str_replace($vk, $vv, $control);
$curr = preg_replace('/\\{(=|&[lg]t;)(\\$:?\\w+)\\}/e', "PageVar(\$pn, '\$2', '\$1')", $curr);
if ($when == 'first' && $i > 0 && $last[$t] == $curr) {
continue;
}
$last[$t] = $curr;
}
if ($when == 'last') {
$Cursor['<'] = $Cursor['<'] = $pn;
$Cursor['='] = (string) @$matches[$i + 1];
$Cursor['>'] = $Cursor['>'] = (string) @$matches[$i + 2];
$next = str_replace($vk, $vv, $control);
$next = preg_replace('/\\{(=|&[lg]t;)(\\$:?\\w+)\\}/e', "PageVar(\$pn, '\$2', '\$1')", $next);
if ($next == $last[$t] && $i != count($matches) - 1) {
//.........這裏部分代碼省略.........
示例4: FPLTemplate
function FPLTemplate($pagename, &$matches, $opt)
{
global $Cursor, $FPLFormatOpt, $FPLTemplatePageFmt;
SDV($FPLTemplatePageFmt, array('{$FullName}', '{$SiteGroup}.LocalTemplates', '{$SiteGroup}.PageListTemplates'));
StopWatch("FPLTemplate begin");
$template = @$opt['template'];
if (!$template) {
$template = @$opt['fmt'];
}
list($tname, $qf) = explode('#', $template, 2);
if ($tname) {
$tname = array(MakePageName($pagename, $tname));
} else {
$tname = (array) $FPLTemplatePageFmt;
}
foreach ($tname as $t) {
$t = FmtPageName($t, $pagename);
if (!PageExists($t)) {
continue;
}
if ($qf) {
$t .= "#{$qf}";
}
$ttext = IncludeText($pagename, $t, true);
if (!$qf || strpos($ttext, "[[#{$qf}]]") !== false) {
break;
}
}
## remove any anchor markups to avoid duplications
$ttext = preg_replace('/\\[\\[#[A-Za-z][-.:\\w]*\\]\\]/', '', $ttext);
## save any escapes
$ttext = MarkupEscape($ttext);
$matches = array_values(MakePageList($pagename, $opt, 0));
if (@$opt['count']) {
array_splice($matches, $opt['count']);
}
$savecursor = $Cursor;
$pagecount = 0;
$groupcount = 0;
$grouppagecount = 0;
$pseudovars = array('{$$PageCount}' => &$pagecount, '{$$GroupCount}' => &$groupcount, '{$$GroupPageCount}' => &$grouppagecount);
foreach (preg_grep('/^[\\w$]/', array_keys($opt)) as $k) {
if (!is_array($opt[$k])) {
$pseudovars["{\$\${$k}}"] = htmlspecialchars($opt[$k], ENT_NOQUOTES);
}
}
$vk = array_keys($pseudovars);
$vv = array_values($pseudovars);
$lgroup = '';
$out = '';
foreach ($matches as $i => $pn) {
$prev = (string) @$matches[$i - 1];
$next = (string) @$matches[$i + 1];
$Cursor['<'] = $Cursor['<'] = $prev;
$Cursor['='] = $pn;
$Cursor['>'] = $Cursor['>'] = $next;
$group = PageVar($pn, '$Group');
if ($group != $lgroup) {
$groupcount++;
$grouppagecount = 0;
}
$grouppagecount++;
$pagecount++;
$item = str_replace($vk, $vv, $ttext);
$item = preg_replace('/\\{(=|&[lg]t;)(\\$:?\\w+)\\}/e', "PVSE(PageVar(\$pn, '\$2', '\$1'))", $item);
$out .= MarkupRestore($item);
$lgroup = $group;
}
$class = preg_replace('/[^-a-zA-Z0-9\\x80-\\xff]/', ' ', @$opt['class']);
$div = $class ? "<div class='{$class}'>" : '<div>';
$out = $div . MarkupToHTML($pagename, $out, array('escape' => 0)) . '</div>';
StopWatch("FPLTemplate end");
return $out;
}
示例5: ReplaceOnSave
function ReplaceOnSave($pagename,&$page,&$new) {
global $EnablePost, $ROSPatterns, $ROEPatterns, $EnableROSEscape;
$t = $new['text'];
if (IsEnabled($EnableROSEscape, 0)) $t = MarkupEscape($t);
$t = PPRA((array)@$ROEPatterns, $t);
if ($EnablePost) {
$t = PPRA((array)@$ROSPatterns, $t);
}
if (IsEnabled($EnableROSEscape, 0)) $t = MarkupRestore($t);
$new['=preview'] = $new['text'] = $t;
PCache($pagename, $new);
}
示例6: FPLTemplate
function FPLTemplate($pagename, &$matches, $opt) {
global $Cursor, $FPLFormatOpt, $FPLTemplatePageFmt;
SDV($FPLTemplatePageFmt, array('{$FullName}',
'{$SiteGroup}.LocalTemplates','{$SiteGroup}.PageListTemplates'));
$template = @$opt['template'];
if (!$template) $template = @$opt['fmt'];
list($tname, $qf) = explode('#', $template, 2);
if ($tname) $tname = array(MakePageName($pagename, $tname));
else $tname = (array)$FPLTemplatePageFmt;
foreach ($tname as $t) {
$t = FmtPageName($t, $pagename);
if (!PageExists($t)) continue;
if ($qf) $t .= "#$qf";
$ttext = IncludeText($pagename, $t, true);
if (!$qf || strpos($ttext, "[[#$qf]]") !== false) break;
}
## remove any anchor markups to avoid duplications
$ttext = preg_replace('/\\[\\[#[A-Za-z][-.:\\w]*\\]\\]/', '', $ttext);
if (!@$opt['order'] && !@$opt['trail']) $opt['order'] = 'name';
$matches = array_values(MakePageList($pagename, $opt, 0));
if (@$opt['count']) array_splice($matches, $opt['count']);
$savecursor = $Cursor;
$pagecount = 0; $groupcount = 0; $grouppagecount = 0;
$vk = array('{$PageCount}', '{$GroupCount}', '{$GroupPageCount}');
$vv = array(&$pagecount, &$groupcount, &$grouppagecount);
$lgroup = ''; $out = '';
foreach($matches as $i => $pn) {
$prev = (string)@$matches[$i-1];
$next = (string)@$matches[$i+1];
$Cursor['<'] = $Cursor['<'] = $prev;
$Cursor['='] = $pn;
$Cursor['>'] = $Cursor['>'] = $next;
$group = PageVar($pn, '$Group');
if ($group != $lgroup) { $groupcount++; $grouppagecount = 0; }
$grouppagecount++; $pagecount++;
$item = str_replace($vk, $vv, MarkupEscape($ttext));
$item = preg_replace('/\\{(=|&[lg]t;)(\\$:?\\w+)\\}/e',
"PageVar(\$pn, '$2', '$1')", $item);
$out .= MarkupRestore($item);
$lgroup = $group;
}
$class = preg_replace('/[^-a-zA-Z0-9\\x80-\\xff]/', ' ', @$opt['class']);
$div = ($class) ? "<div class='$class'>" : '<div>';
return $div.MarkupToHTML($pagename, $out, array('escape' => 0)).'</div>';
}