r88822 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88821‎ | r88822 | r88823 >
Date:19:41, 25 May 2011
Author:reedy
Status:deferred
Tags:
Comment:
Parameter documentation

Wrap a long line
Modified paths:
  • /trunk/extensions/ShortUrl/ShortUrl.functions.php (modified) (history)
  • /trunk/extensions/ShortUrl/ShortUrl.hooks.php (modified) (history)
  • /trunk/extensions/ShortUrl/ShortUrl.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ShortUrl/ShortUrl.functions.php
@@ -13,14 +13,22 @@
1414 exit( 1 );
1515 }
1616
17 -/* stolen from http://www.php.net/manual/en/function.base64-encode.php#63543 */
 17+/**
 18+ * stolen from http://www.php.net/manual/en/function.base64-encode.php#63543
 19+ *
 20+ * @param $string string
 21+ */
1822 function urlsafe_b64encode( $string ) {
1923 $data = base64_encode( $string );
2024 $data = str_replace( array( '+', '/', '=' ), array( '-', '_', '' ), $data );
2125 return $data;
2226 }
2327
24 -/* stolen from http://www.php.net/manual/en/function.base64-encode.php#63543 */
 28+/**
 29+ * stolen from http://www.php.net/manual/en/function.base64-encode.php#63543
 30+ *
 31+ * @param $string string
 32+ */
2533 function urlsafe_b64decode( $string ) {
2634 $data = str_replace( array( '-', '_' ), array( '+', '/' ), $string );
2735 $mod4 = strlen( $data ) % 4;
@@ -30,6 +38,10 @@
3139 return base64_decode( $data );
3240 }
3341
 42+/**
 43+ * @param $title Title
 44+ * @return mixed|string
 45+ */
3446 function shorturlEncode ( $title ) {
3547 global $wgMemc;
3648
@@ -59,6 +71,10 @@
6072 return urlsafe_b64encode( $id );
6173 }
6274
 75+/**
 76+ * @param $data string
 77+ * @return Title
 78+ */
6379 function shorturlDecode ( $data ) {
6480 global $wgMemc;
6581
Index: trunk/extensions/ShortUrl/ShortUrl.php
@@ -28,7 +28,6 @@
2929 $dir = dirname( __FILE__ ) . '/';
3030 $wgExtensionMessagesFiles['ShortUrl'] = $dir . 'ShortUrl.i18n.php';
3131
32 -
3332 $wgAutoloadClasses['ShortUrlHooks'] = $dir . 'ShortUrl.hooks.php';
3433 $wgAutoloadClasses['SpecialShortUrl'] = $dir . 'SpecialShortUrl.php';
3534 $wgSpecialPages['ShortUrl'] = 'SpecialShortUrl';
Index: trunk/extensions/ShortUrl/ShortUrl.hooks.php
@@ -16,6 +16,10 @@
1717 require_once "ShortUrl.functions.php";
1818
1919 class ShortUrlHooks {
 20+ /**
 21+ * @param $tpl
 22+ * @return bool
 23+ */
2024 public static function AddToolboxLink( &$tpl ) {
2125 global $wgOut, $wgShortUrlPrefix;
2226 if ( ! $wgOut->getTitle()->equals( Title::newMainPage() ) ) {
@@ -23,7 +27,11 @@
2428 $shortId = shorturlEncode( $title );
2529 $shortURL = $wgShortUrlPrefix . $shortId;
2630 $html = Html::rawElement( 'li', array( 'id' => 't-shorturl' ),
27 - Html::Element( 'a', array( 'href' => $shortURL, 'title' => wfMsg( 'shorturl-toolbox-title' ) ), wfMsg ( 'shorturl-toolbox-text' ) )
 31+ Html::Element( 'a', array(
 32+ 'href' => $shortURL,
 33+ 'title' => wfMsg( 'shorturl-toolbox-title' )
 34+ ),
 35+ wfMsg ( 'shorturl-toolbox-text' ) )
2836 );
2937
3038 echo $html;
@@ -31,6 +39,10 @@
3240 return true;
3341 }
3442
 43+ /**
 44+ * @param $du DatabaseUpdater
 45+ * @return bool
 46+ */
3547 public static function SetupSchema( DatabaseUpdater $du ) {
3648 $base = dirname( __FILE__ ) . '/schemas';
3749 $du->addExtensionTable( "shorturls", "$base/shorturls.sql" );

Status & tagging log