本文整理汇总了PHP中ParseArgs函数的典型用法代码示例。如果您正苦于以下问题:PHP ParseArgs函数的具体用法?PHP ParseArgs怎么用?PHP ParseArgs使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ParseArgs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FmtPageList
function FmtPageList($fmt, $pagename, $opt)
{
global $GroupPattern, $FmtV, $FPLFunctions;
# if (isset($_REQUEST['q']) && $_REQUEST['q']=='') $_REQUEST['q']="''";
$rq = htmlspecialchars(stripmagic(@$_REQUEST['q']), ENT_NOQUOTES);
$FmtV['$Needle'] = $opt['o'] . ' ' . $rq;
if (preg_match("!^({$GroupPattern}(\\|{$GroupPattern})*)?/!i", $rq, $match)) {
$opt['group'] = @$match[1];
$rq = substr($rq, strlen(@$match[1]) + 1);
}
$opt = array_merge($opt, ParseArgs($opt['o'] . ' ' . $rq), @$_REQUEST);
if (@($opt['req'] && !$opt['-'] && !$opt[''] && !$opt['+'] && !$opt['q'])) {
return;
}
$GLOBALS['SearchIncl'] = array_merge((array) @$opt[''], (array) @$opt['+']);
$GLOBALS['SearchExcl'] = (array) @$opt['-'];
$GLOBALS['SearchGroup'] = @$opt['group'];
$matches = array();
$fmtfn = @$FPLFunctions[$opt['fmt']];
if (!function_exists($fmtfn)) {
$fmtfn = 'FPLByGroup';
}
$out = $fmtfn($pagename, $matches, $opt);
$FmtV['$MatchCount'] = count($matches);
if ($fmt != '$MatchList') {
$FmtV['$MatchList'] = $out;
$out = FmtPageName($fmt, $pagename);
}
if ($out[0] == '<') {
return '<div>' . Keep($out) . '</div>';
}
PRR();
return $out;
}
示例2: InputMarkup
function InputMarkup($pagename, $type, $args)
{
global $InputTags, $InputAttrs, $InputValues, $FmtV;
if (!@$InputTags[$type]) {
return "(:input {$type} {$args}:)";
}
$opt = array_merge($InputTags[$type], ParseArgs($args));
$args = @$opt[':args'];
if (!$args) {
$args = array('name', 'value');
}
while (count(@$opt['']) > 0 && count($args) > 0) {
$opt[array_shift($args)] = array_shift($opt['']);
}
foreach ((array) @$opt[''] as $a) {
if (!isset($opt[$a])) {
$opt[$a] = $a;
}
}
if (!isset($opt['value']) && isset($InputValues[@$opt['name']])) {
$opt['value'] = $InputValues[$opt['name']];
}
$attr = array();
foreach ($InputAttrs as $a) {
if (!isset($opt[$a])) {
continue;
}
$attr[] = "{$a}='" . str_replace("'", ''', $opt[$a]) . "'";
}
$FmtV['$InputFormArgs'] = implode(' ', $attr);
$out = FmtPageName($opt[':html'], $pagename);
return preg_replace('/<(\\w+\\s)(.*)$/es', "'<\$1'.Keep(PSS('\$2'))", $out);
}
示例3: NewPageBox
function NewPageBox($pagename, $opt)
{
global $ScriptUrl;
$defaults = array('base' => $pagename, 'template' => '', 'button' => 'left', 'value' => '', 'label' => FmtPageName(' $[Create a new page called:] ', $pagename));
$opt = array_merge($defaults, ParseArgs($opt));
$buttonHTML = "<input class='inputbutton newpagebutton' type='submit' value='{$opt['label']}' />";
return "<form class='newpage' action='{$ScriptUrl}' method='post'>\r\n <input type='hidden' name='n' value='{$pagename}' />\r\n <input type='hidden' name='action' value='new' />\r\n <input type='hidden' name='base' value='{$opt['base']}' />\r\n <input type='hidden' name='template' value='{$opt['template']}' />" . ($opt['button'] == "left" ? $buttonHTML : "") . "<input class='inputbox newpagetext' type='text' name='name' size='16' value=' {$opt['value']} '\r\n onfocus=\"if(this.value='{$opt['value']}') {this.value=''}\"\r\n onblur=\"if(this.value=='') {this.value='{$opt['value']}'}\" />" . ($opt['button'] == "right" ? $buttonHTML : "") . "</form>";
}
示例4: BDropdownMenu
function BDropdownMenu($inp)
{
$defaults = array('title' => 'Dropdown');
$args = array_merge($defaults, ParseArgs($inp));
$inline_code_begin = "<li class='dropdown'><a href='#' class='dropdown-toggle' data-toggle='dropdown'>" . $args['title'] . "<b class='caret'></b></a><ul class='dropdown-menu'>";
$inline_code_end = "</ul></li>";
// if we're using MakePageList, we have to pass ALL the opts along...
// in this case, named $args
$group_list = BGetWikiPages($args);
$formatted_list = BBuildGroupList($group_list);
return Keep($inline_code_begin . $formatted_list . $inline_code_end);
}
示例5: openlayers
function openlayers($args)
{
global $HTMLHeaderFmt, $HTMLFooterFmt;
$params = ParseArgs($args);
$slippymap_default = array('width' => 500, 'height' => 400, 'lat' => '49.4312', 'lon' => '-2.364', 'zoom' => 14);
$width = $params['width'] ? $params['width'] : $slippymap_default['width'];
$height = $params['height'] ? $params['height'] : $slippymap_default['height'];
$lat = $params['lat'] ? $params['lat'] : $slippymap_default['lat'];
$lon = $params['lon'] ? $params['lon'] : $slippymap_default['lon'];
$zoom = $params['zoom'] ? $params['zoom'] : $slippymap_default['zoom'];
$HTMLHeaderFmt['slippymap'] = "\r\n" . '<script src="http://localhost/pmwiki-2.2.0-beta65/pub/js/OpenLayers/OpenLayers.js"></script>' . "\r\n" . '<script src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>' . "\r\n" . '<script type="text/javascript">' . "\r\n" . ' var lat = ' . $lat . ";\r\n" . ' var lon = ' . $lon . ";\r\n" . ' var zoom = ' . $zoom . ";\r\n" . ' var map; //complex object of type OpenLayers.Map' . "\r\n" . ' //"map" Objekt initialisieren' . "\r\n" . ' function slippymap_init() {' . "\r\n" . ' map = new OpenLayers.Map ("map", {' . "\r\n" . ' controls:[' . "\r\n" . ' new OpenLayers.Control.Navigation(),' . "\r\n" . ' new OpenLayers.Control.PanZoomBar(),' . "\r\n" . ' new OpenLayers.Control.Attribution()],' . "\r\n" . ' maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),' . "\r\n" . ' maxResolution: 156543.0399,' . "\r\n" . ' numZoomLevels: 19,' . "\r\n" . ' units: \'m\',' . "\r\n" . ' projection: new OpenLayers.Projection("EPSG:900913"),' . "\r\n" . ' displayProjection: new OpenLayers.Projection("EPSG:4326")' . "\r\n" . ' } );' . "\r\n" . ' // weitere Basiskarten: OpenLayers.Layer.OSM.Mapnik, OpenLayers.Layer.OSM.Maplint und OpenLayers.Layer.OSM.CycleMap' . "\r\n" . ' layerTilesAtHome = new OpenLayers.Layer.OSM.Osmarender("Osmarender");' . "\r\n" . ' map.addLayer(layerTilesAtHome);' . "\r\n" . ' var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());' . "\r\n" . ' map.setCenter (lonLat, zoom);' . "\r\n" . ' }' . "\r\n" . '</script>' . "\r\n" . "\r\n";
$HTMLFooterFmt = '<script type="text/javascript">' . "\n\t" . 'slippymap_init();' . "\n" . '</script>';
return '<div style="width: ' . $width . 'px; height:' . $height . 'px; border-style:solid; border-width:1px; border-color:lightgrey;" id="map">' . "\n\t" . '<noscript>' . "\n\t\t" . 'Die Nutzung der Karte setzt die Aktivierung von JavaScript voraus.' . "\n\t" . '</noscript>' . "\n" . '</div>';
}
示例6: MarkupExpression
function MarkupExpression($pagename, $expr)
{
global $KeepToken, $KPV, $MarkupExpr;
$rpat = "/{$KeepToken}(\\d+P){$KeepToken}/e";
$rrep = '$KPV[\'$1\']';
$expr = preg_replace('/([\'"])(.*?)\\1/e', "Keep(PSS('\$2'),'P')", $expr);
$expr = preg_replace('/\\(\\W/e', "Keep(PSS('\$2'),'P')", $expr);
while (preg_match('/\\((\\w+)(\\s[^()]*)?\\)/', $expr, $match)) {
list($repl, $func, $params) = $match;
$code = @$MarkupExpr[$func];
## if not a valid function, save this string as-is and exit
if (!$code) {
break;
}
## if the code uses '$params', we just evaluate directly
if (strpos($code, '$params') !== false) {
$out = eval("return ({$code});");
if ($expr == $repl) {
$expr = $out;
break;
}
$expr = str_replace($repl, $out, $expr);
continue;
}
## otherwise, we parse arguments into $args before evaluating
$argp = ParseArgs($params);
$x = $argp['#'];
$args = array();
while ($x) {
list($k, $v) = array_splice($x, 0, 2);
if ($k == '' || $k == '+' || $k == '-') {
$args[] = $k . preg_replace($rpat, $rrep, $v);
}
}
## fix any quoted arguments
foreach ($argp as $k => $v) {
if (!is_array($v)) {
$argp[$k] = preg_replace($rpat, $rrep, $v);
}
}
$out = eval("return ({$code});");
if ($expr == $repl) {
$expr = $out;
break;
}
$expr = str_replace($repl, Keep($out, 'P'), $expr);
}
return preg_replace($rpat, $rrep, $expr);
}
示例7: FmtUploadList2
function FmtUploadList2($pagename, $args)
{
global $UploadDir, $UploadPrefixFmt, $UploadUrlFmt, $EnableUploadOverwrite, $FileListTimeFmt, $EnableDirectDownload, $HTMLStylesFmt, $FarmPubDirUrl;
$HTMLStylesFmt['filelist'] = "\r\n table.filelist { padding:0; margin:0; border-spacing:0; }\r\n table.filelist td { padding:3px 0 0 0; margin:0; }\r\n .filelist a { text-decoration:underline; }\r\n .dotted { background:url({$FarmPubDirUrl}/images/dot3.png) repeat-x bottom; }\r\n .nodots { background:#feffff; }\r\n ";
$opt = ParseArgs($args);
if (@$opt[''][0]) {
$pagename = MakePageName($pagename, $opt[''][0]);
}
if (@$opt['re']) {
$matchre = '/^(' . $opt['re'] . ')$/i';
}
if (@$opt['ext']) {
$matchext = '/\\.(' . implode('|', preg_split('/\\W+/', $opt['ext'], -1, PREG_SPLIT_NO_EMPTY)) . ')$/i';
}
$uploaddir = FmtPageName("{$UploadDir}{$UploadPrefixFmt}", $pagename);
$uploadurl = FmtPageName(IsEnabled($EnableDirectDownload, 1) ? "{$UploadUrlFmt}{$UploadPrefixFmt}/" : "\$PageUrl?action=download&upname=", $pagename);
$dirp = @opendir($uploaddir);
if (!$dirp) {
return '';
}
$filelist = array();
while (($file = readdir($dirp)) !== false) {
if ($file[0] == '.') {
continue;
}
if (@$matchext && !preg_match(@$matchext, $file)) {
continue;
}
if (@$matchre && !preg_match(@$matchre, $file)) {
continue;
}
$filelist[$file] = $file;
}
closedir($dirp);
$out = array();
#asort($filelist);
$overwrite = '';
foreach ($filelist as $file => $x) {
$name = PUE("{$uploadurl}{$file}");
$stat = stat("{$uploaddir}/{$file}");
if ($EnableUploadOverwrite) {
$overwrite = FmtPageName("<a class='createlink'\r\n href='\$PageUrl?action=upload&upname={$file}'> Δ</a>", $pagename);
}
$out[] = "<tr><td class='dotted'> <a href='{$name}'>{$file}</a>{$overwrite} </td>" . "<td class='dotted' align=right><span class='nodots'>" . number_format($stat['size'] / 1024) . "Kb</span></td>" . "<td> " . strftime($FileListTimeFmt, $stat['mtime']) . "</td>" . "<tr>";
}
return implode("\n", $out);
}
示例8: BootstrapButton
function BootstrapButton($args)
{
$opt = ParseArgs($args);
// expect link, class
// TODO: test for options
// TODO: handle alt params
// TODO: handle rel=nofollow per pmwiki settings
// what about other PmWiki shortcut-type things?
// like... [[PmWiki/basic editing|+]]%apply=link class="btn"%
$target = $opt['link'];
$text = $opt['text'] ? $opt['text'] : $target;
// if text not provided, default to the link
$class = $opt['class'];
$l = '<a href="%s" class="%s">%s</a>';
$linkf = sprintf($l, $target, $class, $text);
return $linkf;
}
示例9: HandyTocProcessMarkup
function HandyTocProcessMarkup($pagename, $argstr)
{
global $HandyTocEndAt, $HandyTocStartAt, $HandyTocIgnoreSoleH1;
global $HTMLFooterFmt;
$args = ParseArgs($argstr);
$title = $args[''] ? implode(' ', $args['']) : '';
$start = $args['start'] ? $args['start'] : $HandyTocStartAt;
$end = $args['end'] ? $args['end'] : $HandyTocEndAt;
$ignoreh1 = $args['ignoreh1'] ? $args['ignoreh1'] : $HandyTocIgnoreSoleH1;
$class = $args['class'] ? ' class="' . $args['class'] . '" ' : '';
$HTMLFooterFmt['handytoc'] = " \n <script language='javascript' type='text/javascript'\n src='\$HandyTocPubDirUrl/handytoc.js'></script>\n <script language='javascript' type='text/javascript'>TOC.set_args({start:{$start}, end:{$end}, ignoreh1:{$ignoreh1}});</script>\n";
if ($title) {
return Keep("<div {$class}id='htoc'><h3>{$title}</h3></div>");
} else {
return Keep("<div {$class}id='htoc'></div>");
}
}
示例10: galleria
function galleria($args = false)
{
global $galleria, $galleria_unsafe_options, $galleria_safe_mode;
$args = ParseArgs($args);
unset($args['#']);
if ($galleria_safe_mode) {
#remove unsafe options from markup args -- only allow from config.php
foreach ($galleria_unsafe_options as $v) {
unset($args[$v]);
}
}
$o = array_merge($galleria, $args);
return '
<script type="text/javascript">
$(document).ready(function(){
$("' . $o['list'] . '").galleria(' . galleria_json_encode($o, false, $galleria_unsafe_options) . ');
});
</script>';
}
示例11: InputMarkup
function InputMarkup($pagename, $type, $args) {
global $InputTags, $InputAttrs, $InputValues, $FmtV;
if (!@$InputTags[$type]) return "(:input $type $args:)";
$opt = array_merge($InputTags[$type], ParseArgs($args));
$args = @$opt[':args'];
if (!$args) $args = array('name', 'value');
while (count(@$opt['']) > 0 && count($args) > 0)
$opt[array_shift($args)] = array_shift($opt['']);
foreach ((array)@$opt[''] as $a)
if (!isset($opt[$a])) $opt[$a] = $a;
if (!isset($opt['value']) && isset($InputValues[@$opt['name']]))
$opt['value'] = $InputValues[$opt['name']];
$attr = array();
foreach ($InputAttrs as $a) {
if (!isset($opt[$a])) continue;
$attr[] = "$a='".str_replace("'", ''', $opt[$a])."'";
}
$FmtV['$InputFormArgs'] = implode(' ', $attr);
$out = FmtPageName($opt[':html'], $pagename);
return Keep($out);
}
示例12: MarkupMarkup
function MarkupMarkup($pagename, $text, $opt = '')
{
$MarkupMarkupOpt = array('class' => 'vert');
$opt = array_merge($MarkupMarkupOpt, ParseArgs($opt));
$html = MarkupToHTML($pagename, $text, array('escape' => 0));
if (@$opt['caption']) {
$caption = str_replace("'", ''', "<caption>{$opt['caption']}</caption>");
}
$class = preg_replace('/[^-\\s\\w]+/', ' ', @$opt['class']);
if (strpos($class, 'horiz') !== false) {
$sep = '';
$pretext = wordwrap($text, 40);
} else {
$sep = '</tr><tr>';
$pretext = wordwrap($text, 75);
}
return Keep("<table class='markup {$class}' align='center'>{$caption}\n <tr><td class='markup1' valign='top'><pre>{$pretext}</pre></td>{$sep}<td \n class='markup2' valign='top'>{$html}</td></tr></table>");
}
示例13: FmtUploadList
function FmtUploadList($pagename, $args)
{
global $UploadDir, $UploadPrefixFmt, $UploadUrlFmt, $EnableUploadOverwrite, $TimeFmt, $EnableDirectDownload;
$opt = ParseArgs($args);
if (@$opt[''][0]) {
$pagename = MakePageName($pagename, $opt[''][0]);
}
if (@$opt['ext']) {
$matchext = '/\\.(' . implode('|', preg_split('/\\W+/', $opt['ext'], -1, PREG_SPLIT_NO_EMPTY)) . ')$/i';
}
$uploaddir = FmtPageName("{$UploadDir}{$UploadPrefixFmt}", $pagename);
$uploadurl = FmtPageName(IsEnabled($EnableDirectDownload, 1) ? "{$UploadUrlFmt}{$UploadPrefixFmt}/" : "\$PageUrl?action=download&upname=", $pagename);
$dirp = @opendir($uploaddir);
if (!$dirp) {
return '';
}
$filelist = array();
while (($file = readdir($dirp)) !== false) {
if ($file[0] == '.') {
continue;
}
if (@$matchext && !preg_match(@$matchext, $file)) {
continue;
}
$filelist[$file] = $file;
}
closedir($dirp);
$out = array();
asort($filelist);
$overwrite = '';
foreach ($filelist as $file => $x) {
$name = PUE("{$uploadurl}{$file}");
$stat = stat("{$uploaddir}/{$file}");
if ($EnableUploadOverwrite) {
$overwrite = FmtPageName("<a class='createlink'\n href='\$PageUrl?action=upload&upname={$file}'> Δ</a>", $pagename);
}
$out[] = "<li> <a href='{$name}'>{$file}</a>{$overwrite} ... " . number_format($stat['size']) . " bytes ... " . strftime($TimeFmt, $stat['mtime']) . "</li>";
}
return implode("\n", $out);
}
示例14: NotifyUpdate
function NotifyUpdate($pagename, $dir = '')
{
global $NotifyList, $NotifyListPageFmt, $NotifyFile, $IsPagePosted, $FmtV, $NotifyTimeFmt, $NotifyItemFmt, $SearchPatterns, $NotifySquelch, $NotifyDelay, $Now, $NotifySubjectFmt, $NotifyBodyFmt, $NotifyHeaders, $NotifyParameters;
$abort = ignore_user_abort(true);
if ($dir) {
flush();
chdir($dir);
}
$GLOBALS['EnableRedirect'] = 0;
## Read in the current notify configuration
$pn = FmtPageName($NotifyListPageFmt, $pagename);
$npage = ReadPage($pn, READPAGE_CURRENT);
preg_match_all('/^[\\s*:#->]*(notify[:=].*)/m', $npage['text'], $nlist);
$nlist = array_merge((array) @$NotifyList, (array) @$nlist[1]);
if (!$nlist) {
return;
}
## make sure other processes are locked out
Lock(2);
## let's load the current .notifylist table
$nfile = FmtPageName($NotifyFile, $pagename);
$nfp = @fopen($nfile, 'r');
if ($nfp) {
## get our current squelch and delay timestamps
clearstatcache();
$sz = filesize($nfile);
list($nextevent, $firstpost) = explode(' ', rtrim(fgets($nfp, $sz)));
## restore our notify array
$notify = unserialize(fgets($nfp, $sz));
fclose($nfp);
}
if (!is_array($notify)) {
$notify = array();
}
## if this is for a newly posted page, get its information
if ($IsPagePosted) {
$page = ReadPage($pagename, READPAGE_CURRENT);
$FmtV['$PostTime'] = strftime($NotifyTimeFmt, $Now);
$item = urlencode(FmtPageName($NotifyItemFmt, $pagename));
if ($firstpost < 1) {
$firstpost = $Now;
}
}
foreach ($nlist as $n) {
$opt = ParseArgs($n);
$mailto = preg_split('/[\\s,]+/', $opt['notify']);
if (!$mailto) {
continue;
}
if ($opt['squelch']) {
foreach ($mailto as $m) {
$squelch[$m] = $opt['squelch'];
}
}
if (!$IsPagePosted) {
continue;
}
if ($opt['link']) {
$link = MakePageName($pagename, $opt['link']);
if (!preg_match("/(^|,){$link}(,|\$)/i", $page['targets'])) {
continue;
}
}
$pats = @(array) $SearchPatterns[$opt['list']];
if ($opt['group']) {
$pats[] = FixGlob($opt['group'], '$1$2.*');
}
if ($opt['name']) {
$pats[] = FixGlob($opt['name'], '$1*.$2');
}
if ($pats && !MatchPageNames($pagename, $pats)) {
continue;
}
if ($opt['trail']) {
$trail = ReadTrail($pagename, $opt['trail']);
for ($i = 0; $i < count($trail); $i++) {
if ($trail[$i]['pagename'] == $pagename) {
break;
}
}
if ($i >= count($trail)) {
continue;
}
}
foreach ($mailto as $m) {
$notify[$m][] = $item;
}
}
$nnow = time();
if ($nnow < $firstpost + $NotifyDelay) {
$nextevent = $firstpost + $NotifyDelay;
} else {
$firstpost = 0;
$nextevent = $nnow + 86400;
$mailto = array_keys($notify);
$subject = FmtPageName($NotifySubjectFmt, $pagename);
$body = FmtPageName($NotifyBodyFmt, $pagename);
foreach ($mailto as $m) {
$msquelch = @$notify[$m]['lastmail'] + (@$squelch[$m] ? $squelch[$m] : $NotifySquelch);
if ($nnow < $msquelch) {
//.........这里部分代码省略.........
示例15: 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) {
//.........这里部分代码省略.........