本文整理汇总了PHP中FmtPageName函数的典型用法代码示例。如果您正苦于以下问题:PHP FmtPageName函数的具体用法?PHP FmtPageName怎么用?PHP FmtPageName使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FmtPageName函数的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: HandleCrypt
function HandleCrypt($pagename, $auth='read') {
global $ScriptUrl,$HTMLStartFmt,$HTMLEndFmt;
PrintFmt($pagename,$HTMLStartFmt);
$passwd = stripmagic(@$_POST["passwd"]);
echo FmtPageName(
"<form action='{\$ScriptUrl}' method='POST'><p>
Enter password to encrypt:
<input type='text' name='passwd' value='"
. PHSC($passwd, ENT_QUOTES) ."' />
<input type='submit' />
<input type='hidden' name='n' value='{\$FullName}' />
<input type='hidden' name='action' value='crypt' /></p></form>",
$pagename);
if ($passwd) {
$crypt = pmcrypt($passwd);
echo "<p class='vspace'>Encrypted password = $crypt</p>";
echo "<p class='vspace'>To set a site-wide password, insert the line below
in your <i>config.php</i> file, <br />replacing <tt>'type'</tt> with
one of <tt>'admin'</tt>, <tt>'read'</tt>, <tt>'edit'</tt>,
or <tt>'attr'</tt>. <br />See <a
href='$ScriptUrl?n=PmWiki.PasswordsAdmin'>PasswordsAdmin</a> for more
details.</p>
<pre class='vspace'> \$DefaultPasswords['type']='$crypt';</pre>";
}
PrintFmt($pagename,$HTMLEndFmt);
}
示例3: 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);
}
示例4: HandleApprove
function HandleApprove($pagename)
{
global $ApproveUrlPattern, $WhiteUrlPatterns, $ApprovedUrlPagesFmt, $action;
Lock(2);
$page = ReadPage($pagename);
$text = preg_replace('/[()]/', '', $page['text']);
preg_match_all("/{$ApproveUrlPattern}/", $text, $match);
ReadApprovedUrls($pagename);
$addpat = array();
foreach ($match[0] as $a) {
foreach ((array) $WhiteUrlPatterns as $pat) {
if (preg_match("!^{$pat}(/|\$)!", $a)) {
continue 2;
}
}
if ($action == 'approvesites') {
$a = preg_replace("!^([^:]+://[^/]+).*\$!", '$1', $a);
}
$addpat[] = $a;
}
if (count($addpat) > 0) {
$aname = FmtPageName($ApprovedUrlPagesFmt[0], $pagename);
$apage = ReadPage($aname, '');
$new = $apage;
if (substr($new['text'], -1, 1) != "\n") {
$new['text'] .= "\n";
}
foreach ($addpat as $pat) {
$new['text'] .= " {$pat}\n";
}
$_REQUEST['post'] = 'y';
PostPage($aname, $apage, $new);
}
Redirect($pagename);
}
示例5: LoadPageTemplate
function LoadPageTemplate($pagename, $tfilefmt)
{
global $PageStartFmt, $PageEndFmt, $BasicLayoutVars, $HTMLHeaderFmt;
SDV($BasicLayoutVars, array('HeaderText', 'PageHeaderFmt', 'PageLeftFmt', 'PageTitleFmt', 'PageText', 'PageRightFmt', 'PageFooterFmt'));
$k = implode('', file(FmtPageName($tfilefmt, $pagename)));
$sect = preg_split('#[[<]!--(/?Page[A-Za-z]+Fmt|PageText|HeaderText)--[]>]#', $k, 0, PREG_SPLIT_DELIM_CAPTURE);
$PageStartFmt = array_merge(array('headers:'), preg_split('/[[<]!--((?:wiki|file|function|markup):.*?)--[]>]/s', array_shift($sect), 0, PREG_SPLIT_DELIM_CAPTURE));
$PageEndFmt = array();
$ps = 'PageStartFmt';
while (count($sect) > 0) {
$k = array_shift($sect);
$v = preg_split('/[[<]!--((?:wiki|file|function|markup):.*?)--[]>]/', array_shift($sect), 0, PREG_SPLIT_DELIM_CAPTURE);
if (substr($k, 0, 1) == '/') {
$GLOBALS[$ps][] = "<!--{$k}-->";
$GLOBALS[$ps][] = count($v) > 1 ? $v : $v[0];
continue;
}
$GLOBALS[$k] = count($v) > 1 ? $v : $v[0];
if (in_array($k, $BasicLayoutVars)) {
$GLOBALS[$ps][] = "<!--{$k}-->";
if ($k == 'PageText') {
$ps = 'PageEndFmt';
}
if ($k == 'HeaderText') {
$GLOBALS[$ps][] =& $HTMLHeaderFmt;
}
$GLOBALS[$ps][] =& $GLOBALS[$k];
}
}
array_push($PageStartFmt, "\n<div id='wikitext'>\n");
array_unshift($PageEndFmt, '</div>');
}
示例6: FPLByGroup
function FPLByGroup($pagename, &$matches, $opt)
{
global $FPLByGroupStartFmt, $FPLByGroupEndFmt, $FPLByGroupGFmt, $FPLByGroupIFmt, $FPLByGroupOpt;
SDV($FPLByGroupStartFmt, "<dl class='fplbygroup'>");
SDV($FPLByGroupEndFmt, '</dl>');
SDV($FPLByGroupGFmt, "<dt><a href='\$ScriptUrl/\$Group'>\$Group</a> /</dt>\n");
SDV($FPLByGroupIFmt, "<dd><a href='\$PageUrl'>\$Name</a></dd>\n");
SDVA($FPLByGroupOpt, array('readf' => 0, 'order' => 'name'));
$matches = MakePageList($pagename, array_merge((array) $FPLByGroupOpt, $opt), 0);
if (@$opt['count']) {
array_splice($matches, $opt['count']);
}
if (count($matches) < 1) {
return '';
}
$out = '';
foreach ($matches as $pn) {
$pgroup = FmtPageName($FPLByGroupGFmt, $pn);
if ($pgroup != @$lgroup) {
$out .= $pgroup;
$lgroup = $pgroup;
}
$out .= FmtPageName($FPLByGroupIFmt, $pn);
}
return FmtPageName($FPLByGroupStartFmt, $pagename) . $out . FmtPageName($FPLByGroupEndFmt, $pagename);
}
示例7: 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>";
}
示例8: AuthUserId
function AuthUserId($pagename, $id, $pw = NULL)
{
global $AuthUser, $AuthUserPageFmt, $AuthUserFunctions, $AuthId, $AuthList, $MessagesFmt;
$auth = $AuthUser;
$authid = '';
# load information from Site.AuthUser (or page in $AuthUserPageFmt)
SDV($AuthUserPageFmt, '$SiteGroup.AuthUser');
SDVA($AuthUserFunctions, array('htpasswd' => 'AuthUserHtPasswd', 'ldap' => 'AuthUserLDAP', $id => 'AuthUserConfig'));
$pn = FmtPageName($AuthUserPageFmt, $pagename);
$apage = ReadPage($pn, READPAGE_CURRENT);
if ($apage && preg_match_all("/\n\\s*([@\\w][^\\s:]*):(.*)/", $apage['text'], $matches, PREG_SET_ORDER)) {
foreach ($matches as $m) {
if (!preg_match_all('/\\bldap:\\S+|[^\\s,]+/', $m[2], $v)) {
continue;
}
if ($m[1][0] == '@') {
foreach ($v[0] as $g) {
$auth[$g][] = $m[1];
}
} else {
$auth[$m[1]] = array_merge((array) @$auth[$m[1]], $v[0]);
}
}
}
if (is_null($pw)) {
$authid = $id;
} else {
foreach ($AuthUserFunctions as $k => $fn) {
if ($auth[$k] && $fn($pagename, $id, $pw, $auth[$k])) {
$authid = $id;
break;
}
}
}
if (!$authid) {
$GLOBALS['InvalidLogin'] = 1;
return;
}
if (!isset($AuthId)) {
$AuthId = $authid;
}
@session_start();
$_SESSION['authid'] = $authid;
$_SESSION['authlist']["id:{$authid}"] = 1;
$_SESSION['authlist']["id:-{$authid}"] = -1;
$_SESSION['authlist']["id:*"] = 1;
foreach ((array) @$auth[$authid] as $g) {
if ($g[0] == '@') {
@($_SESSION['authlist'][$g] = 1);
}
}
foreach ((array) @$auth['*'] as $g) {
if ($g[0] == '@') {
@($_SESSION['authlist'][$g] = 1);
}
}
$AuthList = array_merge($AuthList, $_SESSION['authlist']);
}
示例9: HTTPBasicAuth
function HTTPBasicAuth($pagename, $level, $authprompt = true)
{
global $AuthRealmFmt, $AuthDeniedFmt, $DefaultPasswords, $AllowPassword, $GroupAttributesFmt;
SDV($GroupAttributesFmt, '$Group/GroupAttributes');
SDV($AllowPassword, 'nopass');
SDV($AuthRealmFmt, $GLOBALS['WikiTitle']);
SDV($AuthDeniedFmt, 'A valid password is required to access this feature.');
$page = ReadPage($pagename);
if (!$page) {
return false;
}
$passwd = @$page["passwd{$level}"];
if ($passwd == "") {
$grouppg = ReadPage(FmtPageName($GroupAttributesFmt, $pagename));
$passwd = @$grouppg["passwd{$level}"];
if ($passwd == '') {
$passwd = @$DefaultPasswords[$level];
}
if ($passwd == '') {
$passwd = @$page["passwdread"];
}
if ($passwd == '') {
$passwd = @$grouppg["passwdread"];
}
if ($passwd == '') {
$passwd = @$DefaultPasswords['read'];
}
}
if ($passwd == '') {
return $page;
}
if (crypt($AllowPassword, $passwd) == $passwd) {
return $page;
}
@session_start();
if (@$_SERVER['PHP_AUTH_PW']) {
@$_SESSION['authpw'][$_SERVER['PHP_AUTH_PW']]++;
}
$authpw = array_keys((array) @$_SESSION['authpw']);
foreach (array_merge((array) $DefaultPasswords['admin'], (array) $passwd) as $pwchal) {
foreach ($authpw as $pwresp) {
if (@crypt($pwresp, $pwchal) == $pwchal) {
return $page;
}
}
}
if (!$authprompt) {
return false;
}
$realm = FmtPageName($AuthRealmFmt, $pagename);
header("WWW-Authenticate: Basic realm=\"{$realm}\"");
header("Status: 401 Unauthorized");
header("HTTP-Status: 401 Unauthorized");
PrintFmt($pagename, $AuthDeniedFmt);
exit;
}
示例10: AuthUserId
function AuthUserId($pagename, $id, $pw=NULL) {
global $AuthUser, $AuthUserPageFmt, $AuthUserFunctions,
$AuthId, $MessagesFmt, $AuthUserPat;
$auth = array();
foreach((array)$AuthUser as $k=>$v) $auth[$k] = (array)$v;
$authid = '';
# load information from SiteAdmin.AuthUser (or page in $AuthUserPageFmt)
SDV($AuthUserPageFmt, '$SiteAdminGroup.AuthUser');
SDVA($AuthUserFunctions, array(
'htpasswd' => 'AuthUserHtPasswd',
'ldap' => 'AuthUserLDAP',
# 'mysql' => 'AuthUserMySQL',
$id => 'AuthUserConfig'));
SDV($AuthUserPat, "/^\\s*([@\\w][^\\s:]*):(.*)/m");
$pn = FmtPageName($AuthUserPageFmt, $pagename);
$apage = ReadPage($pn, READPAGE_CURRENT);
if ($apage && preg_match_all($AuthUserPat,
$apage['text'], $matches, PREG_SET_ORDER)) {
foreach($matches as $m) {
if (!preg_match_all('/\\bldaps?:\\S+|[^\\s,]+/', $m[2], $v))
continue;
if ($m[1]{0} == '@')
foreach($v[0] as $g) $auth[$g][] = $m[1];
else $auth[$m[1]] = array_merge((array)@$auth[$m[1]], $v[0]);
}
}
if (func_num_args()==2) $authid = $id;
else
foreach($AuthUserFunctions as $k => $fn)
if (@$auth[$k] && $fn($pagename, $id, $pw, $auth[$k], $authlist))
{ $authid = $id; break; }
if (!$authid) { $GLOBALS['InvalidLogin'] = 1; return; }
if (!isset($AuthId)) $AuthId = $authid;
$authlist["id:$authid"] = 1;
$authlist["id:-$authid"] = -1;
foreach(preg_grep('/^@/', (array)@$auth[$authid]) as $g)
$authlist[$g] = 1;
foreach(preg_grep('/^@/', (array)@$auth['*']) as $g)
$authlist[$g] = 1;
foreach(preg_grep('/^@/', array_keys($auth)) as $g) # useless? PITS:01201
if (in_array($authid, $auth[$g])) $authlist[$g] = 1;
if ($auth['htgroup']) {
foreach(AuthUserHtGroup($pagename, $id, $pw, $auth['htgroup']) as $g)
$authlist["@$g"] = 1;
}
foreach(preg_grep('/^@/', (array)@$auth["-$authid"]) as $g)
unset($authlist[$g]);
SessionAuth($pagename, array('authid' => $authid, 'authlist' => $authlist));
}
示例11: HTTPBasicAuthPrompt
function HTTPBasicAuthPrompt($pagename)
{
global $AuthRealmFmt, $AuthDeniedFmt;
SDV($AuthRealmFmt, $GLOBALS['WikiTitle']);
SDV($AuthDeniedFmt, 'A valid password is required to access this feature.');
$realm = FmtPageName($AuthRealmFmt, $pagename);
header("WWW-Authenticate: Basic realm=\"{$realm}\"");
header("Status: 401 Unauthorized");
header("HTTP-Status: 401 Unauthorized");
PrintFmt($pagename, $AuthDeniedFmt);
exit;
}
示例12: VarIndexList
function VarIndexList($pagename) {
global $VarIndex;
if (!isset($VarIndex)) VarIndexLoad($pagename);
ksort($VarIndex);
$out = "<table><tr><th>Variable</th><th>Documented in</th></tr>\n";
foreach($VarIndex as $v=>$a)
$out .= FmtPageName("<tr><td><a class='varlink'
href='{$a['url']}'><code>$$v</code></a></td><td><a
href='{\$PageUrl}'>{\$Name}</a></td></tr>\n",$a['pagename']);
$out .= "</table>";
return $out;
}
示例13: MailPosts
function MailPosts($pagename, &$page, &$new)
{
global $IsPagePosted, $MailPostsFile, $MailPostsTimeFmt, $Now, $MailPostsItemFmt, $PostTime;
if (!$IsPagePosted) {
return;
}
$fp = @fopen($MailPostsFile, "a");
if ($fp) {
$PostTime = strftime($MailPostsTimeFmt, $Now);
fputs($fp, urlencode(FmtPageName("{$Now} {$MailPostsItemFmt}", $pagename)) . "\n");
fclose($fp);
}
}
示例14: VarIndexList
function VarIndexList()
{
global $VarIndex;
if (!isset($VarIndex)) {
VarIndexLoad();
}
ksort($VarIndex);
$out = "<table><tr><th>Variable</th><th>Documented in</th></tr>\n";
foreach ($VarIndex as $v => $a) {
$out .= FmtPageName("<tr><td><a class='varlink' \n href='{$a['url']}'><code>${$v}</code></a></td><td><a \n href='\$PageUrl'>\$Name</a></td></tr>\n", $a['pagename']);
}
$out .= "</table>";
return $out;
}
示例15: 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);
}