r13607 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r13606‎ | r13607 | r13608 >
Date:10:59, 12 April 2006
Author:magnusmanske
Status:old
Tags:
Comment:
simple fixes for DISPLAYTITLE
Modified paths:
  • /trunk/phase3/includes/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -2441,7 +2441,7 @@
24422442 * @access private
24432443 */
24442444 function braceSubstitution( $piece ) {
2445 - global $wgContLang, $wgAllowDisplayTitle;
 2445+ global $wgContLang, $wgAllowDisplayTitle, $action;
24462446 $fname = 'Parser::braceSubstitution';
24472447 wfProfileIn( $fname );
24482448
@@ -2613,27 +2613,30 @@
26142614 }
26152615
26162616 # 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();
2628 -
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 );
 2617+ if ( !$found && $argc == 1 && $wgAllowDisplayTitle && $action == "view" ) {
 2618+ $mwDT =& MagicWord::get( MAG_DISPLAYTITLE );
 2619+ if ( $mwDT->matchStartAndRemove( $part1 ) ) {
 2620+ global $wgOut;
 2621+
 2622+ # Only the first one counts...
 2623+ if ( $wgOut->mPageLinkTitle == "" ) {
 2624+ $param = $args[0];
 2625+ $parserOptions = new ParserOptions;
 2626+ $local_parser = new Parser ();
 2627+ $t2 = $local_parser->parse ( $param, $this->mTitle, $parserOptions, false );
 2628+ $wgOut->mPageLinkTitle = $wgOut->getPageTitle();
 2629+ $wgOut->mPagetitle = $t2->GetText();
 2630+
 2631+ # Add subtitle
 2632+ $t = $this->mTitle->getPrefixedText();
 2633+ $st = trim ( $wgOut->getSubtitle () );
 2634+ if ( $st != "" ) $st .= " ";
 2635+ $st .= wfMsg('displaytitle', $t);
 2636+ $wgOut->setSubtitle ( $st );
 2637+ }
 2638+ $text = "" ;
 2639+ $found = true ;
26352640 }
2636 - $text = "" ;
2637 - $found = true ;
26382641 }
26392642
26402643 # Extensions

Status & tagging log