Make it possible for EditPage::getCopyrightWarning to return HTML
authorKunal Mehta <legoktm@gmail.com>
Thu, 17 Oct 2013 05:34:07 +0000 (22:34 -0700)
committerKunal Mehta <legoktm@gmail.com>
Sun, 20 Oct 2013 10:04:25 +0000 (03:04 -0700)
Adds a $format option to let it return various output formats
so code that needs HTML doesn't have to do hacky stuff.

Change-Id: Ie4ff9738773399f9f00994c6cc587703ce99a681

includes/EditPage.php

index 12cd4b3..7471589 100644 (file)
@@ -2859,7 +2859,15 @@ HTML
                return self::getCopyrightWarning( $this->mTitle );
        }
 
-       public static function getCopyrightWarning( $title ) {
+       /**
+        * Get the copyright warning, by default returns wikitext
+        *
+        * @param Title $title
+        * @param string $format output format, valid values are any function of
+        *                       a Message object
+        * @return string
+        */
+       public static function getCopyrightWarning( $title, $format = 'plain' ) {
                global $wgRightsText;
                if ( $wgRightsText ) {
                        $copywarnMsg = array( 'copyrightwarning',
@@ -2873,7 +2881,7 @@ HTML
                wfRunHooks( 'EditPageCopyrightWarning', array( $title, &$copywarnMsg ) );
 
                return "<div id=\"editpage-copywarn\">\n" .
-                       call_user_func_array( 'wfMessage', $copywarnMsg )->plain() . "\n</div>";
+                       call_user_func_array( 'wfMessage', $copywarnMsg )->$format() . "\n</div>";
        }
 
        /**