Index: trunk/extensions/DPLforum/DPLforum_body.php |
— | — | @@ -68,8 +68,9 @@ |
69 | 69 | if ( preg_match_all( "/^\s*$name\s*=\s*(.*)/mi", $this->sInput, $matches ) ) { |
70 | 70 | foreach ( $matches[1] as $cat ) { |
71 | 71 | $title = Title::newFromText( $parser->replaceVariables( trim( $cat ) ) ); |
72 | | - if ( !is_null( $title ) ) |
| 72 | + if ( !is_null( $title ) ) { |
73 | 73 | $cats[] = $title; |
| 74 | + } |
74 | 75 | } |
75 | 76 | } |
76 | 77 | return $cats; |
— | — | @@ -78,42 +79,48 @@ |
79 | 80 | function get( $name, $value = null, $parser = null ) { |
80 | 81 | if ( preg_match( "/^\s*$name\s*=\s*(.*)/mi", $this->sInput, $matches ) ) { |
81 | 82 | $arg = trim( $matches[1] ); |
82 | | - if ( is_int( $value ) ) |
| 83 | + if ( is_int( $value ) ) { |
83 | 84 | return intval( $arg ); |
84 | | - elseif ( is_null( $parser ) ) |
| 85 | + } elseif ( is_null( $parser ) ) { |
85 | 86 | return htmlspecialchars( $arg ); |
86 | | - else |
| 87 | + } else { |
87 | 88 | return $parser->replaceVariables( $arg ); |
| 89 | + } |
88 | 90 | } |
89 | 91 | return $value; |
90 | 92 | } |
91 | 93 | |
92 | 94 | function link( &$parser, $count, $page = '', $text = '' ) { |
93 | 95 | $count = intval( $count ); |
94 | | - if ( $count < 1 ) |
| 96 | + if ( $count < 1 ) { |
95 | 97 | return ''; |
| 98 | + } |
96 | 99 | |
97 | | - if ( $this->requireCache ) |
| 100 | + if ( $this->requireCache ) { |
98 | 101 | $offset = 0; |
99 | | - else { |
| 102 | + } else { |
100 | 103 | global $wgRequest; |
101 | 104 | $parser->disableCache(); |
102 | 105 | $offset = intval( $wgRequest->getVal( 'offset', '' ) ); |
103 | 106 | } |
104 | 107 | |
105 | 108 | $i = intval( $page ); |
106 | | - if ( ( $i != 0 ) && ctype_digit( $page[0] ) ) |
| 109 | + if ( ( $i != 0 ) && ctype_digit( $page[0] ) ) { |
107 | 110 | $i -= 1; |
108 | | - else |
| 111 | + } else { |
109 | 112 | $i += intval( $offset / $count ); |
110 | | - if ( $this->link_test( $i, $page ) ) |
| 113 | + } |
| 114 | + if ( $this->link_test( $i, $page ) ) { |
111 | 115 | return ''; |
| 116 | + } |
112 | 117 | |
113 | | - if ( $text === '' ) |
| 118 | + if ( $text === '' ) { |
114 | 119 | $text = ( $i + 1 ); |
| 120 | + } |
115 | 121 | $page = ( $count * $i ); |
116 | | - if ( $page == $offset ) |
| 122 | + if ( $page == $offset ) { |
117 | 123 | return $text; |
| 124 | + } |
118 | 125 | |
119 | 126 | return '[' . $parser->replaceVariables( '{{fullurl:{{FULLPAGENAME}}|offset=' . $page . '}} ' ) . $text . ']'; |
120 | 127 | } |
— | — | @@ -137,13 +144,14 @@ |
138 | 145 | } |
139 | 146 | |
140 | 147 | function msg( $type, $error = null ) { |
141 | | - if ( $error && ( $this->get( 'suppresserrors' ) == 'true' ) ) |
| 148 | + if ( $error && ( $this->get( 'suppresserrors' ) == 'true' ) ) { |
142 | 149 | return ''; |
| 150 | + } |
143 | 151 | |
144 | 152 | return htmlspecialchars( wfMsg( $type ) ); |
145 | 153 | } |
146 | 154 | |
147 | | - function date( $ts, $type = 'date', $df = false ) { // based on Language::date() |
| 155 | + function date( $ts, $type = 'date', $df = false ) { // based on Language::date() |
148 | 156 | global $wgLang; |
149 | 157 | $ts = wfTimestamp( TS_MW, $ts ); |
150 | 158 | $ts = $wgLang->userAdjust( $ts ); |
— | — | @@ -186,22 +194,25 @@ |
187 | 195 | } |
188 | 196 | |
189 | 197 | $arg = $this->get( 'compact' ); |
190 | | - if ( $arg == 'all' || strpos( $arg, 'edit' ) === 0 ) |
191 | | - $this->bCompactEdit = $this->bAddLastEdit; |
| 198 | + if ( $arg == 'all' || strpos( $arg, 'edit' ) === 0 ) { |
| 199 | + $this->bCompactEdit = $this->bAddLastEdit; |
| 200 | + } |
192 | 201 | $this->bCompactAuthor = ( $arg == 'author' || $arg == 'all' ); |
193 | 202 | |
194 | 203 | $arg = $this->get( 'namespace', '', $parser ); |
195 | 204 | $iNamespace = $wgContLang->getNsIndex( $arg ); |
196 | 205 | if ( !$iNamespace ) { |
197 | | - if ( ( $arg ) || ( $arg === '0' ) ) |
| 206 | + if ( ( $arg ) || ( $arg === '0' ) ) { |
198 | 207 | $iNamespace = intval( $arg ); |
199 | | - else |
200 | | - $iNamespace = - 1; |
| 208 | + } else { |
| 209 | + $iNamespace = -1; |
| 210 | + } |
201 | 211 | } |
202 | | - if ( $iNamespace < 0 ) |
| 212 | + if ( $iNamespace < 0 ) { |
203 | 213 | $this->bShowNamespace = ( $this->get( 'shownamespace' ) != 'false' ); |
204 | | - else |
| 214 | + } else { |
205 | 215 | $this->bShowNamespace = ( $this->get( 'shownamespace' ) == 'true' ); |
| 216 | + } |
206 | 217 | |
207 | 218 | $this->bTableMode = false; |
208 | 219 | $sStartItem = $sEndItem = ''; |
— | — | @@ -234,10 +245,12 @@ |
235 | 246 | $output = ''; |
236 | 247 | |
237 | 248 | if ( $sPrefix === '' && ( ( $cats < 1 && $iNamespace < 0 ) || |
238 | | - ( $total < $this->minCategories ) ) ) |
| 249 | + ( $total < $this->minCategories ) ) ) { |
239 | 250 | return $this->msg( 'dplforum-toofew', 1 ); |
240 | | - if ( ( $total > $this->maxCategories ) && ( !$this->unlimitedCategories ) ) |
| 251 | + } |
| 252 | + if ( ( $total > $this->maxCategories ) && ( !$this->unlimitedCategories ) ) { |
241 | 253 | return $this->msg( 'dplforum-toomany', 1 ); |
| 254 | + } |
242 | 255 | |
243 | 256 | $count = 1; |
244 | 257 | $start = $this->get( 'start', 0 ); |
— | — | @@ -251,18 +264,21 @@ |
252 | 265 | $start += intval( $wgRequest->getVal( 'offset' ) ); |
253 | 266 | } |
254 | 267 | } |
255 | | - if ( $start < 0 ) |
| 268 | + if ( $start < 0 ) { |
256 | 269 | $start = 0; |
| 270 | + } |
257 | 271 | |
258 | 272 | if ( is_null( $title ) ) { |
259 | 273 | $count = $this->get( 'count', 0 ); |
260 | 274 | if ( $count > 0 ) { |
261 | | - if ( $count > $this->maxResultCount ) |
| 275 | + if ( $count > $this->maxResultCount ) { |
262 | 276 | $count = $this->maxResultCount; |
263 | | - } elseif ( $this->unlimitedResults ) |
| 277 | + } |
| 278 | + } elseif ( $this->unlimitedResults ) { |
264 | 279 | $count = 0x7FFFFFFF; // maximum integer value |
265 | | - else |
| 280 | + } else { |
266 | 281 | $count = $this->maxResultCount; |
| 282 | + } |
267 | 283 | } |
268 | 284 | |
269 | 285 | // build the SQL query |
— | — | @@ -416,7 +432,7 @@ |
417 | 433 | } |
418 | 434 | |
419 | 435 | if ( $tm ) { |
420 | | - $output .= "<td class='forum_title'>"; |
| 436 | + $output .= '<td class="forum_title">'; |
421 | 437 | } |
422 | 438 | |
423 | 439 | $text = $query = $props = ''; |