| Index: trunk/extensions/FormatNum/FormatNum.i18n.php |
| — | — | @@ -0,0 +1,27 @@ |
| | 2 | +<?php |
| | 3 | + |
| | 4 | +/** |
| | 5 | + * Messages file for the FormatNum extension |
| | 6 | + * |
| | 7 | + * @addtogroup Extensions |
| | 8 | + */ |
| | 9 | + |
| | 10 | +/** |
| | 11 | + * Get all extension messages |
| | 12 | + * |
| | 13 | + * @return array |
| | 14 | + */ |
| | 15 | +$messages = array(); |
| | 16 | + |
| | 17 | +$messages['qqq'] = array( |
| | 18 | + 'formatnum-desc' => 'Description for Special:Version', |
| | 19 | +); |
| | 20 | + |
| | 21 | +$messages['en'] = array( |
| | 22 | + 'formatnum-desc' => 'Passes formatnum to php number_format', |
| | 23 | +); |
| | 24 | + |
| | 25 | +$messages['de'] = array( |
| | 26 | + 'formatnum-desc' => 'Ermöglicht das formatieren von Zahel mit php number_format', |
| | 27 | +); |
| | 28 | + |
| Property changes on: trunk/extensions/FormatNum/FormatNum.i18n.php |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| 1 | 29 | + native |
| Index: trunk/extensions/FormatNum/FormatNum.php |
| — | — | @@ -0,0 +1,57 @@ |
| | 2 | +<?php |
| | 3 | +/** |
| | 4 | +* @addtogroup Extensions |
| | 5 | +*/ |
| | 6 | +// Check environment |
| | 7 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| | 8 | + echo( "This is an extension to the MediaWiki package and cannot be run standalone.\n" ); |
| | 9 | + die( -1 ); |
| | 10 | +} |
| | 11 | + |
| | 12 | +/* Configuration */ |
| | 13 | + |
| | 14 | +// Credits |
| | 15 | +$wgExtensionCredits['parserhook'][] = array ( |
| | 16 | + 'path'=> __FILE__ , |
| | 17 | + 'name'=>'FormatNum', |
| | 18 | + 'url'=>'http://www.mediawiki.org/wiki/Extension:FormatNum', |
| | 19 | + 'description'=>'Passes formatnum to php number_format', |
| | 20 | + 'descriptionmsg' => 'formatnum-desc', |
| | 21 | + 'author'=>'[http://www.dasch-tour.de DaSch]', |
| | 22 | + 'version'=>'0.1.1', |
| | 23 | +); |
| | 24 | +$dir = dirname( __FILE__ ) . '/'; |
| | 25 | + |
| | 26 | +// Internationalization |
| | 27 | +$wgExtensionMessagesFiles['FormatNum'] = $dir . 'FormatNum.i18n.php'; |
| | 28 | + |
| | 29 | +# Define a setup function |
| | 30 | +$wgHooks['ParserFirstCallInit'][] = 'efFormatNumParserFunction_Setup'; |
| | 31 | +# Add a hook to initialise the magic word |
| | 32 | +$wgHooks['LanguageGetMagic'][] = 'efFormatNumParserFunction_Magic'; |
| | 33 | + |
| | 34 | +function efFormatNumParserFunction_Setup( $parser ) { |
| | 35 | + # Set a function hook associating the "example" magic word with our function |
| | 36 | + $parser->setFunctionHook( 'formatnum', 'efFormatNumParserFunction_Render' ); |
| | 37 | + return true; |
| | 38 | +} |
| | 39 | + |
| | 40 | +function efFormatNumParserFunction_Magic( &$magicWords, $langCode ) { |
| | 41 | + # Add the magic word |
| | 42 | + # The first array element is case sensitive, in this case it is not case sensitive |
| | 43 | + # All remaining elements are synonyms for our parser function |
| | 44 | + $magicWords['formatnum'] = array( 0, 'formatnum' ); |
| | 45 | + # unless we return true, other parser functions extensions won't get loaded. |
| | 46 | + return true; |
| | 47 | +} |
| | 48 | + |
| | 49 | +function efFormatNumParserFunction_Render( $parser, $param1 = 0, $param2 = 0, $param3 = '.', $param4 = ',' ) { |
| | 50 | + # The parser function itself |
| | 51 | + # The input parameters are wikitext with templates expanded |
| | 52 | + # The output should be wikitext too |
| | 53 | + if ($param4 == '_') { |
| | 54 | + $param4 = ' '; |
| | 55 | + } |
| | 56 | + $output = number_format($param1, $param2, $param3, $param4); |
| | 57 | + return $output; |
| | 58 | +} |
| \ No newline at end of file |
| Property changes on: trunk/extensions/FormatNum/FormatNum.php |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| 1 | 59 | + native |
| Property changes on: trunk/extensions/FormatNum |
| ___________________________________________________________________ |
| Added: bugtraq:number |
| 2 | 60 | + true |
| Index: trunk/extensions/ThumbParser/ThumbParser.i18n.php |
| — | — | @@ -0,0 +1,27 @@ |
| | 2 | +<?php |
| | 3 | + |
| | 4 | +/** |
| | 5 | + * Messages file for the ThumbParser extension |
| | 6 | + * |
| | 7 | + * @addtogroup Extensions |
| | 8 | + */ |
| | 9 | + |
| | 10 | +/** |
| | 11 | + * Get all extension messages |
| | 12 | + * |
| | 13 | + * @return array |
| | 14 | + */ |
| | 15 | +$messages = array(); |
| | 16 | + |
| | 17 | +$messages['qqq'] = array( |
| | 18 | + 'thumbparser-desc' => 'Description for Special:Version', |
| | 19 | +); |
| | 20 | + |
| | 21 | +$messages['en'] = array( |
| | 22 | + 'thumbparser-desc' => 'Prints users Thumb size', |
| | 23 | +); |
| | 24 | + |
| | 25 | +$messages['de'] = array( |
| | 26 | + 'thumbparser-desc' => 'Gibt die vom Benutzer definierte Größe für Vorschaubilder aus', |
| | 27 | +); |
| | 28 | + |
| Property changes on: trunk/extensions/ThumbParser/ThumbParser.i18n.php |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| 1 | 29 | + native |
| Index: trunk/extensions/ThumbParser/ThumbParser.php |
| — | — | @@ -0,0 +1,72 @@ |
| | 2 | +<?php |
| | 3 | +/** |
| | 4 | +* @addtogroup Extensions |
| | 5 | +*/ |
| | 6 | +// Check environment |
| | 7 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| | 8 | + echo( "This is an extension to the MediaWiki package and cannot be run standalone.\n" ); |
| | 9 | + die( -1 ); |
| | 10 | +} |
| | 11 | + |
| | 12 | +/* Configuration */ |
| | 13 | + |
| | 14 | +// Credits |
| | 15 | +$wgExtensionCredits['parserhook'][] = array ( |
| | 16 | + 'path'=> __FILE__ , |
| | 17 | + 'name'=>'ThumbParser', |
| | 18 | + 'url'=>'http://www.mediawiki.org/wiki/Extension:ThumbParser', |
| | 19 | + 'description'=>'Prints users Thumb size', |
| | 20 | + 'descriptionmsg' => 'thumbparser-desc', |
| | 21 | + 'author'=>'[http://www.dasch-tour.de DaSch]', |
| | 22 | + 'version'=>'0.1', |
| | 23 | +); |
| | 24 | +$dir = dirname( __FILE__ ) . '/'; |
| | 25 | + |
| | 26 | +// Internationalization |
| | 27 | +$wgExtensionMessagesFiles['ThumbParser'] = $dir . 'ThumbParser.i18n.php'; |
| | 28 | + |
| | 29 | +# Define a setup function |
| | 30 | +$wgHooks['ParserFirstCallInit'][] = 'efThumbParserFunction_Setup'; |
| | 31 | +# Add a hook to initialise the magic word |
| | 32 | +$wgHooks['LanguageGetMagic'][] = 'efThumbParserFunction_Magic'; |
| | 33 | + |
| | 34 | +function efThumbParserFunction_Setup( $parser ) { |
| | 35 | + # Set a function hook associating the "example" magic word with our function |
| | 36 | + $parser->setFunctionHook( 'thumb', 'efThumbParserFunction_Render' ); |
| | 37 | + return true; |
| | 38 | +} |
| | 39 | + |
| | 40 | +function efThumbParserFunction_Magic( &$magicWords, $langCode ) { |
| | 41 | + # Add the magic word |
| | 42 | + # The first array element is case sensitive, in this case it is not case sensitive |
| | 43 | + # All remaining elements are synonyms for our parser function |
| | 44 | + $magicWords['thumb'] = array( 0, 'thumb' ); |
| | 45 | + # unless we return true, other parser functions extensions won't get loaded. |
| | 46 | + return true; |
| | 47 | +} |
| | 48 | + |
| | 49 | +function efThumbParserFunction_Render( $parser, $param1 = '') { |
| | 50 | + # The parser function itself |
| | 51 | + # The input parameters are wikitext with templates expanded |
| | 52 | + # The output should be wikitext too |
| | 53 | + global $wgThumbLimits, $wgUser; |
| | 54 | + $param1 = strtolower($param1); |
| | 55 | + $parser->disableCache(); # Mark this content as uncacheable |
| | 56 | + $wopt = $wgUser->getOption('thumbsize'); |
| | 57 | + switch ($param1) { |
| | 58 | + case 'size': |
| | 59 | + $output = $wgThumbLimits[$wopt]; |
| | 60 | + break; |
| | 61 | + case 'px': |
| | 62 | + $output = $wgThumbLimits[$wopt].'px'; |
| | 63 | + break; |
| | 64 | + case 'width': |
| | 65 | + $size = intval($wgThumbLimits[$wopt])+10; |
| | 66 | + $strsize = strval($size); |
| | 67 | + $output = $strsize."px"; |
| | 68 | + break; |
| | 69 | + default: |
| | 70 | + $output = $wgThumbLimits[$wopt]; |
| | 71 | + } |
| | 72 | + return $output; |
| | 73 | +} |
| \ No newline at end of file |
| Property changes on: trunk/extensions/ThumbParser/ThumbParser.php |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| 1 | 74 | + native |
| Property changes on: trunk/extensions/ThumbParser |
| ___________________________________________________________________ |
| Added: bugtraq:number |
| 2 | 75 | + true |