本文整理汇总了PHP中Title::getFullUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Title::getFullUrl方法的具体用法?PHP Title::getFullUrl怎么用?PHP Title::getFullUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Title
的用法示例。
在下文中一共展示了Title::getFullUrl方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getURL
/**
* Return absolute URL to a page to be shared (uses wgTitle)
* The path component of the URL is urlencoded to prevent confusion between sharing services
* @return string URL to be shared
*/
protected function getURL()
{
$path = $this->title->getLocalUrl();
$paths = explode('/', $path);
foreach ($paths as $index => $section) {
$paths[$index] = urlencode($section);
}
return str_replace($path, implode('/', $paths), $this->title->getFullUrl());
}
示例2: notfound
public function notfound()
{
global $wgHubRssFeeds;
$url = $this->currentTitle->getFullUrl();
$links = [];
foreach ($wgHubRssFeeds as $feedName) {
$links[] = $url . '/' . $feedName;
}
$this->setVal('links', $links);
$this->wg->SupressPageSubtitle = true;
}
示例3: isLocalSource
/**
* Check if the given local page title is a spam regex source.
* @param Title $title
* @return bool
*/
function isLocalSource($title)
{
global $wgDBname;
if ($title->getNamespace() == NS_MEDIAWIKI) {
$sources = array("Spam-blacklist", "Spam-whitelist");
if (in_array($title->getDBkey(), $sources)) {
return true;
}
}
$thisHttp = wfExpandUrl($title->getFullUrl('action=raw'), PROTO_HTTP);
$thisHttpRegex = '/^' . preg_quote($thisHttp, '/') . '(?:&.*)?$/';
foreach ($this->files as $fileName) {
$matches = array();
if (preg_match('/^DB: (\\w*) (.*)$/', $fileName, $matches)) {
if ($wgDBname == $matches[1]) {
if ($matches[2] == $title->getPrefixedDbKey()) {
// Local DB fetch of this page...
return true;
}
}
} elseif (preg_match($thisHttpRegex, $fileName)) {
// Raw view of this page
return true;
}
}
return false;
}
示例4: readOnlyPage
/**
* Show a read-only error
* Parameters are the same as OutputPage:readOnlyPage()
* Redirect to the article page if redlink=1
*/
function readOnlyPage($source = null, $protected = false, $reasons = array(), $action = null)
{
global $wgRequest, $wgOut;
if ($wgRequest->getBool('redlink')) {
// The edit page was reached via a red link.
// Redirect to the article page and let them click the edit tab if
// they really want a permission error.
$wgOut->redirect($this->mTitle->getFullUrl());
} else {
$wgOut->readOnlyPage($source, $protected, $reasons, $action);
}
}
示例5: editPage
/**
* editPage -- show edit form
*
* @access public
*
* @return String
*/
public function editPage()
{
global $wgStylePath;
wfProfileIn(__METHOD__);
$text = '';
$this->load(true);
if ($this->canEdit()) {
$vars = ['canEdit' => $this->canEdit(), 'comment' => htmlentities(ArticleCommentsAjax::getConvertedContent($this->mLastRevision->getText())), 'isReadOnly' => wfReadOnly(), 'isMiniEditorEnabled' => ArticleComment::isMiniEditorEnabled(), 'stylePath' => $wgStylePath, 'articleId' => $this->mTitle->getArticleId(), 'articleFullUrl' => $this->mTitle->getFullUrl()];
$text = F::app()->getView('ArticleComments', 'Edit', $vars)->render();
}
wfProfileOut(__METHOD__);
return $text;
}
示例6: isLocalSource
/**
* Check if the given local page title is a spam regex source.
*
* @param Title $title
* @return bool
*/
public static function isLocalSource( $title ) {
global $wgDBname, $wgBlacklistSettings;
if( $title->getNamespace() == NS_MEDIAWIKI ) {
$sources = array();
foreach ( self::$blacklistTypes as $type => $class ) {
$type = ucfirst( $type );
$sources += array(
"$type-blacklist",
"$type-whitelist"
);
}
if( in_array( $title->getDBkey(), $sources ) ) {
return true;
}
}
$thisHttp = wfExpandUrl( $title->getFullUrl( 'action=raw' ), PROTO_HTTP );
$thisHttpRegex = '/^' . preg_quote( $thisHttp, '/' ) . '(?:&.*)?$/';
$files = array();
foreach ( self::$blacklistTypes as $type => $class ) {
if ( isset( $wgBlacklistSettings[$type]['files'] ) ) {
$files += $wgBlacklistSettings[$type]['files'];
}
}
foreach( $files as $fileName ) {
$matches = array();
if ( preg_match( '/^DB: (\w*) (.*)$/', $fileName, $matches ) ) {
if ( $wgDBname == $matches[1] ) {
if( $matches[2] == $title->getPrefixedDbKey() ) {
// Local DB fetch of this page...
return true;
}
}
} elseif( preg_match( $thisHttpRegex, $fileName ) ) {
// Raw view of this page
return true;
}
}
return false;
}
示例7: addReturnTo
/**
* Add a "return to" link pointing to a specified title
*
* @param Title $title Title to link
*/
public function addReturnTo($title)
{
global $wgUser;
$this->addLink(array('rel' => 'next', 'href' => $title->getFullUrl()));
$link = wfMsg('returnto', $wgUser->getSkin()->makeLinkObj($title));
$this->addHTML("<p>{$link}</p>\n");
}
示例8: composeCommonMailtext
/**
* Generate the generic "this page has been changed" e-mail text.
*/
private function composeCommonMailtext()
{
$this->composedCommon = true;
$action = strtolower($this->action);
$subject = wfMessage('enotif_subject_' . $action)->inContentLanguage()->text();
if (wfEmptyMsg('enotif_subject_' . $action, $subject)) {
$subject = wfMessage('enotif_subject')->inContentLanguage()->text();
}
list($body, $bodyHTML) = wfMsgHTMLwithLanguageAndAlternative('enotif_body' . ($action == '' ? '' : '_' . $action), 'enotif_body', F::app()->wg->LanguageCode);
# You as the WikiAdmin and Sysops can make use of plenty of
# named variables when composing your notification emails while
# simply editing the Meta pages
$keys = [];
$postTransformKeys = [];
if ($this->isNewPage()) {
// watchlist link tracking
list($keys['$NEWPAGE'], $keys['$NEWPAGEHTML']) = wfMsgHTMLwithLanguageAndAlternative('enotif_lastvisited', 'enotif_lastvisited', F::app()->wg->LanguageCode, [], $this->title->getFullUrl('s=wldiff&diff=0&previousRevId=' . $this->previousRevId));
$keys['$OLDID'] = $this->previousRevId;
$keys['$CHANGEDORCREATED'] = wfMessage('changed')->inContentLanguage()->plain();
} else {
if ($action == '') {
// no previousRevId + empty action = create edit, ok to use newpagetext
$keys['$NEWPAGEHTML'] = $keys['$NEWPAGE'] = wfMessage('enotif_newpagetext')->inContentLanguage()->plain();
} else {
// no previousRevId + action = event, dont show anything, confuses users
$keys['$NEWPAGEHTML'] = $keys['$NEWPAGE'] = '';
}
# clear $OLDID placeholder in the message template
$keys['$OLDID'] = '';
$keys['$CHANGEDORCREATED'] = wfMessage('created')->inContentLanguage()->plain();
}
$keys['$PAGETITLE'] = $this->title->getPrefixedText();
$keys['$PAGETITLE_URL'] = $this->title->getCanonicalUrl('s=wl');
$keys['$PAGEMINOREDIT'] = $this->minorEdit ? wfMessage('minoredit')->inContentLanguage()->plain() : '';
$keys['$UNWATCHURL'] = $this->title->getCanonicalUrl('action=unwatch');
$keys['$ACTION'] = $this->action;
// Hook registered in FollowHelper -- used for blogposts and categoryAdd
wfRunHooks('MailNotifyBuildKeys', [&$keys, $this->action, $this->otherParam]);
if ($this->editor->isAnon()) {
# real anon (user:xxx.xxx.xxx.xxx)
$keys['$PAGEEDITOR'] = wfMessage('enotif_anon_editor', $this->editor->getName())->inContentLanguage()->plain();
$keys['$PAGEEDITOR_EMAIL'] = wfMessage('noemailtitle')->inContentLanguage()->plain();
} else {
$keys['$PAGEEDITOR'] = F::app()->wg->EnotifUseRealName ? $this->editor->getRealName() : $this->editor->getName();
$emailPage = SpecialPage::getSafeTitleFor('Emailuser', $this->editor->getName());
$keys['$PAGEEDITOR_EMAIL'] = $emailPage->getCanonicalUrl();
}
$keys['$PAGEEDITOR_WIKI'] = $this->editor->getUserPage()->getCanonicalUrl();
$summary = $this->summary == '' ? wfMessage('enotif_no_summary')->inContentLanguage()->plain() : '"' . $this->summary . '"';
$postTransformKeys['$PAGESUMMARY'] = $summary;
// Now build message's subject and body
// ArticleComment -- updates subject and $keys['$PAGEEDITOR'] if anon editor
// EmailTemplatesHooksHelper -- updates subject if blogpost
// TopListHelper -- updates subject if title is toplist
wfRunHooks('ComposeCommonSubjectMail', [$this->title, &$keys, &$subject, $this->editor]);
$subject = strtr($subject, $keys);
$subject = MessageCache::singleton()->transform($subject, false, null, $this->title);
$this->subject = strtr($subject, $postTransformKeys);
// ArticleComment -- updates body and $keys['$PAGEEDITOR'] if anon editor
// EmailTemplatesHooksHelper -- changes body to blog post. EmailTemplates only enabled on community and messaging so this tranforms
// any watched page email coming from Community to a blog post (I think)
// TopListHelper -- updates body if title is toplist
wfRunHooks('ComposeCommonBodyMail', [$this->title, &$keys, &$body, $this->editor, &$bodyHTML, &$postTransformKeys]);
$body = strtr($body, $keys);
$body = MessageCache::singleton()->transform($body, false, null, $this->title);
$this->body = wordwrap(strtr($body, $postTransformKeys), 72);
if ($bodyHTML) {
$bodyHTML = strtr($bodyHTML, $keys);
$bodyHTML = MessageCache::singleton()->transform($bodyHTML, false, null, $this->title);
$this->bodyHTML = strtr($bodyHTML, $postTransformKeys);
}
}
示例9: getDiffLink
/**
* Generates a diff link. Used when the full diff is not wanted for example
* when $wgFeedDiffCutoff is 0.
*
* @param $title Title object: used to generate the diff URL
* @param $newid Integer newid for this diff
* @param $oldid Integer|null oldid for the diff. Null means it is a new article
* @return string
*/
protected static function getDiffLink(Title $title, $newid, $oldid = null)
{
$queryParameters = $oldid == null ? "diff={$newid}" : "diff={$newid}&oldid={$oldid}";
$diffUrl = $title->getFullUrl($queryParameters);
$diffLink = Html::element('a', array('href' => $diffUrl), wfMessage('showdiff')->inContentLanguage()->text());
return $diffLink;
}
示例10:
function __construct($index, Title $title = null, $invalidMarkup = null)
{
parent::__construct("Invalid Lite Semantics markup at index {$index}" . !empty($invalidMarkup) ? ": <pre>{$invalidMarkup}</pre>" : '' . $title instanceof Title ? ' (URL: ' . $title->getFullUrl() . ')' : '');
}
示例11: redirect
/**
* Redirect to a given page
*
* @param object $title Title object
*/
private static function redirect(Title &$title)
{
global $wgOut;
$wgOut->redirect($title->getFullUrl());
}
示例12: readOnlyPage
/**
* Show a read-only error
* Parameters are the same as OutputPage:readOnlyPage()
* Redirect to the article page if redlink=1
* @deprecated in 1.19; use displayPermissionsError() instead
*/
function readOnlyPage($source = null, $protected = false, $reasons = array(), $action = null)
{
wfDeprecated(__METHOD__, '1.19');
global $wgRequest;
// Wikia - start - @author: ADi - removed wgOut from global to allow injecting it
// define wgOut
$wgOut = !empty($this->customOutputPage) ? $this->customOutputPage : $GLOBALS['wgOut'];
// Wikia - end
if ($wgRequest->getBool('redlink')) {
// The edit page was reached via a red link.
// Redirect to the article page and let them click the edit tab if
// they really want a permission error.
$wgOut->redirect($this->mTitle->getFullUrl());
} else {
$wgOut->readOnlyPage($source, $protected, $reasons, $action);
}
}
示例13: testGetRedirectUrl
/**
* @param string $page
* @param string $queryString
* @param string $extraQueryString
* @param int $cbVal
* @param Title $actualTitle
* @param string $actualQueryString
*
* @dataProvider getRedirectUrlDataProvider
*/
public function testGetRedirectUrl($page, $queryString, $extraQueryString, $cbVal, Title $actualTitle, $actualQueryString)
{
$request = F::app()->wg->Request;
$request->setVal('returnto', $page);
$request->setVal('returntoquery', $queryString);
$userLoginHelper = new UserLoginHelper();
$testUrl = $userLoginHelper->getRedirectUrl($extraQueryString, $cbVal);
$actualUrl = $actualTitle->getFullUrl($actualQueryString);
$this->assertEquals($testUrl, $actualUrl);
}
示例14: composeCommonMailtext
/**
* Generate the generic "this page has been changed" e-mail text.
*/
private function composeCommonMailtext()
{
global $wgPasswordSender, $wgPasswordSenderName, $wgNoReplyAddress;
global $wgEnotifFromEditor, $wgEnotifRevealEditorAddress;
global $wgEnotifImpersonal, $wgEnotifUseRealName;
global $wgLanguageCode;
$this->composed_common = true;
# <Wikia>
$action = strtolower($this->action);
$subject = wfMsgForContent('enotif_subject_' . $action);
if (wfEmptyMsg('enotif_subject_' . $action, $subject)) {
$subject = wfMsgForContent('enotif_subject');
}
list($body, $bodyHTML) = wfMsgHTMLwithLanguageAndAlternative('enotif_body' . ($action == '' ? '' : '_' . $action), 'enotif_body', $wgLanguageCode);
# </Wikia>
# You as the WikiAdmin and Sysops can make use of plenty of
# named variables when composing your notification emails while
# simply editing the Meta pages
$keys = array();
$postTransformKeys = array();
if ($this->oldid) {
if ($wgEnotifImpersonal) {
// For impersonal mail, show a diff link to the last revision.
$keys['$NEWPAGE'] = wfMsgForContent('enotif_lastdiff', $this->title->getCanonicalUrl('diff=next&oldid=' . $this->oldid));
} else {
/* WIKIA change, watchlist link tracking, rt#33913 */
list($keys['$NEWPAGE'], $keys['$NEWPAGEHTML']) = wfMsgHTMLwithLanguageAndAlternative('enotif_lastvisited', 'enotif_lastvisited', $wgLanguageCode, array(), $this->title->getFullUrl('s=wldiff&diff=0&oldid=' . $this->oldid));
# </Wikia>
}
$keys['$OLDID'] = $this->oldid;
$keys['$CHANGEDORCREATED'] = wfMsgForContent('changed');
} else {
# <Wikia>
if ($action == '') {
//no oldid + empty action = create edit, ok to use newpagetext
$keys['$NEWPAGEHTML'] = $keys['$NEWPAGE'] = wfMsgForContent('enotif_newpagetext');
} else {
//no oldid + action = event, dont show anything, confuses users
$keys['$NEWPAGEHTML'] = $keys['$NEWPAGE'] = '';
}
# </Wikia>
# clear $OLDID placeholder in the message template
$keys['$OLDID'] = '';
$keys['$CHANGEDORCREATED'] = wfMsgForContent('created');
}
$keys['$PAGETITLE'] = $this->title->getPrefixedText();
$keys['$PAGETITLE_URL'] = $this->title->getCanonicalUrl('s=wl');
$keys['$PAGEMINOREDIT'] = $this->minorEdit ? wfMsgForContent('minoredit') : '';
$keys['$UNWATCHURL'] = $this->title->getCanonicalUrl('action=unwatch');
# <Wikia>
$keys['$ACTION'] = $this->action;
wfRunHooks('MailNotifyBuildKeys', array(&$keys, $this->action, $this->other_param));
# </Wikia>
if ($this->editor->isAnon()) {
# real anon (user:xxx.xxx.xxx.xxx)
$keys['$PAGEEDITOR'] = wfMsgForContent('enotif_anon_editor', $this->editor->getName());
$keys['$PAGEEDITOR_EMAIL'] = wfMsgForContent('noemailtitle');
} else {
$keys['$PAGEEDITOR'] = $wgEnotifUseRealName ? $this->editor->getRealName() : $this->editor->getName();
$emailPage = SpecialPage::getSafeTitleFor('Emailuser', $this->editor->getName());
$keys['$PAGEEDITOR_EMAIL'] = $emailPage->getCanonicalUrl();
}
$keys['$PAGEEDITOR_WIKI'] = $this->editor->getUserPage()->getCanonicalUrl();
# <Wikia>
// RT #1294 Bartek 07.05.2009, use the language of the wiki
$summary = $this->summary == '' ? wfMsgForContent('enotif_no_summary') : '"' . $this->summary . '"';
# </Wikia>
# Replace this after transforming the message, bug 35019
$postTransformKeys['$PAGESUMMARY'] = $summary;
# Now build message's subject and body
# <Wikia>
wfRunHooks('ComposeCommonSubjectMail', array($this->title, &$keys, &$subject, $this->editor));
# </Wikia>
$subject = strtr($subject, $keys);
$subject = MessageCache::singleton()->transform($subject, false, null, $this->title);
$this->subject = strtr($subject, $postTransformKeys);
wfRunHooks('ComposeCommonBodyMail', array($this->title, &$keys, &$body, $this->editor, &$bodyHTML, &$postTransformKeys));
$body = strtr($body, $keys);
$body = MessageCache::singleton()->transform($body, false, null, $this->title);
$this->body = wordwrap(strtr($body, $postTransformKeys), 72);
# <Wikia>
if ($bodyHTML) {
$bodyHTML = strtr($bodyHTML, $keys);
$bodyHTML = MessageCache::singleton()->transform($bodyHTML, false, null, $this->title);
$this->bodyHTML = strtr($bodyHTML, $postTransformKeys);
}
# </Wikia>
# Reveal the page editor's address as REPLY-TO address only if
# the user has not opted-out and the option is enabled at the
# global configuration level.
$adminAddress = new MailAddress($wgPasswordSender, $wgPasswordSenderName);
if ($wgEnotifRevealEditorAddress && $this->editor->getEmail() != '' && $this->editor->getOption('enotifrevealaddr')) {
$editorAddress = new MailAddress($this->editor);
if ($wgEnotifFromEditor) {
$this->from = $editorAddress;
} else {
$this->from = $adminAddress;
//.........这里部分代码省略.........