当前位置: 首页>>代码示例>>PHP>>正文


PHP Title::getFullURL方法代码示例

本文整理汇总了PHP中Title::getFullURL方法的典型用法代码示例。如果您正苦于以下问题:PHP Title::getFullURL方法的具体用法?PHP Title::getFullURL怎么用?PHP Title::getFullURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Title的用法示例。


在下文中一共展示了Title::getFullURL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getRedirectURL

 /**
  * Get the Title object or URL to use for a redirect. We use Title
  * objects for same-wiki, non-special redirects and URLs for everything
  * else.
  * @param $rt Title Redirect target
  * @return mixed false, Title object of local target, or string with URL
  */
 public function getRedirectURL($rt)
 {
     if ($rt) {
         if ($rt->getInterwiki() != '') {
             if ($rt->isLocal()) {
                 // Offsite wikis need an HTTP redirect.
                 //
                 // This can be hard to reverse and may produce loops,
                 // so they may be disabled in the site configuration.
                 $source = $this->mTitle->getFullURL('redirect=no');
                 return $rt->getFullURL('rdfrom=' . urlencode($source));
             }
         } else {
             if ($rt->getNamespace() == NS_SPECIAL) {
                 // Gotta handle redirects to special pages differently:
                 // Fill the HTTP response "Location" header and ignore
                 // the rest of the page we're on.
                 //
                 // This can be hard to reverse, so they may be disabled.
                 if ($rt->isSpecial('Userlogout')) {
                     // rolleyes
                 } else {
                     return $rt->getFullURL();
                 }
             }
             return $rt;
         }
     }
     // No or invalid redirect
     return false;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:38,代码来源:WikiPage.php

示例2: makeRedirectContent

 /**
  * Create a redirect that is also valid JavaScript
  *
  * @param Title $destination
  * @param string $text ignored
  * @return JavaScriptContent
  */
 public function makeRedirectContent(Title $destination, $text = '')
 {
     // The parameters are passed as a string so the / is not url-encoded by wfArrayToCgi
     $url = $destination->getFullURL('action=raw&ctype=text/javascript', false, PROTO_RELATIVE);
     $class = $this->getContentClass();
     return new $class('/* #REDIRECT */' . Xml::encodeJsCall('mw.loader.load', [$url]));
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:14,代码来源:JavaScriptContentHandler.php

示例3: showCode

 /**
  * Look for the requested qrcode file. If we don't have the code on file,
  * first generate then publish it.
  */
 public function showCode($label = false)
 {
     // Check for a provided label and use the page URL as default (but force protocol if requested)
     if ($label) {
         $this->_label = $label;
         // should we sanitize this?
         $this->_uploadComment = $label;
     } else {
         $url = parse_url($this->_title->getFullURL());
         $url['scheme'] = $this->_scheme ? $this->_scheme : $url['scheme'];
         //$this->_label = http_build_url($url);	// http_build_url is part of pecl_http >= 0.21.0 :(
         $this->_label = $url['scheme'] . '://' . $url['host'] . (isset($url['port']) ? $url['port'] : '') . (isset($url['path']) ? $url['path'] : '') . (isset($url['query']) ? '?' . $url['query'] : '') . (isset($url['fragment']) ? '#' . $url['fragment'] : '');
         $this->_uploadComment = 'Encoded URL for ' . $this->_title->getFullText();
     }
     // Use this page's title as part of the filename (Also regenerates qrcodes when the label changes).
     $this->_dstFileName = 'QR-' . md5($this->_label) . '.png';
     $file = wfFindFile($this->_dstFileName);
     // Shortcut for RepoGroup::singleton()->findFile()
     if ($file && $file->isVisible()) {
         wfDebug("QrCode::showCode: Requested file " . $this->_dstFileName . " already exists. Displaying image.\n");
         return $this->_displayImage($file);
     } else {
         wfDebug("QrCode::showCode: Requested file " . $this->_dstFileName . " is new and needs to be generated.\n");
         $this->_generate();
         return;
     }
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:31,代码来源:QrCode.php

示例4: getRedirectURL

	/**
	 * Get the Title object or URL to use for a redirect. We use Title
	 * objects for same-wiki, non-special redirects and URLs for everything
	 * else.
	 * @param $rt Title Redirect target
	 * @return mixed false, Title object of local target, or string with URL
	 */
	public function getRedirectURL( $rt ) {
		if ( !$rt ) {
			return false;
		}

		if ( $rt->isExternal() ) {
			if ( $rt->isLocal() ) {
				// Offsite wikis need an HTTP redirect.
				//
				// This can be hard to reverse and may produce loops,
				// so they may be disabled in the site configuration.
				$source = $this->mTitle->getFullURL( 'redirect=no' );
				return $rt->getFullURL( array( 'rdfrom' => $source ) );
			} else {
				// External pages pages without "local" bit set are not valid
				// redirect targets
				return false;
			}
		}

		if ( $rt->isSpecialPage() ) {
			// Gotta handle redirects to special pages differently:
			// Fill the HTTP response "Location" header and ignore
			// the rest of the page we're on.
			//
			// Some pages are not valid targets
			if ( $rt->isValidRedirectTarget() ) {
				return $rt->getFullURL();
			} else {
				return false;
			}
		}

		return $rt;
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:42,代码来源:WikiPage.php

示例5: makeRedirectContent

 /**
  * Create a redirect that is also valid CSS
  *
  * @param Title $destination
  * @param string $text ignored
  * @return CssContent
  */
 public function makeRedirectContent(Title $destination, $text = '')
 {
     // The parameters are passed as a string so the / is not url-encoded by wfArrayToCgi
     $url = $destination->getFullURL('action=raw&ctype=text/css', false, PROTO_RELATIVE);
     $class = $this->getContentClass();
     return new $class('/* #REDIRECT */@import ' . CSSMin::buildUrlValue($url) . ';');
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:14,代码来源:CssContentHandler.php

示例6: __construct

 /**
  * @param Title $title Title object that this entry is for.
  * @param String $pubDate Publish date formattable by wfTimestamp.
  * @param Array $keywords list of (String) keywords
  * @param Mixed Boolean or Integer. Namespace containing comments page for entry.
  *   True for the corresponding talk page of $title
  *   False for none
  *   An integer for the page name of $title in the specific namespace denoted by that integer.
  */
 public function __construct($title, $pubDate, $keywords = '', $comment = true)
 {
     if (!$title || !$title instanceof Title) {
         // Paranoia
         throw new MWException('Invalid title object passed to FeedSMItem');
     }
     $commentsURL = '';
     if ($comment === true) {
         // The comment ns is this article's talk namespace.
         $commentsURL = $title->getTalkPage()->getFullUrl();
     } elseif (is_int($comment)) {
         // There's a specific comments namespace.
         $commentsTitle = Title::makeTitle($comment, $title->getDBkey());
         if ($commentsTitle) {
             $commentsURL = $commentsTitle->getFullUrl();
         }
     }
     $this->keywords = $keywords;
     $this->titleObj = $title;
     parent::__construct($title->getText(), '', $title->getFullURL(), $pubDate, '', $commentsURL);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:30,代码来源:FeedSMItem.php

示例7: desktopFooter

 /**
  * Appends a mobile view link to the desktop footer
  * @param Skin $sk
  * @param QuickTemplate $tpl
  * @param MobileContext $ctx
  * @param Title $title
  * @param WebRequest $req
  */
 public static function desktopFooter($sk, $tpl, $ctx, $title, $req)
 {
     $footerlinks = $tpl->data['footerlinks'];
     $args = $req->getQueryValues();
     // avoid title being set twice
     unset($args['title'], $args['useformat']);
     $args['mobileaction'] = 'toggle_view_mobile';
     $mobileViewUrl = $title->getFullURL($args);
     $mobileViewUrl = $ctx->getMobileUrl($mobileViewUrl);
     $link = Html::element('a', array('href' => $mobileViewUrl, 'class' => 'noprint stopMobileRedirectToggle'), wfMessage('mobile-frontend-view')->text());
     $tpl->set('mobileview', $link);
     $footerlinks['places'][] = 'mobileview';
     $tpl->set('footerlinks', $footerlinks);
 }
开发者ID:micha6554,项目名称:mediawiki-extensions-MobileFrontend,代码行数:22,代码来源:MobileFrontend.skin.hooks.php

示例8: attemptSave

 /**
  * Attempt submission
  * @return bool false if output is done, true if the rest of the form should be displayed
  */
 function attemptSave()
 {
     global $wgUser, $wgOut;
     $resultDetails = false;
     # Allow bots to exempt some edits from bot flagging
     $bot = $wgUser->isAllowed('bot') && $this->bot;
     $status = $this->internalAttemptSave($resultDetails, $bot);
     // FIXME: once the interface for internalAttemptSave() is made nicer, this should use the message in $status
     if ($status->value == self::AS_SUCCESS_UPDATE || $status->value == self::AS_SUCCESS_NEW_ARTICLE) {
         $this->didSave = true;
     }
     switch ($status->value) {
         case self::AS_HOOK_ERROR_EXPECTED:
         case self::AS_CONTENT_TOO_BIG:
         case self::AS_ARTICLE_WAS_DELETED:
         case self::AS_CONFLICT_DETECTED:
         case self::AS_SUMMARY_NEEDED:
         case self::AS_TEXTBOX_EMPTY:
         case self::AS_MAX_ARTICLE_SIZE_EXCEEDED:
         case self::AS_END:
             return true;
         case self::AS_HOOK_ERROR:
         case self::AS_FILTERING:
             return false;
         case self::AS_SUCCESS_NEW_ARTICLE:
             $query = $resultDetails['redirect'] ? 'redirect=no' : '';
             $anchor = isset($resultDetails['sectionanchor']) ? $resultDetails['sectionanchor'] : '';
             $wgOut->redirect($this->mTitle->getFullURL($query) . $anchor);
             return false;
         case self::AS_SUCCESS_UPDATE:
             $extraQuery = '';
             $sectionanchor = $resultDetails['sectionanchor'];
             // Give extensions a chance to modify URL query on update
             wfRunHooks('ArticleUpdateBeforeRedirect', array($this->mArticle, &$sectionanchor, &$extraQuery));
             if ($resultDetails['redirect']) {
                 if ($extraQuery == '') {
                     $extraQuery = 'redirect=no';
                 } else {
                     $extraQuery = 'redirect=no&' . $extraQuery;
                 }
             }
             $wgOut->redirect($this->mTitle->getFullURL($extraQuery) . $sectionanchor);
             return false;
         case self::AS_BLANK_ARTICLE:
             $wgOut->redirect($this->getContextTitle()->getFullURL());
             return false;
         case self::AS_SPAM_ERROR:
             $this->spamPageWithContent($resultDetails['spam']);
             return false;
         case self::AS_BLOCKED_PAGE_FOR_USER:
             throw new UserBlockedError($wgUser->mBlock);
         case self::AS_IMAGE_REDIRECT_ANON:
         case self::AS_IMAGE_REDIRECT_LOGGED:
             throw new PermissionsError('upload');
         case self::AS_READ_ONLY_PAGE_ANON:
         case self::AS_READ_ONLY_PAGE_LOGGED:
             throw new PermissionsError('edit');
         case self::AS_READ_ONLY_PAGE:
             throw new ReadOnlyError();
         case self::AS_RATE_LIMITED:
             throw new ThrottledError();
         case self::AS_NO_CREATE_PERMISSION:
             $permission = $this->mTitle->isTalkPage() ? 'createtalk' : 'createpage';
             throw new PermissionsError($permission);
     }
     return false;
 }
开发者ID:slackfaith,项目名称:deadbrain_site,代码行数:71,代码来源:EditPage.php

示例9: getFooterAllChangesLink

 protected function getFooterAllChangesLink()
 {
     $articleTitle = $this->pageTitle->getText();
     $url = $this->pageTitle->getFullURL(['action' => 'history']);
     return $this->getMessage('emailext-founder-footer-all-changes', $url, $articleTitle)->parse();
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:6,代码来源:FounderController.class.php

示例10: linkBegin

 static function linkBegin($skin, Title $target, &$text, array &$attribs, &$query, &$options, &$ret)
 {
     if ($target->isExternal()) {
         $args = '';
         $u = $target->getFullURL();
         $link = $target->getPrefixedURL();
         if ('' == $text) {
             $text = $target->getPrefixedText();
         }
         $style = Linker::getInterwikiLinkAttributes($link, $text, 'extiw');
         if ($text == 'RTENOTITLE') {
             // 2223
             $text = $u = $link;
             $args .= '_fcknotitle="true" ';
         }
         $t = "<a {$args}href=\"{$u}\"{$style}>{$text}</a>";
         wfProfileOut(__METHOD__);
         $ret = $t;
         return false;
     }
     return true;
 }
开发者ID:AbedSHP,项目名称:WYSIWYG-CKeditor,代码行数:22,代码来源:CKeditorLinker.php

示例11: getTitleLink

 /**
  * Prepare a data to create a link element
  *
  * @param Title $title A target article's Title object
  * @param $params
  * @return array
  */
 public static function getTitleLink(Title $title, $params)
 {
     $prefixedTitle = $title->getPrefixedText();
     $data = ['text' => $prefixedTitle, 'url' => $title->getFullURL($params), 'title' => $prefixedTitle, 'classes' => ''];
     if (!$title->exists()) {
         $data['classes'] = 'new';
         $data['title'] = wfMessage('red-link-title', $prefixedTitle)->escaped();
     }
     return $data;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:17,代码来源:InsightsHelper.php

示例12: handleStatus

 /**
  * Handle status, such as after attempt save
  *
  * @param Status $status
  * @param array|bool $resultDetails
  *
  * @throws ErrorPageError
  * @return bool False, if output is done, true if rest of the form should be displayed
  */
 private function handleStatus(Status $status, $resultDetails)
 {
     global $wgUser, $wgOut;
     /**
      * @todo FIXME: once the interface for internalAttemptSave() is made
      *   nicer, this should use the message in $status
      */
     if ($status->value == self::AS_SUCCESS_UPDATE || $status->value == self::AS_SUCCESS_NEW_ARTICLE) {
         $this->didSave = true;
         if (!$resultDetails['nullEdit']) {
             $this->setPostEditCookie($status->value);
         }
     }
     switch ($status->value) {
         case self::AS_HOOK_ERROR_EXPECTED:
         case self::AS_CONTENT_TOO_BIG:
         case self::AS_ARTICLE_WAS_DELETED:
         case self::AS_CONFLICT_DETECTED:
         case self::AS_SUMMARY_NEEDED:
         case self::AS_TEXTBOX_EMPTY:
         case self::AS_MAX_ARTICLE_SIZE_EXCEEDED:
         case self::AS_END:
         case self::AS_BLANK_ARTICLE:
             return true;
         case self::AS_HOOK_ERROR:
             return false;
         case self::AS_PARSE_ERROR:
             $wgOut->addWikiText('<div class="error">' . $status->getWikiText() . '</div>');
             return true;
         case self::AS_SUCCESS_NEW_ARTICLE:
             $query = $resultDetails['redirect'] ? 'redirect=no' : '';
             $anchor = isset($resultDetails['sectionanchor']) ? $resultDetails['sectionanchor'] : '';
             $wgOut->redirect($this->mTitle->getFullURL($query) . $anchor);
             return false;
         case self::AS_SUCCESS_UPDATE:
             $extraQuery = '';
             $sectionanchor = $resultDetails['sectionanchor'];
             // Give extensions a chance to modify URL query on update
             wfRunHooks('ArticleUpdateBeforeRedirect', array($this->mArticle, &$sectionanchor, &$extraQuery));
             if ($resultDetails['redirect']) {
                 if ($extraQuery == '') {
                     $extraQuery = 'redirect=no';
                 } else {
                     $extraQuery = 'redirect=no&' . $extraQuery;
                 }
             }
             $wgOut->redirect($this->mTitle->getFullURL($extraQuery) . $sectionanchor);
             return false;
         case self::AS_SPAM_ERROR:
             $this->spamPageWithContent($resultDetails['spam']);
             return false;
         case self::AS_BLOCKED_PAGE_FOR_USER:
             throw new UserBlockedError($wgUser->getBlock());
         case self::AS_IMAGE_REDIRECT_ANON:
         case self::AS_IMAGE_REDIRECT_LOGGED:
             throw new PermissionsError('upload');
         case self::AS_READ_ONLY_PAGE_ANON:
         case self::AS_READ_ONLY_PAGE_LOGGED:
             throw new PermissionsError('edit');
         case self::AS_READ_ONLY_PAGE:
             throw new ReadOnlyError();
         case self::AS_RATE_LIMITED:
             throw new ThrottledError();
         case self::AS_NO_CREATE_PERMISSION:
             $permission = $this->mTitle->isTalkPage() ? 'createtalk' : 'createpage';
             throw new PermissionsError($permission);
         case self::AS_NO_CHANGE_CONTENT_MODEL:
             throw new PermissionsError('editcontentmodel');
         default:
             // We don't recognize $status->value. The only way that can happen
             // is if an extension hook aborted from inside ArticleSave.
             // Render the status object into $this->hookError
             // FIXME this sucks, we should just use the Status object throughout
             $this->hookError = '<div class="error">' . $status->getWikitext() . '</div>';
             return true;
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:86,代码来源:EditPage.php

示例13: getPreviewText

 /**
  * Get the rendered text for previewing.
  * @return string
  */
 function getPreviewText()
 {
     wfProfileIn(__METHOD__);
     // Wikia change begin
     global $wgEnableSlowPagesBlacklistExt;
     if (!empty($wgEnableSlowPagesBlacklistExt)) {
         global $wgSlowPagesBlacklist;
         if (in_array($this->mTitle->getFullURL(), $wgSlowPagesBlacklist)) {
             wfProfileOut(__METHOD__);
             return sprintf('<div class="previewnote">%s</div>', wfMessage('slowpagesblacklist-preview-unavailable')->plain());
         }
     }
     // Wikia change end
     global $wgOut, $wgUser, $wgParser, $wgRawHtml;
     // wikia change begin
     // TODO: remove?
     // @see https://trac.wikia-inc.com/changeset/6028
     global $wgRequest;
     if ($wgUser->getGlobalPreference('showtoolbar') && !$wgUser->getGlobalPreference('riched_disable') && !$this->previewOnOpen()) {
         $oldTextBox1 = $this->textbox1;
         $this->importFormData($wgRequest);
     }
     // wikia change end
     if ($wgRawHtml && !$this->mTokenOk) {
         // Could be an offsite preview attempt. This is very unsafe if
         // HTML is enabled, as it could be an attack.
         $parsedNote = '';
         if ($this->textbox1 !== '') {
             // Do not put big scary notice, if previewing the empty
             // string, which happens when you initially edit
             // a category page, due to automatic preview-on-open.
             $parsedNote = $wgOut->parse("<div class='previewnote'>" . wfMsg('session_fail_preview_html') . "</div>", true, true);
         }
         wfProfileOut(__METHOD__);
         return $parsedNote;
     }
     if ($this->mTriedSave && !$this->mTokenOk) {
         if ($this->mTokenOkExceptSuffix) {
             $note = wfMsg('token_suffix_mismatch');
         } else {
             $note = wfMsg('session_fail_preview');
         }
     } elseif ($this->incompleteForm) {
         $note = wfMsg('edit_form_incomplete');
     } else {
         $note = wfMsg('previewnote');
     }
     $parserOptions = ParserOptions::newFromUser($wgUser);
     $parserOptions->setEditSection(false);
     $parserOptions->setTidy(true);
     $parserOptions->setIsPreview(true);
     $parserOptions->setIsSectionPreview(!is_null($this->section) && $this->section !== '');
     # don't parse non-wikitext pages, show message about preview
     # XXX: stupid php bug won't let us use $this->getContextTitle()->isCssJsSubpage() here -- This note has been there since r3530. Sure the bug was fixed time ago?
     if ($this->isCssJsSubpage || !$this->mTitle->isWikitextPage()) {
         if ($this->mTitle->isCssJsSubpage()) {
             $level = 'user';
         } elseif ($this->mTitle->isCssOrJsPage()) {
             $level = 'site';
         } else {
             $level = false;
         }
         # Used messages to make sure grep find them:
         # Messages: usercsspreview, userjspreview, sitecsspreview, sitejspreview
         if ($level) {
             if (preg_match("/\\.css\$/", $this->mTitle->getText())) {
                 $previewtext = "<div id='mw-{$level}csspreview'>\n" . wfMsg("{$level}csspreview") . "\n</div>";
                 $class = "mw-code mw-css";
             } elseif (preg_match("/\\.js\$/", $this->mTitle->getText())) {
                 $previewtext = "<div id='mw-{$level}jspreview'>\n" . wfMsg("{$level}jspreview") . "\n</div>";
                 $class = "mw-code mw-js";
             } else {
                 throw new MWException('A CSS/JS (sub)page but which is not css nor js!');
             }
         }
         $parserOutput = $wgParser->parse($previewtext, $this->mTitle, $parserOptions);
         $previewHTML = $parserOutput->mText;
         $previewHTML .= "<pre class=\"{$class}\" dir=\"ltr\">\n" . htmlspecialchars($this->textbox1) . "\n</pre>\n";
     } else {
         $rt = Title::newFromRedirectArray($this->textbox1);
         if ($rt) {
             $previewHTML = $this->mArticle->viewRedirect($rt, false);
         } else {
             $toparse = $this->textbox1;
             # If we're adding a comment, we need to show the
             # summary as the headline
             if ($this->section == "new" && $this->summary != "") {
                 $toparse = wfMsgForContent('newsectionheaderdefaultlevel', $this->summary) . "\n\n" . $toparse;
             }
             wfRunHooks('EditPageGetPreviewText', array($this, &$toparse));
             $parserOptions->enableLimitReport();
             $toparse = $wgParser->preSaveTransform($toparse, $this->mTitle, $wgUser, $parserOptions);
             $parserOutput = $wgParser->parse($toparse, $this->mTitle, $parserOptions);
             $previewHTML = $parserOutput->getText();
             $this->mParserOutput = $parserOutput;
             $wgOut->addParserOutputNoText($parserOutput);
//.........这里部分代码省略.........
开发者ID:Tjorriemorrie,项目名称:app,代码行数:101,代码来源:EditPage.php

示例14: getFooterMessages

 protected function getFooterMessages()
 {
     $unwatchUrl = $this->title->getFullURL(['action' => 'unwatch']);
     $footerMessages = [$this->getMessage('emailext-unfollow-text', $unwatchUrl, $this->title->getPrefixedText())->parse()];
     return array_merge($footerMessages, parent::getFooterMessages());
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:6,代码来源:WallMessageController.class.php

示例15: getFooterMessages

 protected function getFooterMessages()
 {
     $footerMessages = [$this->getMessage('emailext-unfollow-text', $this->categoryPage->getFullURL('action=unwatch'), $this->categoryPage->getPrefixedText())->parse()];
     return array_merge($footerMessages, parent::getFooterMessages());
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:5,代码来源:CategoryAddController.class.php


注:本文中的Title::getFullURL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。