r70749 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70748‎ | r70749 | r70750 >
Date:06:56, 9 August 2010
Author:reedy
Status:ok
Tags:
Comment:
Fixup (and add) some braces, remove trailing whitespace
Modified paths:
  • /trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php (modified) (history)
  • /trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php
@@ -36,8 +36,9 @@
3737 * some help text and a list of all supported languages.
3838 */
3939
40 -if( !defined( 'MEDIAWIKI' ) )
 40+if( !defined( 'MEDIAWIKI' ) ) {
4141 die();
 42+}
4243
4344 $wgExtensionCredits['parserhook']['SyntaxHighlight_GeSHi'] = array(
4445 'path' => __FILE__,
@@ -57,8 +58,7 @@
5859 if ( version_compare( $wgVersion, '1.17alpha', '>=' ) ) {
5960 // For MediaWiki 1.17 alpha and later.
6061 $wgHooks['ExtensionTypes'][] = 'SyntaxHighlight_GeSHi::hSpecialVersion_GeSHi';
61 -}
62 -else {
 62+} else {
6363 // For pre-MediaWiki 1.17 alpha.
6464 $wgHooks['SpecialVersionExtensionTypes'][] = 'SyntaxHighlight_GeSHi::hOldSpecialVersion_GeSHi';
6565 }
Index: trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php
@@ -62,15 +62,19 @@
6363 // Highlighting specific lines
6464 if( isset( $args['highlight'] ) ) {
6565 $lines = self::parseHighlightLines( $args['highlight'] );
66 - if ( count($lines) ) $geshi->highlight_lines_extra( $lines );
 66+ if ( count($lines) ) {
 67+ $geshi->highlight_lines_extra( $lines );
 68+ }
6769 }
6870 // Starting line number
69 - if( isset( $args['start'] ) )
 71+ if( isset( $args['start'] ) ) {
7072 $geshi->start_line_numbers_at( $args['start'] );
 73+ }
7174 $geshi->set_header_type( $enclose );
7275 // Strict mode
73 - if( isset( $args['strict'] ) )
 76+ if( isset( $args['strict'] ) ) {
7477 $geshi->enable_strict_mode();
 78+ }
7579 // Format
7680 $out = $geshi->parse_code();
7781 $err = $geshi->error();
@@ -93,7 +97,7 @@
9498 wfProfileOut( __METHOD__ );
9599 return $out;
96100 }
97 -
 101+
98102 /**
99103 * Take an input specifying a list of lines to highlight, returning
100104 * a raw list of matching line numbers.
@@ -124,7 +128,7 @@
125129 }
126130 return $lines;
127131 }
128 -
 132+
129133 /**
130134 * Validate a provided input range
131135 */
@@ -209,8 +213,9 @@
210214 private static function prepare( $text, $lang ) {
211215 self::initialise();
212216 $geshi = new GeSHi( $text, $lang );
213 - if( $geshi->error() == GESHI_ERROR_NO_SUCH_LANG )
 217+ if( $geshi->error() == GESHI_ERROR_NO_SUCH_LANG ) {
214218 return null;
 219+ }
215220 $geshi->set_encoding( 'UTF-8' );
216221 $geshi->enable_classes();
217222 $geshi->set_overall_class( "source-$lang" );
@@ -255,8 +260,9 @@
256261 */
257262 private static function formatError( $error = '' ) {
258263 $html = '';
259 - if( $error )
 264+ if( $error ) {
260265 $html .= "<p>{$error}</p>";
 266+ }
261267 $html .= '<p>' . htmlspecialchars( wfMsgForContent( 'syntaxhighlight-specify' ) )
262268 . ' <samp>&lt;source lang=&quot;html4strict&quot;&gt;...&lt;/source&gt;</samp></p>'
263269 . '<p>' . htmlspecialchars( wfMsgForContent( 'syntaxhighlight-supported' ) ) . '</p>'
@@ -305,8 +311,9 @@
306312 private static function initialise() {
307313 if( !self::$initialised ) {
308314 wfLoadExtensionMessages( 'SyntaxHighlight_GeSHi' );
309 - if( !class_exists( 'GeSHi' ) )
 315+ if( !class_exists( 'GeSHi' ) ) {
310316 require( 'geshi/geshi.php' );
 317+ }
311318 self::$initialised = true;
312319 }
313320 return true;
@@ -321,12 +328,12 @@
322329 $wgExtensionCredits['parserhook']['SyntaxHighlight_GeSHi']['version'] = GESHI_VERSION;
323330 return true;
324331 }
325 -
 332+
326333 /**
327334 * @see SyntaxHighlight_GeSHi::hSpecialVersion_GeSHi
328335 */
329336 public static function hOldSpecialVersion_GeSHi( &$sp, &$extensionTypes ) {
330337 return self::hSpecialVersion_GeSHi( $extensionTypes );
331 - }
 338+ }
332339
333340 }
\ No newline at end of file

Status & tagging log