From 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 12 Aug 2013 09:28:15 +0200 Subject: Update to MediaWiki 1.21.1 --- includes/api/ApiFormatBase.php | 48 ++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 27 deletions(-) (limited to 'includes/api/ApiFormatBase.php') diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index 8ad9b8ca..d8aa1634 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -38,7 +38,7 @@ abstract class ApiFormatBase extends ApiBase { * Constructor * If $format ends with 'fm', pretty-print the output in HTML. * @param $main ApiMain - * @param $format string Format name + * @param string $format Format name */ public function __construct( $main, $format ) { parent::__construct( $main, $format ); @@ -58,7 +58,7 @@ abstract class ApiFormatBase extends ApiBase { * This method is not called if getIsHtml() returns true. * @return string */ - public abstract function getMimeType(); + abstract public function getMimeType(); /** * Whether this formatter needs raw data such as _element tags @@ -83,7 +83,7 @@ abstract class ApiFormatBase extends ApiBase { * special-case fix that should be removed once the help has been * reworked to use a fully HTML interface. * - * @param $b bool Whether or not ampersands should be escaped. + * @param bool $b Whether or not ampersands should be escaped. */ public function setUnescapeAmps ( $b ) { $this->mUnescapeAmps = $b; @@ -123,11 +123,13 @@ abstract class ApiFormatBase extends ApiBase { /** * Initialize the printer function and prepare the output headers, etc. - * This method must be the first outputing method during execution. - * A help screen's header is printed for the HTML-based output - * @param $isError bool Whether an error message is printed + * This method must be the first outputting method during execution. + * A human-targeted notice about available formats is printed for the HTML-based output, + * except for help screens (caused by either an error in the API parameters, + * the calling of action=help, or requesting the root script api.php). + * @param bool $isHelpScreen Whether a help screen is going to be shown */ - function initPrinter( $isError ) { + function initPrinter( $isHelpScreen ) { if ( $this->mDisabled ) { return; } @@ -164,7 +166,7 @@ abstract class ApiFormatBase extends ApiBase {
@@ -175,15 +177,18 @@ To see the non HTML representation of the mFormat ); ?> forma See the complete documentation, or API help for more information. +
  for help screens
+			          // because these are actually formatted to rely on
+			          // the monospaced font for layout purposes
 ?>
 
 complete documentation,
 	}
 
 	/**
-	 * Sets whether the pretty-printer should format *bold* and $italics$
+	 * Sets whether the pretty-printer should format *bold*
 	 * @param $help bool
 	 */
 	public function setHelp( $help = true ) {
@@ -264,22 +269,19 @@ See the complete documentation,
 	protected function formatHTML( $text ) {
 		// Escape everything first for full coverage
 		$text = htmlspecialchars( $text );
-
 		// encode all comments or tags as safe blue strings
 		$text = str_replace( '<', '<', $text );
 		$text = str_replace( '>', '>', $text );
-		// identify URLs
-		$protos = wfUrlProtocolsWithoutProtRel();
-		// This regex hacks around bug 13218 (" included in the URL)
-		$text = preg_replace( "#(((?i)$protos).*?)(")?([ \\'\"<>\n]|<|>|")#", '\\1\\3\\4', $text );
 		// identify requests to api.php
 		$text = preg_replace( "#api\\.php\\?[^ <\n\t]+#", '\\0', $text );
 		if ( $this->mHelp ) {
 			// make strings inside * bold
 			$text = preg_replace( "#\\*[^<>\n]+\\*#", '\\0', $text );
-			// make strings inside $ italic
-			$text = preg_replace( "#\\$[^<>\n]+\\$#", '\\0', $text );
 		}
+		// identify URLs
+		$protos = wfUrlProtocolsWithoutProtRel();
+		// This regex hacks around bug 13218 (" included in the URL)
+		$text = preg_replace( "#(((?i)$protos).*?)(")?([ \\'\"<>\n]|<|>|")#", '\\1\\3\\4', $text );
 
 		/**
 		 * Temporary fix for bad links in help messages. As a special case,
@@ -308,10 +310,6 @@ See the complete documentation,
 	public function getDescription() {
 		return $this->getIsHtml() ? ' (pretty-print in HTML)' : '';
 	}
-
-	public static function getBaseVersion() {
-		return __CLASS__ . ': $Id$';
-	}
 }
 
 /**
@@ -328,7 +326,7 @@ class ApiFormatFeedWrapper extends ApiFormatBase {
 	 * Call this method to initialize output data. See execute()
 	 * @param $result ApiResult
 	 * @param $feed object an instance of one of the $wgFeedClasses classes
-	 * @param $feedItems array of FeedItem objects
+	 * @param array $feedItems of FeedItem objects
 	 */
 	public static function setResult( $result, $feed, $feedItems ) {
 		// Store output in the Result data.
@@ -381,8 +379,4 @@ class ApiFormatFeedWrapper extends ApiFormatBase {
 			ApiBase::dieDebug( __METHOD__, 'Invalid feed class/item' );
 		}
 	}
-
-	public function getVersion() {
-		return __CLASS__ . ': $Id$';
-	}
 }
-- 
cgit v1.2.2