r24444 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24443‎ | r24444 | r24445 >
Date:23:53, 29 July 2007
Author:robchurch
Status:old
Tags:
Comment:
Introduce OutputPage::addReturnTo(), with a view to replacing OutputPage::returnToMain() [cleaner calling convention], and document the latter
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -1059,12 +1059,25 @@
10601060 }
10611061
10621062 /**
1063 - * return from error messages or notes
1064 - * @param $unused No longer used
1065 - * @param $returnto page title to return to. Default is Main Page.
 1063+ * Add a "return to" link pointing to a specified title
 1064+ *
 1065+ * @param Title $title Title to link
10661066 */
 1067+ public function addReturnTo( $title ) {
 1068+ global $wgUser;
 1069+ $link = wfMsg( 'returnto', $wgUser->getSkin()->makeLinkObj( $title ) );
 1070+ $this->addHtml( "<p>{$link}</p>\n" );
 1071+ }
 1072+
 1073+ /**
 1074+ * Add a "return to" link pointing to a specified title,
 1075+ * or the title indicated in the request, or else the main page
 1076+ *
 1077+ * @param null $unused No longer used
 1078+ * @param Title $returnto Title to return to
 1079+ */
10671080 public function returnToMain( $unused = null, $returnto = NULL ) {
1068 - global $wgUser, $wgOut, $wgRequest;
 1081+ global $wgRequest;
10691082
10701083 if ( $returnto == NULL ) {
10711084 $returnto = $wgRequest->getText( 'returnto' );
@@ -1083,11 +1096,7 @@
10841097 $titleObj = Title::newMainPage();
10851098 }
10861099
1087 - $sk = $wgUser->getSkin();
1088 - $link = $sk->makeLinkObj( $titleObj, '' );
1089 -
1090 - $r = wfMsg( 'returnto', $link );
1091 - $wgOut->addHTML( "\n<p>$r</p>\n" );
 1100+ $this->addReturnTo( $titleObj );
10921101 }
10931102
10941103 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r24502Merged revisions 24415-24479 via svnmerge from...david22:31, 31 July 2007

Status & tagging log