r106437 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106436‎ | r106437 | r106438 >
Date:14:51, 16 December 2011
Author:reedy
Status:ok
Tags:
Comment:
Fix whitespace

Don't use direct member variable access
Modified paths:
  • /trunk/extensions/Contest/specials/SpecialContest.php (modified) (history)
  • /trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php (modified) (history)
  • /trunk/extensions/auth/SampleAuth.php (modified) (history)

Diff [purge]

Index: trunk/extensions/auth/SampleAuth.php
@@ -11,8 +11,7 @@
1212 }
1313
1414 function authenticate( $username, $password ) {
15 - return $this->userExists( $username ) &&
16 - ( $password == "password" );
 15+ return $this->userExists( $username ) && ( $password == "password" );
1716 }
1817
1918 function autoCreate() {
Index: trunk/extensions/Contest/specials/SpecialContest.php
@@ -56,13 +56,13 @@
5757
5858 $this->displayNavigation();
5959 $this->showGeneralInfo( $contest );
60 -
 60+
6161 if ( $this->getUser()->isAllowed( 'contestadmin' ) ) {
6262 $this->showMailFunctionality( $contest );
6363 }
64 -
 64+
6565 $out->addHTML( Html::element( 'h3', array(), wfMsg( 'contest-contest-contestants' ) ) );
66 -
 66+
6767 $this->addFilterOptionsToSession();
6868 $this->showFilterControl( $contest, $challengeTitle );
6969 $this->showContestants( $contest, $challengeTitle );
@@ -150,7 +150,7 @@
151151 'id' => 'send-reminder',
152152 'data-token' => $this->getUser()->editToken(),
153153 'data-contest-id' => $contest->getId(),
154 -
 154+
155155 // Note: this is a copy of the message in ContestContestant::sendReminderEmail.
156156 // If it's changed or modified by a hook, this message might not be accurate.
157157 'data-reminder-subject' => wfMsgExt( 'contest-email-reminder-title', 'parsemag', $contest->getDaysLeft() )
@@ -184,9 +184,9 @@
185185 $conds = array(
186186 'contestant_contest_id' => $contest->getId()
187187 );
188 -
 188+
189189 $this->addRequestConditions( $conds );
190 -
 190+
191191 $pager = new ContestantPager( $this, $conds );
192192
193193 if ( $pager->getNumRows() ) {
@@ -200,12 +200,12 @@
201201 $out->addWikiMsg( 'contest-contest-no-results' );
202202 }
203203 }
204 -
 204+
205205 /**
206206 * Add the filter options to the session, so they get retained
207207 * when the user does navigation such as going to the next
208208 * set of results using the pager.
209 - *
 209+ *
210210 * @since 0.2
211211 */
212212 protected function addFilterOptionsToSession() {
@@ -217,27 +217,27 @@
218218 'challenge',
219219 'submission'
220220 );
221 -
 221+
222222 $req = $this->getRequest();
223 -
 223+
224224 foreach ( $fields as $field ) {
225225 if ( $req->getCheck( $field ) ) {
226226 $req->setSessionData( 'contestant-' . $field, $req->getVal( $field ) );
227227 }
228228 }
229229 }
230 -
 230+
231231 /**
232232 * Add the needed conditions to the provided array depending
233233 * on the filter options set.
234 - *
 234+ *
235235 * @since 0.2
236 - *
 236+ *
237237 * @param array $conds
238238 */
239239 protected function addRequestConditions( &$conds ) {
240240 $req = $this->getRequest();
241 -
 241+
242242 foreach ( array( 'volunteer', 'wmf' ) as $field ) {
243243 if ( in_array( $req->getSessionData( 'contestant-' . $field ), array( 'yes', 'no' ) ) ) {
244244 $conds['contestant_' . $field] = $req->getSessionData( 'contestant-' . $field ) == 'yes' ? 1 : 0;
@@ -254,7 +254,7 @@
255255 }
256256 }
257257 }
258 -
 258+
259259 if ( $req->getSessionData( 'contestant-challenge' ) ) {
260260 $challenge = ContestChallenge::s()->selectRow( 'id', array( 'title' => $req->getSessionData( 'contestant-' . $field ) ) );
261261
@@ -263,7 +263,7 @@
264264 unset( $conds['contestant_contest_id'] ); // Not needed because the challenge implies the context
265265 }
266266 }
267 -
 267+
268268 if ( in_array( $req->getSessionData( 'contestant-submission' ), array( 'some', 'none' ) ) ) {
269269 if ( $req->getSessionData( 'contestant-submission' ) == 'none' ) {
270270 $conds['contestant_submission'] = '';
@@ -273,61 +273,60 @@
274274 }
275275 }
276276 }
277 -
 277+
278278 /**
279279 * Create the filter control and add it to the output.
280 - *
 280+ *
281281 * @since 0.2
282 - *
 282+ *
283283 * @param Contest $contest
284284 */
285285 protected function showFilterControl( Contest $contest ) {
286 - $req = $this->getRequest();
287286 $challenges = array();
288 -
 287+
289288 foreach ( $contest->getChallenges() as /* ContestChallenge */ $challenge ) {
290289 $challenges[$challenge->getField( 'title' )] = $challenge->getField( 'title' );
291290 }
292 -
 291+
293292 $yesNo = array(
294293 'yes' => wfMsg( 'contest-contest-yes' ),
295294 'no' => wfMsg( 'contest-contest-no' )
296295 );
297 -
 296+
298297 $noneSome = array(
299298 'none' => wfMsg( 'contest-contest-none' ),
300299 'some' => wfMsg( 'contest-contest-some' ),
301300 );
302 -
 301+
303302 $title = $this->getTitle( $this->subPage )->getFullText();
304 -
 303+
305304 $this->getOutput()->addHTML(
306305 '<fieldset>' .
307306 '<legend>' . wfMsgHtml( 'contest-contest-showonly' ) . '</legend>' .
308307 '<form method="post" action="' . $GLOBALS['wgScript'] . '?title=' . $title . '">' .
309308 Html::hidden( 'title', $title ) .
310309 $this->getDropdownHTML(
311 - 'challenge',
 310+ 'challenge',
312311 $challenges
313312 ) .
314313 $this->getDropdownHTML(
315 - 'volunteer',
 314+ 'volunteer',
316315 $yesNo
317316 ) .
318317 $this->getDropdownHTML(
319 - 'wmf',
 318+ 'wmf',
320319 $yesNo
321320 ) .
322321 $this->getDropdownHTML(
323 - 'comments',
 322+ 'comments',
324323 $noneSome
325324 ) .
326325 $this->getDropdownHTML(
327 - 'rating_count',
 326+ 'rating_count',
328327 $noneSome
329328 ) .
330329 $this->getDropdownHTML(
331 - 'submission',
 330+ 'submission',
332331 $noneSome
333332 ) .
334333 '<input type="submit" value="' . wfMsgHtml( 'contest-contest-go' ) . '">' .
@@ -335,41 +334,41 @@
336335 '</fieldset>'
337336 );
338337 }
339 -
 338+
340339 /**
341340 * Get the HTML for a filter option dropdown menu.
342 - *
 341+ *
343342 * @since 0.2
344 - *
 343+ *
345344 * @param string $name
346345 * @param array $options
347346 * @param string|null $message
348347 * @param mixed $value
349 - *
 348+ *
350349 * @return string
351350 */
352351 protected function getDropdownHTML( $name, array $options, $message = null, $value = null ) {
353352 $opts = array();
354353 $options = array_merge( array( '' => ' ' ), $options );
355 -
 354+
356355 if ( is_null( $value ) ) {
357356 $value = $this->getRequest()->getSessionData( 'contestant-' . $name );
358357 }
359 -
 358+
360359 if ( is_null( $message ) ) {
361360 $message = 'contest-contest-filter-' . $name;
362361 }
363 -
 362+
364363 foreach ( $options as $val => $label ) {
365364 $attribs = array( 'value' => $val );
366 -
 365+
367366 if ( $val == $value || ( $val === ' ' && !array_key_exists( $val, $options ) ) ) {
368367 $attribs['selected'] = 'selected';
369368 }
370 -
 369+
371370 $opts[] = Html::element( 'option', $attribs, $label );
372371 }
373 -
 372+
374373 return Html::element( 'label', array( 'for' => $name ), wfMsg( $message ) ) . '&#160;' .
375374 Html::rawElement( 'select', array( 'name' => $name, 'id' => $name ), implode( "\n", $opts ) ) . '&#160;';
376375 }
Index: trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php
@@ -102,10 +102,10 @@
103103 $out = str_replace( "\n", '', $out );
104104 }
105105 // Register CSS
106 - $parser->mOutput->addHeadItem( self::buildHeadItem( $geshi ), "source-{$lang}" );
 106+ $parser->getOutput()->addHeadItem( self::buildHeadItem( $geshi ), "source-{$lang}" );
107107
108108 if( $wgUseSiteCss ) {
109 - $parser->mOutput->addModuleStyles( 'ext.geshi.local' );
 109+ $parser->getOutput()->addModuleStyles( 'ext.geshi.local' );
110110 }
111111
112112 $encloseTag = $enclose === GESHI_HEADER_NONE ? 'span' : 'div';

Status & tagging log