* (bug 16335) __NONEWSECTIONLINK__ magic word to suppress new section link.
Patch by Carlin: https://bugzilla.wikimedia.org/attachment.cgi?id=5680 With slight whitespace tweaks.
This commit is contained in:
parent
5a22b57fd1
commit
92079d3b1c
8 changed files with 36 additions and 5 deletions
1
CREDITS
1
CREDITS
|
|
@ -59,6 +59,7 @@ following names for their contribution to the product.
|
|||
* Brad Jorsch
|
||||
* Brent G
|
||||
* Brianna Laugher
|
||||
* Carlin
|
||||
* Daniel Arnold
|
||||
* Danny B.
|
||||
* FunPika
|
||||
|
|
|
|||
|
|
@ -197,6 +197,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
|
|||
* ForeignApiRepos now fetch MIME types, rather than trying to figure it locally
|
||||
* (bug 17570) $wgMaxRedirects is now correctly respected when following
|
||||
redirects (was previously one more than $wgMaxRedirects)
|
||||
* (bug 16335) __NONEWSECTIONLINK__ magic word to suppress new section link.
|
||||
|
||||
== API changes in 1.15 ==
|
||||
* (bug 16858) Revamped list=deletedrevs to make listing deleted contributions
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ class MagicWord {
|
|||
'numberofusers',
|
||||
'numberofactiveusers',
|
||||
'newsectionlink',
|
||||
'nonewsectionlink',
|
||||
'numberofpages',
|
||||
'currentversion',
|
||||
'basepagename',
|
||||
|
|
@ -160,6 +161,7 @@ class MagicWord {
|
|||
'toc',
|
||||
'noeditsection',
|
||||
'newsectionlink',
|
||||
'nonewsectionlink',
|
||||
'hiddencat',
|
||||
'index',
|
||||
'noindex',
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class OutputPage {
|
|||
var $mArticleBodyOnly = false;
|
||||
|
||||
var $mNewSectionLink = false;
|
||||
var $mHideNewSectionLink = false;
|
||||
var $mNoGallery = false;
|
||||
var $mPageTitleActionText = '';
|
||||
var $mParseWarnings = array();
|
||||
|
|
@ -516,6 +517,7 @@ class OutputPage {
|
|||
$this->mLanguageLinks += $parserOutput->getLanguageLinks();
|
||||
$this->addCategoryLinks( $parserOutput->getCategories() );
|
||||
$this->mNewSectionLink = $parserOutput->getNewSection();
|
||||
$this->mHideNewSectionLink = $parserOutput->getHideNewSection();
|
||||
|
||||
if( is_null( $wgExemptFromUserRobotsControl ) ) {
|
||||
$bannedNamespaces = $wgContentNamespaces;
|
||||
|
|
@ -1777,6 +1779,15 @@ class OutputPage {
|
|||
return $this->mNewSectionLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forcibly hide the new section link?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function forceHideNewSectionLink() {
|
||||
return $this->mHideNewSectionLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a warning about slave lag
|
||||
*
|
||||
|
|
|
|||
|
|
@ -690,11 +690,13 @@ class SkinTemplate extends Skin {
|
|||
);
|
||||
|
||||
if ( $istalk || $wgOut->showNewSectionLink() ) {
|
||||
$content_actions['addsection'] = array(
|
||||
'class' => $section == 'new'?'selected':false,
|
||||
'text' => wfMsg('addsection'),
|
||||
'href' => $this->mTitle->getLocalUrl( 'action=edit§ion=new' )
|
||||
);
|
||||
if ( !$wgOut->forceHideNewSectionLink() ) {
|
||||
$content_actions['addsection'] = array(
|
||||
'class' => $section == 'new' ? 'selected' : false,
|
||||
'text' => wfMsg('addsection'),
|
||||
'href' => $this->mTitle->getLocalUrl( 'action=edit§ion=new' )
|
||||
);
|
||||
}
|
||||
}
|
||||
} elseif ( $this->mTitle->isKnown() ) {
|
||||
$content_actions['viewsource'] = array(
|
||||
|
|
|
|||
|
|
@ -3388,6 +3388,12 @@ class Parser
|
|||
$this->mOutput->setNewSection( true );
|
||||
}
|
||||
|
||||
# Allow user to remove the "new section"
|
||||
# link via __NONEWSECTIONLINK__
|
||||
if ( isset( $this->mDoubleUnderscores['nonewsectionlink'] ) ) {
|
||||
$this->mOutput->hideNewSection( true );
|
||||
}
|
||||
|
||||
# if the string __FORCETOC__ (not case-sensitive) occurs in the HTML,
|
||||
# override above conditions and always show TOC above first header
|
||||
if ( isset( $this->mDoubleUnderscores['forcetoc'] ) ) {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class ParserOutput
|
|||
$mImages = array(), # DB keys of the images used, in the array key only
|
||||
$mExternalLinks = array(), # External link URLs, in the key only
|
||||
$mNewSection = false, # Show a new section link?
|
||||
$mHideNewSection = false, # Hide the new section link?
|
||||
$mNoGallery = false, # No gallery on category page? (__NOGALLERY__)
|
||||
$mHeadItems = array(), # Items to put in the <head> section
|
||||
$mOutputHooks = array(), # Hook tags as per $wgParserOutputHooks
|
||||
|
|
@ -80,6 +81,12 @@ class ParserOutput
|
|||
function setNewSection( $value ) {
|
||||
$this->mNewSection = (bool)$value;
|
||||
}
|
||||
function hideNewSection ( $value ) {
|
||||
$this->mHideNewSection = (bool)$value;
|
||||
}
|
||||
function getHideNewSection () {
|
||||
return (bool)$this->mHideNewSection;
|
||||
}
|
||||
function getNewSection() {
|
||||
return (bool)$this->mNewSection;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -311,6 +311,7 @@ $magicWords = array(
|
|||
'displaytitle' => array( 1, 'DISPLAYTITLE' ),
|
||||
'rawsuffix' => array( 1, 'R' ),
|
||||
'newsectionlink' => array( 1, '__NEWSECTIONLINK__' ),
|
||||
'nonewsectionlink' => array( 1, '__NONEWSECTIONLINK__' ),
|
||||
'currentversion' => array( 1, 'CURRENTVERSION' ),
|
||||
'urlencode' => array( 0, 'URLENCODE:' ),
|
||||
'anchorencode' => array( 0, 'ANCHORENCODE' ),
|
||||
|
|
|
|||
Loading…
Reference in a new issue