r64579 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64578‎ | r64579 | r64580 >
Date:22:51, 3 April 2010
Author:siebrand
Status:deferred
Tags:
Comment:
stylize.php, trailing whitespace removed
Modified paths:
  • /trunk/extensions/AmazonPlus/AmazonPlus.js (modified) (history)
  • /trunk/extensions/AmazonPlus/AmazonPlus.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AmazonPlus/AmazonPlus.php
@@ -25,11 +25,11 @@
2626 exit( 1 );
2727 }
2828
29 -if( !function_exists( 'wfIniGetBool' ) ) {
30 - #perhaps GlobalFunctions wasn't loaded?
 29+if ( !function_exists( 'wfIniGetBool' ) ) {
 30+ # perhaps GlobalFunctions wasn't loaded?
3131 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
3434 echo '<html><head><title>Error</title></head><body>The AmazonPlus extension does not support your version of MediaWiki.
3535 Please either upgrade MediaWiki or uninstall the AmazonPlus extension.</body></html>';
3636 die( 1 );
@@ -38,16 +38,16 @@
3939
4040 # make sure that everything that needs to be set/loaded is that way
4141 $err = '';
42 -if( !wfIniGetBool( 'allow_url_fopen' ) && !extension_loaded( 'curl' ) ) {
 42+if ( !wfIniGetBool( 'allow_url_fopen' ) && !extension_loaded( 'curl' ) ) {
4343 # we need allow_url_fopen or curl to be on in order for the Http::get() call to work on the amazon url
4444 $err .= "\n<li>allow_url_fopen or curl must be enabled in php.ini</li>";
4545 }
46 -if( !extension_loaded( 'simplexml' ) ) {
 46+if ( !extension_loaded( 'simplexml' ) ) {
4747 # we need the simplexml extension loaded to parse the xml string
4848 $err .= "\n<li>The SimpleXML extension for PHP must be loaded</li>";
4949 }
5050 # if there were errors found, die with the messages
51 -if( $err ) {
 51+if ( $err ) {
5252 $html = '<html><head><title>Error</title></head><body>
5353 The following errors were discovered with the AmazonPlus extension for MediaWiki:
5454 <ul>' . $err . '</ul></body></html>';
@@ -111,7 +111,7 @@
112112
113113 # Parse out template parameters only before getting setting up the class so {{{1}}} and the like work
114114 $input = $parser->replaceVariables( $input, false, true );
115 - foreach( $args as $key => $arg ) {
 115+ foreach ( $args as $key => $arg ) {
116116 $args[$key] = $parser->replaceVariables( $arg, false, true );
117117 }
118118
@@ -188,7 +188,7 @@
189189 'SearchIndex' => $si,
190190 );
191191 $this->doRequest();
192 - if( !$this->xml || !$this->xml->Items->TotalResults ) {
 192+ if ( !$this->xml || !$this->xml->Items->TotalResults ) {
193193 return false;
194194 }
195195 return $this->xml->Items->Item[0]->ASIN;
@@ -206,7 +206,7 @@
207207 ksort( $this->request );
208208 $prestr = "GET\necs.amazonaws.{$tld}\n/onca/xml\n";
209209 $str = '';
210 - foreach( $this->request as $key => $value ) {
 210+ foreach ( $this->request as $key => $value ) {
211211 $str .= $this->encode( $key ) . '=' . $this->encode( $value ) . '&';
212212 }
213213 $str = rtrim( $str, '&' );
@@ -228,7 +228,7 @@
229229 }
230230 return true;
231231 }
232 -
 232+
233233 function encode( $str ) {
234234 return str_ireplace( '%7E', '~', rawurlencode( $str ) );
235235 }
@@ -335,10 +335,10 @@
336336 $pieces = explode( '-', $date );
337337 return $pieces[$segment];
338338 }
339 -
 339+
340340 function shortReview( $rev ) {
341341 // return the first 3 paragraphs and have a more/less link afterwards
342 - if( !$this->shortReview ) {
 342+ if ( !$this->shortReview ) {
343343 $rev = str_replace( '<br>', '<br />', $rev );
344344 $paras = explode( '<br />', $rev );
345345 switch( count( $paras ) ) {
@@ -353,7 +353,7 @@
354354 $html = '<div class="shortReviewFrame" id="shortReviewFrame' . ++$this->src . '">';
355355 $html .= '<div class="shortReviewHead">' . $head . '</div>';
356356 $html .= '<div class="shortReviewBody" style="display: none">';
357 - for( $i = 3; $i < count( $paras ); $i++ ) {
 357+ for ( $i = 3; $i < count( $paras ); $i++ ) {
358358 $html .= '<br />' . $paras[$i];
359359 }
360360 $more = wfMsg( 'amazonplus-more' );
Index: trunk/extensions/AmazonPlus/AmazonPlus.js
@@ -18,4 +18,4 @@
1919 b.style.display = 'block';
2020 a.innerHTML = less;
2121 }
22 -}
\ No newline at end of file
 22+}

Status & tagging log