Remove redirectToFragment() from wikibits.js
[lhc/web/wiklou.git] / includes / exception / MWException.php
index 80b6ac5..2b8cb00 100644 (file)
@@ -29,7 +29,7 @@ class MWException extends Exception {
         *
         * @return bool
         */
-       function useOutputPage() {
+       public function useOutputPage() {
                return $this->useMessageCache() &&
                !empty( $GLOBALS['wgFullyInitialised'] ) &&
                !empty( $GLOBALS['wgOut'] ) &&
@@ -40,9 +40,9 @@ class MWException extends Exception {
         * Whether to log this exception in the exception debug log.
         *
         * @since 1.23
-        * @return boolean
+        * @return bool
         */
-       function isLoggable() {
+       public function isLoggable() {
                return true;
        }
 
@@ -51,7 +51,7 @@ class MWException extends Exception {
         *
         * @return bool
         */
-       function useMessageCache() {
+       public function useMessageCache() {
                global $wgLang;
 
                foreach ( $this->getTrace() as $frame ) {
@@ -66,11 +66,11 @@ class MWException extends Exception {
        /**
         * Run hook to allow extensions to modify the text of the exception
         *
-        * @param string $name class name of the exception
-        * @param array $args arguments to pass to the callback functions
-        * @return string|null string to output or null if any hook has been called
+        * @param string $name Class name of the exception
+        * @param array $args Arguments to pass to the callback functions
+        * @return string|null String to output or null if any hook has been called
         */
-       function runHooks( $name, $args = array() ) {
+       public function runHooks( $name, $args = array() ) {
                global $wgExceptionHooks;
 
                if ( !isset( $wgExceptionHooks ) || !is_array( $wgExceptionHooks ) ) {
@@ -107,17 +107,17 @@ class MWException extends Exception {
        /**
         * Get a message from i18n
         *
-        * @param string $key message name
-        * @param string $fallback default message if the message cache can't be
+        * @param string $key Message name
+        * @param string $fallback Default message if the message cache can't be
         *                  called by the exception
         * The function also has other parameters that are arguments for the message
-        * @return string message with arguments replaced
+        * @return string Message with arguments replaced
         */
-       function msg( $key, $fallback /*[, params...] */ ) {
+       public function msg( $key, $fallback /*[, params...] */ ) {
                $args = array_slice( func_get_args(), 2 );
 
                if ( $this->useMessageCache() ) {
-                       return wfMessage( $key, $args )->plain();
+                       return wfMessage( $key, $args )->text();
                } else {
                        return wfMsgReplaceArgs( $fallback, $args );
                }
@@ -128,9 +128,9 @@ class MWException extends Exception {
         * backtrace to the error, otherwise show a message to ask to set it to true
         * to show that information.
         *
-        * @return string html to output
+        * @return string Html to output
         */
-       function getHTML() {
+       public function getHTML() {
                global $wgShowExceptionDetails;
 
                if ( $wgShowExceptionDetails ) {
@@ -155,7 +155,7 @@ class MWException extends Exception {
         *
         * @return string
         */
-       function getText() {
+       public function getText() {
                global $wgShowExceptionDetails;
 
                if ( $wgShowExceptionDetails ) {
@@ -172,9 +172,8 @@ class MWException extends Exception {
         *
         * @return string
         */
-       function getPageTitle() {
-               global $wgSitename;
-               return $this->msg( 'pagetitle', "$1 - $wgSitename", $this->msg( 'internalerror', 'Internal error' ) );
+       public function getPageTitle() {
+               return $this->msg( 'internalerror', 'Internal error' );
        }
 
        /**
@@ -184,7 +183,7 @@ class MWException extends Exception {
         * @deprecated since 1.22 Use MWExceptionHandler::getLogId instead.
         * @return string
         */
-       function getLogId() {
+       public function getLogId() {
                wfDeprecated( __METHOD__, '1.22' );
                return MWExceptionHandler::getLogId( $this );
        }
@@ -197,7 +196,7 @@ class MWException extends Exception {
         * @deprecated since 1.22 Use MWExceptionHandler::getLogMessage instead.
         * @return string
         */
-       function getLogMessage() {
+       public function getLogMessage() {
                wfDeprecated( __METHOD__, '1.22' );
                return MWExceptionHandler::getLogMessage( $this );
        }
@@ -205,8 +204,8 @@ class MWException extends Exception {
        /**
         * Output the exception report using HTML.
         */
-       function reportHTML() {
-               global $wgOut;
+       public function reportHTML() {
+               global $wgOut, $wgSitename;
                if ( $this->useOutputPage() ) {
                        $wgOut->prepareErrorPage( $this->getPageTitle() );
 
@@ -222,7 +221,8 @@ class MWException extends Exception {
                        header( 'Content-Type: text/html; charset=utf-8' );
                        echo "<!DOCTYPE html>\n" .
                                '<html><head>' .
-                               '<title>' . htmlspecialchars( $this->getPageTitle() ) . '</title>' .
+                               // Mimick OutputPage::setPageTitle behaviour
+                               '<title>' . htmlspecialchars( $this->msg( 'pagetitle', "$1 - $wgSitename", $this->getPageTitle() ) ) . '</title>' .
                                '<style>body { font-family: sans-serif; margin: 0; padding: 0.5em 2em; }</style>' .
                                "</head><body>\n";
 
@@ -241,7 +241,7 @@ class MWException extends Exception {
         * Output a report about the exception and takes care of formatting.
         * It will be either HTML or plain text based on isCommandLine().
         */
-       function report() {
+       public function report() {
                global $wgMimeType;
 
                MWExceptionHandler::logException( $this );
@@ -267,7 +267,7 @@ class MWException extends Exception {
         *
         * @return bool
         */
-       static function isCommandLine() {
+       public static function isCommandLine() {
                return !empty( $GLOBALS['wgCommandLineMode'] );
        }
 }