本文整理汇总了PHP中FixGlob函数的典型用法代码示例。如果您正苦于以下问题:PHP FixGlob函数的具体用法?PHP FixGlob怎么用?PHP FixGlob使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FixGlob函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RedirectMarkup
function RedirectMarkup($pagename, $opt) {
$k = Keep("(:redirect $opt:)");
global $MarkupFrame;
if (!@$MarkupFrame[0]['redirect']) return $k;
$opt = ParseArgs($opt);
$to = @$opt['to']; if (!$to) $to = @$opt[''][0];
if (!$to) return $k;
if (preg_match('/^([^#]+)(#[A-Za-z][-\\w]*)$/', $to, $match))
{ $to = $match[1]; $anchor = $match[2]; }
$to = MakePageName($pagename, $to);
if (!PageExists($to)) return $k;
if ($to == $pagename) return '';
if (@$opt['from']
&& !MatchPageNames($pagename, FixGlob($opt['from'], '$1*.$2')))
return '';
if (preg_match('/^30[1237]$/', @$opt['status']))
header("HTTP/1.1 {$opt['status']}");
Redirect($to, "{\$PageUrl}?from=$pagename$anchor");
exit();
}
示例2: 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) {
//.........这里部分代码省略.........
示例3: PageListSources
function PageListSources(&$list, &$opt, $pn, &$page) {
global $SearchPatterns;
StopWatch('PageListSources begin');
## add the list= option to our list of pagename filter patterns
$opt['=pnfilter'] = array_merge((array)@$opt['=pnfilter'],
(array)@$SearchPatterns[$opt['list']]);
if (@$opt['group']) $opt['=pnfilter'][] = FixGlob($opt['group'], '$1$2.*');
if (@$opt['name']) $opt['=pnfilter'][] = FixGlob($opt['name'], '$1*.$2');
if (@$opt['trail']) {
$trail = ReadTrail($pn, $opt['trail']);
$tlist = array();
foreach($trail as $tstop) {
$n = $tstop['pagename'];
$tlist[] = $n;
$tstop['parentnames'] = array();
PCache($n, $tstop);
}
foreach($trail as $tstop)
$PCache[$tstop['pagename']]['parentnames'][] =
@$trail[$tstop['parent']]['pagename'];
if (!@$opt['=cached']) $list = MatchPageNames($tlist, $opt['=pnfilter']);
} else if (!@$opt['=cached']) $list = ListPages($opt['=pnfilter']);
StopWatch("PageListSources end count=".count($list));
return 0;
}
示例4: MakePageList
function MakePageList($pagename, $opt, $retpages = 1)
{
global $MakePageListOpt, $SearchPatterns, $EnablePageListProtect, $PCache, $FmtV;
StopWatch('MakePageList begin');
SDVA($MakePageListOpt, array('list' => 'default'));
$opt = array_merge((array) $MakePageListOpt, $opt);
$readf = @$opt['readf'];
# we have to read the page if order= is anything but name
$order = @$opt['order'];
$readf |= $order && $order != 'name' && $order != '-name';
$pats = @(array) $SearchPatterns[$opt['list']];
if (@$opt['group']) {
$pats[] = FixGlob($opt['group'], '$1$2.*');
}
if (@$opt['name']) {
$pats[] = FixGlob($opt['name'], '$1*.$2');
}
# inclp/exclp contain words to be included/excluded.
$incl = array();
$inclp = array();
$inclx = false;
$excl = array();
$exclp = '';
foreach ((array) @$opt[''] as $i) {
$incl[] = $i;
}
foreach ((array) @$opt['+'] as $i) {
$incl[] = $i;
}
foreach ((array) @$opt['-'] as $i) {
$excl[] = $i;
}
foreach ($incl as $i) {
$inclp[] = '$' . preg_quote($i) . '$i';
$inclx |= preg_match('[^\\w\\x80-\\xff]', $i);
}
if ($excl) {
$exclp = '$' . implode('|', array_map('preg_quote', $excl)) . '$i';
}
$searchterms = count($incl) + count($excl);
$readf += $searchterms;
# forced read if incl/excl
if (@$opt['trail']) {
$trail = ReadTrail($pagename, $opt['trail']);
$list = array();
foreach ($trail as $tstop) {
$pn = $tstop['pagename'];
$list[] = $pn;
$tstop['parentnames'] = array();
PCache($pn, $tstop);
}
foreach ($trail as $tstop) {
$PCache[$tstop['pagename']]['parentnames'][] = @$trail[$tstop['parent']]['pagename'];
}
} else {
$list = ListPages($pats);
}
if (IsEnabled($EnablePageListProtect, 1)) {
$readf = 1000;
}
$matches = array();
$FmtV['$MatchSearched'] = count($list);
$terms = $incl ? PageIndexTerms($incl) : array();
if (@$opt['link']) {
$link = MakePageName($pagename, $opt['link']);
$linkp = "/(^|,){$link}(,|\$)/i";
$terms[] = " {$link} ";
$readf++;
}
if ($terms) {
$xlist = PageIndexGrep($terms, true);
$a = count($list);
$list = array_diff($list, $xlist);
$a -= count($list);
StopWatch("MakePageList: PageIndex filtered {$a} pages");
}
$xlist = array();
StopWatch('MakePageList scanning ' . count($list) . " pages, readf={$readf}");
foreach ((array) $list as $pn) {
if ($readf) {
$page = $readf >= 1000 ? RetrieveAuthPage($pn, 'read', false, READPAGE_CURRENT) : ReadPage($pn, READPAGE_CURRENT);
if (!$page) {
continue;
}
if (@$linkp && !preg_match($linkp, @$page['targets'])) {
$xlist[] = $pn;
continue;
}
if ($searchterms) {
$text = $pn . "\n" . @$page['targets'] . "\n" . @$page['text'];
if ($exclp && preg_match($exclp, $text)) {
continue;
}
foreach ($inclp as $i) {
if (!preg_match($i, $text)) {
if (!$inclx) {
$xlist[] = $pn;
}
continue 2;
}
//.........这里部分代码省略.........
示例5: MakePageList
function MakePageList($pagename, $opt, $retpages = 1)
{
global $MakePageListOpt, $SearchPatterns, $EnablePageListProtect, $PCache, $FmtV;
StopWatch('MakePageList begin');
SDVA($MakePageListOpt, array('list' => 'default'));
$opt = array_merge((array) $MakePageListOpt, $opt);
$readf = @$opt['readf'];
# we have to read the page if order= is anything but name
$order = @$opt['order'];
$readf |= $order && $order != 'name' && $order != '-name';
$pats = @(array) $SearchPatterns[$opt['list']];
if (@$opt['group']) {
$pats[] = FixGlob($opt['group'], '$1$2.*');
}
if (@$opt['name']) {
$pats[] = FixGlob($opt['name'], '$1*.$2');
}
# inclp/exclp contain words to be included/excluded.
$inclp = array();
$exclp = array();
foreach ((array) @$opt[''] as $i) {
$inclp[] = '/' . preg_quote($i, '/') . '/i';
}
foreach ((array) @$opt['+'] as $i) {
$inclp[] = '/' . preg_quote($i, '/') . '/i';
}
foreach ((array) @$opt['-'] as $i) {
$exclp[] = '/' . preg_quote($i, '/') . '/i';
}
$searchterms = count($inclp) + count($exclp);
$readf += $searchterms;
# forced read if incl/excl
if (@$opt['trail']) {
$trail = ReadTrail($pagename, $opt['trail']);
$list = array();
foreach ($trail as $tstop) {
$pn = $tstop['pagename'];
$list[] = $pn;
$tstop['parentnames'] = array();
PCache($pn, $tstop);
}
foreach ($trail as $tstop) {
$PCache[$tstop['pagename']]['parentnames'][] = @$trail[$tstop['parent']]['pagename'];
}
} else {
$list = ListPages($pats);
}
if (IsEnabled($EnablePageListProtect, 1)) {
$readf = 1000;
}
$matches = array();
$FmtV['$MatchSearched'] = count($list);
# link= (backlinks)
if (@$opt['link']) {
$link = MakePageName($pagename, $opt['link']);
$linkpat = "/(^|,){$link}(,|\$)/i";
$readf++;
$xlist = BacklinksTo($link, false);
$list = array_diff((array) $list, $xlist);
}
$xlist = array();
StopWatch('MakePageList scan');
foreach ((array) $list as $pn) {
if ($readf) {
$page = $readf >= 1000 ? RetrieveAuthPage($pn, 'read', false, READPAGE_CURRENT) : ReadPage($pn, READPAGE_CURRENT);
if (!$page) {
continue;
}
if (@$linkpat && !preg_match($linkpat, @$page['targets'])) {
$PCache[$pn]['targets'] = @$page['targets'];
$xlist[] = $pn;
continue;
}
if ($searchterms) {
$text = $pn . "\n" . @$page['targets'] . "\n" . @$page['text'];
foreach ($inclp as $i) {
if (!preg_match($i, $text)) {
continue 2;
}
}
foreach ($exclp as $i) {
if (preg_match($i, $text)) {
continue 2;
}
}
}
$page['size'] = strlen(@$page['text']);
} else {
$page = array();
}
$page['pagename'] = $page['name'] = $pn;
PCache($pn, $page);
$matches[] = $pn;
}
StopWatch('MakePageList sort');
if ($order) {
SortPageList($matches, $order);
}
StopWatch('MakePageList update');
if ($xlist) {
//.........这里部分代码省略.........
示例6: PageListSources
function PageListSources(&$list, &$opt, $pagename, &$page)
{
global $SearchPatterns;
StopWatch('PageListSources begin');
## add the list= option to our list of pagename filter patterns
$opt['=pnfilter'] = array_merge(@$opt['=pnfilter'], $SearchPatterns[$opt['list']]);
if (@$opt['group']) {
$opt['=pnfilter'][] = FixGlob($opt['group'], '$1$2.*');
}
if (@$opt['name']) {
$opt['=pnfilter'][] = FixGlob($opt['group'], '$1$2.*');
}
if (@$opt['trail']) {
$trail = ReadTrail($pagename, $opt['trail']);
$list = array();
foreach ($trail as $tstop) {
$pn = $tstop['pagename'];
$list[] = $pn;
$tstop['parentnames'] = array();
PCache($pn, $tstop);
}
foreach ($trail as $tstop) {
$PCache[$tstop['pagename']]['parentnames'][] = @$trail[$tstop['parent']]['pagename'];
}
} else {
$list = ListPages($opt['=pnfilter']);
}
StopWatch('PageListSources end');
return 0;
}
示例7: MxMakePList
function MxMakePList($pagename, $args, $opt = '')
{
if ($args[0] == '' && $opt == '') {
return $pagename;
}
StopWatch('plist start');
$grp = PageVar($pagename, '$Group');
$exlist = array();
$inlist = array();
$plist = array();
if (isset($opt['groups'])) {
$grps = explode(",", $opt['groups']);
foreach ($grps as $g) {
$args[] = "{$g}.*";
}
$opt['fmt'] = 'groups';
}
if (isset($opt['group'])) {
$gp = explode(",", $opt['group']);
foreach ($gp as $g) {
$args[] = "{$g}.*";
}
}
if (isset($opt['name'])) {
$ns = explode(",", $opt['name']);
foreach ($ns as $n) {
$args[] = "*.{$n}";
}
}
foreach ($args as $src) {
$pgs = preg_split("/[\\s,|]+/", $src, -1, PREG_SPLIT_NO_EMPTY);
$plist = array_merge($plist, $pgs);
}
foreach ((array) $plist as $pn) {
//check for exclusions
if ($pn[0] == '-') {
$pn = substr($pn, 1);
//check for group.name pattern
if (strstr($pn, '.')) {
$pgpat = $pn;
} else {
$pgpat = $grp . "." . $pn;
}
//make preg pattern from wildcard pattern
$prpat = GlobToPCRE(FixGlob($pgpat));
//make list from preg name pattern
$exlist = array_merge($exlist, ListPages("/{$prpat['0']}/"));
} elseif (strstr($pn, '#')) {
$inlist[] = $pn;
} else {
//check for group.name pattern
if (strstr($pn, '.')) {
$pgpat = $pn;
} else {
$pgpat = $grp . "." . $pn;
}
//make preg pattern from wildcard pattern
$prpat = GlobToPCRE(FixGlob($pgpat));
//make list from preg name pattern
$inlist = array_merge($inlist, ListPages("/{$prpat['0']}/"));
}
}
$plist = array_diff($inlist, $exlist);
sort($plist);
if ($opt['fmt'] == 'groups') {
$glist = array();
foreach ($plist as $p) {
$pp = explode('.', $p);
if (in_array($pp[0], $glist)) {
continue;
}
$glist[] = $pp[0];
}
$plist = $glist;
}
$sep = @$opt['sep'] ? $opt['sep'] : ",";
$sep = str_replace('\\n', "\n", $sep);
if ($sep == 'LF') {
$sep = "\n";
}
foreach ($plist as $i => $p) {
$plist[$i] = @$opt['pre'] . $p . @$opt['suf'];
}
StopWatch('plist end');
return implode($sep, $plist);
}