Index: trunk/extensions/AmazonPlus/AmazonPlus.php |
— | — | @@ -25,11 +25,11 @@ |
26 | 26 | exit( 1 ); |
27 | 27 | } |
28 | 28 | |
29 | | -if( !function_exists( 'wfIniGetBool' ) ) { |
30 | | - #perhaps GlobalFunctions wasn't loaded? |
| 29 | +if ( !function_exists( 'wfIniGetBool' ) ) { |
| 30 | + # perhaps GlobalFunctions wasn't loaded? |
31 | 31 | require_once( "$IP/includes/GlobalFunctions.php" ); |
32 | | - if( !function_exists( 'wfIniGetBool' ) ) { |
33 | | - #unsupported MediaWiki version, exit early so we don't get fatals or whatnot |
| 32 | + if ( !function_exists( 'wfIniGetBool' ) ) { |
| 33 | + # unsupported MediaWiki version, exit early so we don't get fatals or whatnot |
34 | 34 | echo '<html><head><title>Error</title></head><body>The AmazonPlus extension does not support your version of MediaWiki. |
35 | 35 | Please either upgrade MediaWiki or uninstall the AmazonPlus extension.</body></html>'; |
36 | 36 | die( 1 ); |
— | — | @@ -38,16 +38,16 @@ |
39 | 39 | |
40 | 40 | # make sure that everything that needs to be set/loaded is that way |
41 | 41 | $err = ''; |
42 | | -if( !wfIniGetBool( 'allow_url_fopen' ) && !extension_loaded( 'curl' ) ) { |
| 42 | +if ( !wfIniGetBool( 'allow_url_fopen' ) && !extension_loaded( 'curl' ) ) { |
43 | 43 | # we need allow_url_fopen or curl to be on in order for the Http::get() call to work on the amazon url |
44 | 44 | $err .= "\n<li>allow_url_fopen or curl must be enabled in php.ini</li>"; |
45 | 45 | } |
46 | | -if( !extension_loaded( 'simplexml' ) ) { |
| 46 | +if ( !extension_loaded( 'simplexml' ) ) { |
47 | 47 | # we need the simplexml extension loaded to parse the xml string |
48 | 48 | $err .= "\n<li>The SimpleXML extension for PHP must be loaded</li>"; |
49 | 49 | } |
50 | 50 | # if there were errors found, die with the messages |
51 | | -if( $err ) { |
| 51 | +if ( $err ) { |
52 | 52 | $html = '<html><head><title>Error</title></head><body> |
53 | 53 | The following errors were discovered with the AmazonPlus extension for MediaWiki: |
54 | 54 | <ul>' . $err . '</ul></body></html>'; |
— | — | @@ -111,7 +111,7 @@ |
112 | 112 | |
113 | 113 | # Parse out template parameters only before getting setting up the class so {{{1}}} and the like work |
114 | 114 | $input = $parser->replaceVariables( $input, false, true ); |
115 | | - foreach( $args as $key => $arg ) { |
| 115 | + foreach ( $args as $key => $arg ) { |
116 | 116 | $args[$key] = $parser->replaceVariables( $arg, false, true ); |
117 | 117 | } |
118 | 118 | |
— | — | @@ -188,7 +188,7 @@ |
189 | 189 | 'SearchIndex' => $si, |
190 | 190 | ); |
191 | 191 | $this->doRequest(); |
192 | | - if( !$this->xml || !$this->xml->Items->TotalResults ) { |
| 192 | + if ( !$this->xml || !$this->xml->Items->TotalResults ) { |
193 | 193 | return false; |
194 | 194 | } |
195 | 195 | return $this->xml->Items->Item[0]->ASIN; |
— | — | @@ -206,7 +206,7 @@ |
207 | 207 | ksort( $this->request ); |
208 | 208 | $prestr = "GET\necs.amazonaws.{$tld}\n/onca/xml\n"; |
209 | 209 | $str = ''; |
210 | | - foreach( $this->request as $key => $value ) { |
| 210 | + foreach ( $this->request as $key => $value ) { |
211 | 211 | $str .= $this->encode( $key ) . '=' . $this->encode( $value ) . '&'; |
212 | 212 | } |
213 | 213 | $str = rtrim( $str, '&' ); |
— | — | @@ -228,7 +228,7 @@ |
229 | 229 | } |
230 | 230 | return true; |
231 | 231 | } |
232 | | - |
| 232 | + |
233 | 233 | function encode( $str ) { |
234 | 234 | return str_ireplace( '%7E', '~', rawurlencode( $str ) ); |
235 | 235 | } |
— | — | @@ -335,10 +335,10 @@ |
336 | 336 | $pieces = explode( '-', $date ); |
337 | 337 | return $pieces[$segment]; |
338 | 338 | } |
339 | | - |
| 339 | + |
340 | 340 | function shortReview( $rev ) { |
341 | 341 | // return the first 3 paragraphs and have a more/less link afterwards |
342 | | - if( !$this->shortReview ) { |
| 342 | + if ( !$this->shortReview ) { |
343 | 343 | $rev = str_replace( '<br>', '<br />', $rev ); |
344 | 344 | $paras = explode( '<br />', $rev ); |
345 | 345 | switch( count( $paras ) ) { |
— | — | @@ -353,7 +353,7 @@ |
354 | 354 | $html = '<div class="shortReviewFrame" id="shortReviewFrame' . ++$this->src . '">'; |
355 | 355 | $html .= '<div class="shortReviewHead">' . $head . '</div>'; |
356 | 356 | $html .= '<div class="shortReviewBody" style="display: none">'; |
357 | | - for( $i = 3; $i < count( $paras ); $i++ ) { |
| 357 | + for ( $i = 3; $i < count( $paras ); $i++ ) { |
358 | 358 | $html .= '<br />' . $paras[$i]; |
359 | 359 | } |
360 | 360 | $more = wfMsg( 'amazonplus-more' ); |
Index: trunk/extensions/AmazonPlus/AmazonPlus.js |
— | — | @@ -18,4 +18,4 @@ |
19 | 19 | b.style.display = 'block'; |
20 | 20 | a.innerHTML = less; |
21 | 21 | } |
22 | | -} |
\ No newline at end of file |
| 22 | +} |