当前位置: 首页>>代码示例>>PHP>>正文


PHP MatchPageNames函数代码示例

本文整理汇总了PHP中MatchPageNames函数的典型用法代码示例。如果您正苦于以下问题:PHP MatchPageNames函数的具体用法?PHP MatchPageNames怎么用?PHP MatchPageNames使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了MatchPageNames函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ls

 function ls($pats=NULL) {
   global $GroupPattern, $NamePattern;
   StopWatch("PageStore::ls begin {$this->dir}");
   $pats=(array)$pats; 
   array_push($pats, "/^$GroupPattern\.$NamePattern$/");
   $dir = $this->pagefile('$Group.$Name');
   $dirlist = array(preg_replace('!/*[^/]*\\$.*$!','',$dir));
   $out = array();
   while (count($dirlist)>0) {
     $dir = array_shift($dirlist);
     $dfp = @opendir($dir); if (!$dfp) { continue; }
     $o = array();
     while ( ($pagefile = readdir($dfp)) !== false) {
       if ($pagefile{0} == '.') continue;
       if (is_dir("$dir/$pagefile"))
         { array_push($dirlist,"$dir/$pagefile"); continue; }
       $o[] = $pagefile;
     }
     closedir($dfp);
     StopWatch("PageStore::ls merge {$this->dir}");
     $out = array_merge($out, MatchPageNames($o, $pats));
   }
   StopWatch("PageStore::ls end {$this->dir}");
   return $out;
 }
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:25,代码来源:pmwiki.php

示例2: 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;
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:29,代码来源:pagelist.php

示例3: 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) {
//.........这里部分代码省略.........
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:101,代码来源:notify.php

示例4: ls

 function ls($pats = NULL)
 {
     global $UploadDir, $UploadPrefixFmt;
     global $GroupPattern, $NamePattern;
     global $ThumbShoeThumbPrefix, $ThumbShoePageSep;
     StopWatch("ThumbShoePageStore::ls begin {$this->galleryGroup}");
     $pats = (array) $pats;
     $topdir = PageVar($this->galleryGroup . '.' . $this->galleryGroup, '$TSAttachTopDir');
     StopWatch("ThumbShoePageStore::ls topdir={$topdir}");
     $out = array();
     $o = array();
     $dfp = @opendir($topdir);
     if ($dfp) {
         while (($file = readdir($dfp)) !== false) {
             if ($file[0] == '.') {
                 continue;
             }
             if (is_dir("{$topdir}/{$file}")) {
                 $sub_dfp = @opendir("{$topdir}/{$file}");
                 while (($subfile = readdir($sub_dfp)) !== false) {
                     if ($subfile[0] == '.') {
                         continue;
                     }
                     if (is_dir("{$topdir}/{$file}/{$subfile}")) {
                         continue;
                     }
                     if (!preg_match("/{$this->ImgRx}\$/", $subfile)) {
                         continue;
                     }
                     if (preg_match("/^{$ThumbShoeThumbPrefix}/", $subfile)) {
                         continue;
                     }
                     $pn = str_replace('.', '_', $subfile);
                     $pn = "{$file}{$ThumbShoePageSep}" . $pn;
                     $pn = MakePageName($this->galleryGroup . '.' . $this->galleryGroup, $pn);
                     $o[] = $pn;
                     StopWatch("ThumbShoePageStore::ls pn={$pn}");
                 }
                 closedir($sub_dfp);
             } else {
                 if (!preg_match("/{$this->ImgRx}\$/", $file)) {
                     continue;
                 }
                 if (preg_match("/^{$ThumbShoeThumbPrefix}/", $file)) {
                     continue;
                 }
                 $pn = str_replace('.', '_', $file);
                 $pn = MakePageName($this->galleryGroup . '.' . $this->galleryGroup, $pn);
                 $o[] = $pn;
                 StopWatch("ThumbShoePageStore::ls pn={$pn}");
             }
         }
         closedir($dfp);
     }
     StopWatch("ThumbShoePageStore::ls merge {$this->galleryGroup}");
     $out = array_merge($out, MatchPageNames($o, $pats));
     StopWatch("ThumbShoePageStore::ls end {$this->galleryGroup}");
     return $out;
 }
开发者ID:rubykat,项目名称:pmwiki-thumbshoe,代码行数:59,代码来源:pagestore.php

示例5: bi_Convert

function bi_Convert($src, $auth = 'admin', $dataset, $pagelist, $mode)
{
    global $bi_ConvertRules, $bi_TagSeparator, $_GET, $SearchPatterns;
    $datarules = $bi_ConvertRules[$dataset];
    $pagelist = MatchPageNames($pagelist, $SearchPatterns['default']);
    foreach ($pagelist as $i => $pn) {
        list($group, $name) = explode('.', $pn);
        #$name used to derive title.
        $pagetext = '';
        $org = RetrieveAuthPage($pn, $auth, 0, READPAGE_CURRENT);
        echo "<b>{$pn}</b><br/>";
        if (!$org) {
            echo 'No admin privs on page.<br/>';
            continue;
        }
        $entryType = PageTextVar($pn, 'entrytype');
        if ($mode == 'convert' && empty($entryType) || $mode == 'upgrade' && $entryType == 'blog') {
            #populate $new_field_val array for each $new_field_name based on $new_field_rules
            foreach ($datarules['new'] as $new_field_name => $new_field_rules) {
                $new_field_val[$new_field_name] = '';
                #is the new field based on an old_field or was the field defined in the prior version, with the same name?
                if (isset($datarules['old'][$new_field_name])) {
                    $new_field_val[$new_field_name] = PageTextVar($pn, $new_field_name);
                    # Get basic separated list with no formatting
                    if ($datarules['old'][$old_field]['format']) {
                        $new_field_val[$new_field_name] = implode($bi_TagSeparator, preg_match_all('/' . $datarules['old'][$old_field]['format'] . '/', $new_field_val[$new_field_name], $m) ? $m[1] : array());
                    }
                }
                # Set default value if none calculated so far
                if (empty($new_field_val[$new_field_name]) && isset($datarules['new'][$new_field_name]['default'])) {
                    $new_field_val[$new_field_name] = eval('return (' . $datarules['new'][$new_field_name]['default'] . ');');
                }
                # Format the field
                if (isset($datarules['new'][$new_field_name]['format'])) {
                    $new_field_val[$new_field_name] = str_replace('$1', $new_field_val[$new_field_name], $datarules['new'][$new_field_name]['format']);
                } else {
                    $new_field_val[$new_field_name] = '(:' . $new_field_name . ':' . $new_field_val[$new_field_name] . ':)';
                }
                $pagetext .= $new_field_val[$new_field_name] . "\n";
            }
        } elseif ($mode == 'revert' && $entryType == 'blog') {
            $pagetext = PageTextVar($pn, 'entrybody') . "\n\n" . PageTextVar($pn, 'pmmarkup');
        } else {
            echo 'Nothing to ' . $mode . '<br/>';
        }
        if ($_GET['writetofile'] == 'true') {
            if (!empty($pagetext)) {
                $new = $org;
                $new['csum'] = $new['csum:' . $GLOBALS['Now']] = $GLOBALS['ChangeSummary'] = 'BlogIt Format: ' . $mode;
                $new['diffclass'] = 'minor';
                $new['text'] = $pagetext;
                PostPage($pn, $org, $new);
                #Don't need UpdatePage, as we don't require edit functions to run
                echo 'BlogIt page attributes written.<br/>';
            } else {
                echo 'Nothing to write.<br/>';
            }
        }
        echo str_replace("\n", '<br/>', $pagetext . '<br/>');
    }
}
开发者ID:Nepherim,项目名称:BlogIt,代码行数:61,代码来源:blogit_upgrade.php

示例6: ls

 function ls($pats = NULL)
 {
     global $GroupPattern, $NamePattern;
     $pats = (array) $pats;
     array_push($pats, "/^{$GroupPattern}\\.{$NamePattern}\$/");
     $out = array();
     // only one directory, no subdirs
     $dir = $this->dirfmt;
     $dfp = @opendir($dir);
     if (!$dfp) {
         continue;
     }
     $o = array();
     while (($pagefile = readdir($dfp)) !== false) {
         if ($pagefile[0] == '.') {
             continue;
         }
         if (is_dir("{$dir}/{$pagefile}")) {
             continue;
         } else {
             $o[] = $this->cddbGroup . '.' . $this->filepage($pagefile);
         }
     }
     closedir($dfp);
     $out = array_merge($out, MatchPageNames($o, $pats));
     return $out;
 }
开发者ID:rubykat,项目名称:pmwiki-cddb,代码行数:27,代码来源:cddb.php


注:本文中的MatchPageNames函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。