From: Brion Vibber Date: Sun, 15 May 2005 20:42:11 +0000 (+0000) Subject: Revert __LCFIRST__ patch. Title objects should be treated as value objects; X-Git-Tag: 1.5.0alpha2~167 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=fe2ac1409b6c8c23e01f01c5cf1dfd68287bff9e;p=lhc%2Fweb%2Fwiklou.git Revert __LCFIRST__ patch. Title objects should be treated as value objects; any Title object for a given title should always act the same. Poking around with the guts of one to change some of its return values is not a good idea. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index cc1a46a5c3..c7c20a69e0 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -191,10 +191,6 @@ Various bugfixes, small features, and a few experimental things: * New fileicons for c, cpp, deb, dvi, exe, h, html, iso, java, mid, mov, o, ogg, pdf, ps, rm, rpm, tar, tex, ttf and txt files based on the KDE crystalsvg theme. -* (bug 2118) Added a __LCFIRST__ magic word for forcing the first character of - a pages heading to render in its lower case form on output, however the page - is still saved under its upper case name in the database so this is purely an - aesthetic change (unlike setting $wgCapitalLinks to false). === Caveats === diff --git a/includes/EditPage.php b/includes/EditPage.php index e6f9a7534e..fbcb6af407 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -443,12 +443,6 @@ class EditPage { # Enabled article-related sidebar, toplinks, etc. $wgOut->setArticleRelated( true ); - # Calculate preview html - must be here, because for the next things you - # have to know, if the title changes because of __LCFIRST__ - if ( 'preview' == $formtype) { - $previewOutput = $this->getPreviewText( $isConflict, $isCssJsSubpage ); - } - if ( $isConflict ) { $s = wfMsg( 'editconflict', $this->mTitle->getPrefixedText() ); $wgOut->setPageTitle( $s ); @@ -572,6 +566,7 @@ class EditPage { $wgOut->addHTML( '
' ); if ( 'preview' == $formtype) { + $previewOutput = $this->getPreviewText( $isConflict, $isCssJsSubpage ); if ( $wgUser->getOption('previewontop' ) ) { $wgOut->addHTML( $previewOutput ); $wgOut->addHTML( "
\n" ); diff --git a/includes/MagicWord.php b/includes/MagicWord.php index cc86426665..4c1f9a9f52 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -51,7 +51,6 @@ define('MAG_NOCONTENTCONVERT', 36); define('MAG_CURRENTWEEK', 37); define('MAG_CURRENTDOW', 38); define('MAG_REVISIONID', 39); -define('MAG_LCFIRST', 40); $wgVariableIDs = array( MAG_CURRENTMONTH, diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 6cf581d4bb..aa3d46f501 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -284,14 +284,12 @@ class OutputPage { * @return bool */ function tryParserCache( $article, $user ) { - global $wgParserCache, $wgTitle; + global $wgParserCache; $parserOutput = $wgParserCache->get( $article, $user ); if ( $parserOutput !== false ) { $this->mLanguageLinks += $parserOutput->getLanguageLinks(); $this->mCategoryLinks += $parserOutput->getCategoryLinks(); $this->addHTML( $parserOutput->getText() ); - if( $parserOutput->getLcfirstTitle() ) - $wgTitle->lcfirst(); $t = $parserOutput->getTitleText(); if( !empty( $t ) ) { $this->setPageTitle( $t ); diff --git a/includes/Parser.php b/includes/Parser.php index 1ab8b03374..fc6db01c67 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -163,7 +163,7 @@ class Parser * @return ParserOutput a ParserOutput */ function parse( $text, &$title, $options, $linestart = true, $clearState = true ) { - global $wgUseTidy, $wgContLang, $wgCapitalLinks; + global $wgUseTidy, $wgContLang; $fname = 'Parser::parse'; wfProfileIn( $fname ); @@ -173,7 +173,6 @@ class Parser $this->mOptions = $options; $this->mTitle =& $title; - $this->mOutput->mLcfirstTitle = false; $this->mOutputType = OT_HTML; $this->mStripState = NULL; @@ -185,14 +184,7 @@ class Parser $text = $this->internalParse( $text ); - // if the string __LCFIRST__ (make the first character of the title - // lower case) occurs in the HTML, set the mLcfirstTitle to true - $mw =& MagicWord::get( MAG_LCFIRST ); - if( $mw->matchAndRemove( $text ) && $wgCapitalLinks ) { - $title->lcfirst(); - $this->mOutput->mLcfirstTitle = true; - } - + $text = $this->unstrip( $text, $this->mStripState ); # Clean up special characters, only run once, next-to-last before doBlockLevels @@ -3120,7 +3112,6 @@ class ParserOutput var $mCacheTime; # Used in ParserCache var $mVersion; # Compatibility check var $mTitleText; # title text of the chosen language variant - var $mLcfirstTitle; # This is true if the first letter in the title has to be lowercase function ParserOutput( $text = '', $languageLinks = array(), $categoryLinks = array(), $containsOldMagic = false, $titletext = '' ) @@ -3139,7 +3130,6 @@ class ParserOutput function getCategoryLinks() { return array_keys( $this->mCategoryLinks ); } function getCacheTime() { return $this->mCacheTime; } function getTitleText() { return $this->mTitleText; } - function getLcfirstTitle() { return $this->mLcfirstTitle; } function containsOldMagic() { return $this->mContainsOldMagic; } function setText( $text ) { return wfSetVar( $this->mText, $text ); } function setLanguageLinks( $ll ) { return wfSetVar( $this->mLanguageLinks, $ll ); } diff --git a/includes/Title.php b/includes/Title.php index bfdc6111da..a5e119f073 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2015,16 +2015,5 @@ class Title { return ( 0 == $this->mNamespace && "" == $this->mDbkeyform ) || NS_SPECIAL == $this->mNamespace || NS_IMAGE == $this->mNamespace; } - - /** - * Changes the title to lowercase - used, when __LCFIRST__ occurs - */ - function lcfirst() { - global $wgContLang; - $this->mTextform = $wgContLang->lcfirst($this->mTextform); - // reset mPrefixedText, so that it's recalculated when already created - // with uppercase title - unset($this->mPrefixedText); - } } ?> diff --git a/languages/Language.php b/languages/Language.php index d31788a9b8..f32c342441 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -247,7 +247,6 @@ $wgLanguageNamesEn =& $wgLanguageNames; MAG_CURRENTWEEK => array( 1, 'CURRENTWEEK' ), MAG_CURRENTDOW => array( 1, 'CURRENTDOW' ), MAG_REVISIONID => array( 1, 'REVISIONID' ), - MAG_LCFIRST => array( 0, '__LCFIRST__' ), ); #-------------------------------------------------------------------