r25826 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25825‎ | r25826 | r25827 >
Date:13:17, 13 September 2007
Author:aaron
Status:old
Tags:
Comment:
*Clean E_STRICT errors
Modified paths:
  • /trunk/extensions/Review/Review.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Review/Review.php
@@ -92,16 +92,16 @@
9393 foreach ( $s AS $v ) {
9494 $v = explode ( ':' , trim ( $v ) ) ;
9595 if ( count ( $v ) != 5 ) continue ; # Some other line, ignore it
96 - $x = "" ;
97 - $x->key = (int) trim ( array_shift ( $v ) ) ;
98 - $x->name = trim ( array_shift ( $v ) ) ;
99 - $x->range = (int) trim ( array_shift ( $v ) ) ;
100 - $x->left = trim ( array_shift ( $v ) ) ;
101 - $x->right = trim ( array_shift ( $v ) ) ;
102 - if ( $x->key == 0 ) continue ; # Paranoia
103 - if ( $x->range < 2 ) continue ; # Paranoia
104 - if ( $x->name == "" ) continue ; # Paranoia
105 - $wgReviewExtensionTopics[$x->key] = $x ;
 96+ $x = array();
 97+ $x['key'] = (int) trim ( array_shift ( $v ) ) ;
 98+ $x['name'] = trim ( array_shift ( $v ) ) ;
 99+ $x['range'] = (int) trim ( array_shift ( $v ) ) ;
 100+ $x['left'] = trim ( array_shift ( $v ) ) ;
 101+ $x['right'] = trim ( array_shift ( $v ) ) ;
 102+ if ( $x['key'] == 0 ) continue ; # Paranoia
 103+ if ( $x['range'] < 2 ) continue ; # Paranoia
 104+ if ( $x['name'] == "" ) continue ; # Paranoia
 105+ $wgReviewExtensionTopics[$x['key']] = $x ;
106106 }
107107 }
108108
@@ -115,7 +115,7 @@
116116 if ( !isset ( $topic->value ) )
117117 $topic->value = 0 ;
118118
119 - $tkey = "review_topic[" . $topic->key . "]" ;
 119+ $tkey = "review_topic[" . $topic['key'] . "]" ;
120120 $ret = "" ;
121121 if ( $fullpage )
122122 $ret .= "<td align='center'>" ;
@@ -125,31 +125,31 @@
126126 $ret .= "/></td>" ;
127127 else
128128 $ret .= '/>&nbsp;' ;
129 - if ( $topic->range == 2 ) { # Yes/No
 129+ if ( $topic['range'] == 2 ) { # Yes/No
130130 if ( $fullpage )
131131 $ret .= "<td/><td nowrap>" ;
132132 $ret .= '<input type="radio" name="' . $tkey . '" value="1" id="review_radio_1_of_2"' ;
133133 $ret .= $topic->value == 1 ? " checked" : "" ;
134 - $ret .= '></input>' . $topic->left . ' ' ;
 134+ $ret .= '></input>' . $topic['left'] . ' ' ;
135135 $ret .= '<input type="radio" name="' . $tkey . '" value="2" id="review_radio_2_of_2"' ;
136136 $ret .= $topic->value == 2 ? " checked" : "" ;
137 - $ret .= '/>' . $topic->right ;
 137+ $ret .= '/>' . $topic['right'] ;
138138 if ( $fullpage )
139139 $ret .= "</td><td/><td>" ;
140140 } else { # Range
141141 if ( $fullpage )
142 - $ret .= "<td align='right' nowrap>" . $topic->left . "</td><td nowrap>" ;
143 - for ( $a = 1 ; $a <= $topic->range ; $a++ ) {
 142+ $ret .= "<td align='right' nowrap>" . $topic['left'] . "</td><td nowrap>" ;
 143+ for ( $a = 1 ; $a <= $topic['range'] ; $a++ ) {
144144 $ret .= '<input type="radio" name="' . $tkey . '" value="' . $a . '"' ;
145 - $ret .= " id='review_radio_" . $a . "_of_" . $topic->range . "'" ; # This doesn't show for some weird reason...
 145+ $ret .= " id='review_radio_" . $a . "_of_" . $topic['range'] . "'" ; # This doesn't show for some weird reason...
146146 $ret .= $topic->value == $a ? " checked" : "" ;
147147 $ret .= '/>' ;
148148 }
149149 if ( $fullpage )
150 - $ret .= "</td><td nowrap>" . $topic->right . "</td><td width='100%'>" ;
 150+ $ret .= "</td><td nowrap>" . $topic['right'] . "</td><td width='100%'>" ;
151151 }
152152 if ( $fullpage ) {
153 - $ret .= "<input type='text' style='width:100%' name='review_comment[" . $topic->key . "]' value='" . htmlentities ( $topic->comment ) . "'/>" ;
 153+ $ret .= "<input type='text' style='width:100%' name='review_comment[" . $topic['key'] . "]' value='" . htmlentities ( $topic->comment ) . "'/>" ;
154154 $ret .= "</td>\n" ;
155155 }
156156 return $ret ;
@@ -378,17 +378,17 @@
379379 ?>
380380 <a id="review_sidebar_link" href="
381381 <?php
382 - $topic_title = Title::makeTitleSafe( NS_MEDIAWIKI, wfMsgForContent('review_topic_page').'#'.$topic->name );
 382+ $topic_title = Title::makeTitleSafe( NS_MEDIAWIKI, wfMsgForContent('review_topic_page').'#'.$topic['name'] );
383383 print $topic_title->escapeLocalURL();
384384 ?>
385385 ">
386386 <?php
387 - echo $topic->name ;
 387+ echo $topic['name'] ;
388388 ?>
389389 </a>
390390 <?php
391 - if ( $topic->range > 2 )
392 - print "<small> (" . $topic->left . "&rarr;" . $topic->right . ")</small><br />" ;
 391+ if ( $topic['range'] > 2 )
 392+ print "<small> (" . $topic['left'] . "&rarr;" . $topic['right'] . ")</small><br />" ;
393393 echo "<div id='review_sidebar_range'>" . wfReviewExtensionGetTopicForm ( $topic ) . "</div>" ;
394394 ?>
395395 <?php
@@ -517,7 +517,7 @@
518518 $data[$type]->total_count = 0 ;
519519 $data[$type]->anon_count = 0 ;
520520 $data[$type]->sum = 0 ;
521 - $data[$type]->max = $wgReviewExtensionTopics[$type]->range ;
 521+ $data[$type]->max = $wgReviewExtensionTopics[$type]['range'] ;
522522 }
523523 $data[$type]->total_count++ ;
524524 if ( $review->val_user == 0 )
@@ -598,14 +598,14 @@
599599 foreach ( $wgReviewExtensionTopics AS $type => $topic ) {
600600 if ( $revision < 0 ) {
601601 # Table header row
602 - $ret .= "<th id='review_statistics_table_header'>{$topic->name}</th>" ;
 602+ $ret .= "<th id='review_statistics_table_header'>{$topic['name']}</th>" ;
603603 } else if ( $revision_mode ) {
604604 $ret .= "<td id='review_statistics_table_cell'>" ;
605605 if ( isset ( $data[$type] ) ) {
606606 $ret .= "<div id='" ;
607 - $ret .= "review_radio_" . $data[$type]->val_value . "_of_" . $topic->range ;
 607+ $ret .= "review_radio_" . $data[$type]->val_value . "_of_" . $topic['range'] ;
608608 $ret .= "'>" ;
609 - $ret .= wfMsgForContent ( 'review_version_statistic_cell' , $data[$type]->val_value , $topic->range ) ;
 609+ $ret .= wfMsgForContent ( 'review_version_statistic_cell' , $data[$type]->val_value , $topic['range'] ) ;
610610 $ret .= "</div>" ;
611611 } else {
612612 $ret .= "&mdash;" ;
@@ -723,8 +723,8 @@
724724 $out .= "</th><th colspan='3'>" . wfMsg('review_rating') . "</th><th>" ;
725725 $out .= wfMsg('review_comment') . "</th></tr>" ;
726726 foreach( $wgReviewExtensionTopics as $topic ) {
727 - $topic_title = Title::makeTitleSafe( NS_MEDIAWIKI, wfMsgForContent('review_topic_page').'#'.$topic->name );
728 - $link = $skin->makeLinkObj( $topic_title,$topic->name );
 727+ $topic_title = Title::makeTitleSafe( NS_MEDIAWIKI, wfMsgForContent('review_topic_page').'#'.$topic['name'] );
 728+ $link = $skin->makeLinkObj( $topic_title,$topic['name'] );
729729 $out .= "<tr><th align='left' nowrap>{$link}</th>" ;
730730 $out .= wfReviewExtensionGetTopicForm ( $topic , true ) . "</tr>" ;
731731
@@ -748,7 +748,7 @@
749749 /**
750750 * Special page main function
751751 */
752 - function execute( $par = null ) {
 752+ function execute( $par ) {
753753 global $wgRequest , $wgOut , $wgUser , $wgTitle ;
754754 wfReviewExtensionInitMessages () ;
755755
@@ -772,7 +772,7 @@
773773 }
774774
775775 if ( $page_id == 0 ) {
776 - if( $par != null){
 776+ if( $par != ''){
777777 $title = Title::newFromUrl($par);
778778 $page_id = $title->getArticleID();
779779 }

Status & tagging log