Merge "Followup I888c616e: Keep IRC line format unchanged."
[lhc/web/wiklou.git] / includes / api / ApiFormatBase.php
index 1c6a871..5bbc62e 100644 (file)
@@ -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
@@ -143,6 +143,12 @@ abstract class ApiFormatBase extends ApiBase {
 
                $this->getMain()->getRequest()->response()->header( "Content-Type: $mime; charset=utf-8" );
 
+               //Set X-Frame-Options API results (bug 39180)
+               global $wgApiFrameOptions;
+               if ( $wgApiFrameOptions ) {
+                       $this->getMain()->getRequest()->response()->header( "X-Frame-Options: $wgApiFrameOptions" );
+               }
+
                if ( $isHtml ) {
 ?>
 <!DOCTYPE HTML>
@@ -265,7 +271,7 @@ See the <a href='https://www.mediawiki.org/wiki/API'>complete documentation</a>,
                // identify URLs
                $protos = wfUrlProtocolsWithoutProtRel();
                // This regex hacks around bug 13218 (&quot; included in the URL)
-               $text = preg_replace( "#(($protos).*?)(&quot;)?([ \\'\"<>\n]|&lt;|&gt;|&quot;)#", '<a href="\\1">\\1</a>\\3\\4', $text );
+               $text = preg_replace( "#(((?i)$protos).*?)(&quot;)?([ \\'\"<>\n]|&lt;|&gt;|&quot;)#", '<a href="\\1">\\1</a>\\3\\4', $text );
                // identify requests to api.php
                $text = preg_replace( "#api\\.php\\?[^ <\n\t]+#", '<a href="\\0">\\0</a>', $text );
                if ( $this->mHelp ) {
@@ -302,10 +308,6 @@ See the <a href='https://www.mediawiki.org/wiki/API'>complete documentation</a>,
        public function getDescription() {
                return $this->getIsHtml() ? ' (pretty-print in HTML)' : '';
        }
-
-       public static function getBaseVersion() {
-               return __CLASS__ . ': $Id$';
-       }
 }
 
 /**
@@ -326,7 +328,7 @@ class ApiFormatFeedWrapper extends ApiFormatBase {
         */
        public static function setResult( $result, $feed, $feedItems ) {
                // Store output in the Result data.
-               // This way we can check during execution if any error has occured
+               // This way we can check during execution if any error has occurred
                // Disable size checking for this because we can't continue
                // cleanly; size checking would cause more problems than it'd
                // solve
@@ -371,12 +373,8 @@ class ApiFormatFeedWrapper extends ApiFormatBase {
                        }
                        $feed->outFooter();
                } else {
-                       // Error has occured, print something useful
+                       // Error has occurred, print something useful
                        ApiBase::dieDebug( __METHOD__, 'Invalid feed class/item' );
                }
        }
-
-       public function getVersion() {
-               return __CLASS__ . ': $Id$';
-       }
 }