r24066 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24065‎ | r24066 | r24067 >
Date:18:07, 13 July 2007
Author:brion
Status:old
Tags:
Comment:
Don't spew pathnames into the language list, that's kind of.... lame?
Modified paths:
  • /trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php
@@ -166,9 +166,8 @@
167167 $langs = self::getSupportedLanguages();
168168 $list = array();
169169 if( count( $langs ) > 0 ) {
170 - for( $i = 0; $i < count( $langs ); $i++ ) {
171 - if( preg_match( '!/([^\.]+)\.php$!u', $langs[$i], $m ) )
172 - $list[] = '<samp>' . $m[1] . '</samp>';
 170+ foreach( $langs as $lang ) {
 171+ $list[] = '<samp>' . htmlspecialchars( $lang ) . '</samp>';
173172 }
174173 return '<p style="padding: 0em 1em;">' . implode( ', ', $list ) . '</p>';
175174 } else {
@@ -184,7 +183,10 @@
185184 private static function getSupportedLanguages() {
186185 if( !is_array( self::$languages ) ) {
187186 self::initialise();
188 - self::$languages = glob( GESHI_LANG_ROOT . "/*.php" );
 187+ self::$languages = array();
 188+ foreach( glob( GESHI_LANG_ROOT . "/*.php" ) as $file ) {
 189+ self::$languages[] = basename( $file, '.php' );
 190+ }
189191 sort( self::$languages );
190192 }
191193 return self::$languages;

Status & tagging log