本文整理汇总了PHP中Qualify函数的典型用法代码示例。如果您正苦于以下问题:PHP Qualify函数的具体用法?PHP Qualify怎么用?PHP Qualify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Qualify函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ReadTrail
function ReadTrail($pagename, $trailname) {
global $RASPageName, $SuffixPattern, $GroupPattern, $WikiWordPattern,
$LinkWikiWords;
if (preg_match('/^\\[\\[(.+?)(->|\\|)(.+?)\\]\\]$/', $trailname, $m))
$trailname = ($m[2] == '|') ? $m[1] : $m[3];
$trailtext = RetrieveAuthSection($pagename, $trailname);
$trailname = $RASPageName;
$trailtext = Qualify($trailname, $trailtext);
$t = array();
$n = 0;
foreach(explode("\n", htmlspecialchars(@$trailtext, ENT_NOQUOTES))
as $x) {
$x = preg_replace("/\\[\\[([^\\]]*)->([^\\]]*)\\]\\]/",'[[$2|$1]]',$x);
if (!preg_match("/^([#*:]+) \\s*
(\\[\\[([^:#!|][^|:]*?)(\\|.*?)?\\]\\]($SuffixPattern)
| (($GroupPattern([\\/.]))?$WikiWordPattern)) (.*)/x",$x,$match))
continue;
if (@$match[6]) {
if (!$LinkWikiWords) continue;
$tgt = MakePageName($trailname, $match[6]);
} else $tgt = MakePageName($trailname,
preg_replace('/[#?].+/', '', $match[3]));
$t[$n]['depth'] = $depth = strlen($match[1]);
$t[$n]['pagename'] = $tgt;
$t[$n]['markup'] = $match[2];
$t[$n]['detail'] = $match[9];
for($i=$depth;$i<10;$i++) $d[$i]=$n;
if ($depth>1) $t[$n]['parent']=@$d[$depth-1];
$n++;
}
return $t;
}
示例2: IncludeText
function IncludeText($pagename, $inclspec) {
global $MaxIncludes, $IncludeOpt, $InclCount;
SDV($MaxIncludes,50);
SDVA($IncludeOpt, array('self'=>1));
$npat = '[[:alpha:]][-\\w]*';
if ($InclCount++>=$MaxIncludes) return Keep($inclspec);
$args = array_merge($IncludeOpt, ParseArgs($inclspec));
while (count($args['#'])>0) {
$k = array_shift($args['#']); $v = array_shift($args['#']);
if ($k=='') {
preg_match('/^([^#\\s]*)(.*)$/', $v, $match);
if ($match[1]) { # include a page
if (isset($itext)) continue;
$iname = MakePageName($pagename, $match[1]);
if (!$args['self'] && $iname == $pagename) continue;
if (!PageExists($iname)) continue;
$ipage = RetrieveAuthPage($iname, 'read', false, READPAGE_CURRENT);
$itext = @$ipage['text'];
}
if (preg_match("/^#($npat)?(\\.\\.)?(#($npat)?)?$/", $match[2], $m)) {
@list($x, $aa, $dots, $b, $bb) = $m;
if (!$dots && !$b) $bb = $npat;
if ($aa)
$itext=preg_replace("/^.*?\n([^\n]*\\[\\[#$aa\\]\\])/s",
'$1', $itext, 1);
if ($bb)
$itext=preg_replace("/(\n)[^\n]*\\[\\[#$bb\\]\\].*$/s",
'$1', $itext, 1);
}
continue;
}
if (in_array($k, array('line', 'lines', 'para', 'paras'))) {
preg_match('/^(\\d*)(\\.\\.(\\d*))?$/', $v, $match);
@list($x, $a, $dots, $b) = $match;
$upat = ($k{0} == 'p') ? ".*?(\n\\s*\n|$)" : "[^\n]*(?:\n|$)";
if (!$dots) { $b=$a; $a=0; }
if ($a>0) $a--;
$itext=preg_replace("/^(($upat){0,$b}).*$/s",'$1',$itext,1);
$itext=preg_replace("/^($upat){0,$a}/s",'',$itext,1);
continue;
}
}
$basepage = isset($args['basepage'])
? MakePageName($pagename, $args['basepage'])
: $iname;
if ($basepage) $itext = Qualify(@$basepage, @$itext);
return PVS(htmlspecialchars($itext, ENT_NOQUOTES));
}
示例3: 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);
}
示例4: 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) {
//.........这里部分代码省略.........
示例5: InputDefault
function InputDefault($pagename, $type, $args) {
global $InputValues, $PageTextVarPatterns;
$args = ParseArgs($args);
$args[''] = (array)@$args[''];
$name = (isset($args['name'])) ? $args['name'] : array_shift($args['']);
$name = str_replace('/^\\$:/', 'ptv_', $name);
$value = (isset($args['value'])) ? $args['value'] : array_shift($args['']);
if (!isset($InputValues[$name])) $InputValues[$name] = $value;
if (@$args['request']) {
$req = array_merge($_GET, $_POST);
foreach($req as $k => $v)
if (!isset($InputValues[$k]))
$InputValues[$k] = htmlspecialchars(stripmagic($v), ENT_NOQUOTES);
}
$source = @$args['source'];
if ($source) {
$source = MakePageName($pagename, $source);
$page = RetrieveAuthPage($source, 'read', false, READPAGE_CURRENT);
if ($page) {
foreach((array)$PageTextVarPatterns as $pat)
if (preg_match_all($pat, $page['text'], $match, PREG_SET_ORDER))
foreach($match as $m)
if (!isset($InputValues['ptv_'.$m[1]]))
$InputValues['ptv_'.$m[2]] =
htmlspecialchars(Qualify($source, $m[3]), ENT_NOQUOTES);
}
}
return '';
}
示例6: InputDefault
function InputDefault($pagename, $type, $args)
{
global $InputValues, $PageTextVarPatterns, $PCache;
$args = ParseArgs($args);
$args[''] = (array) @$args[''];
$name = isset($args['name']) ? $args['name'] : array_shift($args['']);
$name = preg_replace('/^\\$:/', 'ptv_', $name);
$value = isset($args['value']) ? $args['value'] : array_shift($args['']);
if (!isset($InputValues[$name])) {
$InputValues[$name] = $value;
}
if (@$args['request']) {
$req = array_merge($_GET, $_POST);
foreach ($req as $k => $v) {
if (!isset($InputValues[$k])) {
$InputValues[$k] = PHSC(stripmagic($v), ENT_NOQUOTES);
}
}
}
$source = @$args['source'];
if ($source) {
$source = MakePageName($pagename, $source);
$page = RetrieveAuthPage($source, 'read', false, READPAGE_CURRENT);
if ($page) {
foreach ((array) $PageTextVarPatterns as $pat) {
if (preg_match_all($pat, IsEnabled($PCache[$source]['=preview'], $page['text']), $match, PREG_SET_ORDER)) {
foreach ($match as $m) {
# if (!isset($InputValues['ptv_'.$m[2]])) PITS:01337
$InputValues['ptv_' . $m[2]] = PHSC(Qualify($source, $m[3]), ENT_NOQUOTES);
}
}
}
}
}
return '';
}
示例7: InputDefault
function InputDefault($pagename, $type, $args) {
global $InputValues, $PageTextVarPatterns, $PCache;
$args = ParseArgs($args);
$args[''] = (array)@$args[''];
$name = (isset($args['name'])) ? $args['name'] : array_shift($args['']);
$name = preg_replace('/^\\$:/', 'ptv_', $name);
$value = (isset($args['value'])) ? $args['value'] : $args[''];
if (!isset($InputValues[$name])) $InputValues[$name] = $value;
if (@$args['request']) {
$req = RequestArgs();
foreach($req as $k => $v) {
if (is_array($v)) {
foreach($v as $vk=>$vv) {
if(is_numeric($vk)) $InputValues["{$k}[]"][] = PHSC($vv, ENT_NOQUOTES);
else $InputValues["{$k}[{$vk}]"] = PHSC($vv, ENT_NOQUOTES);
}
}
else {
if (!isset($InputValues[$k]))
$InputValues[$k] = PHSC($v, ENT_NOQUOTES);
}
}
}
$sources = @$args['source'];
if ($sources) {
foreach(explode(',', $sources) as $source) {
$source = MakePageName($pagename, $source);
if (!PageExists($source)) continue;
$page = RetrieveAuthPage($source, 'read', false, READPAGE_CURRENT);
if (! $page || ! isset($page['text'])) continue;
foreach((array)$PageTextVarPatterns as $pat)
if (preg_match_all($pat, IsEnabled($PCache[$source]['=preview'], $page['text']),
$match, PREG_SET_ORDER))
foreach($match as $m)
# if (!isset($InputValues['ptv_'.$m[2]])) PITS:01337
$InputValues['ptv_'.$m[2]] =
PHSC(Qualify($source, $m[3]), ENT_NOQUOTES);
break;
}
}
return '';
}
示例8: TETextRows
function TETextRows($pagename, $source, $opt, &$par)
{
if ($source == $pagename) {
return '';
}
$page = ReadPage($source);
if (!$page) {
return '';
}
$text = $page['text'];
//use pagename#section if present
if ($opt['section']) {
$text = TextSection($text, $source . $opt['section']);
}
//skip page if it has an exclude match
if ($opt['pat']['-'] != '') {
foreach ($opt['-'] as $pat) {
if (preg_match("({$pat})" . $par['qi'], $text)) {
return;
}
}
}
//skip page if it has no match; all inclusive elements need to match (AND condition)
foreach ($opt[''] as $pat) {
if (!preg_match("({$pat})" . $par['qi'], $text)) {
return;
}
}
$text = Qualify($source, $text);
$rows = explode("\n", rtrim($text));
//use range of lines
if ($opt['lines'] != '') {
$cnt = count($rows);
if (strstr($opt['lines'], '..')) {
preg_match_all("/\\d*/", $lines, $k);
$a = $k[0][0];
$b = $k[0][3];
$c = $k[0][2];
if ($a && $b) {
$rows = array_slice($rows, $a - 1, $b - $a + 1);
} else {
if ($a) {
$rows = array_slice($rows, $a - 1);
} else {
if ($c) {
$rows = array_slice($rows, 0, $c);
}
}
}
} else {
if ($opt['lines'][0] == '-') {
$rows = array_slice($rows, $opt['lines']);
} else {
$rows = array_slice($rows, 0, $opt['lines']);
}
}
}
//unit=para: combine rows to paragraph rows
if ($opt['unit'] == 'para') {
$paras = array();
$j = 0;
foreach ($rows as $i => $row) {
$row = rtrim($row);
if ($row == '') {
$j++;
continue;
}
$paras[$j] .= $row . "\n";
}
$rows = $paras;
}
//unit=page: combine rows to one row
if ($opt['unit'] == 'page') {
$part = implode("\n", $rows);
$rows[0] = $part;
}
return $rows;
}