MediaWiki r13572 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r13571‎ | r13572 (on ViewVC)‎ | r13573 >
Date:10:16, 11 April 2006
Author:magnusmanske
Status:old
Tags:
Comment:
New DISPLAYTITLE magic template; decativated by default so not to scare Brion
Modified paths:

Diff [purge]

Index: trunk/phase3/skins/MonoBook.php
@@ -93,7 +93,7 @@
9494 <div id="content">
9595 <a name="top" id="top"></a>
9696 <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
97 - <h1 class="firstHeading"><?php $this->text('title') ?></h1>
 97+ <h1 class="firstHeading"><?php $this->data['displaytitle']!=""?$this->text('title'):$this->html('title') ?></h1>
9898 <div id="bodyContent">
9999 <h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
100100 <div id="contentSub"><?php $this->html('subtitle') ?></div>
Index: trunk/phase3/includes/Parser.php
@@ -2441,7 +2441,7 @@
24422442 * @access private
24432443 */
24442444 function braceSubstitution( $piece ) {
2445 - global $wgContLang;
 2445+ global $wgContLang, $wgAllowDisplayTitle;
24462446 $fname = 'Parser::braceSubstitution';
24472447 wfProfileIn( $fname );
24482448
@@ -2611,7 +2611,31 @@
26122612 $found = true;
26132613 }
26142614 }
 2615+
 2616+ # DISPLAYTITLE
 2617+ if ( !$found && $argc == 1 && $wgAllowDisplayTitle ) {
 2618+ global $wgOut;
 2619+
 2620+ # Only the first one counts...
 2621+ if ( $wgOut->mPageLinkTitle == "" ) {
 2622+ $param = $args[0];
 2623+ $parserOptions = new ParserOptions;
 2624+ $local_parser = new Parser ();
 2625+ $t2 = $local_parser->parse ( $param, $this->mTitle, $parserOptions, false );
 2626+ $wgOut->mPageLinkTitle = $wgOut->getPageTitle();
 2627+ $wgOut->mPagetitle = $t2->GetText();
26152628
 2629+ # Add subtitle
 2630+ $t = $this->mTitle->getPrefixedText();
 2631+ $st = trim ( $wgOut->getSubtitle () );
 2632+ if ( $st != "" ) $st .= " ";
 2633+ $st .= str_replace ( "$1", $t, wfMsg('displaytitle') );
 2634+ $wgOut->setSubtitle ( $st );
 2635+ }
 2636+ $text = "" ;
 2637+ $found = true ;
 2638+ }
 2639+
26162640 # Extensions
26172641 if ( !$found ) {
26182642 $colonPos = strpos( $part1, ':' );
Index: trunk/phase3/includes/OutputPage.php
@@ -18,7 +18,7 @@
1919 var $mHTMLtitle, $mRobotpolicy, $mIsarticle, $mPrintable;
2020 var $mSubtitle, $mRedirect, $mStatusCode;
2121 var $mLastModified, $mETag, $mCategoryLinks;
22 - var $mScripts, $mLinkColours;
 22+ var $mScripts, $mLinkColours, $mPageLinkTitle;
2323
2424 var $mSuppressQuickbar;
2525 var $mOnloadHandler;
@@ -40,11 +40,11 @@
4141 $this->mHTMLtitle = $this->mPagetitle = $this->mBodytext =
4242 $this->mRedirect = $this->mLastModified =
4343 $this->mSubtitle = $this->mDebugtext = $this->mRobotpolicy =
44 - $this->mOnloadHandler = '';
 44+ $this->mOnloadHandler = $this->mPageLinkTitle = '';
4545 $this->mIsArticleRelated = $this->mIsarticle = $this->mPrintable = true;
4646 $this->mSuppressQuickbar = $this->mPrintable = false;
4747 $this->mLanguageLinks = array();
48 - $this->mCategoryLinks = array() ;
 48+ $this->mCategoryLinks = array();
4949 $this->mDoNothing = false;
5050 $this->mContainsOldMagic = $this->mContainsNewMagic = 0;
5151 $this->mParserOptions = ParserOptions::newFromUser( $temp = NULL );
@@ -54,7 +54,7 @@
5555 $this->mRevisionId = null;
5656 }
5757
58 - function addHeader( $name, $val ) { array_push( $this->mHeaders, $name.': '.$val ) ; }
 58+ function addHeader( $name, $val ) { array_push( $this->mHeaders, $name.': '.$val ); }
5959 function redirect( $url, $responsecode = '302' ) { $this->mRedirect = $url; $this->mRedirectCode = $responsecode; }
6060 function setStatusCode( $statusCode ) { $this->mStatusCode = $statusCode; }
6161
@@ -821,9 +821,9 @@
822822
823823 if( is_string( $source ) ) {
824824 if( strcmp( $source, '' ) == 0 ) {
825 - global $wgTitle ;
 825+ global $wgTitle;
826826 if ( $wgTitle->getNamespace() == NS_MEDIAWIKI ) {
827 - $source = wfMsgWeirdKey ( $wgTitle->getText() ) ;
 827+ $source = wfMsgWeirdKey ( $wgTitle->getText() );
828828 } else {
829829 $source = wfMsg( $wgUser->isLoggedIn() ? 'noarticletext' : 'noarticletextanon' );
830830 }
Index: trunk/phase3/includes/MagicWord.php
@@ -72,6 +72,7 @@
7373 'MAG_RAW',
7474 'MAG_SUBPAGENAME',
7575 'MAG_SUBPAGENAMEE',
 76+ 'MAG_DISPLAYTITLE',
7677 );
7778 if ( ! defined( 'MEDIAWIKI_INSTALL' ) )
7879 wfRunHooks( 'MagicWordMagicWords', array( &$magicWords ) );
@@ -105,7 +106,8 @@
106107 MAG_CURRENTDOW,
107108 MAG_REVISIONID,
108109 MAG_SUBPAGENAME,
109 - MAG_SUBPAGENAMEE
 110+ MAG_SUBPAGENAMEE,
 111+ MAG_DISPLAYTITLE,
110112 );
111113 if ( ! defined( 'MEDIAWIKI_INSTALL' ) )
112114 wfRunHooks( 'MagicWordwgVariableIDs', array( &$wgVariableIDs ) );
Index: trunk/phase3/includes/SkinTemplate.php
@@ -187,6 +187,7 @@
188188 wfProfileIn( "$fname-stuff2" );
189189 $tpl->set( 'title', $wgOut->getPageTitle() );
190190 $tpl->set( 'pagetitle', $wgOut->getHTMLTitle() );
 191+ $tpl->set( 'displaytitle', $wgOut->mPageLinkTitle );
191192
192193 $tpl->setRef( "thispage", $this->thispage );
193194 $subpagestr = $this->subPageSubtitle();
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1920,5 +1920,9 @@
19211921 */
19221922 $wgAjaxExportList = array( 'wfSajaxSearch' );
19231923
 1924+/**
 1925+ * Allow DISPLAYTITLE to change title display
 1926+ */
 1927+$wgAllowDisplayTitle = false ;
19241928
19251929 ?>
Index: trunk/phase3/includes/Skin.php
@@ -686,7 +686,6 @@
687687
688688 function pageTitle() {
689689 global $wgOut;
690 -
691690 $s = '<h1 class="pagetitle">' . htmlspecialchars( $wgOut->getPageTitle() ) . '</h1>';
692691 return $s;
693692 }
Index: trunk/phase3/RELEASE-NOTES
@@ -43,6 +43,8 @@
4444 * Minor grammatical improvements in English language files
4545 * Display the anon talk page info message on anon talk pages again
4646 (moved outside the parser cache)
 47+* Optional {{DISPLAYTITLE|title with markup}} magic word
 48+ Deactivated by default, set "$wgAllowDisplayTitle = true" in LocalSettings.php to activate
4749
4850
4951 == Compatibility ==
Index: trunk/phase3/languages/Messages.php
@@ -2000,6 +2000,9 @@
20012001 'articletitles' => "Articles starting with ''$1''",
20022002 'hideresults' => 'Hide results',
20032003
 2004+# DISPLAYTITLE
 2005+'displaytitle' => '(Link to this page as [[$1]])',
 2006+
20042007 );
20052008
20062009
Index: trunk/phase3/languages/Language.php
@@ -265,6 +265,7 @@
266266 MAG_LC => array( 0, 'LC:' ),
267267 MAG_UC => array( 0, 'UC:' ),
268268 MAG_RAW => array( 0, 'RAW:' ),
 269+ MAG_DISPLAYTITLE => array( 1, 'DISPLAYTITLE' ),
269270 );
270271
271272 if (!$wgCachedMessageArrays) {

Status & tagging log

  • 01:58, 13 October 2010 ^demon (talk | contribs) changed the status of r13572 [removed: new added: old]