r50119 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50118‎ | r50119 | r50120 >
Date:07:40, 2 May 2009
Author:ialex
Status:deferred
Tags:
Comment:
Fixes to TSPoll extension:
* changed description message from 'descript_msg' to 'tspoll-desc' to avoid possible conflicting messages names
* removed ?> from http.func.php, was throwing warnings since there was a space after it
* code style tweaks
* svn:eol-style native

Note: maybe use Http::get() rather than the http_w class in http.func.php
Modified paths:
  • /trunk/extensions/TSPoll/README (modified) (history)
  • /trunk/extensions/TSPoll/TSPoll.i18n.php (modified) (history)
  • /trunk/extensions/TSPoll/TSPoll.php (modified) (history)
  • /trunk/extensions/TSPoll/http.func.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TSPoll/http.func.php
@@ -162,5 +162,3 @@
163163 }
164164 }
165165 }
166 -
167 -?>
\ No newline at end of file
Index: trunk/extensions/TSPoll/TSPoll.i18n.php
@@ -1,12 +1,21 @@
22 <?php
33 /**
 4+ * Internationalisation file for TSPoll extension.
 5+ *
 6+ * @file
47 * @ingroup Extensions
58 */
69
710 $messages = array();
 11+
812 $messages['en'] = array(
9 - 'descript_msg' => 'Include the [http://www.toolserver.org/~jan/poll/index.php Toolserver-Poll-Skript] as a HTML-tag',
 13+ 'tspoll-desc' => 'Include the [http://www.toolserver.org/~jan/poll/index.php Toolserver-Poll-Skript] as a HTML-tag',
 14+ 'tspoll-fetch-error' => 'Error while fetching the URL!',
1015 );
 16+
 17+/** German (Deutsch)
 18+ * @author Jan Luca
 19+ */
1120 $messages['de'] = array(
12 - 'descript_msg' => 'Bindet das [http://www.toolserver.org/~jan/poll/index.php Toolserver-Poll-Skript] als ein HTML-Tag ein',
 21+ 'tspoll-desc' => 'Bindet das [http://www.toolserver.org/~jan/poll/index.php Toolserver-Poll-Skript] als ein HTML-Tag ein',
1322 );
Index: trunk/extensions/TSPoll/TSPoll.php
@@ -29,7 +29,7 @@
3030 'version' => '1.0 Dev',
3131 'author' => 'Jan Luca',
3232 'url' => 'http://www.mediawiki.org/wiki/User:Jan_Luca/Extension:TSPoll',
33 - 'descriptionmsg'=> 'descript_msg'
 33+ 'descriptionmsg'=> 'tspoll-desc'
3434 );
3535
3636 //Avoid unstubbing $wgParser on setHook() too early on modern (1.12+) MW versions, as per r35980
@@ -45,27 +45,26 @@
4646 function efTSPollSetup() {
4747 global $wgParser;
4848 $wgParser->setHook( 'TSPoll', 'efTSPollRender' );
49 - $wgParser->setHook( 'tspoll', 'efTSPollRender' );
50 - return true;
 49+ $wgParser->setHook( 'tspoll', 'efTSPollRender' );
 50+ return true;
5151 }
5252
5353 function efTSPollRender( $input, $args, $parser ) {
54 - foreach( $args as $name => $value ) {
55 - if ($name == "id") {
56 - $id = htmlspecialchars( $value );
57 - break;
58 - }
59 - else {
60 - continue;
61 - }
62 - }
 54+
 55+ if ( isset( $args['id'] ) ) {
 56+ $id = wfUrlencode( $args['id'] );
 57+ } else {
 58+ // @todo: maybe output an error?
 59+ $id = '';
 60+ }
6361
64 - $http = new http_w("toolserver.org","/~jan/poll/main.php?page=wiki_output&id=".$id."");
65 - $get_server = $http->get("");
66 - if($get_server != "") {
67 - return $get_server;
68 - }
69 - else {
70 - return "Fehler beim Holen!";
71 - }
 62+ $http = new http_w( 'toolserver.org', '/~jan/poll/main.php?page=wiki_output&id=' . $id );
 63+ $get_server = $http->get( '' );
 64+ if( false&& $get_server != '' ) {
 65+ return $get_server;
 66+ }
 67+ else {
 68+ wfLoadExtensionMessages( 'TSPoll' );
 69+ return wfMsgExt( 'tspoll-fetch-error', array( 'parse' ) );
 70+ }
7271 }
Property changes on: trunk/extensions/TSPoll/README
___________________________________________________________________
Name: svn:eol-style
7372 + native

Status & tagging log