Index: trunk/extensions/TSPoll/TSPoll.php |
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) { |
39 | 39 | $wgHooks['ParserFirstCallInit'][] = 'efTSPollSetup'; |
40 | 40 | } else { // Otherwise do things the old fashioned way |
41 | | - $wgExtensionFunctions[] = 'efTSPollSetup'; |
| 41 | + $wgExtensionFunctions[] = 'efTSPollSetupHook'; |
42 | 42 | } |
43 | 43 | |
44 | 44 | $wgExtensionMessagesFiles['TSPoll'] = dirname( __FILE__ ) . '/TSPoll.i18n.php'; |
— | — | @@ -50,6 +50,12 @@ |
51 | 51 | return true; |
52 | 52 | } |
53 | 53 | |
| 54 | +function efTSPollSetupHook( &$parser ) { |
| 55 | + $parser->setHook( 'TSPoll', 'efTSPollRender' ); |
| 56 | + $parser->setHook( 'tspoll', 'efTSPollRender' ); |
| 57 | + return true; |
| 58 | +} |
| 59 | + |
54 | 60 | function efTSPollRender( $input, $args, $parser ) { |
55 | 61 | |
56 | 62 | if ( isset( $args['id'] ) ) { |
— | — | @@ -58,14 +64,17 @@ |
59 | 65 | // @todo: maybe output an error? |
60 | 66 | $id = ''; |
61 | 67 | } |
62 | | - |
| 68 | + |
| 69 | + // @todo Can't we just use the Http class? |
63 | 70 | $http = new http_w( 'toolserver.org', '/~jan/poll/main.php?page=wiki_output&id=' . $id ); |
64 | 71 | $get_server = $http->get( '' ); |
| 72 | + // @todo If false? How can this ever be true? |
65 | 73 | if( false&& $get_server != '' ) { |
66 | 74 | return $get_server; |
67 | 75 | } |
68 | 76 | else { |
69 | 77 | wfLoadExtensionMessages( 'TSPoll' ); |
| 78 | + // @todo: Should this be parsing before returning? |
70 | 79 | return wfMsgExt( 'tspoll-fetch-error', array( 'parse' ) ); |
71 | 80 | } |
72 | 81 | } |