本文整理汇总了PHP中PageExists函数的典型用法代码示例。如果您正苦于以下问题:PHP PageExists函数的具体用法?PHP PageExists怎么用?PHP PageExists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PageExists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MakeUTF8PageName
function MakeUTF8PageName($basepage, $x)
{
global $PagePathFmt;
$PageNameChars = '-\\w\\x80-\\xff';
if (!preg_match('/(?:([^.\\/]+)[.\\/])?([^.\\/]+)$/', $x, $m)) {
return '';
}
$name = preg_replace("/[^{$PageNameChars}]+/", ' ', $m[2]);
$name = preg_replace('/(?<=^| )(.)/eu', "mb_strtoupper('\$1','UTF-8')", $name);
$name = str_replace(' ', '', $name);
if ($m[1]) {
$group = preg_replace("/[^{$PageNameChars}]+/", ' ', $m[1]);
$group = preg_replace('/(?<=^| )(.)/eu', "mb_strtoupper('\$1','UTF-8')", $group);
$group = str_replace(' ', '', $group);
return "{$group}.{$name}";
}
foreach ((array) $PagePathFmt as $pg) {
$pn = FmtPageName(str_replace('$1', $name, $pg), $basepage);
if (PageExists($pn)) {
return $pn;
}
}
$group = preg_replace('/[\\/.].*$/', '', $basepage);
return "{$group}.{$name}";
}
示例2: MergeSimulEdits
function MergeSimulEdits($pagename,&$page,&$new) {
global $Now, $EnablePost, $MessagesFmt, $WorkDir;
if (@!$_POST['basetime'] || !PageExists($pagename)
|| $page['time'] >= $Now
|| $_POST['basetime']>=$page['time']
|| $page['text'] == $new['text']) return;
$EnablePost = 0;
$old = array();
RestorePage($pagename,$page,$old,"diff:{$_POST['basetime']}");
$text = Merge($new['text'],$old['text'],$page['text']);
if ($text > '') { $new['text'] = $text; $ec = '$[EditConflict]'; }
else $ec = '$[EditWarning]';
XLSDV('en', array(
'EditConflict' => "The page you are
editing has been modified since you started editing it.
The modifications have been merged into the text below,
you may want to verify the results of the merge before
pressing save. Conflicts the system couldn't resolve are
bracketed by <<<<<<< and
>>>>>>>.",
'EditWarning' => "The page you are editing has been modified
since you started editing it. If you continue, your
changes will overwrite any changes that others have made."));
$MessagesFmt[] = "<p class='editconflict'>$ec
(<a target='_blank' href='\$PageUrl?action=diff'>$[View changes]</a>)
</p>\n";
}
示例3: EditDraft
function EditDraft(&$pagename, &$page, &$new)
{
global $WikiDir, $DraftSuffix, $DeleteKeyPattern, $EnableDraftAtomicDiff, $DraftRecentChangesFmt, $RecentChangesFmt, $Now;
SDV($DeleteKeyPattern, "^\\s*delete\\s*\$");
$basename = preg_replace("/{$DraftSuffix}\$/", '', $pagename);
$draftname = $basename . $DraftSuffix;
if ($_POST['postdraft'] || $_POST['postedit']) {
$pagename = $draftname;
} else {
if ($_POST['post'] && !preg_match("/{$DeleteKeyPattern}/", $new['text'])) {
$pagename = $basename;
if (IsEnabled($EnableDraftAtomicDiff, 0)) {
$page = ReadPage($basename);
foreach ($new as $k => $v) {
# delete draft history
if (preg_match('/:\\d+(:\\d+:)?$/', $k) && !preg_match("/:{$Now}(:\\d+:)?\$/", $k)) {
unset($new[$k]);
}
}
unset($new['rev']);
SDVA($new, $page);
}
$WikiDir->delete($draftname);
} else {
if (PageExists($draftname) && $pagename != $draftname) {
Redirect($draftname, '$PageUrl?action=edit');
exit;
}
}
}
if ($pagename == $draftname && isset($DraftRecentChangesFmt)) {
$RecentChangesFmt = $DraftRecentChangesFmt;
}
}
示例4: RetrievePageMarkup
function RetrievePageMarkup($pagelist)
{
foreach ($pagelist as $p) {
if (PageExists($p)) {
$page = RetrieveAuthPage($p, 'read', false, READPAGE_CURRENT);
return array($page['text'], $page['title']);
break;
}
}
return null;
}
示例5: MergeSimulEdits
function MergeSimulEdits($pagename, &$page, &$new)
{
global $MessagesFmt, $WorkDir, $SysMergeCmd;
SDV($SysMergeCmd, "/usr/bin/diff3 -L '' -L '' -L '' -m -E");
if (@(!$_POST['basetime']) || !PageExists($pagename) || $_POST['basetime'] >= $page['time']) {
return;
}
unset($_POST['post']);
$MessagesFmt[] = "<p class='editconflict'>The page you are \n editing has been modified since you started editing it. \n The modifications have been merged into the text below,\n you may want to verify the results of the merge before\n pressing save. Conflicts the system couldn't resolve are\n bracketed by <<<<<<< and \n >>>>>>>. (<a target='_blank' \n href='\$PageUrl?action=diff'>View changes</a>)</p>\n";
$old = array();
RestorePage($pagename, $page, $old, "diff:{$_POST['basetime']}");
$new['text'] = Merge($new['text'], $old['text'], $page['text']);
}
示例6: EditDraft
function EditDraft(&$pagename, &$page, &$new) {
global $WikiDir, $DraftSuffix, $DeleteKeyPattern,
$DraftRecentChangesFmt, $RecentChangesFmt;
SDV($DeleteKeyPattern, "^\\s*delete\\s*$");
$basename = preg_replace("/$DraftSuffix\$/", '', $pagename);
$draftname = $basename . $DraftSuffix;
if ($_POST['postdraft'] || $_POST['postedit']) $pagename = $draftname;
else if ($_POST['post'] && !preg_match("/$DeleteKeyPattern/", $new['text'])) {
$pagename = $basename;
# $page = ReadPage($basename); # breaks restores, PITS:01007, Test:DraftRestore
$WikiDir->delete($draftname);
}
else if (PageExists($draftname) && $pagename != $draftname)
{ Redirect($draftname, '$PageUrl?action=edit'); exit(); }
if ($pagename == $draftname && isset($DraftRecentChangesFmt))
$RecentChangesFmt = $DraftRecentChangesFmt;
}
示例7: EditDraft
function EditDraft(&$pagename, &$page, &$new)
{
global $WikiDir, $DraftSuffix, $DeleteKeyPattern;
SDV($DeleteKeyPattern, "^\\s*delete\\s*\$");
$basename = preg_replace("/{$DraftSuffix}\$/", '', $pagename);
$draftname = $basename . $DraftSuffix;
if ($_POST['postdraft']) {
$pagename = $draftname;
return;
}
if ($_POST['post'] && !preg_match("/{$DeleteKeyPattern}/", $new['text'])) {
$pagename = $basename;
$page = ReadPage($basename);
$WikiDir->delete($draftname);
return;
}
if (PageExists($draftname) && $pagename != $draftname) {
Redirect($draftname, '$PageUrl?action=edit');
exit;
}
}
示例8: WikiGallerySlideshow
function WikiGallerySlideshow($pagename, $auth = 'read')
{
global $WikiGallery_DefaultSlideshowDelay, $HTMLHeaderFmt, $WikiGallery_Register;
// get delay from url
if (isset($_GET["delay"])) {
$delay = intval($_GET["delay"]);
} else {
$delay = $WikiGallery_DefaultSlideshowDelay;
}
// find following picture
$group = PageVar($pagename, '$Group');
$next = $WikiGallery_Register[$group]->neighbourPicturePage(PageVar($pagename, '$Name'), 1);
$nextpage = "{$group}.{$next}";
// exists?
if ($next && PageExists($nextpage)) {
// add refresh header
$url = MakeLink($nextpage, $nextpage, NULL, NULL, "\$LinkUrl");
array_unshift($HTMLHeaderFmt, "<meta http-equiv=\"refresh\" content=\"{$delay}; URL={$url}?action=slideshow&delay={$delay}\" />");
}
return HandleBrowse($pagename, $auth);
}
示例9: EditDraft
function EditDraft(&$pagename, &$page, &$new)
{
global $WikiDir, $DraftSuffix, $DeleteKeyPattern, $DraftRecentChangesFmt, $RecentChangesFmt;
SDV($DeleteKeyPattern, "^\\s*delete\\s*\$");
$basename = preg_replace("/{$DraftSuffix}\$/", '', $pagename);
$draftname = $basename . $DraftSuffix;
if ($_POST['postdraft'] || $_POST['postedit']) {
$pagename = $draftname;
} else {
if ($_POST['post'] && !preg_match("/{$DeleteKeyPattern}/", $new['text'])) {
$pagename = $basename;
$page = ReadPage($basename);
$WikiDir->delete($draftname);
} else {
if (PageExists($draftname) && $pagename != $draftname) {
Redirect($draftname, '$PageUrl?action=edit');
exit;
}
}
}
if ($pagename == $draftname && isset($DraftRecentChangesFmt)) {
$RecentChangesFmt = $DraftRecentChangesFmt;
}
}
示例10: PrintRefCount
function PrintRefCount($pagename)
{
global $GroupPattern, $NamePattern, $PageRefCountFmt, $RefCountTimeFmt;
$pagelist = ListPages();
$grouplist = array();
foreach ($pagelist as $pname) {
if (!preg_match("/^({$GroupPattern})[\\/.]({$NamePattern})\$/", $pname, $m)) {
continue;
}
$grouplist[$m[1]] = $m[1];
}
asort($grouplist);
$grouplist = array_merge(array('all' => 'all groups'), $grouplist);
$wlist = array('all', 'missing', 'existing', 'orphaned');
$tlist = isset($_REQUEST['tlist']) ? $_REQUEST['tlist'] : array('all');
$flist = isset($_REQUEST['flist']) ? $_REQUEST['flist'] : array('all');
$whichrefs = @$_REQUEST['whichrefs'];
$showrefs = @$_REQUEST['showrefs'];
$submit = @$_REQUEST['submit'];
echo FmtPageName($PageRefCountFmt, $pagename);
echo "<form method='post'><input type='hidden' action='refcount'>\n <table cellspacing='10'><tr><td valign='top'>Show\n <br><select name='whichrefs'>";
foreach ($wlist as $w) {
echo "<option ", $whichrefs == $w ? 'selected' : '', " value='{$w}'>{$w}\n";
}
echo "</select></td><td valign='top'> page names in group<br>\n <select name='tlist[]' multiple size='4'>";
foreach ($grouplist as $g => $t) {
echo "<option ", in_array($g, $tlist) ? 'selected' : '', " value='{$g}'>{$t}\n";
}
echo "</select></td><td valign='top'> referenced from pages in<br>\n <select name='flist[]' multiple size='4'>";
foreach ($grouplist as $g => $t) {
echo "<option ", in_array($g, $flist) ? 'selected' : '', " value='{$g}'>{$t}\n";
}
echo "</select></td></tr></table>\n <p><input type='checkbox' name='showrefs' value='checked' {$showrefs}>\n Display referencing pages\n <p><input type='submit' name='submit' value='Search'></form><p><hr>";
if ($submit) {
foreach ($pagelist as $pname) {
$ref = array();
$page = ReadPage($pname, READPAGE_CURRENT);
if (!$page) {
continue;
}
$tref[$pname]['time'] = $page['time'];
if (!in_array('all', $flist) && !in_array(FmtPageName('$Group', $pname), $flist)) {
continue;
}
$rc = preg_match('/RecentChanges$/', $pname);
foreach (explode(',', @$page['targets']) as $r) {
if ($r == '') {
continue;
}
if ($rc) {
@$tref[$r]['rc']++;
} else {
@$tref[$r]['page']++;
@$pref[$r][$pname]++;
}
}
}
uasort($tref, 'RefCountCmp');
echo "<table >\n <tr><th></th><th colspan='2'>Referring pages</th></tr>\n <tr><th>Name / Time</th><th>All</th><th>R.C.</th></tr>";
reset($tref);
foreach ($tref as $p => $c) {
if (!in_array('all', $tlist) && !in_array(FmtPageName('$Group', $p), $tlist)) {
continue;
}
if ($whichrefs == 'missing' && PageExists($p)) {
continue;
} elseif ($whichrefs == 'existing' && !PageExists($p)) {
continue;
} elseif ($whichrefs == 'orphaned' && (@$tref[$p]['page'] > 0 || !PageExists($p))) {
continue;
}
echo "<tr><td valign='top'>", LinkPage($pagename, '', $p, '', $p);
if (@$tref[$p]['time']) {
echo strftime($RefCountTimeFmt, $tref[$p]['time']);
}
if ($showrefs && is_array(@$pref[$p])) {
foreach ($pref[$p] as $pr => $pc) {
echo "<dd>", LinkPage($pagename, '', $pr, '', $pr);
}
}
echo "</td>";
echo "<td align='center' valign='top'>", @$tref[$p]['page'] + 0, "</td>";
echo "<td align='center' valign='top'>", @$tref[$p]['rc'] + 0, "</td>";
echo "</tr>";
}
echo "</table>";
}
}
示例11: bi_IsPage
function bi_IsPage($pn)
{
global $bi_Pagename;
$mp = MakePageName($bi_Pagename, $pn);
if (empty($mp)) {
return true;
}
if ($mp == $bi_Pagename) {
return false;
}
return PageExists($mp);
}
示例12: 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, $ttext);
$item = preg_replace('/\\{(=|&[lg]t;)(\\$:?\\w+)\\}/e', "PageVar(\$pn, '\$2', '\$1')", $item);
$out .= $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>';
}
示例13: HandleBrowse
function HandleBrowse($pagename)
{
# handle display of a page
global $DefaultPageTextFmt, $FmtV, $HandleBrowseFmt, $PageStartFmt, $PageEndFmt, $PageRedirectFmt;
Lock(1);
$page = RetrieveAuthPage($pagename, 'read');
if (!$page) {
Abort('?cannot read $pagename');
}
PCache($pagename, $page);
SDV($PageRedirectFmt, "<p><i>(\$[redirected from] \n <a href='\$PageUrl?action=edit'>\$FullName</a>)</i></p>\$HTMLVSpace\n");
if (isset($page['text'])) {
$text = $page['text'];
} else {
$text = FmtPageName($DefaultPageTextFmt, $pagename);
}
if (@(!$_GET['from'])) {
$PageRedirectFmt = '';
if (preg_match('/\\(:redirect\\s+(.+?):\\)/', $text, $match)) {
$rname = MakePageName($pagename, $match[1]);
if (PageExists($rname)) {
Redirect($rname, "\$PageUrl?from={$pagename}");
}
}
} else {
$PageRedirectFmt = FmtPageName($PageRedirectFmt, $_GET['from']);
}
$text = '(:groupheader:)' . @$text . '(:groupfooter:)';
$FmtV['$PageText'] = MarkupToHTML($pagename, $text);
SDV($HandleBrowseFmt, array(&$PageStartFmt, &$PageRedirectFmt, '$PageText', &$PageEndFmt));
PrintFmt($pagename, $HandleBrowseFmt);
}
示例14: HandleFeed
function HandleFeed($pagename, $auth = 'read')
{
global $FeedFmt, $action, $PCache, $FmtV, $ISOTimeFmt, $RSSTimeFmt, $FeedOpt, $FeedDescPatterns, $CategoryGroup, $EntitiesTable;
SDV($ISOTimeFmt, '%Y-%m-%dT%H:%M:%SZ');
SDV($RSSTimeFmt, 'D, d M Y H:i:s \\G\\M\\T');
SDV($FeedDescPatterns, array('/<[^>]*$/' => ' ', '/\\w+$/' => '', '/<[^>]+>/' => ''));
SDVA($FeedCategoryOpt, array('link' => $pagename, 'readf' => 1));
SDVA($FeedTrailOpt, array('trail' => $pagename, 'count' => 10, 'readf' => 1));
$f = $FeedFmt[$action];
$page = RetrieveAuthPage($pagename, $auth, true, READPAGE_CURRENT);
if (!$page) {
Abort("?cannot generate feed");
}
$feedtime = $page['time'];
# determine list of pages to display
if (@($_REQUEST['trail'] || $_REQUEST['group'] || $_REQUEST['link'])) {
$opt['readf'] = 1;
} else {
if ($action == 'dc') {
$opt = array();
} else {
if (preg_match("/^{$CategoryGroup}\\./", $pagename)) {
$opt = $FeedCategoryOpt;
} else {
$opt = $FeedTrailOpt;
}
}
}
if (!$opt) {
PCache($pagename, $page);
$pagelist = array(&$PCache[$pagename]);
} else {
$opt = array_merge($opt, @$_REQUEST);
$pagelist = MakePageList($pagename, $opt);
}
# process list of pages in feed
$rdfseq = '';
foreach ($pagelist as $page) {
$pn = $page['name'];
if (!PageExists($pn)) {
continue;
}
$pl[] = $pn;
if (@$opt['count'] && count($pl) >= $opt['count']) {
break;
}
$rdfseq .= FmtPageName("<rdf:li resource=\"\$PageUrl\" />\n", $pn);
if ($page['time'] > $feedtime) {
$feedtime = $page['time'];
}
}
$pagelist = $pl;
$FmtV['$FeedRDFSeq'] = $rdfseq;
$FmtV['$FeedISOTime'] = gmstrftime($ISOTimeFmt, $feedtime);
$FmtV['$FeedRSSTime'] = gmdate($RSSTimeFmt, $feedtime);
# format start of feed
$out = FmtPageName($f['feed']['_start'], $pagename);
# format feed elements
foreach ($f['feed'] as $k => $v) {
if ($k[0] == '_' || !$v) {
continue;
}
$x = FmtPageName($v, $pagename);
if (!$x) {
continue;
}
$out .= $v[0] == '<' ? $x : "<{$k}>{$x}</{$k}>\n";
}
# format items in feed
if (@$f['feed']['_items']) {
$out .= FmtPageName($f['feed']['_items'], $pagename);
}
foreach ($pagelist as $pn) {
$page =& $PCache[$pn];
$FmtV['$ItemDesc'] = @$page['description'] ? $page['description'] : trim(preg_replace(array_keys($FeedDescPatterns), array_values($FeedDescPatterns), @$page['excerpt']));
$FmtV['$ItemISOTime'] = gmstrftime($ISOTimeFmt, $page['time']);
$out .= FmtPageName($f['item']['_start'], $pn);
foreach ((array) @$f['item'] as $k => $v) {
if ($k[0] == '_' || !$v) {
continue;
}
if (is_callable($v)) {
$out .= $v($pn, $page, $k);
continue;
}
if (strpos($v, '$LastModifiedBy') !== false && !@$page['author']) {
continue;
}
if (strpos($v, '$Category') !== false) {
if (preg_match_all("/(?<=^|,){$CategoryGroup}\\.([^,]+)/", @$page['targets'], $match)) {
foreach ($match[1] as $c) {
$FmtV['$Category'] = $c;
$out .= FmtPageName($v, $pn);
}
}
continue;
}
$x = FmtPageName($v, $pn);
if (!$x) {
continue;
//.........这里部分代码省略.........
示例15: AutoCreateTargets
function AutoCreateTargets($pagename, &$page, &$new) {
global $IsPagePosted, $AutoCreate, $LinkTargets;
if (!$IsPagePosted) return;
foreach((array)@$AutoCreate as $pat => $init) {
if (is_null($init)) continue;
foreach(preg_grep($pat, array_keys((array)@$LinkTargets)) as $aname) {
if (PageExists($aname)) continue;
$x = RetrieveAuthPage($aname, 'edit', false, READPAGE_CURRENT);
if (!$x) continue;
WritePage($aname, $init);
}
}
}