Based on diff to wikia, set more functions consistently public rather than protected
[lhc/web/wiklou.git] / includes / api / ApiFormatBase.php
index 91562f2..555a0fa 100644 (file)
@@ -145,14 +145,12 @@ abstract class ApiFormatBase extends ApiBase {
                if ( is_null( $mime ) ) {
                        return; // skip any initialization
                }
-               
-               if( !$this->getMain()->isInternalMode() ) {
-                       header( "Content-Type: $mime; charset=utf-8" );
-               }
+
+               $this->getMain()->getRequest()->response()->header( "Content-Type: $mime; charset=utf-8" );
 
                if ( $isHtml ) {
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!DOCTYPE HTML>
 <html>
 <head>
 <?php if ( $this->mUnescapeAmps ) {
@@ -259,15 +257,13 @@ See <a href='http://www.mediawiki.org/wiki/API'>complete documentation</a>, or
         * @return string
         */
        protected function formatHTML( $text ) {
-               global $wgUrlProtocols;
-
                // Escape everything first for full coverage
                $text = htmlspecialchars( $text );
 
                // encode all comments or tags as safe blue strings
                $text = preg_replace( '/\&lt;(!--.*?--|.*?)\&gt;/', '<span style="color:blue;">&lt;\1&gt;</span>', $text );
                // identify URLs
-               $protos = implode( "|", $wgUrlProtocols );
+               $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 );
                // identify requests to api.php
@@ -292,10 +288,14 @@ See <a href='http://www.mediawiki.org/wiki/API'>complete documentation</a>, or
                return $text;
        }
 
-       protected function getExamples() {
+       public function getExamples() {
                return 'api.php?action=query&meta=siteinfo&siprop=namespaces&format=' . $this->getModuleName();
        }
 
+       public function getHelpUrls() {
+               return 'http://www.mediawiki.org/wiki/API:Data_formats';
+       }
+
        public function getDescription() {
                return $this->getIsHtml() ? ' (pretty-print in HTML)' : '';
        }
@@ -372,4 +372,4 @@ class ApiFormatFeedWrapper extends ApiFormatBase {
        public function getVersion() {
                return __CLASS__ . ': $Id$';
        }
-}
\ No newline at end of file
+}