Index: trunk/phase3/includes/diff/DifferenceEngine.php |
— | — | @@ -108,8 +108,14 @@ |
109 | 109 | global $wgInputEncoding,$wgServer,$wgScript,$wgLang; |
110 | 110 | $wgOut->disable(); |
111 | 111 | header ( "Content-type: application/x-external-editor; charset=".$wgInputEncoding ); |
112 | | - $url1=$this->mTitle->getFullURL("action=raw&oldid=".$this->mOldid); |
113 | | - $url2=$this->mTitle->getFullURL("action=raw&oldid=".$this->mNewid); |
| 112 | + $url1=$this->mTitle->getFullURL( array( |
| 113 | + 'action' => 'raw', |
| 114 | + 'oldid' => $this->mOldid |
| 115 | + ) ); |
| 116 | + $url2=$this->mTitle->getFullURL( array( |
| 117 | + 'action' => 'raw', |
| 118 | + 'oldid' => $this->mNewid |
| 119 | + ) ); |
114 | 120 | $special=$wgLang->getNsText(NS_SPECIAL); |
115 | 121 | $control=<<<CONTROL |
116 | 122 | [Process] |
— | — | @@ -218,8 +224,19 @@ |
219 | 225 | } |
220 | 226 | // Build the link |
221 | 227 | if( $rcid ) { |
222 | | - $patrol = ' <span class="patrollink">[' . $sk->makeKnownLinkObj( $this->mTitle, |
223 | | - wfMsgHtml( 'markaspatrolleddiff' ), "action=markpatrolled&rcid={$rcid}" ) . ']</span>'; |
| 228 | + $patrol = ' <span class="patrollink">[' . $sk->link( |
| 229 | + $this->mTitle, |
| 230 | + wfMsgHtml( 'markaspatrolleddiff' ), |
| 231 | + array(), |
| 232 | + array( |
| 233 | + 'action' => 'markpatrolled', |
| 234 | + 'rcid' => $rcid |
| 235 | + ), |
| 236 | + array( |
| 237 | + 'known', |
| 238 | + 'noclasses' |
| 239 | + ) |
| 240 | + ) . ']</span>'; |
224 | 241 | } else { |
225 | 242 | $patrol = ''; |
226 | 243 | } |
— | — | @@ -227,21 +244,52 @@ |
228 | 245 | $patrol = ''; |
229 | 246 | } |
230 | 247 | |
231 | | - $diffOnlyArg = ''; |
232 | 248 | # Carry over 'diffonly' param via navigation links |
233 | 249 | if( $diffOnly != $wgUser->getBoolOption('diffonly') ) { |
234 | | - $diffOnlyArg = '&diffonly='.$diffOnly; |
| 250 | + $query['diffonly'] = $diffOnly; |
235 | 251 | } |
| 252 | + |
236 | 253 | $htmldiffarg = $this->htmlDiffArgument(); |
| 254 | + |
| 255 | + if( $htmldiffarg ) { |
| 256 | + $query['htmldiff'] = $htmldiffarg['htmldiff']; |
| 257 | + } |
| 258 | + |
237 | 259 | # Make "previous revision link" |
238 | | - $prevlink = $sk->makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'previousdiff' ), |
239 | | - "diff=prev&oldid={$this->mOldid}{$htmldiffarg}{$diffOnlyArg}", '', '', 'id="differences-prevlink"' ); |
| 260 | + $query['diff'] = 'prev'; |
| 261 | + $query['oldid'] = $this->mOldid; |
| 262 | + |
| 263 | + $prevlink = $sk->link( |
| 264 | + $this->mTitle, |
| 265 | + wfMsgHtml( 'previousdiff' ), |
| 266 | + array( |
| 267 | + 'id' => 'differences-prevlink' |
| 268 | + ), |
| 269 | + $query, |
| 270 | + array( |
| 271 | + 'known', |
| 272 | + 'noclasses' |
| 273 | + ) |
| 274 | + ); |
240 | 275 | # Make "next revision link" |
| 276 | + $query['diff'] = 'next'; |
| 277 | + $query['oldid'] = $this->mNewid; |
| 278 | + |
241 | 279 | if( $this->mNewRev->isCurrent() ) { |
242 | 280 | $nextlink = ' '; |
243 | 281 | } else { |
244 | | - $nextlink = $sk->makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'nextdiff' ), |
245 | | - "diff=next&oldid={$this->mNewid}{$htmldiffarg}{$diffOnlyArg}", '', '', 'id="differences-nextlink"' ); |
| 282 | + $nextlink = $sk->link( |
| 283 | + $this->mTitle, |
| 284 | + wfMsgHtml( 'nextdiff' ), |
| 285 | + array( |
| 286 | + 'id' => 'differences-nextlink' |
| 287 | + ), |
| 288 | + $query, |
| 289 | + array( |
| 290 | + 'known', |
| 291 | + 'noclasses' |
| 292 | + ) |
| 293 | + ); |
246 | 294 | } |
247 | 295 | |
248 | 296 | $oldminor = ''; |
— | — | @@ -258,7 +306,7 @@ |
259 | 307 | if( $wgUser->isAllowed( 'deleterevision' ) ) { |
260 | 308 | if( !$this->mOldRev->userCan( Revision::DELETED_RESTRICTED ) ) { |
261 | 309 | // If revision was hidden from sysops |
262 | | - $ldel = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ), '('.wfMsgHtml( 'rev-delundel' ).')' ); |
| 310 | + $ldel = Xml::tags( 'span', array( 'class' => 'mw-revdelundel-link' ), '(' . wfMsgHtml( 'rev-delundel' ) . ')' ); |
263 | 311 | } else { |
264 | 312 | $query = array( |
265 | 313 | 'type' => 'revision', |
— | — | @@ -310,20 +358,52 @@ |
311 | 359 | array( 'rev-deleted-no-diff' ) ); |
312 | 360 | } else { |
313 | 361 | # Give explanation and add a link to view the diff... |
314 | | - $link = $this->mTitle->getFullUrl( "diff={$this->mNewid}&oldid={$this->mOldid}&unhide=1" ); |
| 362 | + $link = $this->mTitle->getFullUrl( array( |
| 363 | + 'diff' => $this->mNewid, |
| 364 | + 'oldid' => $this->mOldid, |
| 365 | + 'unhide' => 1 |
| 366 | + ) ); |
315 | 367 | $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1</div>\n", |
316 | 368 | array( 'rev-deleted-unhide-diff', $link ) ); |
317 | 369 | } |
318 | 370 | } else if( $wgEnableHtmlDiff && $this->htmldiff ) { |
319 | 371 | $multi = $this->getMultiNotice(); |
320 | | - $wgOut->addHTML('<div class="diff-switchtype">'.$sk->makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'wikicodecomparison' ), |
321 | | - 'diff='.$this->mNewid.'&oldid='.$this->mOldid.'&htmldiff=0', '', '', 'id="differences-switchtype"' ).'</div>'); |
| 372 | + $wgOut->addHTML( '<div class="diff-switchtype">' . $sk->link( |
| 373 | + $this->mTitle, |
| 374 | + wfMsgHtml( 'wikicodecomparison' ), |
| 375 | + array( |
| 376 | + 'id' => 'differences-switchtype' |
| 377 | + ), |
| 378 | + array( |
| 379 | + 'diff' => $this->mNewid, |
| 380 | + 'oldid' => $this->mOldid, |
| 381 | + 'htmldiff' => 0 |
| 382 | + ), |
| 383 | + array( |
| 384 | + 'known', |
| 385 | + 'noclasses' |
| 386 | + ) |
| 387 | + ) . '</div>'); |
322 | 388 | $wgOut->addHTML( $this->addHeader( '', $oldHeader, $newHeader, $multi ) ); |
323 | 389 | $this->renderHtmlDiff(); |
324 | 390 | } else { |
325 | 391 | if( $wgEnableHtmlDiff ) { |
326 | | - $wgOut->addHTML('<div class="diff-switchtype">'.$sk->makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'visualcomparison' ), |
327 | | - 'diff='.$this->mNewid.'&oldid='.$this->mOldid.'&htmldiff=1', '', '', 'id="differences-switchtype"' ).'</div>'); |
| 392 | + $wgOut->addHTML( '<div class="diff-switchtype">' . $sk->link( |
| 393 | + $this->mTitle, |
| 394 | + wfMsgHtml( 'visualcomparison' ), |
| 395 | + array( |
| 396 | + 'id' => 'differences-switchtype' |
| 397 | + ), |
| 398 | + array( |
| 399 | + 'diff' => $this->mNewid, |
| 400 | + 'oldid' => $this->mOldid, |
| 401 | + 'htmldiff' => 1 |
| 402 | + ), |
| 403 | + array( |
| 404 | + 'known', |
| 405 | + 'noclasses' |
| 406 | + ) |
| 407 | + ) . '</div>'); |
328 | 408 | } |
329 | 409 | $this->showDiff( $oldHeader, $newHeader ); |
330 | 410 | if( !$diffOnly ) { |
— | — | @@ -379,9 +459,15 @@ |
380 | 460 | if( $this->mRcidMarkPatrolled && $this->mTitle->quickUserCan('patrol') ) { |
381 | 461 | $sk = $wgUser->getSkin(); |
382 | 462 | $wgOut->addHTML( |
383 | | - "<div class='patrollink'>[" . $sk->makeKnownLinkObj( $this->mTitle, |
384 | | - wfMsgHtml( 'markaspatrolleddiff' ), "action=markpatrolled&rcid={$this->mRcidMarkPatrolled}" ) . |
385 | | - ']</div>' |
| 463 | + "<div class='patrollink'>[" . $sk->link( |
| 464 | + $this->mTitle, |
| 465 | + wfMsgHtml( 'markaspatrolleddiff' ), |
| 466 | + array(), |
| 467 | + array( |
| 468 | + 'action' => 'markpatrolled', |
| 469 | + 'rcid' => $this->mRcidMarkPatrolled |
| 470 | + ) |
| 471 | + ) . ']</div>' |
386 | 472 | ); |
387 | 473 | } |
388 | 474 | |
— | — | @@ -491,8 +577,22 @@ |
492 | 578 | if( !$next ) { |
493 | 579 | $nextlink = ''; |
494 | 580 | } else { |
495 | | - $nextlink = '<br/>' . $sk->makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'nextdiff' ), |
496 | | - 'diff=next&oldid=' . $this->mNewid.$this->htmlDiffArgument(), '', '', 'id="differences-nextlink"' ); |
| 581 | + $nextlink = '<br/>' . $sk->link( |
| 582 | + $this->mTitle, |
| 583 | + wfMsgHtml( 'nextdiff' ), |
| 584 | + array( |
| 585 | + 'id' => 'differences-nextlink' |
| 586 | + ), |
| 587 | + array( |
| 588 | + 'diff' => 'next', |
| 589 | + 'oldid' => $this->mNewid, |
| 590 | + $this->htmlDiffArgument() |
| 591 | + ), |
| 592 | + array( |
| 593 | + 'known', |
| 594 | + 'noclasses' |
| 595 | + ) |
| 596 | + ); |
497 | 597 | } |
498 | 598 | $header = "<div class=\"firstrevisionheader\" style=\"text-align: center\">" . |
499 | 599 | $sk->revUserTools( $this->mNewRev ) . "<br/>" . $sk->revComment( $this->mNewRev ) . $nextlink . "</div>\n"; |
— | — | @@ -509,12 +609,12 @@ |
510 | 610 | global $wgEnableHtmlDiff; |
511 | 611 | if($wgEnableHtmlDiff){ |
512 | 612 | if($this->htmldiff){ |
513 | | - return '&htmldiff=1'; |
| 613 | + return array( 'htmldiff' => 1 ); |
514 | 614 | }else{ |
515 | | - return '&htmldiff=0'; |
| 615 | + return array( 'htmldiff' => 0 ); |
516 | 616 | } |
517 | 617 | }else{ |
518 | | - return ''; |
| 618 | + return array(); |
519 | 619 | } |
520 | 620 | } |
521 | 621 | |
— | — | @@ -849,16 +949,35 @@ |
850 | 950 | $timeofrev = $wgLang->time( $this->mNewRev->getTimestamp(), true ); |
851 | 951 | $this->mNewPage = $this->mNewRev->getTitle(); |
852 | 952 | if( $this->mNewRev->isCurrent() ) { |
853 | | - $newLink = $this->mNewPage->escapeLocalUrl( 'oldid=' . $this->mNewid ); |
854 | | - $this->mPagetitle = htmlspecialchars( wfMsg( 'currentrev-asof', $timestamp ) ); |
855 | | - $newEdit = $this->mNewPage->escapeLocalUrl( 'action=edit' ); |
| 953 | + $newLink = $this->mNewPage->escapeLocalUrl( array( |
| 954 | + 'oldid' => $this->mNewid |
| 955 | + ) ); |
| 956 | + $this->mPagetitle = htmlspecialchars( wfMsg( |
| 957 | + 'currentrev-asof', |
| 958 | + $timestamp, |
| 959 | + $dateofrev, |
| 960 | + $timeofrev |
| 961 | + ) ); |
| 962 | + $newEdit = $this->mNewPage->escapeLocalUrl( array( |
| 963 | + 'action' => 'edit' |
| 964 | + ) ); |
856 | 965 | |
857 | 966 | $this->mNewtitle = "<a href='$newLink'>{$this->mPagetitle}</a>"; |
858 | 967 | $this->mNewtitle .= " (<a href='$newEdit'>" . wfMsgHtml( $editable ? 'editold' : 'viewsourceold' ) . "</a>)"; |
859 | 968 | } else { |
860 | | - $newLink = $this->mNewPage->escapeLocalUrl( 'oldid=' . $this->mNewid ); |
861 | | - $newEdit = $this->mNewPage->escapeLocalUrl( 'action=edit&oldid=' . $this->mNewid ); |
862 | | - $this->mPagetitle = htmlspecialchars( wfMsg( 'revisionasof', $timestamp, $dateofrev, $timeofrev ) ); |
| 969 | + $newLink = $this->mNewPage->escapeLocalUrl( array( |
| 970 | + 'oldid' => $this->mNewid |
| 971 | + ) ); |
| 972 | + $newEdit = $this->mNewPage->escapeLocalUrl( array( |
| 973 | + 'action' => 'edit', |
| 974 | + 'oldid' => $this->mNewid |
| 975 | + ) ); |
| 976 | + $this->mPagetitle = htmlspecialchars( wfMsg( |
| 977 | + 'revisionasof', |
| 978 | + $timestamp, |
| 979 | + $dateofrev, |
| 980 | + $timeofrev |
| 981 | + ) ); |
863 | 982 | |
864 | 983 | $this->mNewtitle = "<a href='$newLink'>{$this->mPagetitle}</a>"; |
865 | 984 | $this->mNewtitle .= " (<a href='$newEdit'>" . wfMsgHtml( $editable ? 'editold' : 'viewsourceold' ) . "</a>)"; |
— | — | @@ -895,14 +1014,23 @@ |
896 | 1015 | $t = $wgLang->timeanddate( $this->mOldRev->getTimestamp(), true ); |
897 | 1016 | $dateofrev = $wgLang->date( $this->mOldRev->getTimestamp(), true ); |
898 | 1017 | $timeofrev = $wgLang->time( $this->mOldRev->getTimestamp(), true ); |
899 | | - $oldLink = $this->mOldPage->escapeLocalUrl( 'oldid=' . $this->mOldid ); |
900 | | - $oldEdit = $this->mOldPage->escapeLocalUrl( 'action=edit&oldid=' . $this->mOldid ); |
| 1018 | + $oldLink = $this->mOldPage->escapeLocalUrl( array( |
| 1019 | + 'oldid' => $this->mOldid |
| 1020 | + ) ); |
| 1021 | + $oldEdit = $this->mOldPage->escapeLocalUrl( array( |
| 1022 | + 'action' => 'edit', |
| 1023 | + 'oldid' => $this->mOldid |
| 1024 | + ) ); |
901 | 1025 | $this->mOldPagetitle = htmlspecialchars( wfMsg( 'revisionasof', $t, $dateofrev, $timeofrev ) ); |
902 | 1026 | |
903 | 1027 | $this->mOldtitle = "<a href='$oldLink'>{$this->mOldPagetitle}</a>" |
904 | 1028 | . " (<a href='$oldEdit'>" . wfMsgHtml( $editable ? 'editold' : 'viewsourceold' ) . "</a>)"; |
905 | 1029 | // Add an "undo" link |
906 | | - $newUndo = $this->mNewPage->escapeLocalUrl( 'action=edit&undoafter=' . $this->mOldid . '&undo=' . $this->mNewid); |
| 1030 | + $newUndo = $this->mNewPage->escapeLocalUrl( array( |
| 1031 | + 'action' => 'edit', |
| 1032 | + 'undoafter' => $this->mOldid, |
| 1033 | + 'undo' => $this->mNewid |
| 1034 | + ) ); |
907 | 1035 | $htmlLink = htmlspecialchars( wfMsg( 'editundo' ) ); |
908 | 1036 | $htmlTitle = $wgUser->getSkin()->tooltip( 'undo' ); |
909 | 1037 | if( $editable && !$this->mOldRev->isDeleted( Revision::DELETED_TEXT ) && !$this->mNewRev->isDeleted( Revision::DELETED_TEXT ) ) { |
— | — | @@ -963,8 +1091,6 @@ |
964 | 1092 | $this->mNewtext = $this->mNewRev->getText( Revision::FOR_THIS_USER ); |
965 | 1093 | return true; |
966 | 1094 | } |
967 | | - |
968 | | - |
969 | 1095 | } |
970 | 1096 | |
971 | 1097 | // A PHP diff engine for phpwiki. (Taken from phpwiki-1.3.3) |