Remove the "Quickbar" feature and all things related to it
[lhc/web/wiklou.git] / includes / diff / DifferenceEngine.php
index c8f1d7f..d03a5be 100644 (file)
@@ -80,7 +80,7 @@ class DifferenceEngine extends ContextSource {
         * Constructor
         * @param $context IContextSource context to use, anything else will be ignored
         * @param $old Integer old ID we want to show and diff with.
-        * @param $new String either 'prev' or 'next'.
+        * @param string $new either 'prev' or 'next'.
         * @param $rcid Integer ??? FIXME (default 0)
         * @param $refreshCache boolean If set, refreshes the diff cache
         * @param $unhide boolean If set, allow viewing deleted revs
@@ -267,6 +267,8 @@ class DifferenceEngine extends ContextSource {
                $deleted = $suppressed = false;
                $allowed = $this->mNewRev->userCan( Revision::DELETED_TEXT, $user );
 
+               $revisionTools = array();
+
                # mOldRev is false if the difference engine is called with a "vague" query for
                # a diff between a version V and its previous version V' AND the version V
                # is the first version of that article. In that case, V' does not exist.
@@ -277,11 +279,6 @@ class DifferenceEngine extends ContextSource {
                } else {
                        wfRunHooks( 'DiffViewHeader', array( $this, $this->mOldRev, $this->mNewRev ) );
 
-                       $sk = $this->getSkin();
-                       if ( method_exists( $sk, 'suppressQuickbar' ) ) {
-                               $sk->suppressQuickbar();
-                       }
-
                        if ( $this->mNewPage->equals( $this->mOldPage ) ) {
                                $out->setPageTitle( $this->msg( 'difference-title', $this->mNewPage->getPrefixedText() ) );
                                $samePage = true;
@@ -301,16 +298,16 @@ class DifferenceEngine extends ContextSource {
                                        }
                                }
                                if ( !$this->mOldRev->isDeleted( Revision::DELETED_TEXT ) && !$this->mNewRev->isDeleted( Revision::DELETED_TEXT ) ) {
-                                       $undoLink = ' ' . $this->msg( 'parentheses' )->rawParams(
-                                               Html::element( 'a', array(
-                                                       'href' => $this->mNewPage->getLocalUrl( array(
+                                       $undoLink = Html::element( 'a', array(
+                                                       'href' => $this->mNewPage->getLocalURL( array(
                                                                'action' => 'edit',
                                                                'undoafter' => $this->mOldid,
                                                                'undo' => $this->mNewid ) ),
                                                        'title' => Linker::titleAttrib( 'undo' )
                                                ),
                                                $this->msg( 'editundo' )->text()
-                                       ) )->escaped();
+                                       );
+                                       $revisionTools[] = $undoLink;
                                }
                        }
 
@@ -376,7 +373,15 @@ class DifferenceEngine extends ContextSource {
 
                # Handle RevisionDelete links...
                $rdel = $this->revisionDeleteLink( $this->mNewRev );
-               $newRevisionHeader = $this->getRevisionHeader( $this->mNewRev, 'complete' ) . $undoLink;
+
+               # Allow extensions to define their own revision tools
+               wfRunHooks( 'DiffRevisionTools', array( $this->mNewRev, &$revisionTools ) );
+               $formattedRevisionTools = array();
+               // Put each one in parentheses (poor man's button)
+               foreach ( $revisionTools as $tool ) {
+                       $formattedRevisionTools[] = $this->msg( 'parentheses' )->rawParams( $tool )->escaped();
+               }
+               $newRevisionHeader = $this->getRevisionHeader( $this->mNewRev, 'complete' ) . ' ' . implode( ' ', $formattedRevisionTools );
 
                $newHeader = '<div id="mw-diff-ntitle1"><strong>' . $newRevisionHeader . '</strong></div>' .
                        '<div id="mw-diff-ntitle2">' . Linker::revUserTools( $this->mNewRev, !$this->unhide ) .
@@ -404,7 +409,7 @@ class DifferenceEngine extends ContextSource {
                                        array( $msg ) );
                        } else {
                                # Give explanation and add a link to view the diff...
-                               $link = $this->getTitle()->getFullUrl( $this->getRequest()->appendQueryValue( 'unhide', '1', true ) );
+                               $link = $this->getTitle()->getFullURL( $this->getRequest()->appendQueryValue( 'unhide', '1', true ) );
                                $msg = $suppressed ? 'rev-suppressed-unhide-diff' : 'rev-deleted-unhide-diff';
                                $out->wrapWikiMsg( "<div id='mw-$msg' class='mw-warning plainlinks'>\n$1\n</div>\n", array( $msg, $link ) );
                        }
@@ -618,7 +623,7 @@ class DifferenceEngine extends ContextSource {
         *
         * @param string|bool $otitle Header for old text or false
         * @param string|bool $ntitle Header for new text or false
-        * @param $notice String: HTML between diff header and body
+        * @param string $notice HTML between diff header and body
         * @return mixed
         */
        function getDiff( $otitle, $ntitle, $notice = '' ) {
@@ -759,8 +764,8 @@ class DifferenceEngine extends ContextSource {
        /**
         * Generate a diff, no caching
         *
-        * @param $otext String: old text, must be already segmented
-        * @param $ntext String: new text, must be already segmented
+        * @param string $otext old text, must be already segmented
+        * @param string $ntext new text, must be already segmented
         * @return bool|string
         * @deprecated since 1.21, use generateContentDiffBody() instead!
         */
@@ -775,8 +780,8 @@ class DifferenceEngine extends ContextSource {
         *
         * @todo move this to TextDifferenceEngine, make DifferenceEngine abstract. At some point.
         *
-        * @param $otext String: old text, must be already segmented
-        * @param $ntext String: new text, must be already segmented
+        * @param string $otext old text, must be already segmented
+        * @param string $ntext new text, must be already segmented
         * @return bool|string
         */
        function generateTextDiffBody( $otext, $ntext ) {
@@ -887,7 +892,6 @@ class DifferenceEngine extends ContextSource {
                return $this->msg( 'lineno' )->numParams( $matches[1] )->escaped();
        }
 
-
        /**
         * If there are revisions between the ones being compared, return a note saying so.
         * @return string
@@ -938,7 +942,7 @@ class DifferenceEngine extends ContextSource {
         * Get a header for a specified revision.
         *
         * @param $rev Revision
-        * @param $complete String: 'complete' to get the header wrapped depending
+        * @param string $complete 'complete' to get the header wrapped depending
         *        the visibility of the revision and a link to edit the page.
         * @return String HTML fragment
         */