From: Andrew Garrett Date: Fri, 3 Nov 2006 05:25:10 +0000 (+0000) Subject: * (bug 7723) Add ic: parser function, with alias tc:, which capitalises the first... X-Git-Tag: 1.31.0-rc.0~55307 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=dc223c593fd43424b7a567a99910841397e30955;p=lhc%2Fweb%2Fwiklou.git * (bug 7723) Add ic: parser function, with alias tc:, which capitalises the first letter of each word. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2b182b4d26..8a3ab20279 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/CoreParserFunctions.php b/includes/CoreParserFunctions.php index b2ee789dd2..2b05437286 100644 --- a/includes/CoreParserFunctions.php +++ b/includes/CoreParserFunctions.php @@ -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 ); } diff --git a/includes/Parser.php b/includes/Parser.php index 336b6f8f32..aa88282f2f 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -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 ); diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index fd12d79489..eeae0312fb 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -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:' ), ); /**