Index: trunk/extensions/examples/Example/Example.i18n.php |
— | — | @@ -0,0 +1,14 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +// initialize the messages variable |
| 5 | +$messages = array(); |
| 6 | + |
| 7 | +// English |
| 8 | +$messages[ 'en' ] = array( |
| 9 | + 'example-example' => 'This is an example!', |
| 10 | +); |
| 11 | + |
| 12 | +// Message documentation for translators |
| 13 | +$messages[ 'qqq' ] = array( |
| 14 | + 'example-example' => 'This is just an example message. Nothing special.', |
| 15 | +); |
Property changes on: trunk/extensions/examples/Example/Example.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 16 | + native |
Index: trunk/extensions/examples/Example/Example.php |
— | — | @@ -0,0 +1,42 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * This is an example extension. It doesn't actually do anything useful, but |
| 5 | + * can be copied to provide the basis for your own extension. |
| 6 | + */ |
| 7 | + |
| 8 | +/** |
| 9 | + * Prevent a user from accessing this file directly and provide a helpful |
| 10 | + * message explaining how to install this extension. |
| 11 | + */ |
| 12 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 13 | + if ( !defined( 'MEDIAWIKI' ) ) { |
| 14 | + echo <<<EOT |
| 15 | +To install the Example extension, put the following line in your |
| 16 | +LocalSettings.php file: |
| 17 | +require_once( "\$IP/extensions/Example/Example.php" ); |
| 18 | +EOT; |
| 19 | + exit( 1 ); |
| 20 | + } |
| 21 | +} |
| 22 | + |
| 23 | +// Extension credits that will show up on Special:Version |
| 24 | +$wgExtensionCredits[ 'other' ][] = array( |
| 25 | + 'path' => __FILE__, |
| 26 | + 'name' => 'Example', |
| 27 | + 'author' =>'Your Name Here', |
| 28 | + 'url' => 'https://www.mediawiki.org/wiki/Extension:Example', |
| 29 | + 'description' => 'This extension is an example extension', |
| 30 | + 'version' => 1.0, |
| 31 | +); |
| 32 | + |
| 33 | +// Find the full directory path of this extension |
| 34 | +$current_dir = dirname( __FILE__ ) . DIRECTORY_SEPARATOR; |
| 35 | + |
| 36 | +// Autoload this extension's classes |
| 37 | +$wgAutoloadClasses[ 'SpecialExample' ] = $current_dir . 'Example.body.php'; |
| 38 | + |
| 39 | +// Add the i18n message file |
| 40 | +$wgExtensionMessagesFiles[ 'Example' ] = $current_dir . 'Example.i18n.php'; |
| 41 | + |
| 42 | +// Tell MediaWiki about the special page |
| 43 | +$wgSpecialPages[ 'Example' ] = 'SpecialExample'; |
Property changes on: trunk/extensions/examples/Example/Example.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 44 | + native |
Index: trunk/extensions/examples/Example/Example.body.php |
— | — | @@ -0,0 +1,17 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class SpecialExample extends SpecialPage { |
| 5 | + |
| 6 | + function __construct() { |
| 7 | + parent::__construct( 'Example' ); |
| 8 | + } |
| 9 | + |
| 10 | + /** |
| 11 | + * Make your magic happen! |
| 12 | + */ |
| 13 | + function execute( $par ) { |
| 14 | + global $wgOut; |
| 15 | + |
| 16 | + $wgOut->addWikiMsg( 'example-example' ); |
| 17 | + } |
| 18 | +} |
Property changes on: trunk/extensions/examples/Example/Example.body.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 19 | + native |
Index: trunk/extensions/examples/Example/README |
— | — | @@ -0,0 +1,7 @@ |
| 2 | +This is an example extension. It doesn't really do anything on its own. It is |
| 3 | +intended to provide a sample layout of a MediaWiki extension which a developer |
| 4 | +can copy and use as a base for their own extension. |
| 5 | + |
| 6 | +If you are checking this our from SVN and intend to copy it, please use: |
| 7 | + svn export /path/to/this/extension /path/to/new/extension |
| 8 | +to create a clean copy without any extra SVN cruft. |
Property changes on: trunk/extensions/examples/Example/README |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 9 | + native |