Index: trunk/extensions/RSS/RSSData.php |
— | — | @@ -18,11 +18,11 @@ |
19 | 19 | $xpath = new DOMXPath( $this->xml ); |
20 | 20 | $items = $xpath->evaluate( '/rss/channel/item' ); |
21 | 21 | |
22 | | - foreach( $items as $item ) { |
| 22 | + foreach ( $items as $item ) { |
23 | 23 | $bit = array(); |
24 | | - foreach( $item->childNodes as $n ) { |
| 24 | + foreach ( $item->childNodes as $n ) { |
25 | 25 | $name = $this->rssTokenToName( $n->nodeName ); |
26 | | - if( $name != null ) { |
| 26 | + if ( $name != null ) { |
27 | 27 | $bit[$name] = $n->nodeValue; |
28 | 28 | } |
29 | 29 | } |
Index: trunk/extensions/RSS/RSSFetch.php |
— | — | @@ -60,8 +60,8 @@ |
61 | 61 | 'wgRSSUseGzip' => true |
62 | 62 | ); |
63 | 63 | |
64 | | - foreach( $nameValue as $n => $v) { |
65 | | - if( !isset( $GLOBALS[$n] ) ) { |
| 64 | + foreach ( $nameValue as $n => $v ) { |
| 65 | + if ( !isset( $GLOBALS[$n] ) ) { |
66 | 66 | $GLOBALS[$n] = $v; |
67 | 67 | } |
68 | 68 | } |
— | — | @@ -200,8 +200,8 @@ |
201 | 201 | $client->setUserAgent( 'MediaWikiRSS/0.01 (+http://www.mediawiki.org/wiki/Extension:RSS) / MediaWiki RSS extension' ); |
202 | 202 | /* $client->use_gzip = $wgRSSUseGzip; */ |
203 | 203 | if ( is_array( $headers ) && count( $headers ) > 0 ) { |
204 | | - foreach( $headers as $h ) { |
205 | | - if( count( $h ) > 1 ) { |
| 204 | + foreach ( $headers as $h ) { |
| 205 | + if ( count( $h ) > 1 ) { |
206 | 206 | $client->setHeader( $h[0], $h[1] ); |
207 | 207 | } |
208 | 208 | } |
— | — | @@ -210,7 +210,7 @@ |
211 | 211 | $fetch = $client->execute(); |
212 | 212 | |
213 | 213 | /* @$client->fetch( $url ); */ |
214 | | - if( $fetch->isGood() ) { |
| 214 | + if ( $fetch->isGood() ) { |
215 | 215 | return $client; |
216 | 216 | } else { |
217 | 217 | wfDebugLog( 'RSS', 'error fetching $url: ' . $fetch->getWikiText() ); |
Index: trunk/extensions/RSS/RSS.php |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | * @link http://www.mediawiki.org/wiki/Extension:RSS Documentation |
16 | 16 | */ |
17 | 17 | |
18 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 18 | +if ( !defined( 'MEDIAWIKI' ) ) { |
19 | 19 | die( "This is not a valid entry point.\n" ); |
20 | 20 | } |
21 | 21 | |
— | — | @@ -70,14 +70,14 @@ |
71 | 71 | $url = $input; |
72 | 72 | |
73 | 73 | # Get charset from argument array |
74 | | - if( isset( $args['charset'] ) ) { |
| 74 | + if ( isset( $args['charset'] ) ) { |
75 | 75 | $charset = $args['charset']; |
76 | 76 | } else { |
77 | 77 | $charset = $wgOutputEncoding; |
78 | 78 | } |
79 | 79 | |
80 | 80 | # Get max number of headlines from argument-array |
81 | | - if( isset( $args['max'] ) ) { |
| 81 | + if ( isset( $args['max'] ) ) { |
82 | 82 | $maxheads = $args['max']; |
83 | 83 | } else { |
84 | 84 | $maxheads = 32; |
— | — | @@ -85,14 +85,14 @@ |
86 | 86 | |
87 | 87 | # Get short flag from argument array |
88 | 88 | # If short is set, no description text is printed |
89 | | - if( isset( $args['short'] ) ) { |
| 89 | + if ( isset( $args['short'] ) ) { |
90 | 90 | $short = true; |
91 | 91 | } else { |
92 | 92 | $short = false; |
93 | 93 | } |
94 | 94 | |
95 | 95 | # Get reverse flag from argument array |
96 | | - if( isset( $args['reverse'] ) ) { |
| 96 | + if ( isset( $args['reverse'] ) ) { |
97 | 97 | $rss->items = array_reverse( $rss->items ); |
98 | 98 | } |
99 | 99 | |
— | — | @@ -104,7 +104,7 @@ |
105 | 105 | } |
106 | 106 | |
107 | 107 | # Get highlight terms from argument array |
108 | | - if( isset( $args['highlight'] ) ) { |
| 108 | + if ( isset( $args['highlight'] ) ) { |
109 | 109 | $rssHighlight = $args['highlight']; |
110 | 110 | $rssHighlight = str_replace( ' ', ' ', $rssHighlight ); |
111 | 111 | $rssHighlight = explode( ' ', trim( $rssHighlight ) ); |
— | — | @@ -113,7 +113,7 @@ |
114 | 114 | } |
115 | 115 | |
116 | 116 | # Get filter terms from argument array |
117 | | - if( isset( $args['filter'] ) ) { |
| 117 | + if ( isset( $args['filter'] ) ) { |
118 | 118 | $rssFilter = $args['filter']; |
119 | 119 | $rssFilter = str_replace( ' ', ' ', $rssFilter ); |
120 | 120 | $rssFilter = explode( ' ', trim( $rssFilter ) ); |
— | — | @@ -122,7 +122,7 @@ |
123 | 123 | } |
124 | 124 | |
125 | 125 | # Filterout terms |
126 | | - if( isset( $args['filterout'] ) ) { |
| 126 | + if ( isset( $args['filterout'] ) ) { |
127 | 127 | $rssFilterout = $args['filterout']; |
128 | 128 | $rssFilterout = str_replace( ' ', ' ', $rssFilterout ); |
129 | 129 | $rssFilterout = explode( ' ', trim( $rssFilterout ) ); |
— | — | @@ -130,7 +130,7 @@ |
131 | 131 | $rssFilterout = false; |
132 | 132 | } |
133 | 133 | |
134 | | - if( isset( $args['template'] ) ) { |
| 134 | + if ( isset( $args['template'] ) ) { |
135 | 135 | $template = 'Template:' . $args['template']; |
136 | 136 | } else { |
137 | 137 | $template = wfMsgNoTrans( 'rss-item' ); |
— | — | @@ -166,16 +166,16 @@ |
167 | 167 | */ |
168 | 168 | if ( $template ) { |
169 | 169 | $headcnt = 0; |
170 | | - foreach( $rss->items as $item ) { |
171 | | - if( $maxheads > 0 && $headcnt >= $maxheads ) { |
| 170 | + foreach ( $rss->items as $item ) { |
| 171 | + if ( $maxheads > 0 && $headcnt >= $maxheads ) { |
172 | 172 | continue; |
173 | 173 | } |
174 | 174 | |
175 | 175 | $decision = true; |
176 | | - foreach( array( 'title', 'author', 'description', 'category' ) as $check ) { |
177 | | - if( isset( $item[$check] ) ) { |
| 176 | + foreach ( array( 'title', 'author', 'description', 'category' ) as $check ) { |
| 177 | + if ( isset( $item[$check] ) ) { |
178 | 178 | $decision &= wfRssFilter( $item[$check], $rssFilter ) & wfRssFilterout( $item[$check], $rssFilterout ); |
179 | | - if( !$decision ) { |
| 179 | + if ( !$decision ) { |
180 | 180 | continue 2; |
181 | 181 | } |
182 | 182 | |
— | — | @@ -186,12 +186,12 @@ |
187 | 187 | |
188 | 188 | $rssTemp = ''; |
189 | 189 | |
190 | | - foreach( explode( '|', $template ) as $bit ) { |
| 190 | + foreach ( explode( '|', $template ) as $bit ) { |
191 | 191 | $bits = explode( '=', $bit ); |
192 | | - if( count( $bits ) == 2 ) { |
| 192 | + if ( count( $bits ) == 2 ) { |
193 | 193 | $left = trim( $bits[0] ); |
194 | 194 | |
195 | | - if( isset( $item[$left] ) ) { |
| 195 | + if ( isset( $item[$left] ) ) { |
196 | 196 | $right = $item[$left]; |
197 | 197 | } |
198 | 198 | |
— | — | @@ -213,7 +213,7 @@ |
214 | 214 | function wfRssFilter( $text, $rssFilter ) { |
215 | 215 | $display = true; |
216 | 216 | if ( is_array( $rssFilter ) ) { |
217 | | - foreach( $rssFilter as $term ) { |
| 217 | + foreach ( $rssFilter as $term ) { |
218 | 218 | if ( $term ) { |
219 | 219 | $display = false; |
220 | 220 | if ( preg_match( "|$term|i", $text, $a ) ) { |
— | — | @@ -257,7 +257,7 @@ |
258 | 258 | $count_color = count( $color ); |
259 | 259 | |
260 | 260 | if ( is_array( $rssHighlight ) ) { |
261 | | - foreach( $rssHighlight as $term ) { |
| 261 | + foreach ( $rssHighlight as $term ) { |
262 | 262 | if ( $term ) { |
263 | 263 | $text = preg_replace( "|\b(\w*?" . $term . "\w*?)\b|i", "$starttag" . "_" . $i . "\\1$endtag", $text ); |
264 | 264 | $i++; |