Index: trunk/extensions/Sort/Sort.class.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | class Sorter { |
14 | 14 | |
15 | 15 | private $parser = null; |
16 | | - |
| 16 | + |
17 | 17 | private $order = 'asc'; |
18 | 18 | private $class = 'ul'; |
19 | 19 | |
— | — | @@ -37,8 +37,9 @@ |
38 | 38 | $value = strtolower( $value ); |
39 | 39 | switch( $name ) { |
40 | 40 | case 'class': |
41 | | - if( $value == 'ul' || $value == 'ol' ) |
| 41 | + if( $value == 'ul' || $value == 'ol' ) { |
42 | 42 | $this->class = $value; |
| 43 | + } |
43 | 44 | break; |
44 | 45 | case 'order': |
45 | 46 | $this->order = $value == 'desc' |
— | — | @@ -77,8 +78,9 @@ |
78 | 79 | $lines[ $line ] = $this->stripWikiTokens( $line ); |
79 | 80 | } |
80 | 81 | natsort( $lines ); |
81 | | - if( $this->order == 'desc' ) |
| 82 | + if( $this->order == 'desc' ) { |
82 | 83 | $lines = array_reverse( $lines, true ); |
| 84 | + } |
83 | 85 | wfProfileOut( __METHOD__ ); |
84 | 86 | return array_keys( $lines ); |
85 | 87 | } |
— | — | @@ -103,9 +105,11 @@ |
104 | 106 | protected function makeList( $lines ) { |
105 | 107 | $list = array(); |
106 | 108 | $token = $this->class == 'ul' ? '*' : '#'; |
107 | | - foreach( $lines as $line ) |
108 | | - if( strlen( $line ) > 0 ) |
| 109 | + foreach( $lines as $line ) { |
| 110 | + if( strlen( $line ) > 0 ) { |
109 | 111 | $list[] = "{$token} {$line}"; |
| 112 | + } |
| 113 | + } |
110 | 114 | return trim( implode( "\n", $list ) ); |
111 | 115 | } |
112 | 116 | |
— | — | @@ -123,4 +127,4 @@ |
124 | 128 | return $output->getText(); |
125 | 129 | } |
126 | 130 | |
127 | | -} |
\ No newline at end of file |
| 131 | +} |
Index: trunk/extensions/Sort/Sort.php |
— | — | @@ -27,6 +27,8 @@ |
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Register hook function |
| 31 | + * |
| 32 | + * @param $parser Parser |
31 | 33 | */ |
32 | 34 | function efSortSetHook( $parser ) { |
33 | 35 | $parser->setHook( 'sort', 'efRenderSort' ); |