From 29de7361fb0f81d3c2ddecf2f453b8b2eaae73dc Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Mon, 9 Aug 2010 06:56:38 +0000 Subject: [PATCH] Fixup (and add) some braces, remove trailing whitespace --- SyntaxHighlight_GeSHi.class.php | 27 +++++++++++++++++---------- SyntaxHighlight_GeSHi.php | 6 +++--- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/SyntaxHighlight_GeSHi.class.php b/SyntaxHighlight_GeSHi.class.php index 0401feca..718fb91a 100644 --- a/SyntaxHighlight_GeSHi.class.php +++ b/SyntaxHighlight_GeSHi.class.php @@ -62,15 +62,19 @@ class SyntaxHighlight_GeSHi { // Highlighting specific lines if( isset( $args['highlight'] ) ) { $lines = self::parseHighlightLines( $args['highlight'] ); - if ( count($lines) ) $geshi->highlight_lines_extra( $lines ); + if ( count($lines) ) { + $geshi->highlight_lines_extra( $lines ); + } } // Starting line number - if( isset( $args['start'] ) ) + if( isset( $args['start'] ) ) { $geshi->start_line_numbers_at( $args['start'] ); + } $geshi->set_header_type( $enclose ); // Strict mode - if( isset( $args['strict'] ) ) + if( isset( $args['strict'] ) ) { $geshi->enable_strict_mode(); + } // Format $out = $geshi->parse_code(); $err = $geshi->error(); @@ -93,7 +97,7 @@ class SyntaxHighlight_GeSHi { wfProfileOut( __METHOD__ ); return $out; } - + /** * Take an input specifying a list of lines to highlight, returning * a raw list of matching line numbers. @@ -124,7 +128,7 @@ class SyntaxHighlight_GeSHi { } return $lines; } - + /** * Validate a provided input range */ @@ -209,8 +213,9 @@ class SyntaxHighlight_GeSHi { private static function prepare( $text, $lang ) { self::initialise(); $geshi = new GeSHi( $text, $lang ); - if( $geshi->error() == GESHI_ERROR_NO_SUCH_LANG ) + if( $geshi->error() == GESHI_ERROR_NO_SUCH_LANG ) { return null; + } $geshi->set_encoding( 'UTF-8' ); $geshi->enable_classes(); $geshi->set_overall_class( "source-$lang" ); @@ -255,8 +260,9 @@ class SyntaxHighlight_GeSHi { */ private static function formatError( $error = '' ) { $html = ''; - if( $error ) + if( $error ) { $html .= "

{$error}

"; + } $html .= '

' . htmlspecialchars( wfMsgForContent( 'syntaxhighlight-specify' ) ) . ' <source lang="html4strict">...</source>

' . '

' . htmlspecialchars( wfMsgForContent( 'syntaxhighlight-supported' ) ) . '

' @@ -305,8 +311,9 @@ class SyntaxHighlight_GeSHi { private static function initialise() { if( !self::$initialised ) { wfLoadExtensionMessages( 'SyntaxHighlight_GeSHi' ); - if( !class_exists( 'GeSHi' ) ) + if( !class_exists( 'GeSHi' ) ) { require( 'geshi/geshi.php' ); + } self::$initialised = true; } return true; @@ -321,12 +328,12 @@ class SyntaxHighlight_GeSHi { $wgExtensionCredits['parserhook']['SyntaxHighlight_GeSHi']['version'] = GESHI_VERSION; return true; } - + /** * @see SyntaxHighlight_GeSHi::hSpecialVersion_GeSHi */ public static function hOldSpecialVersion_GeSHi( &$sp, &$extensionTypes ) { return self::hSpecialVersion_GeSHi( $extensionTypes ); - } + } } \ No newline at end of file diff --git a/SyntaxHighlight_GeSHi.php b/SyntaxHighlight_GeSHi.php index cb64731f..627e8cc0 100644 --- a/SyntaxHighlight_GeSHi.php +++ b/SyntaxHighlight_GeSHi.php @@ -36,8 +36,9 @@ * some help text and a list of all supported languages. */ -if( !defined( 'MEDIAWIKI' ) ) +if( !defined( 'MEDIAWIKI' ) ) { die(); +} $wgExtensionCredits['parserhook']['SyntaxHighlight_GeSHi'] = array( 'path' => __FILE__, @@ -57,8 +58,7 @@ $wgHooks['ParserFirstCallInit'][] = 'efSyntaxHighlight_GeSHiSetup'; if ( version_compare( $wgVersion, '1.17alpha', '>=' ) ) { // For MediaWiki 1.17 alpha and later. $wgHooks['ExtensionTypes'][] = 'SyntaxHighlight_GeSHi::hSpecialVersion_GeSHi'; -} -else { +} else { // For pre-MediaWiki 1.17 alpha. $wgHooks['SpecialVersionExtensionTypes'][] = 'SyntaxHighlight_GeSHi::hOldSpecialVersion_GeSHi'; }