X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fdiff%2FDifferenceEngine.php;h=50e08ca1d22bbabf37ed2d02a0e06411c9131d43;hb=6c2262319b7c34b62478ca3a100a10d9b763c520;hp=3aad38950a8dc56a56ca037fb569cb338597d878;hpb=4f1390819a8fcd91c0c34449736fff4548032ad3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 3aad38950a..50e08ca1d2 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -98,9 +98,9 @@ class DifferenceEngine extends ContextSource { /** * Constructor - * @param IContextSource $context context to use, anything else will be ignored - * @param int $old old ID we want to show and diff with. - * @param string|int $new either revision ID or 'prev' or 'next'. Default: 0. + * @param IContextSource $context Context to use, anything else will be ignored + * @param int $old Old ID we want to show and diff with. + * @param string|int $new Either revision ID or 'prev' or 'next'. Default: 0. * @param int $rcid Deprecated, no longer used! * @param bool $refreshCache If set, refreshes the diff cache * @param bool $unhide If set, allow viewing deleted revs @@ -310,11 +310,11 @@ class DifferenceEngine extends ContextSource { 'undoafter' => $this->mOldid, 'undo' => $this->mNewid ) ), - 'title' => Linker::titleAttrib( 'undo' ) + 'title' => Linker::titleAttrib( 'undo' ), ), $this->msg( 'editundo' )->text() ); - $revisionTools[] = $undoLink; + $revisionTools['mw-diff-undo'] = $undoLink; } } @@ -387,8 +387,14 @@ class DifferenceEngine extends ContextSource { wfRunHooks( 'DiffRevisionTools', array( $this->mNewRev, &$revisionTools, $this->mOldRev ) ); $formattedRevisionTools = array(); // Put each one in parentheses (poor man's button) - foreach ( $revisionTools as $tool ) { - $formattedRevisionTools[] = $this->msg( 'parentheses' )->rawParams( $tool )->escaped(); + foreach ( $revisionTools as $key => $tool ) { + $toolClass = is_string( $key ) ? $key : 'mw-diff-tool'; + $element = Html::rawElement( + 'span', + array( 'class' => $toolClass ), + $this->msg( 'parentheses' )->rawParams( $tool )->escaped() + ); + $formattedRevisionTools[] = $element; } $newRevisionHeader = $this->getRevisionHeader( $this->mNewRev, 'complete' ) . ' ' . implode( ' ', $formattedRevisionTools ); @@ -823,8 +829,8 @@ class DifferenceEngine extends ContextSource { * * @todo move this to TextDifferenceEngine, make DifferenceEngine abstract. At some point. * - * @param string $otext old text, must be already segmented - * @param string $ntext 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 */ @@ -972,7 +978,7 @@ class DifferenceEngine extends ContextSource { } // Sanity: don't show the notice if too many rows must be scanned - // @TODO: show some special message for that case + // @todo show some special message for that case $nEdits = $this->mNewPage->countRevisionsBetween( $oldRev, $newRev, 1000 ); if ( $nEdits > 0 && $nEdits <= 1000 ) { $limit = 100; // use diff-multi-manyusers if too many users @@ -1052,8 +1058,13 @@ class DifferenceEngine extends ContextSource { $key = $title->quickUserCan( 'edit', $user ) ? 'editold' : 'viewsourceold'; $msg = $this->msg( $key )->escaped(); - $header .= ' ' . $this->msg( 'parentheses' )->rawParams( - Linker::linkKnown( $title, $msg, array(), $editQuery ) )->plain(); + $editLink = $this->msg( 'parentheses' )->rawParams( + Linker::linkKnown( $title, $msg, array( ), $editQuery ) )->plain(); + $header .= ' ' . Html::rawElement( + 'span', + array( 'class' => 'mw-diff-edit' ), + $editLink + ); if ( $rev->isDeleted( Revision::DELETED_TEXT ) ) { $header = Html::rawElement( 'span', @@ -1140,6 +1151,8 @@ class DifferenceEngine extends ContextSource { /** * Use specified text instead of loading from the database + * @param Content $oldContent + * @param Content $newContent * @since 1.21 */ public function setContent( Content $oldContent, Content $newContent ) { @@ -1153,6 +1166,7 @@ class DifferenceEngine extends ContextSource { /** * Set the language in which the diff text is written * (Defaults to page content language). + * @param Language|string $lang * @since 1.19 */ public function setTextLanguage( $lang ) {