Index: trunk/extensions/HashTables/HashTables.php |
— | — | @@ -17,14 +17,12 @@ |
18 | 18 | * |
19 | 19 | * @ToDo: |
20 | 20 | * ====== |
21 | | - * - binding one hash tables instance per initialized parser instead of having one global one. |
22 | 21 | * Thinking about: |
23 | 22 | * - Sort function |
24 | 23 | * - Search function |
25 | | - * |
26 | 24 | */ |
27 | 25 | |
28 | | -if ( ! defined( 'MEDIAWIKI' ) ) { die(); } |
| 26 | +if( ! defined( 'MEDIAWIKI' ) ) { die(); } |
29 | 27 | |
30 | 28 | $wgExtensionCredits['parserhook'][] = array( |
31 | 29 | 'path' => __FILE__, |
— | — | @@ -120,8 +118,7 @@ |
121 | 119 | * @return boolean |
122 | 120 | */ |
123 | 121 | public static function getDir() { |
124 | | - static $dir = null; |
125 | | - |
| 122 | + static $dir = null; |
126 | 123 | if( $dir === null ) { |
127 | 124 | $dir = dirname( __FILE__ ); |
128 | 125 | } |
— | — | @@ -149,17 +146,17 @@ |
150 | 147 | |
151 | 148 | if( $value !== '' ) { |
152 | 149 | // Build delimiters: |
153 | | - if ( ! self::isValidRegEx($itemsDelimiter,'/') ) { |
| 150 | + if( ! self::isValidRegEx($itemsDelimiter,'/') ) { |
154 | 151 | $itemsDelimiter = '/\s*' . preg_quote( $itemsDelimiter, '/' ) . '\s*/'; |
155 | 152 | } |
156 | 153 | |
157 | | - if ( ! self::isValidRegEx($innerDelimiter,'/') ) { |
| 154 | + if( ! self::isValidRegEx($innerDelimiter,'/') ) { |
158 | 155 | $innerDelimiter = '/\s*' . preg_quote( $innerDelimiter, '/' ) . '\s*/'; |
159 | 156 | } |
160 | 157 | |
161 | 158 | $items = preg_split( $itemsDelimiter, $value ); // All hash Items |
162 | 159 | |
163 | | - foreach ( $items as $item ) { |
| 160 | + foreach( $items as $item ) { |
164 | 161 | $hashPair = preg_split( $innerDelimiter, $item, 2 ); |
165 | 162 | |
166 | 163 | if( count($hashPair) < 2 ) { |
— | — | @@ -250,7 +247,10 @@ |
251 | 248 | |
252 | 249 | // parameter validation: |
253 | 250 | |
254 | | - $seperator = isset( $args[1] ) ? trim( $frame->expand( $args[1] ) ) : ', '; |
| 251 | + global $wgLang; |
| 252 | + $seperator = isset( $args[1] ) |
| 253 | + ? trim( $frame->expand( $args[1] ) ) |
| 254 | + : $wgLang->getMessageFromDB( 'comma-separator' ); // use local languages default, for English ', ' |
255 | 255 | /* |
256 | 256 | * PPFrame::NO_ARGS and PPFrame::NO_TEMPLATES for expansion make a lot of sense here since the patterns getting replaced |
257 | 257 | * in $subject before $subject is being parsed. So any template or argument influence in the patterns wouldn't make any |
— | — | @@ -333,7 +333,7 @@ |
334 | 334 | |
335 | 335 | $templateArgs = $frame->getArguments(); |
336 | 336 | |
337 | | - foreach ( $templateArgs as $argName => $argVal ) { |
| 337 | + foreach( $templateArgs as $argName => $argVal ) { |
338 | 338 | // one hash value for each parameter |
339 | 339 | $store->setHashValue( $hashId, $argName, $argVal ); |
340 | 340 | } |
Index: trunk/extensions/HashTables/RELEASE-NOTES |
— | — | @@ -9,6 +9,7 @@ |
10 | 10 | - Inclusion of special pages in the middle of the page won't reset all defined hash tables anymore. |
11 | 11 | - arrayprint will handle <includeonly>/<noinclude> correct in case it's used in a template. |
12 | 12 | - '#hashvalue' will only expand its default when required. |
| 13 | + - '#hashprint' will use the languages default comma separator instead of hard-coded ', ' as default. |
13 | 14 | |
14 | 15 | |
15 | 16 | * November 4, 2011 -- Version 0.7 |