Index: trunk/extensions/ExternalData/ExternalData.i18n.php |
— | — | @@ -14,6 +14,15 @@ |
15 | 15 | // user messages |
16 | 16 | 'getdata' => 'Get data', |
17 | 17 | 'externaldata-desc' => 'Allows for retrieving data in CSV, JSON and XML formats from both external URLs and local wiki pages', |
| 18 | + 'externaldata-ldap-unable-to-connect' => 'Unable to connect to $1\n', |
| 19 | + 'externaldata-json-decode-not-supported' => 'Error: json_decode() is not supported in this version of PHP', |
| 20 | + 'externaldata-xml-error' => 'XML error: $1 at line $2', |
| 21 | + 'externaldata-db-incomplete-information' => '<p>ERROR: Incomplete information for this server ID.</p>\n', |
| 22 | + 'externaldata-db-could-not-get-url' => 'Could not get URL after $1 tries.\n\n', |
| 23 | + 'externaldata-db-unknown-type' => '<p>ERROR: Unknown database type.</p>\n', |
| 24 | + 'externaldata-db-could-not-connect' => '<p>ERROR: Could not connect to database.</p>\n', |
| 25 | + 'externaldata-db-no-return-values' => '<p>ERROR: No return values specified.</p>\n', |
| 26 | + 'externaldata-db-invalid-query' => 'Invalid query.', |
18 | 27 | ); |
19 | 28 | |
20 | 29 | /** Message documentation (Message documentation) |
Index: trunk/extensions/ExternalData/ED_Utils.php |
— | — | @@ -93,7 +93,7 @@ |
94 | 94 | # should check the result of the bind here |
95 | 95 | return $ds; |
96 | 96 | } else { |
97 | | - echo "Unable to connect to $server\n"; |
| 97 | + echo ( wfMsg( "externaldata-ldap-unable-to-connect", $server ) ); |
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | (! array_key_exists($server_id, $edgDBName)) || |
119 | 119 | (! array_key_exists($server_id, $edgDBUser)) || |
120 | 120 | (! array_key_exists($server_id, $edgDBPass))) { |
121 | | - echo "<p>ERROR: Incomplete information for this server ID.</p>\n"; |
| 121 | + echo ( wfMsg( "externaldata-db-incomplete-information" ) ); |
122 | 122 | return; |
123 | 123 | } |
124 | 124 | |
— | — | @@ -135,16 +135,16 @@ |
136 | 136 | } elseif ($db_type == "mssql") { |
137 | 137 | $db = new DatabaseMssql($db_server, $db_username, $db_password, $db_name); |
138 | 138 | } else { |
139 | | - echo "<p>ERROR: Unknown database type.</p>\n"; |
| 139 | + echo ( wfMsg( "externaldata-db-unknown-type" ) ); |
140 | 140 | return; |
141 | 141 | } |
142 | 142 | if (! $db->isOpen()) { |
143 | | - echo "<p>ERROR: Could not connect to database.</p>\n"; |
| 143 | + echo ( wfMsg( "externaldata-db-could-not-connect" ) ); |
144 | 144 | return; |
145 | 145 | } |
146 | 146 | |
147 | 147 | if (count($columns) == 0) { |
148 | | - echo "<p>ERROR: No return values specified.</p>\n"; |
| 148 | + echo ( wfMsg( "externaldata-db-no-return-values" ) ); |
149 | 149 | return; |
150 | 150 | } |
151 | 151 | |
— | — | @@ -168,7 +168,7 @@ |
169 | 169 | |
170 | 170 | $result = $db->query($sql); |
171 | 171 | if (!$result) { |
172 | | - echo "Invalid query."; |
| 172 | + echo ( wfMsg( "externaldata-db-invalid-query" ) ); |
173 | 173 | return false; |
174 | 174 | } else { |
175 | 175 | $rows = Array(); |
— | — | @@ -187,9 +187,9 @@ |
188 | 188 | xml_set_element_handler( $xml_parser, array( 'EDUtils', 'startElement' ), array( 'EDUtils', 'endElement' ) ); |
189 | 189 | xml_set_character_data_handler( $xml_parser, array( 'EDUtils', 'getContent' ) ); |
190 | 190 | if (!xml_parse($xml_parser, $xml, true)) { |
191 | | - echo(sprintf("XML error: %s at line %d", |
| 191 | + echo ( wfMsg( 'externaldata-xml-error', |
192 | 192 | xml_error_string(xml_get_error_code($xml_parser)), |
193 | | - xml_get_current_line_number($xml_parser))); |
| 193 | + xml_get_current_line_number($xml_parser)) ); |
194 | 194 | } |
195 | 195 | xml_parser_free( $xml_parser ); |
196 | 196 | return $edgXMLValues; |
— | — | @@ -263,7 +263,7 @@ |
264 | 264 | static function getJSONData( $json ) { |
265 | 265 | // escape if json_decode() isn't supported |
266 | 266 | if ( ! function_exists( 'json_decode' ) ) { |
267 | | - echo( "Error: json_decode() is not supported in this version of PHP" ); |
| 267 | + echo ( wfMsg( "externaldata-json-decode-not-supported" ) ); |
268 | 268 | return array(); |
269 | 269 | } |
270 | 270 | $json_tree = json_decode($json, true); |
— | — | @@ -300,7 +300,7 @@ |
301 | 301 | if ( $page === false ) { |
302 | 302 | sleep( 1 ); |
303 | 303 | if( $try_count >= self::$http_number_of_tries ){ |
304 | | - echo "could not get URL after " . self::$http_number_of_tries . " tries.\n\n"; |
| 304 | + echo ( wfMsg( "externaldata-db-could-not-get-url", self::$http_number_of_tries ) ); |
305 | 305 | return ''; |
306 | 306 | } |
307 | 307 | $try_count++; |