本文整理汇总了PHP中wfUrlencode函数的典型用法代码示例。如果您正苦于以下问题:PHP wfUrlencode函数的具体用法?PHP wfUrlencode怎么用?PHP wfUrlencode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfUrlencode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wfElggWatchlistDisplayForm
function wfElggWatchlistDisplayForm($action, &$wgArticle)
{
global $wgOut;
if ($action == 'myact') {
$title = $wgArticle->getTitle();
//$page = $title->getIndexTitle();
$page = wfUrlencode($title->getPrefixedDBkey());
$ts = time();
$elgg_url = ELGG_URL;
$html = <<<END
\t\t\t<script type="text/javascript">
\t\t\t\$(document).ready(function()
\t\t\t\t{
\t\t\t\t\t\$('#elggwiki_watch_form').load("{$elgg_url}mod/mediawiki/get_watch_form_groups.php?page={$page}&ts={$ts}");
\t\t\t\t}
\t\t\t);
\t\t\t</script>
\t\t\t<div id="elggwiki_watch_form"></div>
END;
//$wgOut->addHTML( 'The page name is ' . $title->getText() . ' and you are ' . $wgArticle->getUserText() );
$wgOut->addHTML($html);
}
return false;
}
开发者ID:surevine-elgg,项目名称:mediawiki,代码行数:27,代码来源:elgg_watchlist.php
示例2: wfSpecialCiteNav
function wfSpecialCiteNav(&$skintemplate, &$nav_urls, &$oldid, &$revid)
{
if ($skintemplate->mTitle->isContentPage() && $revid !== 0) {
$nav_urls['cite'] = array('text' => wfMsg('cite_article_link'), 'href' => $skintemplate->makeSpecialUrl('Cite', "page=" . wfUrlencode("{$skintemplate->thispage}") . "&id={$revid}"));
}
return true;
}
开发者ID:ErdemA,项目名称:wikihow,代码行数:7,代码来源:SpecialCite.php
示例3: efTSPollRender
function efTSPollRender( $input, $args, $parser ) {
// Control if the "id" is set. If not, it output a error
if ( isset( $args['id'] ) && $args['id'] != "" ) {
$id = wfUrlencode( $args['id'] );
} else {
return wfMsg( 'tspoll-id-error' );
}
// Control if "dev" is set. If not, it use the normal skript, else, it use the dev skript
if ( isset( $args['dev'] ) && $args['dev'] == "1" ) { // If the arrgument dev is given, use the TSPoll-Dev-Version
$get_server = Http::get( 'http://toolserver.org/~jan/poll/dev/main.php?page=wiki_output&id='.$id );
} else { // sonst die normale Version verwenden
$get_server = Http::get( 'http://toolserver.org/~jan/poll/main.php?page=wiki_output&id='.$id );
}
// If $get_server is empty it output a error
if ( $get_server != '' ) {
return $get_server;
}
else {
return wfMsg( 'tspoll-fetch-error' );
}
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:26,代码来源:TSPoll.php
示例4: wfSpecialCiteNav
/**
* @param $skintemplate SkinTemplate
* @param $nav_urls
* @param $oldid
* @param $revid
* @return bool
*/
function wfSpecialCiteNav(&$skintemplate, &$nav_urls, &$oldid, &$revid)
{
// check whether we’re in the right namespace, the $revid has the correct type and is not empty
// (what would mean that the current page doesn’t exist)
if ($skintemplate->getTitle()->isContentPage() && $revid !== 0 && !empty($revid)) {
$nav_urls['cite'] = array('args' => "page=" . wfUrlencode("{$skintemplate->thispage}") . "&id={$revid}");
}
return true;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:16,代码来源:SpecialCite.php
示例5: _redirectToCreateSP
private function _redirectToCreateSP($listName = null)
{
global $wgOut;
$specialPageTitle = Title::newFromText('CreateTopList', NS_SPECIAL);
$url = $specialPageTitle->getFullUrl();
if (!empty($listName)) {
$url .= '/' . wfUrlencode($listName);
}
$wgOut->redirect($url);
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:10,代码来源:SpecialEditTopList.class.php
示例6: buildContentActionUrls
function buildContentActionUrls()
{
global $wgKiwixStaticDump;
$content_actions = array();
$nskey = $this->getNameSpaceKey();
if (isset($wgKiwixStaticDump)) {
$content_actions['current'] = array('text' => wfMsg('currentrev'), 'href' => str_replace('$1', wfUrlencode($this->mTitle->getPrefixedDBkey()), $wgKiwixStaticDump->oldArticlePath), 'class' => false);
}
return $content_actions;
}
开发者ID:kiwix,项目名称:tools,代码行数:10,代码来源:KiwixStaticDump.php
示例7: efNamepacePathsGetURL
function efNamepacePathsGetURL($title, &$url)
{
global $wgNamespacePaths;
// Ensure that the context of this url is one we'd do article path replacements in
$ns = $title->getNamespace();
if (array_key_exists($ns, $wgNamespacePaths)) {
$url = str_replace('$1', wfUrlencode($title->getDBkey()), $wgNamespacePaths[$ns]);
}
return true;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:10,代码来源:NamespacePaths.php
示例8: addLanguageAction
/**
* Add the language action to the list of content actions
*/
public static function addLanguageAction(&$content_actions)
{
global $wgTitle;
if ($wgTitle->getArticleId()) {
$specialTitle = Title::newFromText("Special:MultiLanguageManager");
if (get_class($specialTitle) != "Title") {
return;
}
$content_actions['language'] = array('class' => false, 'text' => wfMsg('multilanguagemanager_language'), 'href' => $specialTitle->getLocalUrl("cible=" . wfUrlencode($wgTitle->getPrefixedDBkey())));
}
}
开发者ID:Avalanche85,项目名称:mw-extensions,代码行数:14,代码来源:MultiLanguageManager_body.php
示例9: wfSpecialEmailuser
/**
* Constructor for Special:Emailuser.
*/
function wfSpecialEmailuser($par)
{
global $wgRequest, $wgUser, $wgOut;
if (!EmailUserForm::userEmailEnabled()) {
$wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
return;
}
$action = $wgRequest->getVal('action');
$target = isset($par) ? $par : $wgRequest->getVal('target');
$targetUser = EmailUserForm::validateEmailTarget($target);
if (!$targetUser instanceof User) {
$wgOut->showErrorPage($targetUser . 'title', $targetUser . 'text');
return;
}
$form = new EmailUserForm($targetUser, $wgRequest->getText('wpText'), $wgRequest->getText('wpSubject'), $wgRequest->getBool('wpCCMe'));
if ($action == 'success') {
$form->showSuccess();
return;
}
$error = EmailUserForm::getPermissionsError($wgUser, $wgRequest->getVal('wpEditToken'));
if ($error) {
switch ($error) {
case 'blockedemailuser':
$wgOut->blockedPage();
return;
case 'actionthrottledtext':
$wgOut->rateLimited();
return;
case 'sessionfailure':
$form->showForm();
return;
case 'mailnologin':
$wgOut->showErrorPage('mailnologin', 'mailnologintext');
return;
default:
// It's a hook error
list($title, $msg, $params) = $error;
$wgOut->showErrorPage($title, $msg, $params);
return;
}
}
if ("submit" == $action && $wgRequest->wasPosted()) {
$result = $form->doSubmit();
if (!is_null($result)) {
$wgOut->addHTML(wfMsg("usermailererror") . ' ' . htmlspecialchars($result->getMessage()));
} else {
$titleObj = SpecialPage::getTitleFor("Emailuser");
$encTarget = wfUrlencode($form->getTarget()->getName());
$wgOut->redirect($titleObj->getFullURL("target={$encTarget}&action=success"));
}
} else {
$form->showForm();
}
}
开发者ID:rocLv,项目名称:conference,代码行数:57,代码来源:SpecialEmailuser.php
示例10: buildContentActionUrls
function buildContentActionUrls()
{
global $wgHTMLDump;
$content_actions = array();
$nskey = $this->getNameSpaceKey();
$content_actions[$nskey] = $this->tabAction($this->mTitle->getSubjectPage(), $nskey, !$this->mTitle->isTalkPage());
$content_actions['talk'] = $this->tabAction($this->mTitle->getTalkPage(), 'talk', $this->mTitle->isTalkPage(), '', true);
if (isset($wgHTMLDump)) {
$content_actions['current'] = array('text' => wfMsg('currentrev'), 'href' => str_replace('$1', wfUrlencode($this->mTitle->getPrefixedDBkey()), $wgHTMLDump->oldArticlePath), 'class' => false);
}
return $content_actions;
}
开发者ID:evopedia,项目名称:evopedia_python,代码行数:12,代码来源:SkinOffline.php
示例11: titleURLString
/**
* Creates the name of the page that appears in the URL;
* this method is necessary because Title::getPartialURL(), for
* some reason, doesn't include the namespace
*/
public static function titleURLString( $title ) {
$namespace = wfUrlencode( $title->getNsText() );
if ( $namespace !== '' ) {
$namespace .= ':';
}
if ( MWNamespace::isCapitalized( $title->getNamespace() ) ) {
global $wgContLang;
return $namespace . $wgContLang->ucfirst( $title->getPartialURL() );
} else {
return $namespace . $title->getPartialURL();
}
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:17,代码来源:SF_Utils.php
示例12: encodePage
/**
* @since 2.2
*
* @param DIWikiPage $diWikiPage
*
* @return string
*/
public static function encodePage(DIWikiPage $diWikiPage)
{
$localName = '';
if ($diWikiPage->getInterwiki() !== '') {
$localName = $diWikiPage->getInterwiki() . ':';
}
if ($diWikiPage->getNamespace() !== 0) {
$localName .= str_replace(' ', '_', $GLOBALS['wgContLang']->getNSText($diWikiPage->getNamespace())) . ':' . $diWikiPage->getDBkey();
} else {
$localName .= $diWikiPage->getDBkey();
}
return self::encodeUri(wfUrlencode($localName));
}
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:20,代码来源:Escaper.php
示例13: verifyEncodingFor
/**
* Internal helper that actually run the test.
* Called by the public methods testEncodingUrlWith...()
*
*/
private function verifyEncodingFor($server, $input, $expectations)
{
$expected = $this->extractExpect($server, $expectations);
// save up global
$old = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : null;
$_SERVER['SERVER_SOFTWARE'] = $server;
wfUrlencode(null);
// do the requested test
$this->assertEquals($expected, wfUrlencode($input), "Encoding '{$input}' for server '{$server}' should be '{$expected}'");
// restore global
if ($old === null) {
unset($_SERVER['SERVER_SOFTWARE']);
} else {
$_SERVER['SERVER_SOFTWARE'] = $old;
}
wfUrlencode(null);
}
开发者ID:ptoomey3,项目名称:mediawiki,代码行数:22,代码来源:wfUrlencodeTest.php
示例14: wfElggNotifyCurlUpdate
/**
* wfElggNotifyCurlUpdate
*
* @param object $article
* @param object $user
* @param bool $isMinor
* @param bool $isWatch
* @return bool
*/
function wfElggNotifyCurlUpdate($article, $user, $text, $summary, $isMinor, $isWatch, $section, $flags, $revision)
{
if ($isMinor) {
$editStatus = 'minor';
} else {
$editStatus = 'major';
}
$title = $article->getTitle();
$page = wfUrlencode($title->getPrefixedDBkey());
$username = $user->mName;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ELGG_URL . "mod/mediawiki/edit_notify.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "page={$page}&mediawiki_username={$username}&edit_status={$editStatus}");
curl_exec($ch);
curl_close($ch);
return true;
}
开发者ID:surevine-elgg,项目名称:mediawiki,代码行数:27,代码来源:elgg_notify.php
示例15: getPageUrl
/**
* Returns the (partial) URL for the given page (including any section identifier).
*
* @param TitleValue $page The link's target
* @param array $params any additional URL parameters.
*
* @return string
*/
public function getPageUrl(TitleValue $page, $params = array())
{
//TODO: move the code from Linker::linkUrl here!
//The below is just a rough estimation!
$name = $this->formatter->getPrefixedText($page);
$name = str_replace(' ', '_', $name);
$name = wfUrlencode($name);
$url = $this->baseUrl . $name;
if ($params) {
$separator = strpos($url, '?') ? '&' : '?';
$url .= $separator . wfArrayToCgi($params);
}
$fragment = $page->getFragment();
if ($fragment !== '') {
$url = $url . '#' . wfUrlencode($fragment);
}
return $url;
}
开发者ID:Tarendai,项目名称:spring-website,代码行数:26,代码来源:MediaWikiPageLinkRenderer.php
示例16: _executeCreate
/**
* Displays form to create wiki
*/
protected function _executeCreate($wgFarmer, $wiki)
{
global $wgOut, $wgUser, $wgRequest;
if (!$wgFarmer->getActiveWiki()->isDefaultWiki()) {
$wgOut->wrapWikiMsg('== $1 ==', 'farmer-notavailable');
$wgOut->addWikiMsg('farmer-notavailable-text');
return;
}
if (!MediaWikiFarmer::userCanCreateWiki($wgUser, $wiki)) {
$wgOut->addWikiMsg('farmercantcreatewikis');
return;
}
$name = MediaWikiFarmer_Wiki::sanitizeName($wgRequest->getVal('wpName', $wiki));
$title = MediaWikiFarmer_Wiki::sanitizeTitle($wgRequest->getVal('wpTitle'));
$description = $wgRequest->getVal('wpDescription', '');
$reason = $wgRequest->getVal('wpReason');
$action = $this->getTitle('create')->escapeLocalURL();
// if something was POST'd
if ($wgRequest->wasPosted()) {
// we create the wiki if the user pressed 'Confirm'
if ($wgRequest->getCheck('wpConfirm')) {
$wikiObj = MediaWikiFarmer_Wiki::newFromParams($name, $title, $description, $wgUser->getName());
$wikiObj->create();
$log = new LogPage('farmer');
$log->addEntry('create', $this->getTitle(), $reason, array($name));
$wgOut->wrapWikiMsg('== $1 ==', 'farmer-wikicreated');
$wgOut->addWikiMsg('farmer-wikicreated-text', $wikiObj->getUrl(wfUrlencode(wfMessage('mainpage')->inContentLanguage()->useDatabase(false)->plain())));
$wgOut->addWikiMsg('farmer-default', '[[' . $title . ':Special:Farmer|Special:Farmer]]');
return;
}
if ($name && $title && $description) {
$wiki = new MediaWikiFarmer_Wiki($name);
if ($wiki->exists() || $wiki->databaseExists()) {
$wgOut->wrapWikiMsg("== \$1 ==\n\n\$2", 'farmer-wikiexists', array('farmer-wikiexists-text', $name));
return;
}
$url = $wiki->getUrl('');
$wgOut->wrapWikiMsg('== $1 ==', 'farmer-confirmsetting');
$wgOut->addHtml(Xml::openElement('table', array('class' => 'wikitable')) . "\n" . Xml::tags('tr', array(), Xml::tags('th', array(), wfMsgExt('farmer-confirmsetting-name', 'parseinline')) . Xml::element('td', array(), $name)) . "\n" . Xml::tags('tr', array(), Xml::tags('th', array(), wfMsgExt('farmer-confirmsetting-title', 'parseinline')) . Xml::element('td', array(), $title)) . "\n" . Xml::tags('tr', array(), Xml::tags('th', array(), wfMsgExt('farmer-confirmsetting-description', 'parseinline')) . Xml::element('td', array(), $description)) . "\n" . Xml::tags('tr', array(), Xml::tags('th', array(), wfMsgExt('farmer-confirmsetting-reason', 'parseinline')) . Xml::element('td', array(), $reason)) . "\n" . Xml::closeElement('table'));
$wgOut->addWikiMsg('farmer-confirmsetting-text', $name, $title, $url);
$nameaccount = htmlspecialchars($name);
$nametitle = htmlspecialchars($title);
$namedescript = htmlspecialchars($description);
$confirmaccount = wfMsgHtml('farmer-button-confirm');
$wgOut->addHTML("\n\n<form id=\"farmercreate2\" method=\"post\" action=\"{$action}\">\n<input type=\"hidden\" name=\"wpName\" value=\"{$nameaccount}\" />\n<input type=\"hidden\" name=\"wpTitle\" value=\"{$nametitle}\" />\n<input type=\"hidden\" name=\"wpDescription\" value=\"{$namedescript}\" />\n<input type=\"hidden\" name=\"wpReason\" value=\"{$reason}\" />\n<input type=\"submit\" name=\"wpConfirm\" value=\"{$confirmaccount}\" />\n</form>");
return;
}
}
if ($wiki && !$name) {
$name = $wiki;
}
$wgOut->wrapWikiMsg("== \$1 ==\n\$2\n== \$3 ==\n\$4\n\$5\n\$6", 'farmer-createwiki-form-title', 'farmer-createwiki-form-text1', 'farmer-createwiki-form-help', 'farmer-createwiki-form-text2', 'farmer-createwiki-form-text3', 'farmer-createwiki-form-text4');
$formURL = wfMsgHTML('farmercreateurl');
$formSitename = wfMsgHTML('farmercreatesitename');
$formNextStep = wfMsgHTML('farmercreatenextstep');
$token = htmlspecialchars($wgUser->editToken());
$wgOut->addHTML(Xml::openElement('form', array('method' => 'post', 'action' => $action)) . "\n" . Xml::buildForm(array('farmer-createwiki-user' => Xml::element('b', array(), $wgUser->getName()), 'farmer-createwiki-name' => Xml::input('wpName', 20, $name), 'farmer-createwiki-title' => Xml::input('wpTitle', 20, $title), 'farmer-createwiki-description' => Xml::textarea('wpDescription', $description), 'farmer-createwiki-reason' => Xml::input('wpReason', 20, $reason)), 'farmer-button-submit') . "\n" . Html::Hidden('token', $token) . "\n" . Xml::closeElement('form'));
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:61,代码来源:SpecialFarmer.php
示例17: speciale
public static function speciale($parser, $text)
{
return wfUrlencode(str_replace(' ', '_', self::special($parser, $text)));
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:4,代码来源:CoreParserFunctions.php
示例18: getVariableValue
//.........这里部分代码省略.........
break;
case 'revisionyear':
# Let the edit saving system know we should parse the page
# *after* a revision ID has been assigned. This is for null edits.
$this->mOutput->setFlag('vary-revision');
wfDebug(__METHOD__ . ": {{REVISIONYEAR}} used, setting vary-revision...\n");
$value = substr($this->getRevisionTimestamp(), 0, 4);
break;
case 'revisiontimestamp':
# Let the edit saving system know we should parse the page
# *after* a revision ID has been assigned. This is for null edits.
$this->mOutput->setFlag('vary-revision');
wfDebug(__METHOD__ . ": {{REVISIONTIMESTAMP}} used, setting vary-revision...\n");
$value = $this->getRevisionTimestamp();
break;
case 'revisionuser':
# Let the edit saving system know we should parse the page
# *after* a revision ID has been assigned. This is for null edits.
$this->mOutput->setFlag('vary-revision');
wfDebug(__METHOD__ . ": {{REVISIONUSER}} used, setting vary-revision...\n");
$value = $this->getRevisionUser();
break;
case 'revisionsize':
# Let the edit saving system know we should parse the page
# *after* a revision ID has been assigned. This is for null edits.
$this->mOutput->setFlag('vary-revision');
wfDebug(__METHOD__ . ": {{REVISIONSIZE}} used, setting vary-revision...\n");
$value = $this->getRevisionSize();
break;
case 'namespace':
$value = str_replace('_', ' ', $wgContLang->getNsText($this->mTitle->getNamespace()));
break;
case 'namespacee':
$value = wfUrlencode($wgContLang->getNsText($this->mTitle->getNamespace()));
break;
case 'namespacenumber':
$value = $this->mTitle->getNamespace();
break;
case 'talkspace':
$value = $this->mTitle->canTalk() ? str_replace('_', ' ', $this->mTitle->getTalkNsText()) : '';
break;
case 'talkspacee':
$value = $this->mTitle->canTalk() ? wfUrlencode($this->mTitle->getTalkNsText()) : '';
break;
case 'subjectspace':
$value = str_replace('_', ' ', $this->mTitle->getSubjectNsText());
break;
case 'subjectspacee':
$value = wfUrlencode($this->mTitle->getSubjectNsText());
break;
case 'currentdayname':
$value = $pageLang->getWeekdayName((int) MWTimestamp::getInstance($ts)->format('w') + 1);
break;
case 'currentyear':
$value = $pageLang->formatNum(MWTimestamp::getInstance($ts)->format('Y'), true);
break;
case 'currenttime':
$value = $pageLang->time(wfTimestamp(TS_MW, $ts), false, false);
break;
case 'currenthour':
$value = $pageLang->formatNum(MWTimestamp::getInstance($ts)->format('H'), true);
break;
case 'currentweek':
# @bug 4594 PHP5 has it zero padded, PHP4 does not, cast to
# int to remove the padding
$value = $pageLang->formatNum((int) MWTimestamp::getInstance($ts)->format('W'));
开发者ID:Tarendai,项目名称:spring-website,代码行数:67,代码来源:Parser.php
示例19: getDescriptionRenderUrl
/**
* Get the URL of the content-only fragment of the description page. For
* MediaWiki this means action=render. This should only be called by the
* repository's file class, since it may return invalid results. User code
* should use File::getDescriptionText().
*
* @param $name String: name of image to fetch
* @param $lang String: language to fetch it in, if any.
* @return string
*/
public function getDescriptionRenderUrl($name, $lang = null)
{
$query = 'action=render';
if (!is_null($lang)) {
$query .= '&uselang=' . $lang;
}
if (isset($this->scriptDirUrl)) {
return $this->makeUrl('title=' . wfUrlencode('Image:' . $name) . "&{$query}");
} else {
$descUrl = $this->getDescriptionUrl($name);
if ($descUrl) {
return wfAppendQuery($descUrl, $query);
} else {
return false;
}
}
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:27,代码来源:FileRepo.php
示例20: logFeatureUsage
/**
* Write logging information for API features to a debug log, for usage
* analysis.
* @param string $feature Feature being used.
*/
protected function logFeatureUsage($feature)
{
$request = $this->getRequest();
$s = '"' . addslashes($feature) . '"' . ' "' . wfUrlencode(str_replace(' ', '_', $this->getUser()->getName())) . '"' . ' "' . $request->getIP() . '"' . ' "' . addslashes($request->getHeader('Referer')) . '"' . ' "' . addslashes($this->getMain()->getUserAgent()) . '"';
wfDebugLog('api-feature-usage', $s, 'private');
}
开发者ID:pirater,项目名称:mediawiki,代码行数:11,代码来源:ApiBase.php
注:本文中的wfUrlencode函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论