r104032 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104031‎ | r104032 | r104033 >
Date:13:33, 23 November 2011
Author:danwe
Status:deferred
Tags:
Comment:
Version increased to 1.0.2, 'pf_' prefix for internal parser function functions
Modified paths:
  • /trunk/extensions/RegexFun/RELEASE-NOTES (modified) (history)
  • /trunk/extensions/RegexFun/RegexFun.php (modified) (history)

Diff [purge]

Index: trunk/extensions/RegexFun/RELEASE-NOTES
@@ -1,5 +1,9 @@
22 Changelog:
33 ==========
 4+
 5+ * (trunk) -- Version 1.0.2 alpha
 6+ - Internal representative functions for parser functions now have a 'pf_' prefix.
 7+
48 * November 6, 2011 -- Version 1.0.1
59 - Bug in '#regex_var' solved: default value now gets returned in case '#regex' went wrong or
610 not called before.
Index: trunk/extensions/RegexFun/RegexFun.php
@@ -8,7 +8,7 @@
99 * Support: http://www.mediawiki.org/wiki/Extension_talk:Regex_Fun
1010 * Source code: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/RegexFun
1111 *
12 - * @version: 1.0.1
 12+ * @version: 1.0.2 alpha
1313 * @license: ISC license
1414 * @author: Daniel Werner < danweetz@web.de >
1515 *
@@ -57,7 +57,7 @@
5858 *
5959 * @var string
6060 */
61 - const VERSION = '1.0.1';
 61+ const VERSION = '1.0.2 alpha';
6262
6363 /**
6464 * Sets up parser functions
@@ -72,7 +72,7 @@
7373 }
7474 private static function initFunction( Parser &$parser, $name, $functionCallback = null ) {
7575 if( $functionCallback === null ) {
76 - $functionCallback = array( __CLASS__, $name );
 76+ $functionCallback = array( __CLASS__, "pf_{$name}" );
7777 }
7878
7979 global $egRegexFunDisabledFunctions;
@@ -253,7 +253,7 @@
254254 *
255255 * @return String Result of replacing pattern with replacement in string, or matching text if replacement was omitted
256256 */
257 - public static function regex( Parser &$parser, $subject = '', $pattern = '', $replace = null, $limit = -1 ) {
 257+ public static function pf_regex( Parser &$parser, $subject = '', $pattern = '', $replace = null, $limit = -1 ) {
258258 // check whether limit exceeded:
259259 if( self::limitExceeded( $parser ) ) {
260260 return self::msgLimitExceeded();
@@ -316,7 +316,7 @@
317317 self::setLastMatches( $parser, $matches );
318318
319319 // use #regex_var for transforming replacement string with matches:
320 - $replace = self::regex_var( $parser, $replace );
 320+ $replace = self::pf_regex_var( $parser, $replace );
321321
322322 // parse the replacement after matches are inserted
323323 // use a new frame, no need for SFH_OBJECT_ARGS style parser functions
@@ -339,7 +339,7 @@
340340 *
341341 * @return String result of all matching text parts separated by a string
342342 */
343 - public static function regexall( &$parser , $subject = '' , $pattern = '' , $separator = ', ' , $offset = 0 , $length = '' ) {
 343+ public static function pf_regexall( &$parser , $subject = '' , $pattern = '' , $separator = ', ' , $offset = 0 , $length = '' ) {
344344 // check whether limit exceeded:
345345 if( self::limitExceeded( $parser ) ) {
346346 return self::msgLimitExceeded();
@@ -384,7 +384,7 @@
385385 * @param $index Integer index of the last match which should be returnd or a string containing $n as indexes to be replaced
386386 * @param $defaultVal Integer default value which will be returned when the result with the given index doesn't exist or is a void string
387387 */
388 - public static function regex_var( &$parser, $index = 0, $defaultVal = '' ) {
 388+ public static function pf_regex_var( &$parser, $index = 0, $defaultVal = '' ) {
389389 // get matches from last #regex
390390 $lastMatches = self::getLastMatches( $parser );
391391
@@ -456,7 +456,7 @@
457457 *
458458 * @return String Returns the quoted string
459459 */
460 - public static function regexquote( &$parser, $str = null, $delimiter = '/' ) {
 460+ public static function pf_regexquote( &$parser, $str = null, $delimiter = '/' ) {
461461 if( $str === null ) {
462462 return '';
463463 }

Status & tagging log