From: Magnus Manske Date: Wed, 12 Apr 2006 10:59:21 +0000 (+0000) Subject: simple fixes for DISPLAYTITLE X-Git-Tag: 1.31.0-rc.0~57509 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=bf4cd7087d69791c6380e5548afd67b49251f301;p=lhc%2Fweb%2Fwiklou.git simple fixes for DISPLAYTITLE --- diff --git a/includes/Parser.php b/includes/Parser.php index 7a2c92cede..1cdab61fc4 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -2441,7 +2441,7 @@ class Parser * @access private */ function braceSubstitution( $piece ) { - global $wgContLang, $wgAllowDisplayTitle; + global $wgContLang, $wgAllowDisplayTitle, $action; $fname = 'Parser::braceSubstitution'; wfProfileIn( $fname ); @@ -2613,27 +2613,30 @@ class Parser } # DISPLAYTITLE - if ( !$found && $argc == 1 && $wgAllowDisplayTitle ) { - global $wgOut; - - # Only the first one counts... - if ( $wgOut->mPageLinkTitle == "" ) { - $param = $args[0]; - $parserOptions = new ParserOptions; - $local_parser = new Parser (); - $t2 = $local_parser->parse ( $param, $this->mTitle, $parserOptions, false ); - $wgOut->mPageLinkTitle = $wgOut->getPageTitle(); - $wgOut->mPagetitle = $t2->GetText(); - - # Add subtitle - $t = $this->mTitle->getPrefixedText(); - $st = trim ( $wgOut->getSubtitle () ); - if ( $st != "" ) $st .= " "; - $st .= str_replace ( "$1", $t, wfMsg('displaytitle') ); - $wgOut->setSubtitle ( $st ); + if ( !$found && $argc == 1 && $wgAllowDisplayTitle && $action == "view" ) { + $mwDT =& MagicWord::get( MAG_DISPLAYTITLE ); + if ( $mwDT->matchStartAndRemove( $part1 ) ) { + global $wgOut; + + # Only the first one counts... + if ( $wgOut->mPageLinkTitle == "" ) { + $param = $args[0]; + $parserOptions = new ParserOptions; + $local_parser = new Parser (); + $t2 = $local_parser->parse ( $param, $this->mTitle, $parserOptions, false ); + $wgOut->mPageLinkTitle = $wgOut->getPageTitle(); + $wgOut->mPagetitle = $t2->GetText(); + + # Add subtitle + $t = $this->mTitle->getPrefixedText(); + $st = trim ( $wgOut->getSubtitle () ); + if ( $st != "" ) $st .= " "; + $st .= wfMsg('displaytitle', $t); + $wgOut->setSubtitle ( $st ); + } + $text = "" ; + $found = true ; } - $text = "" ; - $found = true ; } # Extensions