* (bug 7723) Add ic: parser function, with alias tc:, which capitalises the first...
authorAndrew Garrett <werdna@users.mediawiki.org>
Fri, 3 Nov 2006 05:25:10 +0000 (05:25 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Fri, 3 Nov 2006 05:25:10 +0000 (05:25 +0000)
RELEASE-NOTES
includes/CoreParserFunctions.php
includes/Parser.php
languages/messages/MessagesEn.php

index 2b182b4..8a3ab20 100644 (file)
@@ -125,6 +125,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Remove entries from redirect table on article deletion
 * (bug 7788) Force section headers in new section links for users who have
   'prompt for blank edit summaries' on.
+* (bug 7723) Add ic: parser function, with alias tc:, which capitalises the first
+   letter of each word.
 
 == Languages updated ==
 
index b2ee789..2b05437 100644 (file)
@@ -59,6 +59,13 @@ class CoreParserFunctions {
                return $wgContLang->uc( $s );
        }
 
+       static function ic( $parser, $s = '' ) {
+               /*Testing showed that ucwords does NOT convert the rest of the words to lowercase
+                * Converting it all to lowercase first fixes this. */
+               $s = strtolower($s);
+               return ucwords($s);
+       }
+
        static function localurl( $parser, $s = '', $arg = null ) { return self::urlFunction( 'getLocalURL', $s, $arg ); }
        static function localurle( $parser, $s = '', $arg = null ) { return self::urlFunction( 'escapeLocalURL', $s, $arg ); }
        static function fullurl( $parser, $s = '', $arg = null ) { return self::urlFunction( 'getFullURL', $s, $arg ); }
index 336b6f8..aa88282 100644 (file)
@@ -165,6 +165,7 @@ class Parser
                $this->setFunctionHook( 'padright', array( 'CoreParserFunctions', 'padright' ), SFH_NO_HASH );
                $this->setFunctionHook( 'anchorencode', array( 'CoreParserFunctions', 'anchorencode' ), SFH_NO_HASH );
                $this->setFunctionHook( 'special', array( 'CoreParserFunctions', 'special' ) );
+               $this->setFunctionHook( 'ic', array( 'CoreParserFunctions', 'ic' ), SFH_NO_HASH );
 
                if ( $wgAllowDisplayTitle ) {
                        $this->setFunctionHook( 'displaytitle', array( 'CoreParserFunctions', 'displaytitle' ), SFH_NO_HASH );
index fd12d79..eeae031 100644 (file)
@@ -307,7 +307,7 @@ $magicWords = array(
        'newsectionlink'         => array( 1,    '__NEWSECTIONLINK__'     ),
        'currentversion'         => array( 1,    'CURRENTVERSION'         ),
        'urlencode'              => array( 0,    'URLENCODE:'             ),
-       'anchorencode'                   => array( 0,    'ANCHORENCODE'                   ),
+       'anchorencode'           => array( 0,    'ANCHORENCODE'                   ),
        'currenttimestamp'       => array( 1,    'CURRENTTIMESTAMP'       ),
        'localtimestamp'         => array( 1,    'LOCALTIMESTAMP'         ),
        'directionmark'          => array( 1,    'DIRECTIONMARK', 'DIRMARK' ),
@@ -319,6 +319,7 @@ $magicWords = array(
        'padleft'                => array( 0,    'PADLEFT'                ),
        'padright'               => array( 0,    'PADRIGHT'               ),
        'special'                => array( 0,    'special',               ),
+       'ic'                     => array( 0,    'ic:', 'tc:'             ),
 );
 
 /**