https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113372

Revision: 113372
Author:   maxsem
Date:     2012-03-08 18:14:26 +0000 (Thu, 08 Mar 2012)
Log Message:
-----------
Remove weird underscore prefixes from function names

Modified Paths:
--------------
    trunk/extensions/OpenSearchXml/ApiOpenSearchXml.php

Modified: trunk/extensions/OpenSearchXml/ApiOpenSearchXml.php
===================================================================
--- trunk/extensions/OpenSearchXml/ApiOpenSearchXml.php 2012-03-08 17:51:07 UTC 
(rev 113371)
+++ trunk/extensions/OpenSearchXml/ApiOpenSearchXml.php 2012-03-08 18:14:26 UTC 
(rev 113372)
@@ -107,8 +107,8 @@
 
                $results = array();
                foreach ( $titles as $title ) {
-                       $title = $this->_checkRedirect( $title );
-                       if( $this->_seen( $title ) ) {
+                       $title = $this->checkRedirect( $title );
+                       if( $this->seen( $title ) ) {
                                continue;
                        }
                        $results[$title->getArticleID()] = array(
@@ -185,7 +185,7 @@
         *
         * @return Title
         */
-       protected function _checkRedirect( $title ) {
+       protected function checkRedirect( $title ) {
                $art = new Article( $title );
                $target = $art->getRedirectTarget();
                if( $target ) {
@@ -199,7 +199,7 @@
         * @param  $title Title
         * @return bool
         */
-       protected function _seen( $title ) {
+       protected function seen( $title ) {
                $name = $title->getPrefixedText();
                if( isset( $this->mSeen[$name] ) ) {
                        return true;
@@ -213,7 +213,7 @@
         * @param string $text
         * @return string
         */
-       function _stripMarkup( $text ) {
+       function stripMarkup( $text ) {
                $text = substr( $text, 0, 4096 ); // don't bother with long 
text...
 
                $text = str_replace( "'''", "", $text );
@@ -245,7 +245,7 @@
         * @param $matches array
         * @return string
         */
-       function _stripLink( $matches ) {
+       function stripLink( $matches ) {
                $target = trim( $matches[1] );
                if( isset( $matches[2] ) ) {
                        $text = trim( $matches[2] );
@@ -271,7 +271,7 @@
         * @return string
         * @access private
         */
-       function _extractStart( $text ) {
+       function extractStart( $text ) {
                $endchars = array(
                        '([^\d])\.\s', '\!\s', '\?\s', // regular ASCII
                        '。', // full-width ideographic full-stop
@@ -299,7 +299,7 @@
         * @param $text string
         * @return string|bool
         */
-       function _extractBadge( $text ) {
+       function extractBadge( $text ) {
                global $wgContLang;
                $image = preg_quote( $wgContLang->getNsText( NS_IMAGE ), '#' );
                $matches = array();
@@ -314,10 +314,10 @@
         * @param $arg string
         * @return bool|String
         */
-       function _validateBadge( $arg ) {
+       function validateBadge( $arg ) {
                // Some templates want an entire [[Image:Foo.jpg|250px]]
                if( substr( $arg, 0, 2 ) == '[[' ) {
-                       return $this->_extractBadge( $arg );
+                       return $this->extractBadge( $arg );
                }
 
                // Others will take Image:Foo.jpg or Foo.jpg
@@ -372,7 +372,7 @@
                                                        //var_dump( $arg );
                                                        $argName = trim( 
$frame->expand( $arg["name"], PPFrame::RECOVER_ORIG ) );
                                                        if( in_array( $argName, 
$imageArgs ) ) {
-                                                               $badge = 
$this->_validateBadge(
+                                                               $badge = 
$this->validateBadge(
                                                                        trim(
                                                                                
$frame->expand( $arg["value"], PPFrame::RECOVER_ORIG ) ) );
                                                                if( $badge ) {
@@ -389,18 +389,18 @@
                        if( !$badge ) {
                                // Look for the first image in the body text if 
there wasn't
                                // one in an infobox.
-                               $badge = $this->_extractBadge( $out );
+                               $badge = $this->extractBadge( $out );
                        }
 
                        // The remaining text may still contain wiki and HTML 
markup.
                        // We'll use our shitty hand parser to strip most of 
those from
                        // the beginning of the text.
-                       $stripped = $this->_stripMarkup( $out );
+                       $stripped = $this->stripMarkup( $out );
 
                        // And now, we'll grab just the first sentence as text, 
and
                        // also try to rip out a badge image.
                        return array(
-                               $this->_extractStart( $stripped ),
+                               $this->extractStart( $stripped ),
                                $badge );
                }
                return '';


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to