本文整理汇总了PHP中wfUrlencode函数的典型用法代码示例。如果您正苦于以下问题:PHP wfUrlencode函数的具体用法?PHP wfUrlencode怎么用?PHP wfUrlencode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfUrlencode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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' );
}
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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())));
}
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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));
}
示例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);
}
示例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;
}
示例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;
}