Index: trunk/extensions/OpenSearchXml/ApiOpenSearchXml.php |
— | — | @@ -107,8 +107,8 @@ |
108 | 108 | |
109 | 109 | $results = array(); |
110 | 110 | foreach ( $titles as $title ) { |
111 | | - $title = $this->_checkRedirect( $title ); |
112 | | - if( $this->_seen( $title ) ) { |
| 111 | + $title = $this->checkRedirect( $title ); |
| 112 | + if( $this->seen( $title ) ) { |
113 | 113 | continue; |
114 | 114 | } |
115 | 115 | $results[$title->getArticleID()] = array( |
— | — | @@ -185,7 +185,7 @@ |
186 | 186 | * |
187 | 187 | * @return Title |
188 | 188 | */ |
189 | | - protected function _checkRedirect( $title ) { |
| 189 | + protected function checkRedirect( $title ) { |
190 | 190 | $art = new Article( $title ); |
191 | 191 | $target = $art->getRedirectTarget(); |
192 | 192 | if( $target ) { |
— | — | @@ -199,7 +199,7 @@ |
200 | 200 | * @param $title Title |
201 | 201 | * @return bool |
202 | 202 | */ |
203 | | - protected function _seen( $title ) { |
| 203 | + protected function seen( $title ) { |
204 | 204 | $name = $title->getPrefixedText(); |
205 | 205 | if( isset( $this->mSeen[$name] ) ) { |
206 | 206 | return true; |
— | — | @@ -213,7 +213,7 @@ |
214 | 214 | * @param string $text |
215 | 215 | * @return string |
216 | 216 | */ |
217 | | - function _stripMarkup( $text ) { |
| 217 | + function stripMarkup( $text ) { |
218 | 218 | $text = substr( $text, 0, 4096 ); // don't bother with long text... |
219 | 219 | |
220 | 220 | $text = str_replace( "'''", "", $text ); |
— | — | @@ -245,7 +245,7 @@ |
246 | 246 | * @param $matches array |
247 | 247 | * @return string |
248 | 248 | */ |
249 | | - function _stripLink( $matches ) { |
| 249 | + function stripLink( $matches ) { |
250 | 250 | $target = trim( $matches[1] ); |
251 | 251 | if( isset( $matches[2] ) ) { |
252 | 252 | $text = trim( $matches[2] ); |
— | — | @@ -271,7 +271,7 @@ |
272 | 272 | * @return string |
273 | 273 | * @access private |
274 | 274 | */ |
275 | | - function _extractStart( $text ) { |
| 275 | + function extractStart( $text ) { |
276 | 276 | $endchars = array( |
277 | 277 | '([^\d])\.\s', '\!\s', '\?\s', // regular ASCII |
278 | 278 | '。', // full-width ideographic full-stop |
— | — | @@ -299,7 +299,7 @@ |
300 | 300 | * @param $text string |
301 | 301 | * @return string|bool |
302 | 302 | */ |
303 | | - function _extractBadge( $text ) { |
| 303 | + function extractBadge( $text ) { |
304 | 304 | global $wgContLang; |
305 | 305 | $image = preg_quote( $wgContLang->getNsText( NS_IMAGE ), '#' ); |
306 | 306 | $matches = array(); |
— | — | @@ -314,10 +314,10 @@ |
315 | 315 | * @param $arg string |
316 | 316 | * @return bool|String |
317 | 317 | */ |
318 | | - function _validateBadge( $arg ) { |
| 318 | + function validateBadge( $arg ) { |
319 | 319 | // Some templates want an entire [[Image:Foo.jpg|250px]] |
320 | 320 | if( substr( $arg, 0, 2 ) == '[[' ) { |
321 | | - return $this->_extractBadge( $arg ); |
| 321 | + return $this->extractBadge( $arg ); |
322 | 322 | } |
323 | 323 | |
324 | 324 | // Others will take Image:Foo.jpg or Foo.jpg |
— | — | @@ -372,7 +372,7 @@ |
373 | 373 | //var_dump( $arg ); |
374 | 374 | $argName = trim( $frame->expand( $arg["name"], PPFrame::RECOVER_ORIG ) ); |
375 | 375 | if( in_array( $argName, $imageArgs ) ) { |
376 | | - $badge = $this->_validateBadge( |
| 376 | + $badge = $this->validateBadge( |
377 | 377 | trim( |
378 | 378 | $frame->expand( $arg["value"], PPFrame::RECOVER_ORIG ) ) ); |
379 | 379 | if( $badge ) { |
— | — | @@ -389,18 +389,18 @@ |
390 | 390 | if( !$badge ) { |
391 | 391 | // Look for the first image in the body text if there wasn't |
392 | 392 | // one in an infobox. |
393 | | - $badge = $this->_extractBadge( $out ); |
| 393 | + $badge = $this->extractBadge( $out ); |
394 | 394 | } |
395 | 395 | |
396 | 396 | // The remaining text may still contain wiki and HTML markup. |
397 | 397 | // We'll use our shitty hand parser to strip most of those from |
398 | 398 | // the beginning of the text. |
399 | | - $stripped = $this->_stripMarkup( $out ); |
| 399 | + $stripped = $this->stripMarkup( $out ); |
400 | 400 | |
401 | 401 | // And now, we'll grab just the first sentence as text, and |
402 | 402 | // also try to rip out a badge image. |
403 | 403 | return array( |
404 | | - $this->_extractStart( $stripped ), |
| 404 | + $this->extractStart( $stripped ), |
405 | 405 | $badge ); |
406 | 406 | } |
407 | 407 | return ''; |