r82618 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82617‎ | r82618 | r82619 >
Date:18:19, 22 February 2011
Author:yaron
Status:deferred
Tags:
Comment:
Added new helper method, linkForSpecialPage()
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_Utils.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_Utils.php
@@ -10,6 +10,19 @@
1111 class SFUtils {
1212
1313 /**
 14+ * Creates a link to a special page, using that page's top-level description as the link text.
 15+ */
 16+ public static function linkForSpecialPage( $skin, $specialPageName ) {
 17+ $specialPage = SpecialPage::getPage( $specialPageName );
 18+ // link() method was added in MW 1.16
 19+ if ( method_exists( $skin, 'link' ) ) {
 20+ return $skin->link( $specialPage->getTitle(), $specialPage->getDescription() );
 21+ } else {
 22+ return $skin->makeKnownLinkObj( $specialPage->getTitle(), $specialPage->getDescription() );
 23+ }
 24+ }
 25+
 26+ /**
1427 * Creates the name of the page that appears in the URL;
1528 * this method is necessary because Title::getPartialURL(), for
1629 * some reason, doesn't include the namespace