Revert __LCFIRST__ patch. Title objects should be treated as value objects;
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 15 May 2005 20:42:11 +0000 (20:42 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 15 May 2005 20:42:11 +0000 (20:42 +0000)
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.

RELEASE-NOTES
includes/EditPage.php
includes/MagicWord.php
includes/OutputPage.php
includes/Parser.php
includes/Title.php
languages/Language.php

index cc1a46a..c7c20a6 100644 (file)
@@ -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 ===
index e6f9a75..fbcb6af 100644 (file)
@@ -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( '<div id="wikiPreview">' );
                if ( 'preview' == $formtype) {
+                       $previewOutput = $this->getPreviewText( $isConflict, $isCssJsSubpage );
                        if ( $wgUser->getOption('previewontop' ) ) {
                                $wgOut->addHTML( $previewOutput );
                                $wgOut->addHTML( "<br style=\"clear:both;\" />\n" );
index cc86426..4c1f9a9 100644 (file)
@@ -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,
index 6cf581d..aa3d46f 100644 (file)
@@ -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 );
index 1ab8b03..fc6db01 100644 (file)
@@ -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 ); }
index bfdc611..a5e119f 100644 (file)
@@ -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);
-       }
 }
 ?>
index d31788a..f32c342 100644 (file)
@@ -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__'            ),
 );
 
 #-------------------------------------------------------------------