Index: trunk/extensions/TSPoll/TSPoll.php |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | * This line must be present before any global variable is referenced. |
19 | 19 | */ |
20 | 20 | |
21 | | -// Abbrechen des Skriptes, wenn es nicht in Mediawiki eingebunden ist |
| 21 | +// Die the extension, if not MediaWiki is used |
22 | 22 | if ( !defined( 'MEDIAWIKI' ) ) { |
23 | 23 | echo( "This is an extension to the MediaWiki package and cannot be run standalone.\n" ); |
24 | 24 | die( - 1 ); |
— | — | @@ -42,6 +42,7 @@ |
43 | 43 | |
44 | 44 | $wgExtensionMessagesFiles['TSPoll'] = dirname( __FILE__ ) . '/TSPoll.i18n.php'; |
45 | 45 | |
| 46 | +//Set function fpr <tspoll ...> and <TSPoll ...> to efTSPollRender |
46 | 47 | function efTSPollSetup() { |
47 | 48 | global $wgParser; |
48 | 49 | $wgParser->setHook( 'TSPoll', 'efTSPollRender' ); |
— | — | @@ -49,27 +50,32 @@ |
50 | 51 | return true; |
51 | 52 | } |
52 | 53 | |
| 54 | +//Set function fpr <tspoll ...> and <TSPoll ...> to efTSPollRender |
53 | 55 | function efTSPollSetupHook( &$parser ) { |
54 | 56 | $parser->setHook( 'TSPoll', 'efTSPollRender' ); |
55 | 57 | $parser->setHook( 'tspoll', 'efTSPollRender' ); |
56 | 58 | return true; |
57 | 59 | } |
58 | 60 | |
| 61 | +// Get the Output of the TSPoll-Skript and return that |
59 | 62 | function efTSPollRender( $input, $args, $parser ) { |
60 | 63 | |
61 | | - if ( isset( $args['id'] ) && $args['id'] != "" ) { |
| 64 | + // Control if the "id" is set. If not, it output a error |
| 65 | + if ( isset( $args['id'] ) && $args['id'] != "" ) { |
62 | 66 | $id = wfUrlencode( $args['id'] ); |
63 | 67 | } else { |
64 | 68 | wfLoadExtensionMessages( 'TSPoll' ); |
65 | 69 | return wfMsg( 'tspoll-id-error' ); |
66 | 70 | } |
67 | | - |
| 71 | + |
| 72 | + // Control if "dev" is set. If not, it use the normal skript, else, it use the dev skript |
68 | 73 | if ( isset( $args['dev'] ) && $args['dev'] == "1" ) { // If the arrgument dev is given, use the TSPoll-Dev-Version |
69 | 74 | $get_server = Http::get( 'http://toolserver.org/~jan/poll/dev/main.php?page=wiki_output&id='.$id ); |
70 | 75 | } else { // sonst die normale Version verwenden |
71 | 76 | $get_server = Http::get( 'http://toolserver.org/~jan/poll/main.php?page=wiki_output&id='.$id ); |
72 | 77 | } |
73 | | - |
| 78 | + |
| 79 | + // If $get_server is empty it output a error |
74 | 80 | if ( $get_server != '' ) { |
75 | 81 | return $get_server; |
76 | 82 | } |