本文整理汇总了PHP中wfUrlEncode函数 的典型用法代码示例。如果您正苦于以下问题:PHP wfUrlEncode函数的具体用法?PHP wfUrlEncode怎么用?PHP wfUrlEncode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfUrlEncode函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: efContributorsNavigation
/**
* Prepare the toolbox link
*
* @var $skintemplate SkinTemplate
*/
function efContributorsNavigation(&$skintemplate, &$nav_urls, &$oldid, &$revid)
{
if ($skintemplate->getTitle()->getNamespace() === NS_MAIN && $revid !== 0) {
$nav_urls['contributors'] = array('text' => wfMsg('contributors-toolbox'), 'href' => $skintemplate->makeSpecialUrl('Contributors', "target=" . wfUrlEncode("{$skintemplate->thispage}")));
}
return true;
}
开发者ID:realsoc, 项目名称:mediawiki-extensions, 代码行数:12, 代码来源:Contributors.php
示例2: efDuplicatorNavigation
/**
* Build the link to be shown in the toolbox if appropriate
* @param $skin Skin
*/
function efDuplicatorNavigation(&$skin, &$nav_urls, &$oldid, &$revid)
{
global $wgUser;
$ns = $skin->getTitle()->getNamespace();
if (($ns === NS_MAIN || $ns === NS_TALK) && $wgUser->isAllowed('duplicate')) {
$nav_urls['duplicator'] = array('text' => wfMsg('duplicator-toolbox'), 'href' => $skin->makeSpecialUrl('Duplicator', "source=" . wfUrlEncode("{$skin->thispage}")));
}
return true;
}
开发者ID:realsoc, 项目名称:mediawiki-extensions, 代码行数:13, 代码来源:Duplicator.php
示例3: showChunk
/**
* @param integer $namespace (Default NS_MAIN)
* @param string $from list all pages from this name (default FALSE)
*/
function showChunk($namespace = NS_MAIN, $prefix, $including = false, $from = null)
{
global $wgOut, $wgUser, $wgContLang;
$fname = 'indexShowChunk';
$sk = $wgUser->getSkin();
if (!isset($from)) {
$from = $prefix;
}
$fromList = $this->getNamespaceKeyAndText($namespace, $from);
$prefixList = $this->getNamespaceKeyAndText($namespace, $prefix);
$namespaces = $wgContLang->getNamespaces();
$align = $wgContLang->isRtl() ? 'left' : 'right';
if (!$prefixList || !$fromList) {
$out = wfMsgWikiHtml('allpagesbadtitle');
} elseif (!in_array($namespace, array_keys($namespaces))) {
// Show errormessage and reset to NS_MAIN
$out = wfMsgExt('allpages-bad-ns', array('parseinline'), $namespace);
$namespace = NS_MAIN;
} else {
list($namespace, $prefixKey, $prefix) = $prefixList;
list(, $fromKey, $from) = $fromList;
### FIXME: should complain if $fromNs != $namespace
$dbr = wfGetDB(DB_SLAVE);
$res = $dbr->select('page', array('page_namespace', 'page_title', 'page_is_redirect'), array('page_namespace' => $namespace, 'page_title LIKE \'' . $dbr->escapeLike($prefixKey) . '%\'', 'page_title >= ' . $dbr->addQuotes($fromKey)), $fname, array('ORDER BY' => 'page_title', 'LIMIT' => $this->maxPerPage + 1, 'USE INDEX' => 'name_title'));
### FIXME: side link to previous
$n = 0;
$out = '<table style="background: inherit;" border="0" width="100%">';
while ($n < $this->maxPerPage && ($s = $dbr->fetchObject($res))) {
$t = Title::makeTitle($s->page_namespace, $s->page_title);
if ($t) {
$link = ($s->page_is_redirect ? '<div class="allpagesredirect">' : '') . $sk->makeKnownLinkObj($t, htmlspecialchars($t->getText()), false, false) . ($s->page_is_redirect ? '</div>' : '');
} else {
$link = '[[' . htmlspecialchars($s->page_title) . ']]';
}
if ($n % 3 == 0) {
$out .= '<tr>';
}
$out .= "<td>{$link}</td>";
$n++;
if ($n % 3 == 0) {
$out .= '</tr>';
}
}
if ($n % 3 != 0) {
$out .= '</tr>';
}
$out .= '</table>';
}
if ($including) {
$out2 = '';
} else {
$nsForm = $this->namespaceForm($namespace, $prefix);
$out2 = '<table style="background: inherit;" width="100%" cellpadding="0" cellspacing="0" border="0">';
$out2 .= '<tr valign="top"><td>' . $nsForm;
$out2 .= '</td><td align="' . $align . '" style="font-size: smaller; margin-bottom: 1em;">' . $sk->makeKnownLink($wgContLang->specialPage($this->name), wfMsg('allpages'));
if (isset($dbr) && $dbr && $n == $this->maxPerPage && ($s = $dbr->fetchObject($res))) {
$namespaceparam = $namespace ? "&namespace={$namespace}" : "";
$out2 .= " | " . $sk->makeKnownLink($wgContLang->specialPage($this->name), wfMsg('nextpage', $s->page_title), "from=" . wfUrlEncode($s->page_title) . "&prefix=" . wfUrlEncode($prefix) . $namespaceparam);
}
$out2 .= "</td></tr></table><hr />";
}
$wgOut->addHtml($out2 . $out);
}
开发者ID:Jobava, 项目名称:diacritice-meta-repo, 代码行数:67, 代码来源:SpecialPrefixindex.php
示例4: wfSpecialContributions
/**
* Special page "user contributions".
* Shows a list of the contributions of a user.
*
* @return none
* @param string $par (optional) user name of the user for which to show the contributions
*/
function wfSpecialContributions($par = null)
{
global $wgUser, $wgOut, $wgLang, $wgContLang, $wgRequest, $wgTitle, $wgScript;
$fname = 'wfSpecialContributions';
$target = isset($par) ? $par : $wgRequest->getVal('target');
if (!strlen($target)) {
$wgOut->errorpage('notargettitle', 'notargettext');
return;
}
$nt = Title::newFromURL($target);
if (!$nt) {
$wgOut->errorpage('notargettitle', 'notargettext');
return;
}
$nt =& Title::makeTitle(NS_USER, $nt->getDBkey());
list($limit, $offset) = wfCheckLimits();
$offset = $wgRequest->getVal('offset');
/* Offset must be an integral. */
if (!strlen($offset) || !preg_match("/^[0-9]+\$/", $offset)) {
$offset = 0;
}
$title = Title::makeTitle(NS_SPECIAL, "Contributions");
$urlbits = "target=" . wfUrlEncode($target);
$myurl = $title->escapeLocalURL($urlbits);
$finder = new contribs_finder($target == 'newbies' ? 'newbies' : $nt->getText());
$finder->set_limit($limit);
$finder->set_offset($offset);
$nsurl = $xnsurl = "";
if (($ns = $wgRequest->getVal('namespace', null)) !== null) {
$nsurl = "&namespace={$ns}";
$xnsurl = htmlspecialchars($nsurl);
$finder->set_namespace($ns);
}
if ($wgRequest->getText('go') == "prev") {
$prevts = $finder->get_previous_offset_for_paging();
$prevurl = $title->getLocalURL($urlbits . "&offset={$prevts}&limit={$limit}{$nsurl}");
$wgOut->redirect($prevurl);
return;
}
if ($wgRequest->getText('go') == "first") {
$prevts = $finder->get_first_offset_for_paging();
$prevurl = $title->getLocalURL($urlbits . "&offset={$prevts}&limit={$limit}{$nsurl}");
$wgOut->redirect($prevurl);
return;
}
$sk = $wgUser->getSkin();
$id = User::idFromName($nt->getText());
if (0 == $id) {
$ul = $nt->getText();
} else {
$ul = $sk->makeLinkObj($nt, htmlspecialchars($nt->getText()));
$userCond = '=' . $id;
}
$talk = $nt->getTalkPage();
if ($talk) {
$ul .= ' (' . $sk->makeLinkObj($talk, $wgLang->getNsText(NS_TALK)) . ')';
}
if ($target == 'newbies') {
$ul = wfMsg('newbies');
}
$wgOut->setSubtitle(wfMsgHtml('contribsub', $ul));
wfRunHooks('SpecialContributionsBeforeMainOutput', $id);
$arr = $wgContLang->getFormattedNamespaces();
$nsform = "<form method='get' action=\"{$wgScript}\">\n";
$nsform .= wfElement("input", array("name" => "title", "type" => "hidden", "value" => $wgTitle->getPrefixedText()));
$nsform .= wfElement("input", array("name" => "offset", "type" => "hidden", "value" => $offset));
$nsform .= wfElement("input", array("name" => "limit", "type" => "hidden", "value" => $limit));
$nsform .= wfElement("input", array("name" => "target", "type" => "hidden", "value" => $target));
$nsform .= "<p>";
$nsform .= wfMsgHtml('namespace');
$nsform .= HTMLnamespaceselector($ns, '');
$nsform .= wfElement("input", array("type" => "submit", "value" => wfMsg('allpagessubmit')));
$nsform .= "</p></form>\n";
$wgOut->addHTML($nsform);
$contribsPage = Title::makeTitle(NS_SPECIAL, 'Contributions');
$contribs = $finder->find();
if (count($contribs) == 0) {
$wgOut->addWikiText(wfMsg("nocontribs"));
return;
}
list($early, $late) = $finder->get_edit_limits();
$lastts = count($contribs) ? $contribs[count($contribs) - 1]->rev_timestamp : 0;
$atstart = !count($contribs) || $late == $contribs[0]->rev_timestamp;
$atend = !count($contribs) || $early == $lastts;
$lasturl = $wgTitle->escapeLocalURL("action=history&limit={$limit}");
$firsttext = wfMsgHtml("histfirst");
$lasttext = wfMsgHtml("histlast");
$prevtext = wfMsg("prevn", $limit);
if ($atstart) {
$lastlink = $lasttext;
$prevlink = $prevtext;
} else {
$lastlink = "<a href=\"{$myurl}&limit={$limit}{$xnsurl}\">{$lasttext}</a>";
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios, 项目名称:openzaurus-svn, 代码行数:101, 代码来源:SpecialContributions.php
示例5: wfSajaxSearch
function wfSajaxSearch($term)
{
global $wgContLang, $wgUser, $wgRequest, $wgAjaxCachePolicy;
$limit = 16;
$l = new Linker();
$term = str_replace(' ', '_', $wgContLang->ucfirst($wgContLang->checkTitleEncoding($wgContLang->recodeInput(js_unescape($term)))));
if (strlen(str_replace('_', '', $term)) < 3) {
return;
}
$wgAjaxCachePolicy->setPolicy(30 * 60);
$db =& wfGetDB(DB_SLAVE);
$res = $db->select('page', 'page_title', array('page_namespace' => 0, "page_title LIKE '" . $db->strencode($term) . "%'"), "wfSajaxSearch", array('LIMIT' => $limit + 1));
$r = "";
$i = 0;
while (($row = $db->fetchObject($res)) && ++$i <= $limit) {
$nt = Title::newFromDBkey($row->page_title);
$r .= '<li>' . $l->makeKnownLinkObj($nt) . "</li>\n";
}
if ($i > $limit) {
$more = '<i>' . $l->makeKnownLink($wgContLang->specialPage("Allpages"), wfMsg('moredotdotdot'), "namespace=0&from=" . wfUrlEncode($term)) . '</i>';
} else {
$more = '';
}
$term = htmlspecialchars($term);
return '<div style="float:right; border:solid 1px black;background:gainsboro;padding:2px;"><a onclick="Searching_Hide_Results();">' . wfMsg('hideresults') . '</a></div>' . '<h1 class="firstHeading">' . wfMsg('search') . '</h1><div id="contentSub">' . wfMsg('searchquery', $term) . '</div><ul><li>' . $l->makeKnownLink($wgContLang->specialPage('Search'), wfMsg('searchcontaining', $term), "search={$term}&fulltext=Search") . '</li><li>' . $l->makeKnownLink($wgContLang->specialPage('Search'), wfMsg('searchnamed', $term), "search={$term}&go=Go") . "</li></ul><h2>" . wfMsg('articletitles', $term) . "</h2>" . '<ul>' . $r . '</ul>' . $more;
}
开发者ID:BackupTheBerlios, 项目名称:blahtex, 代码行数:26, 代码来源:AjaxFunctions.php
示例6: execute
//.........这里部分代码省略.........
if ($wgLuceneSearchVersion >= 2) {
$searchq = $this->replacePrefixes($q);
if ($wgRequest->getText('fulltext') == wfMsg('searchexactcase')) {
$case = 'exact';
}
} else {
$searchq = $q;
}
global $wgDisableTextSearch;
if (!$wgDisableTextSearch) {
$results = LuceneSearchSet::newFromQuery('search', $searchq, $this->namespaces, $limit, $offset, $case);
}
if ($wgDisableTextSearch || $results === false) {
if ($wgDisableTextSearch) {
$wgOut->addHTML(wfMsg('searchdisabled'));
} else {
$wgOut->addWikiText(wfMsg('lucenefallback'));
}
$wgOut->addHTML(wfMsg('googlesearch', htmlspecialchars($q), 'utf-8', htmlspecialchars(wfMsg('search'))));
wfProfileOut($fname);
return;
}
$subtitleMsg = is_object(Title::newFromText($q)) ? 'searchsubtitle' : 'searchsubtitleinvalid';
$wgOut->setSubtitle($wgOut->parse(wfMsg($subtitleMsg, wfEscapeWikiText($q))));
// If the search returned no results, an alternate fuzzy search
// match may be displayed as a suggested search. Link it.
if ($results->hasSuggestion()) {
$suggestion = $results->getSuggestion();
$o = ' ' . wfMsg('searchdidyoumean', $this->makeLink($suggestion, $offset, $limit, $case), htmlspecialchars($suggestion));
$wgOut->addHTML('<div style="text-align: center;">' . $o . '</div>');
}
$nmtext = '';
if ($offset == 0 && !$wgLuceneDisableTitleMatches) {
$titles = LuceneSearchSet::newFromQuery('titlematch', $q, $this->namespaces, 5, $case);
if ($titles && $titles->hasResults()) {
$nmtext = '<p>' . wfMsg('searchnearmatches') . '</p>';
$nmtext .= '<ul>';
$nmtext .= implode("\n", $titles->iterateResults(array(&$this, 'formatNearMatch')));
$nmtext .= '</ul>';
$nmtext .= '<hr />';
}
}
$wgOut->addHTML($nmtext);
if (!$results->hasResults()) {
# Pass search terms back in a few different formats
# $1: Plain search terms
# $2: Search terms with s/ /_/
# $3: URL-encoded search terms
$tmsg = array(htmlspecialchars($q), htmlspecialchars(str_replace(' ', '_', $q)), wfUrlEncode($q));
$wgOut->addHtml(wfMsgWikiHtml('searchnoresults', $tmsg[0], $tmsg[1], $tmsg[2]));
} else {
#$showresults = min($limit, count($results)-$numresults);
$i = $offset;
$resq = trim(preg_replace("/[ |\\[\\]()\"{}+]+/", " ", $q));
$contextWords = implode("|", array_map(array(&$this, 'regexQuote'), $wgContLang->convertForSearchResult(split(" ", $resq))));
$top = wfMsg('searchnumber', $offset + 1, min($results->getTotalHits(), $offset + $limit), $results->getTotalHits());
$out = '<ul id="lucene-results">';
$numchunks = ceil($results->getTotalHits() / $limit);
$whichchunk = $offset / $limit;
$prevnext = "";
if ($whichchunk > 0) {
$prevnext .= '<a href="' . $this->makelink($q, $offset - $limit, $limit, $case) . '">' . wfMsg('searchprev') . '</a> ';
}
$first = max($whichchunk - 11, 0);
$last = min($numchunks, $whichchunk + 11);
//$wgOut->addWikiText("whichchunk=$whichchunk numchunks=$numchunks first=$first last=$last num=".count($chunks)." limit=$limit offset=$offset results=".count($results)."\n\n");
if ($last - $first > 1) {
for ($i = $first; $i < $last; $i++) {
if ($i === $whichchunk) {
$prevnext .= '<strong>' . ($i + 1) . '</strong> ';
} else {
$prevnext .= '<a href="' . $this->makelink($q, $limit * $i, $limit, $case) . '">' . ($i + 1) . '</a> ';
}
}
}
if ($whichchunk < $last - 1) {
$prevnext .= '<a href="' . $this->makelink($q, $offset + $limit, $limit, $case) . '">' . wfMsg('searchnext') . '</a> ';
}
$prevnext = '<div style="text-align: center;">' . $prevnext . '</div>';
$top .= $prevnext;
$out .= implode("\n", $results->iterateResults(array(&$this, 'showHit'), $contextWords));
$out .= '</ul>';
}
#$wgOut->addHTML('<hr />');
if (isset($top)) {
$wgOut->addHTML($top);
}
if (isset($out)) {
$wgOut->addHTML($out);
}
#if( isset( $prevnext ) ) $wgOut->addHTML('<hr />' . $prevnext);
if (isset($prevnext)) {
$wgOut->addHTML($prevnext);
}
$wgOut->addHTML($this->showFullDialog($q));
}
$wgOut->setRobotpolicy('noindex,nofollow');
$wgOut->setArticleRelated(false);
wfProfileOut($fname);
}
开发者ID:ErdemA, 项目名称:wikihow, 代码行数:101, 代码来源:LuceneSearch_body.php
示例7: getVariableValue
/**
* Return value of a magic variable (like PAGENAME)
*
* @private
*/
function getVariableValue($index)
{
global $wgContLang, $wgSitename, $wgServer, $wgServerName, $wgScriptPath;
/**
* Some of these require message or data lookups and can be
* expensive to check many times.
*/
if (wfRunHooks('ParserGetVariableValueVarCache', array(&$this, &$this->mVarCache))) {
if (isset($this->mVarCache[$index])) {
return $this->mVarCache[$index];
}
}
$ts = wfTimestamp(TS_UNIX, $this->mOptions->getTimestamp());
wfRunHooks('ParserGetVariableValueTs', array(&$this, &$ts));
# Use the time zone
global $wgLocaltimezone;
if (isset($wgLocaltimezone)) {
$oldtz = getenv('TZ');
putenv('TZ=' . $wgLocaltimezone);
}
wfSuppressWarnings();
// E_STRICT system time bitching
$localTimestamp = date('YmdHis', $ts);
$localMonth = date('m', $ts);
$localMonthName = date('n', $ts);
$localDay = date('j', $ts);
$localDay2 = date('d', $ts);
$localDayOfWeek = date('w', $ts);
$localWeek = date('W', $ts);
$localYear = date('Y', $ts);
$localHour = date('H', $ts);
if (isset($wgLocaltimezone)) {
putenv('TZ=' . $oldtz);
}
wfRestoreWarnings();
switch ($index) {
case 'currentmonth':
return $this->mVarCache[$index] = $wgContLang->formatNum(gmdate('m', $ts));
case 'currentmonthname':
return $this->mVarCache[$index] = $wgContLang->getMonthName(gmdate('n', $ts));
case 'currentmonthnamegen':
return $this->mVarCache[$index] = $wgContLang->getMonthNameGen(gmdate('n', $ts));
case 'currentmonthabbrev':
return $this->mVarCache[$index] = $wgContLang->getMonthAbbreviation(gmdate('n', $ts));
case 'currentday':
return $this->mVarCache[$index] = $wgContLang->formatNum(gmdate('j', $ts));
case 'currentday2':
return $this->mVarCache[$index] = $wgContLang->formatNum(gmdate('d', $ts));
case 'localmonth':
return $this->mVarCache[$index] = $wgContLang->formatNum($localMonth);
case 'localmonthname':
return $this->mVarCache[$index] = $wgContLang->getMonthName($localMonthName);
case 'localmonthnamegen':
return $this->mVarCache[$index] = $wgContLang->getMonthNameGen($localMonthName);
case 'localmonthabbrev':
return $this->mVarCache[$index] = $wgContLang->getMonthAbbreviation($localMonthName);
case 'localday':
return $this->mVarCache[$index] = $wgContLang->formatNum($localDay);
case 'localday2':
return $this->mVarCache[$index] = $wgContLang->formatNum($localDay2);
case 'pagename':
return wfEscapeWikiText($this->mTitle->getText());
case 'pagenamee':
return $this->mTitle->getPartialURL();
case 'fullpagename':
return wfEscapeWikiText($this->mTitle->getPrefixedText());
case 'fullpagenamee':
return $this->mTitle->getPrefixedURL();
case 'subpagename':
return wfEscapeWikiText($this->mTitle->getSubpageText());
case 'subpagenamee':
return $this->mTitle->getSubpageUrlForm();
case 'basepagename':
return wfEscapeWikiText($this->mTitle->getBaseText());
case 'basepagenamee':
return wfUrlEncode(str_replace(' ', '_', $this->mTitle->getBaseText()));
case 'talkpagename':
if ($this->mTitle->canTalk()) {
$talkPage = $this->mTitle->getTalkPage();
return wfEscapeWikiText($talkPage->getPrefixedText());
} else {
return '';
}
case 'talkpagenamee':
if ($this->mTitle->canTalk()) {
$talkPage = $this->mTitle->getTalkPage();
return $talkPage->getPrefixedUrl();
} else {
return '';
}
case 'subjectpagename':
$subjPage = $this->mTitle->getSubjectPage();
return wfEscapeWikiText($subjPage->getPrefixedText());
case 'subjectpagenamee':
$subjPage = $this->mTitle->getSubjectPage();
//.........这里部分代码省略.........
开发者ID:josephdye, 项目名称:wikireader, 代码行数:101, 代码来源:Parser.php
示例8: getVariableValue
//.........这里部分代码省略.........
$value = $pageLang->getMonthNameGen($localMonthName);
break;
case 'localmonthabbrev':
$value = $pageLang->getMonthAbbreviation($localMonthName);
break;
case 'localday':
$value = $pageLang->formatNum($localDay);
break;
case 'localday2':
$value = $pageLang->formatNum($localDay2);
break;
case 'pagename':
$value = wfEscapeWikiText($this->mTitle->getText());
break;
case 'pagenamee':
$value = wfEscapeWikiText($this->mTitle->getPartialURL());
break;
case 'fullpagename':
$value = wfEscapeWikiText($this->mTitle->getPrefixedText());
break;
case 'fullpagenamee':
$value = wfEscapeWikiText($this->mTitle->getPrefixedURL());
break;
case 'subpagename':
$value = wfEscapeWikiText($this->mTitle->getSubpageText());
break;
case 'subpagenamee':
$value = wfEscapeWikiText($this->mTitle->getSubpageUrlForm());
break;
case 'basepagename':
$value = wfEscapeWikiText($this->mTitle->getBaseText());
break;
case 'basepagenamee':
$value = wfEscapeWikiText(wfUrlEncode(str_replace(' ', '_', $this->mTitle->getBaseText())));
break;
case 'talkpagename':
if ($this->mTitle->canTalk()) {
$talkPage = $this->mTitle->getTalkPage();
$value = wfEscapeWikiText($talkPage->getPrefixedText());
} else {
$value = '';
}
break;
case 'talkpagenamee':
if ($this->mTitle->canTalk()) {
$talkPage = $this->mTitle->getTalkPage();
$value = wfEscapeWikiText($talkPage->getPrefixedUrl());
} else {
$value = '';
}
break;
case 'subjectpagename':
$subjPage = $this->mTitle->getSubjectPage();
$value = wfEscapeWikiText($subjPage->getPrefixedText());
break;
case 'subjectpagenamee':
$subjPage = $this->mTitle->getSubjectPage();
$value = wfEscapeWikiText($subjPage->getPrefixedUrl());
break;
case 'revisionid':
# Let the edit saving system know we should parse the page
# *after* a revision ID has been assigned.
$this->mOutput->setFlag('vary-revision');
wfDebug(__METHOD__ . ": {{REVISIONID}} used, setting vary-revision...\n");
$value = $this->mRevisionId;
break;
开发者ID:laiello, 项目名称:media-wiki-law, 代码行数:67, 代码来源:Parser.php
示例9: basepagenamee
public static function basepagenamee($parser, $title = null)
{
$t = Title::newFromText($title);
if (is_null($t)) {
return '';
}
return wfEscapeWikiText(wfUrlEncode(str_replace(' ', '_', $t->getBaseText())));
}
开发者ID:D66Ha, 项目名称:mediawiki, 代码行数:8, 代码来源:CoreParserFunctions.php
示例10: getVariableValue
/**
* Return value of a magic variable (like PAGENAME)
*
* @private
*/
function getVariableValue($index)
{
global $wgContLang, $wgSitename, $wgServer, $wgServerName, $wgScriptPath;
/**
* Some of these require message or data lookups and can be
* expensive to check many times.
*/
static $varCache = array();
if (wfRunHooks('ParserGetVariableValueVarCache', array(&$this, &$varCache))) {
if (isset($varCache[$index])) {
return $varCache[$index];
}
}
$ts = time();
wfRunHooks('ParserGetVariableValueTs', array(&$this, &$ts));
# Use the time zone
global $wgLocaltimezone;
if (isset($wgLocaltimezone)) {
$oldtz = getenv('TZ');
putenv('TZ=' . $wgLocaltimezone);
}
$localTimestamp = date('YmdHis', $ts);
$localMonth = date('m', $ts);
$localMonthName = date('n', $ts);
$localDay = date('j', $ts);
$localDay2 = date('d', $ts);
$localDayOfWeek = date('w', $ts);
$localWeek = date('W', $ts);
$localYear = date('Y', $ts);
$localHour = date('H', $ts);
if (isset($wgLocaltimezone)) {
putenv('TZ=' . $oldtz);
}
switch ($index) {
case 'currentmonth':
return $varCache[$index] = $wgContLang->formatNum(date('m', $ts));
case 'currentmonthname':
return $varCache[$index] = $wgContLang->getMonthName(date('n', $ts));
case 'currentmonthnamegen':
return $varCache[$index] = $wgContLang->getMonthNameGen(date('n', $ts));
case 'currentmonthabbrev':
return $varCache[$index] = $wgContLang->getMonthAbbreviation(date('n', $ts));
case 'currentday':
return $varCache[$index] = $wgContLang->formatNum(date('j', $ts));
case 'currentday2':
return $varCache[$index] = $wgContLang->formatNum(date('d', $ts));
case 'localmonth':
return $varCache[$index] = $wgContLang->formatNum($localMonth);
case 'localmonthname':
return $varCache[$index] = $wgContLang->getMonthName($localMonthName);
case 'localmonthnamegen':
return $varCache[$index] = $wgContLang->getMonthNameGen($localMonthName);
case 'localmonthabbrev':
return $varCache[$index] = $wgContLang->getMonthAbbreviation($localMonthName);
case 'localday':
return $varCache[$index] = $wgContLang->formatNum($localDay);
case 'localday2':
return $varCache[$index] = $wgContLang->formatNum($localDay2);
case 'pagename':
return $this->mTitle->getText();
case 'pagenamee':
return $this->mTitle->getPartialURL();
case 'fullpagename':
return $this->mTitle->getPrefixedText();
case 'fullpagenamee':
return $this->mTitle->getPrefixedURL();
case 'subpagename':
return $this->mTitle->getSubpageText();
case 'subpagenamee':
return $this->mTitle->getSubpageUrlForm();
case 'basepagename':
return $this->mTitle->getBaseText();
case 'basepagenamee':
return wfUrlEncode(str_replace(' ', '_', $this->mTitle->getBaseText()));
case 'talkpagename':
if ($this->mTitle->canTalk()) {
$talkPage = $this->mTitle->getTalkPage();
return $talkPage->getPrefixedText();
} else {
return '';
}
case 'talkpagenamee':
if ($this->mTitle->canTalk()) {
$talkPage = $this->mTitle->getTalkPage();
return $talkPage->getPrefixedUrl();
} else {
return '';
}
case 'subjectpagename':
$subjPage = $this->mTitle->getSubjectPage();
return $subjPage->getPrefixedText();
case 'subjectpagenamee':
$subjPage = $this->mTitle->getSubjectPage();
return $subjPage->getPrefixedUrl();
case 'revisionid':
//.........这里部分代码省略.........
开发者ID:puring0815, 项目名称:OpenKore, 代码行数:101, 代码来源:Parser.php
示例11: showUserNetwork
private function showUserNetwork()
{
global $wgUser, $wgOut, $wgContLang;
$wgOut->setPageTitle(wfMsg('networkusercontent', $this->username, $this->otherUsername));
$wgOut->setRobotpolicy('noindex,nofollow');
$wgOut->setArticleRelated(false);
$sk = $wgUser->getSkin();
$wgOut->addHtml('<p> < ' . $sk->makeKnownLinkObj(Title::makeTitle(NS_SPECIAL, 'Network'), ' Show full network') . '</p>');
$title = null;
if ($this->from) {
$title = Title::newFromText($this->from);
}
// issue db query to get the family trees
$dbr =& wfGetDB(DB_SLAVE);
$sql = 'SELECT w1.wl_namespace AS namespace, w1.wl_title AS title FROM watchlist AS w1, watchlist AS w2, user WHERE user_name=' . $dbr->addQuotes($this->otherUsername) . ' AND w1.wl_user=' . $this->user->getID() . ' AND w2.wl_user=user_id AND w1.wl_namespace in (108,110) AND w1.wl_namespace=w2.wl_namespace AND w1.wl_title=w2.wl_title';
if ($title) {
$sql .= ' AND ((w1.wl_namespace = ' . $dbr->addQuotes($title->getNamespace()) . ' AND w1.wl_title >= ' . $dbr->addQuotes($title->getDBkey()) . ')' . ' OR w1.wl_namespace > ' . $dbr->addQuotes($title->getNamespace()) . ')';
}
$sql .= ' ORDER BY w1.wl_namespace, w1.wl_title LIMIT ' . ($this->maxPerPage + 1);
$res = $dbr->query($sql, 'ShowUserNetwork');
### FIXME: side link to previous
$n = 0;
$out = '<table style="background: inherit;" border="0" width="100%">';
while ($n < $this->maxPerPage && ($s = $dbr->fetchObject($res))) {
$title = Title::makeTitle($s->namespace, $s->title);
$link = $sk->makeKnownLinkObj($title, htmlspecialchars($title->getPrefixedText()));
if ($n % 3 == 0) {
$out .= '<tr>';
}
$out .= "<td>{$link}</td>";
$n++;
if ($n % 3 == 0) {
$out .= '</tr>';
}
}
if ($n % 3 != 0) {
$out .= '</tr>';
}
$out .= '</table>';
$form = $this->getForm($this->from);
$users = 'user=' . wfUrlEncode($this->username) . 'relateduser=' . wfUrlEncode($this->otherUsername);
$out2 = '<table style="background: inherit;" width="100%" cellpadding="0" cellspacing="0" border="0">';
$out2 .= '<tr valign="top"><td align="left">' . $form;
if (isset($dbr) && $dbr && $n == $this->maxPerPage && ($s = $dbr->fetchObject($res))) {
$title = Title::makeTitle($s->namespace, $s->title);
$out2 .= '</td><td align="right" style="font-size: smaller; margin-bottom: 1em;">' . $sk->makeKnownLink($wgContLang->specialPage("Network"), wfMsgHtml('nextpage', $title->getPrefixedText()), $users . '&from=' . wfUrlEncode($title->getPrefixedText()));
}
$out2 .= "</td></tr></table><hr />";
$wgOut->addHtml($out2 . $out);
$dbr->freeResult($res);
}
开发者ID:k-hasan-19, 项目名称:wiki, 代码行数:51, 代码来源:SpecialNetwork.php
示例12: randomchaptere
static function randomchaptere(&$parser, $text = null)
{
$t = self::pageText($parser, $text, 'rand');
return wfUrlEncode($t);
}
开发者ID:realsoc, 项目名称:mediawiki-extensions, 代码行数:5, 代码来源:BookManager.body.php
示例13: getVariableValue
/**
* Return value of a magic variable (like PAGENAME)
*
* @private
*/
function getVariableValue($index)
{
global $wgContLang, $wgSitename, $wgServer, $wgServerName, $wgScriptPath;
/**
* Some of these require message or data lookups and can be
* expensive to check many times.
*/
static $varCache = array();
if (wfRunHooks('ParserGetVariableValueVarCache', array(&$this, &$varCache))) {
if (isset($varCache[$index])) {
return $varCache[$index];
}
}
$ts = time();
wfRunHooks('ParserGetVariableValueTs', array(&$this, &$ts));
switch ($index) {
case MAG_CURRENTMONTH:
return $varCache[$index] = $wgContLang->formatNum(date('m', $ts));
case MAG_CURRENTMONTHNAME:
return $varCache[$index] = $wgContLang->getMonthName(date('n', $ts));
case MAG_CURRENTMONTHNAMEGEN:
return $varCache[$index] = $wgContLang->getMonthNameGen(date('n', $ts));
case MAG_CURRENTMONTHABBREV:
return $varCache[$index] = $wgContLang->getMonthAbbreviation(date('n', $ts));
case MAG_CURRENTDAY:
return $varCache[$index] = $wgContLang->formatNum(date('j', $ts));
case MAG_CURRENTDAY2:
return $varCache[$index] = $wgContLang->formatNum(date('d', $ts));
case MAG_PAGENAME:
return $this->mTitle->getText();
case MAG_PAGENAMEE:
return $this->mTitle->getPartialURL();
case MAG_FULLPAGENAME:
return $this->mTitle->getPrefixedText();
case MAG_FULLPAGENAMEE:
return $this->mTitle->getPrefixedURL();
case MAG_SUBPAGENAME:
return $this->mTitle->getSubpageText();
case MAG_SUBPAGENAMEE:
return $this->mTitle->getSubpageUrlForm();
case MAG_BASEPAGENAME:
return $this->mTitle->getBaseText();
case MAG_BASEPAGENAMEE:
return wfUrlEncode(str_replace(' ', '_', $this->mTitle->getBaseText()));
case MAG_TALKPAGENAME:
if ($this->mTitle->canTalk()) {
$talkPage = $this->mTitle->getTalkPage();
return $talkPage->getPrefixedText();
} else {
return '';
}
case MAG_TALKPAGENAMEE:
if ($this->mTitle->canTalk()) {
$talkPage = $this->mTitle->getTalkPage();
return $talkPage->getPrefixedUrl();
} else {
return '';
}
case MAG_SUBJECTPAGENAME:
$subjPage = $this->mTitle->getSubjectPage();
return $subjPage->getPrefixedText();
case MAG_SUBJECTPAGENAMEE:
$subjPage = $this->mTitle->getSubjectPage();
return $subjPage->getPrefixedUrl();
case MAG_REVISIONID:
return $this->mRevisionId;
case MAG_NAMESPACE:
return str_replace('_', ' ', $wgContLang->getNsText($this->mTitle->getNamespace()));
case MAG_NAMESPACEE:
return wfUrlencode($wgContLang->getNsText($this->mTitle->getNamespace()));
case MAG_TALKSPACE:
return $this->mTitle->canTalk() ? str_replace('_', ' ', $this->mTitle->getTalkNsText()) : '';
case MAG_TALKSPACEE:
return $this->mTitle->canTalk() ? wfUrlencode($this->mTitle->getTalkNsText()) : '';
case MAG_SUBJECTSPACE:
return $this->mTitle->getSubjectNsText();
case MAG_SUBJECTSPACEE:
return wfUrlencode($this->mTitle->getSubjectNsText());
case MAG_CURRENTDAYNAME:
return $varCache[$index] = $wgContLang->getWeekdayName(date('w', $ts) + 1);
case MAG_CURRENTYEAR:
return $varCache[$index] = $wgContLang->formatNum(date('Y', $ts), true);
case MAG_CURRENTTIME:
return $varCache[$index] = $wgContLang->time(wfTimestamp(TS_MW, $ts), false, false);
case MAG_CURRENTWEEK:
// @bug 4594 PHP5 has it zero padded, PHP4 does not, cast to
// int to remove the padding
return $varCache[$index] = $wgContLang->formatNum((int) date('W', $ts));
case MAG_CURRENTDOW:
return $varCache[$index] = $wgContLang->formatNum(date('w', $ts));
case MAG_NUMBEROFARTICLES:
return $varCache[$index] = $wgContLang->formatNum(wfNumberOfArticles());
case MAG_NUMBEROFFILES:
return $varCache[$index] = $wgContLang->formatNum(wfNumberOfFiles());
case MAG_NUMBEROFUSERS:
//.........这里部分代码省略.........
开发者ID:k-hasan-19, 项目名称:wiki, 代码行数:101, 代码来源:Parser.php
示例14: addMap
private function addMap()
{
global $wrHostName;
return '<div id="placemap"></div>' . '<div class="plainlinks">[http://' . $wrHostName . '/wiki/Special:PlaceMap?pagetitle=' . wfUrlEncode($this->titleString) . ' Larger map]</div>';
}
开发者ID:k-hasan-19, 项目名称:wiki, 代码行数:5, 代码来源:Place.php
示例15: showChunk
/**
* @param integer $namespace (Default NS_MAIN)
* @param string $from list all pages from this name (default FALSE)
*/
function showChunk($namespace = NS_MAIN, $from, $including = false)
{
global $wgOut, $wgUser, $wgContLang;
$fname = 'indexShowChunk';
$sk = $wgUser->getSkin();
$fromTitle = Title::newFromURL($from);
if ($namespace == NS_MAIN and $fromTitle) {
$namespace = $fromTitle->getNamespace();
}
$fromKey = is_null($fromTitle) ? '' : $fromTitle->getDBkey();
$dbr =& wfGetDB(DB_SLAVE);
$res = $dbr->select('page', array('page_namespace', 'page_title', 'page_is_redirect'), array('page_namespace' => $namespace, 'page_title LIKE \'' . $dbr->escapeLike($fromKey) . '%\''), $fname, array('ORDER BY' => 'page_title', 'LIMIT' => $this->maxPerPage + 1, 'USE INDEX' => 'name_title'));
### FIXME: side link to previous
$n = 0;
$out = '<table style="background: inherit;" border="0" width="100%">';
$namespaces = $wgContLang->getFormattedNamespaces();
while ($n < $this->maxPerPage && ($s = $dbr->fetchObject($res))) {
$t = Title::makeTitle($s->page_namespace, $s->page_title);
if ($t) {
$link = ($s->page_is_redirect ? '<div class="allpagesredirect">' : '') . $sk->makeKnownLinkObj($t, htmlspecialchars($t->getText()), false, false) . ($s->page_is_redirect ? '</div>' : '');
} else {
$link = '[[' . htmlspecialchars($s->page_title) . ']]';
}
if ($n % 3 == 0) {
$out .= '<tr>';
}
$out .= "<td>{$link}</td>";
$n++;
if ($n % 3 == 0) {
$out .= '</tr>';
}
}
if ($n % 3 != 0) {
$out .= '</tr>';
}
$out .= '</table>';
if ($including) {
$out2 = '';
} else {
$nsForm = $this->namespaceForm($namespace, $from);
$out2 = '<table style="background: inherit;" width="100%" cellpadding="0" cellspacing="0" border="0">';
$out2 .= '<tr valign="top"><td align="left">' . $nsForm;
$out2 .= '</td><td align="right" style="font-size: smaller; margin-bottom: 1em;">' . $sk->makeKnownLink($wgContLang->specialPage($this->name), wfMsg('allpages'));
if ($n == $this->maxPerPage && ($s = $dbr->fetchObject($res))) {
$namespaceparam = $namespace ? "&namespace={$namespace}" : "";
$out2 .= " | " . $sk->makeKnownLink($wgContLang->specialPage($this->name), wfMsg('nextpage', $s->page_title), "from=" . wfUrlEncode($s->page_title) . $namespaceparam);
}
$out2 .= "</td></tr></table><hr />";
}
$wgOut->addHtml($out2 . $out);
}
开发者ID:BackupTheBerlios, 项目名称:blahtex, 代码行数:55, 代码来源:SpecialPrefixindex.php
示例16: getLocalUrl
/**
* Helper function for getUrl()
*
* @todo FIXME: This may be generalized...
* @param string $page Page name (must be normalised before calling this function!)
* @return string Url fragment
*/
private function getLocalUrl($page)
{
return str_replace('$1', wfUrlEncode(str_replace(' ', '_', $page)), $this->mPath);
}
开发者ID:D66Ha, 项目名称:mediawiki, 代码行数:11, 代码来源:WikiMap.php
librespeed/speedtest: Self-hosted Speedtest for HTML5 and more. Easy setup, exam
阅读:1218| 2022-08-30
avehtari/BDA_m_demos: Bayesian Data Analysis demos for Matlab/Octave
阅读:1133| 2022-08-17
女人怀孕后,为了有一个健康聪明的宝宝,经历各种体检、筛查。其实这些体检和筛查中的
阅读:942| 2022-11-06
medfreeman/markdown-it-toc-and-anchor: markdown-it plugin to add a toc and ancho
阅读:1339| 2022-08-18
循环读取图片第一种方法①List =dir(amp;#39;*.jpgamp;#39;); %如需其它图片格式支持
阅读:966| 2022-07-18
http://www.borland.com/namespaces/Types-IAppServerSOAP 服务器未能识别HTTP头SO
阅读:542| 2022-07-18
Improper input validation vulnerability in Link of Cybozu Garoon 4.0.0 to 5.5.1
阅读:955| 2022-07-08
sydney0zq/covid-19-detection: The implementation of A Weakly-supervised Framewor
阅读:485| 2022-08-16
离中国最远的国家是阿根廷。从太平洋直线计算,即往东线走,北京到阿根廷的布宜诺斯艾
阅读:641| 2022-11-06
shem8/MaterialLogin: Login view with material design
阅读:725| 2022-08-17
请发表评论