r113372 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113371‎ | r113372 | r113373 >
Date:18:14, 8 March 2012
Author:maxsem
Status:reverted
Tags:gerritmigration 
Comment:
Remove weird underscore prefixes from function names
Modified paths:
  • /trunk/extensions/OpenSearchXml/ApiOpenSearchXml.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenSearchXml/ApiOpenSearchXml.php
@@ -107,8 +107,8 @@
108108
109109 $results = array();
110110 foreach ( $titles as $title ) {
111 - $title = $this->_checkRedirect( $title );
112 - if( $this->_seen( $title ) ) {
 111+ $title = $this->checkRedirect( $title );
 112+ if( $this->seen( $title ) ) {
113113 continue;
114114 }
115115 $results[$title->getArticleID()] = array(
@@ -185,7 +185,7 @@
186186 *
187187 * @return Title
188188 */
189 - protected function _checkRedirect( $title ) {
 189+ protected function checkRedirect( $title ) {
190190 $art = new Article( $title );
191191 $target = $art->getRedirectTarget();
192192 if( $target ) {
@@ -199,7 +199,7 @@
200200 * @param $title Title
201201 * @return bool
202202 */
203 - protected function _seen( $title ) {
 203+ protected function seen( $title ) {
204204 $name = $title->getPrefixedText();
205205 if( isset( $this->mSeen[$name] ) ) {
206206 return true;
@@ -213,7 +213,7 @@
214214 * @param string $text
215215 * @return string
216216 */
217 - function _stripMarkup( $text ) {
 217+ function stripMarkup( $text ) {
218218 $text = substr( $text, 0, 4096 ); // don't bother with long text...
219219
220220 $text = str_replace( "'''", "", $text );
@@ -245,7 +245,7 @@
246246 * @param $matches array
247247 * @return string
248248 */
249 - function _stripLink( $matches ) {
 249+ function stripLink( $matches ) {
250250 $target = trim( $matches[1] );
251251 if( isset( $matches[2] ) ) {
252252 $text = trim( $matches[2] );
@@ -271,7 +271,7 @@
272272 * @return string
273273 * @access private
274274 */
275 - function _extractStart( $text ) {
 275+ function extractStart( $text ) {
276276 $endchars = array(
277277 '([^\d])\.\s', '\!\s', '\?\s', // regular ASCII
278278 '。', // full-width ideographic full-stop
@@ -299,7 +299,7 @@
300300 * @param $text string
301301 * @return string|bool
302302 */
303 - function _extractBadge( $text ) {
 303+ function extractBadge( $text ) {
304304 global $wgContLang;
305305 $image = preg_quote( $wgContLang->getNsText( NS_IMAGE ), '#' );
306306 $matches = array();
@@ -314,10 +314,10 @@
315315 * @param $arg string
316316 * @return bool|String
317317 */
318 - function _validateBadge( $arg ) {
 318+ function validateBadge( $arg ) {
319319 // Some templates want an entire [[Image:Foo.jpg|250px]]
320320 if( substr( $arg, 0, 2 ) == '[[' ) {
321 - return $this->_extractBadge( $arg );
 321+ return $this->extractBadge( $arg );
322322 }
323323
324324 // Others will take Image:Foo.jpg or Foo.jpg
@@ -372,7 +372,7 @@
373373 //var_dump( $arg );
374374 $argName = trim( $frame->expand( $arg["name"], PPFrame::RECOVER_ORIG ) );
375375 if( in_array( $argName, $imageArgs ) ) {
376 - $badge = $this->_validateBadge(
 376+ $badge = $this->validateBadge(
377377 trim(
378378 $frame->expand( $arg["value"], PPFrame::RECOVER_ORIG ) ) );
379379 if( $badge ) {
@@ -389,18 +389,18 @@
390390 if( !$badge ) {
391391 // Look for the first image in the body text if there wasn't
392392 // one in an infobox.
393 - $badge = $this->_extractBadge( $out );
 393+ $badge = $this->extractBadge( $out );
394394 }
395395
396396 // The remaining text may still contain wiki and HTML markup.
397397 // We'll use our shitty hand parser to strip most of those from
398398 // the beginning of the text.
399 - $stripped = $this->_stripMarkup( $out );
 399+ $stripped = $this->stripMarkup( $out );
400400
401401 // And now, we'll grab just the first sentence as text, and
402402 // also try to rip out a badge image.
403403 return array(
404 - $this->_extractStart( $stripped ),
 404+ $this->extractStart( $stripped ),
405405 $badge );
406406 }
407407 return '';

Follow-up revisions

RevisionCommit summaryAuthorDate
r113395Follow-up r113372: missed one usemaxsem20:07, 8 March 2012
r114401Revert r113365, r113372, r113395, r113474, r113475: unreviewed revisions in O...catrope20:27, 21 March 2012

Status & tagging log