Index: trunk/phase3/skins/MonoBook.php |
— | — | @@ -115,7 +115,7 @@ |
116 | 116 | <div id="content"> |
117 | 117 | <a name="top" id="top"></a> |
118 | 118 | <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?> |
119 | | - <h1 class="firstHeading"><?php $this->html('title'); ?></h1> |
| 119 | + <h1 class="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1> |
120 | 120 | <div id="bodyContent"> |
121 | 121 | <h3 id="siteSub"><?php $this->msg('tagline') ?></h3> |
122 | 122 | <div id="contentSub"><?php $this->html('subtitle') ?></div> |
Index: trunk/phase3/skins/Modern.php |
— | — | @@ -102,7 +102,7 @@ |
103 | 103 | class="mediawiki <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>"> |
104 | 104 | |
105 | 105 | <!-- heading --> |
106 | | - <div id="mw_header"><h1 id="firstHeading"><?php $this->html('title') ?></h1></div> |
| 106 | + <div id="mw_header"><h1 id="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1></div> |
107 | 107 | |
108 | 108 | <div id="mw_main"> |
109 | 109 | <div id="mw_contentwrapper"> |
Index: trunk/phase3/includes/parser/ParserOutput.php |
— | — | @@ -29,8 +29,7 @@ |
30 | 30 | /** |
31 | 31 | * Overridden title for display |
32 | 32 | */ |
33 | | - private $displayTitle = false; #for use in the <title> tag |
34 | | - private $displayTitleH1 = false; #for use in the <h1> tag, may contain further HTML tags |
| 33 | + private $displayTitle = false; |
35 | 34 | |
36 | 35 | function ParserOutput( $text = '', $languageLinks = array(), $categoryLinks = array(), |
37 | 36 | $containsOldMagic = false, $titletext = '' ) |
— | — | @@ -146,15 +145,6 @@ |
147 | 146 | } |
148 | 147 | |
149 | 148 | /** |
150 | | - * Get the title to be used for display |
151 | | - * |
152 | | - * @return string |
153 | | - */ |
154 | | - public function getDisplayTitle() { |
155 | | - return $this->displayTitle; |
156 | | - } |
157 | | - |
158 | | - /** |
159 | 149 | * Override the title to be used for display |
160 | 150 | * -- this is assumed to have been validated |
161 | 151 | * (check equal normalisation, etc.) |
— | — | @@ -164,14 +154,15 @@ |
165 | 155 | public function setDisplayTitle( $text ) { |
166 | 156 | $this->displayTitle = $text; |
167 | 157 | } |
168 | | - |
169 | | - public function getDisplayTitleH1() { |
170 | | - return $this->displayTitleH1; |
| 158 | + |
| 159 | + /** |
| 160 | + * Get the title to be used for display |
| 161 | + * |
| 162 | + * @return string |
| 163 | + */ |
| 164 | + public function getDisplayTitle() { |
| 165 | + return $this->displayTitle; |
171 | 166 | } |
172 | | - |
173 | | - public function setDisplayTitleH1( $html ) { |
174 | | - $this->displayTitleH1 = $html; |
175 | | - } |
176 | 167 | |
177 | 168 | /** |
178 | 169 | * Fairly generic flag setter thingy. |
Index: trunk/phase3/includes/parser/CoreParserFunctions.php |
— | — | @@ -164,32 +164,17 @@ |
165 | 165 | * @param string $text Desired title text |
166 | 166 | * @return string |
167 | 167 | */ |
168 | | - static function displaytitle( $parser, $displayTitleH1 = '', $displayTitleTitle = '' ) { |
| 168 | + static function displaytitle( $parser, $text = '' ) { |
169 | 169 | global $wgRestrictDisplayTitle; |
170 | | - |
171 | | - $titleHTML = Sanitizer::removeHTMLtags( $displayTitleH1 ); #escape the bad tags |
172 | | - $titleText = trim( Sanitizer::stripAllTags( $titleHTML ) ); #remove the good tags, leaving the bad tags escaped, and trim it to make sure it comes out pretty |
173 | | - |
174 | | - #the user can put any sanitized text into the page title used in the <title> attribute, since it is not copy-pasteable like the <h1> tag |
175 | | - if ($displayTitleTitle == '') { |
176 | | - $parser->mOutput->setDisplayTitle( $titleText ); #use the stripped contents of <h1> |
177 | | - } else { |
178 | | - $parser->mOutput->setDisplayTitle( $displayTitleTitle ); #use what the user explicitly requested, MediaWiki escapes this automatically before it is served out |
179 | | - } |
180 | | - |
| 170 | + $text = trim( Sanitizer::decodeCharReferences( $text ) ); |
| 171 | + |
181 | 172 | if ( !$wgRestrictDisplayTitle ) { |
182 | | - $parser->mOutput->setDisplayTitleH1( $titleHTML ); |
| 173 | + $parser->mOutput->setDisplayTitle( $text ); |
183 | 174 | } else { |
184 | | - #only titles that normalize to the same title are allowed in the <h1> tag |
185 | | - $title = Title::newFromText( $titleText ); |
186 | | - |
187 | | - if ( $title instanceof Title && $title->getFragment() == '' && $title->equals( $parser->mTitle ) ) { |
188 | | - $parser->mOutput->setDisplayTitleH1( $titleHTML ); |
189 | | - } else { |
190 | | - $parser->mOutput->setDisplayTitleH1( $parser->mTitle ); |
191 | | - } |
| 175 | + $title = Title::newFromText( $text ); |
| 176 | + if( $title instanceof Title && $title->getFragment() == '' && $title->equals( $parser->mTitle ) ) |
| 177 | + $parser->mOutput->setDisplayTitle( $text ); |
192 | 178 | } |
193 | | - |
194 | 179 | return ''; |
195 | 180 | } |
196 | 181 | |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -1083,11 +1083,11 @@ |
1084 | 1084 | # Use the title defined by DISPLAYTITLE magic word when present |
1085 | 1085 | if ( isset($this->mParserOutput) |
1086 | 1086 | && ( $dt = $this->mParserOutput->getDisplayTitle() ) !== false ) { |
1087 | | - $wgOut->setPageTitle( wfMsg( 'editing', $this->mParserOutput->getDisplayTitleH1() ) ); |
1088 | | - $wgOut->setHTMLTitle( wfMsg( 'editing', $dt ) ); #override the HTML that setPageTitle slated for inclusion in the <title> |
| 1087 | + $title = $dt; |
1089 | 1088 | } else { |
1090 | | - $wgOut->setPageTitle( wfMsg( 'editing', $wgTitle->getPrefixedText() ) ); |
| 1089 | + $title = $wgTitle->getPrefixedText(); |
1091 | 1090 | } |
| 1091 | + $wgOut->setPageTitle( wfMsg( 'editing', $title ) ); |
1092 | 1092 | } |
1093 | 1093 | } |
1094 | 1094 | |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -309,10 +309,7 @@ |
310 | 310 | } |
311 | 311 | } |
312 | 312 | |
313 | | - # "HTML title" means <title> |
314 | | - public function setHTMLTitle( $name ) { $this->mHTMLtitle = $name; } |
315 | | - |
316 | | - # "Page title" means <h1> |
| 313 | + public function setHTMLTitle( $name ) {$this->mHTMLtitle = $name; } |
317 | 314 | public function setPageTitle( $name ) { |
318 | 315 | global $action, $wgContLang; |
319 | 316 | $name = $wgContLang->convert($name, true); |
— | — | @@ -323,7 +320,7 @@ |
324 | 321 | $name .= ' - '.$taction; |
325 | 322 | } |
326 | 323 | } |
327 | | - |
| 324 | + |
328 | 325 | $this->setHTMLTitle( wfMsg( 'pagetitle', $name ) ); |
329 | 326 | } |
330 | 327 | public function getHTMLTitle() { return $this->mHTMLtitle; } |
— | — | @@ -542,10 +539,8 @@ |
543 | 540 | } |
544 | 541 | } |
545 | 542 | // Display title |
546 | | - if( ( $displayTitleText = $parserOutput->getDisplayTitle() ) !== false ) { |
547 | | - $this->setPageTitle( $parserOutput->getDisplayTitleH1() ); |
548 | | - $this->setHTMLTitle( wfMsg( 'pagetitle', $displayTitleText ) ); #override the HTML that setPageTitle slated for inclusion in the <title> |
549 | | - } |
| 543 | + if( ( $dt = $parserOutput->getDisplayTitle() ) !== false ) |
| 544 | + $this->setPageTitle( $dt ); |
550 | 545 | |
551 | 546 | // Hooks registered in the object |
552 | 547 | global $wgParserOutputHooks; |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -1014,7 +1014,7 @@ |
1015 | 1015 | |
1016 | 1016 | function pageTitle() { |
1017 | 1017 | global $wgOut; |
1018 | | - $s = '<h1 class="pagetitle">' . $wgOut->getPageTitle() . '</h1>'; |
| 1018 | + $s = '<h1 class="pagetitle">' . htmlspecialchars( $wgOut->getPageTitle() ) . '</h1>'; |
1019 | 1019 | return $s; |
1020 | 1020 | } |
1021 | 1021 | |