r49834 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49833‎ | r49834 | r49835 >
Date:19:51, 24 April 2009
Author:siebrand
Status:deferred
Tags:
Comment:
* stylize.php and trailing whitespace removed
* FIXME: should use a class file and $wgHooks['ParserFirstCallInit']
Modified paths:
  • /trunk/extensions/RT/RT.php (modified) (history)

Diff [purge]

Index: trunk/extensions/RT/RT.php
@@ -20,7 +20,7 @@
2121
2222 $rt_uri = 'http://www.mediawiki.org/wiki/Extension:RT';
2323
24 -## Default values: Override in LocalSettings.php, not here!
 24+# Default values: Override in LocalSettings.php, not here!
2525 $wgRequestTracker_URL = 'http://rt.example.com/Ticket/Display.html?id';
2626 $wgRequestTracker_DBconn = 'user=rt dbname=rt';
2727 $wgRequestTracker_Formats = array();
@@ -28,13 +28,13 @@
2929 $wgRequestTracker_Useballoons = 1;
3030 $wgRequestTracker_Active = 1;
3131
32 -## Time formatting
33 -## Example formats:
34 -## FMHH:MI AM FMMon DD, YYYY => 2:42 PM Jan 23, 2009
35 -## HH:MI FMMonth DD, YYYY => 14:42 January 23, 2009
36 -## YYYY/MM/DD => 2009/01/23
37 -## For a more complete list of possibilities, please visit:
38 -## http://www.postgresql.org/docs/current/interactive/functions-formatting.html
 32+# Time formatting
 33+# Example formats:
 34+# FMHH:MI AM FMMon DD, YYYY => 2:42 PM Jan 23, 2009
 35+# HH:MI FMMonth DD, YYYY => 14:42 January 23, 2009
 36+# YYYY/MM/DD => 2009/01/23
 37+# For a more complete list of possibilities, please visit:
 38+# http://www.postgresql.org/docs/current/interactive/functions-formatting.html
3939 $wgRequestTracker_TIMEFORMAT_LASTUPDATED = 'FMHH:MI AM FMMonth DD, YYYY';
4040 $wgRequestTracker_TIMEFORMAT_LASTUPDATED2 = 'FMMonth DD, YYYY';
4141 $wgRequestTracker_TIMEFORMAT_CREATED = 'FMHH:MI AM FMMonth DD, YYYY';
@@ -80,9 +80,9 @@
8181 return true;
8282 }
8383
84 -
 84+
8585 // This is called to process <rt>...</rt> within a page
86 -function rtRender( $input, $args=array(), $parser=null ) {
 86+function rtRender( $input, $args = array(), $parser = null ) {
8787
8888 global $wgRequestTracker_Cachepage, $wgRequestTracker_Active, $wgRequestTracker_DBconn,
8989 $wgRequestTracker_TIMEFORMAT_LASTUPDATED,
@@ -128,7 +128,7 @@
129129 }
130130 }
131131
132 - // If we are not 'active', we leave right away, with minimal output
 132+ // If we are not 'active', we leave right away, with minimal output
133133 if ( !$wgRequestTracker_Active ) {
134134 if ( $ticketnum ) {
135135 return "<span class='rt-ticket-inactive'>RT #$ticketnum</span>";
@@ -164,8 +164,8 @@
165165
166166 // If just a single number, treat it as <rt>#</rt>
167167 if ( 1 === count( $args ) ) {
168 - if ( preg_match( '/^\d+$/', key($args) ) ) {
169 - $ticketnum = key($args);
 168+ if ( preg_match( '/^\d+$/', key( $args ) ) ) {
 169+ $ticketnum = key( $args );
170170 }
171171 }
172172
@@ -221,7 +221,7 @@
222222 if ( array_key_exists( $word, $valid_orderby ) ) {
223223 $word = $valid_orderby[$word];
224224 }
225 - else if ( !preg_match ('/^\d+$/', $word ) ) {
 225+ else if ( !preg_match ( '/^\d+$/', $word ) ) {
226226 die ( wfMsg ( 'rt-badorderby', $word ) );
227227 }
228228 $orderby .= " $word$mod,";
@@ -251,7 +251,7 @@
252252
253253 // See if we are limiting to one or more queues
254254 $searchq = '';
255 - if ( array_key_exists('q', $args ) ) {
 255+ if ( array_key_exists( 'q', $args ) ) {
256256 $qargs = trim( strtolower( $args['q'] ) );
257257 $searchq = 'AND LOWER(q.name) IN (';
258258 foreach ( preg_split( '/\s*,\s*/', $qargs ) as $word ) {
@@ -266,7 +266,7 @@
267267
268268 // See if we are limiting to one or more owners
269269 $searchowner = '';
270 - if ( array_key_exists('o', $args ) ) {
 270+ if ( array_key_exists( 'o', $args ) ) {
271271 $oargs = trim( strtolower( $args['o'] ) );
272272 $searchowner = 'AND LOWER(u.name) IN (';
273273 foreach ( preg_split( '/\s*,\s*/', $oargs ) as $word ) {
@@ -298,8 +298,8 @@
299299
300300 // The queue: show by default unless searching a single queue
301301 $showqueue = 1;
302 - if ( array_key_exists('noqueue', $args )
303 - || ($searchq
 302+ if ( array_key_exists( 'noqueue', $args )
 303+ || ( $searchq
304304 && false === strpos( $searchq, ',' )
305305 && !array_key_exists( 'queue', $args ) ) ) {
306306 $showqueue = 0;
@@ -317,7 +317,7 @@
318318 // The status: show by default unless searching a single status
319319 $showstatus = 1;
320320 if ( array_key_exists( 'nostatus', $args )
321 - || ( false === strpos($searchstatus, ',' )
 321+ || ( false === strpos( $searchstatus, ',' )
322322 && !array_key_exists( 'status', $args ) ) ) {
323323 $showstatus = 0;
324324 }
@@ -337,7 +337,7 @@
338338 $showage = array_key_exists( 'age', $args );
339339
340340 // Unless 'tablerows' has been set, output the table and header tags
341 - if ( !array_key_exists( 'tablerows',$args ) ) {
 341+ if ( !array_key_exists( 'tablerows', $args ) ) {
342342
343343 $output = "<table class='rt-table' border='1'><tr>";
344344
@@ -362,12 +362,12 @@
363363
364364 if ( $showticket ) {
365365 $id = rtFancyLink( $row, $args, $parser, 1 );
366 - $output .= "<td style='white-space: nowrap'>$id</td>";
 366+ $output .= "<td style='white-space: nowrap'>$id</td>";
367367 }
368368 if ( $showqueue ) { $output .= '<td>' . htmlspecialchars( $row['queue'] ) . '</td>'; }
369369 if ( $showsubject ) { $output .= '<td>' . htmlspecialchars( $row['subject'] ) . '</td>'; }
370370 if ( $showstatus ) { $output .= '<td>' . htmlspecialchars( $row['status'] ) . '</td>'; }
371 - if ( $showpriority ) { $output .= '<td>' . htmlspecialchars( $row['priority'] ). '</td>'; }
 371+ if ( $showpriority ) { $output .= '<td>' . htmlspecialchars( $row['priority'] ) . '</td>'; }
372372 if ( $showowner ) { $output .= '<td>' . htmlspecialchars( $row['owner'] ) . '</td>'; }
373373 if ( $showupdated ) { $output .= '<td>' . $row['lastupdated'] . '</td>'; }
374374 if ( $showupdated2 ) { $output .= '<td>' . $row['lastupdated2'] . '</td>'; }
@@ -379,7 +379,7 @@
380380 $output .= '<tr>';
381381 }
382382
383 - if ( !array_key_exists( 'tablerows',$args ) ) {
 383+ if ( !array_key_exists( 'tablerows', $args ) ) {
384384 $output .= '</table>';
385385 }
386386
@@ -394,8 +394,8 @@
395395 $ticketnum = $row['id'];
396396 $ret = "[$wgRequestTracker_URL=$ticketnum RT #$ticketnum]";
397397
398 - ## Check for any custom format args in the rt tag.
399 - ## If any are found, use that and ignore any other args
 398+ # Check for any custom format args in the rt tag.
 399+ # If any are found, use that and ignore any other args
400400 $foundformat = 0;
401401 foreach ( array_keys( $args ) as $val ) {
402402 if ( array_key_exists( $val, $wgRequestTracker_Formats ) ) {
@@ -409,7 +409,7 @@
410410 }
411411 }
412412
413 - ## Process any column-based args to the rt tag
 413+ # Process any column-based args to the rt tag
414414 if ( !$foundformat and !$istable ) {
415415 foreach ( array_keys( $args ) as $val ) {
416416 if ( array_key_exists( $val, $row ) ) {
@@ -437,7 +437,7 @@
438438 $safesub = htmlspecialchars( $safesub );
439439
440440 $safeowner = $row['owner'];
441 - if ($row['owner'] !== $row['username']) {
 441+ if ( $row['owner'] !== $row['username'] ) {
442442 $safeowner .= " ($row[username])";
443443 }
444444 $safeowner = preg_replace( '/\"/', '\"', $safeowner );
@@ -461,7 +461,7 @@
462462 $text .= "<br />Last updated: <b>$row[lastupdated]</b>";
463463 }
464464
465 - ## Prepare some balloon-tek
 465+ # Prepare some balloon-tek
466466 $link = isset( $args['link'] ) ? $args['link'] : '';
467467 $target = isset( $args['target'] ) ? $args['target'] : '';
468468 $sticky = isset( $args['sticky'] ) ? $args['sticky'] : '0';
@@ -471,12 +471,12 @@
472472 $event2 = '';
473473 $event = "$event=\"balloon.showTooltip(event,'${text}',${sticky},${width})\"";
474474
475 - if ( preg_match( '/onclick/',$event ) && $args['hover'] ) {
 475+ if ( preg_match( '/onclick/', $event ) && $args['hover'] ) {
476476 $event2 = " onmouseover=\"balloon.showTooltip(event,'" . $args['hover'] . "',0,${width})\"";
477477 }
478478
479479 $has_style = isset( $args['style'] ) && $args['style'];
480 - $style = "style=\"" . ($has_style ? $args['style'] . ";cursor:pointer\"" : "cursor:pointer\"");
 480+ $style = "style=\"" . ( $has_style ? $args['style'] . ";cursor:pointer\"" : "cursor:pointer\"" );
481481 $target = $target ? "target=${target}" : '';
482482 $output = "<span class='rt-ticket' ${event} ${event2} ${style}>$ret</span>";
483483

Follow-up revisions

RevisionCommit summaryAuthorDate
r49847Handle FIXME from r49834: split off into a class and register using ParserFir...demon22:53, 24 April 2009

Status & tagging log