http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88822
Revision: 88822
Author: reedy
Date: 2011-05-25 19:41:01 +0000 (Wed, 25 May 2011)
Log Message:
-----------
Parameter documentation
Wrap a long line
Modified Paths:
--------------
trunk/extensions/ShortUrl/ShortUrl.functions.php
trunk/extensions/ShortUrl/ShortUrl.hooks.php
trunk/extensions/ShortUrl/ShortUrl.php
Modified: trunk/extensions/ShortUrl/ShortUrl.functions.php
===================================================================
--- trunk/extensions/ShortUrl/ShortUrl.functions.php 2011-05-25 19:38:24 UTC
(rev 88821)
+++ trunk/extensions/ShortUrl/ShortUrl.functions.php 2011-05-25 19:41:01 UTC
(rev 88822)
@@ -13,14 +13,22 @@
exit( 1 );
}
-/* stolen from http://www.php.net/manual/en/function.base64-encode.php#63543 */
+/**
+ * stolen from http://www.php.net/manual/en/function.base64-encode.php#63543
+ *
+ * @param $string string
+ */
function urlsafe_b64encode( $string ) {
$data = base64_encode( $string );
$data = str_replace( array( '+', '/', '=' ), array( '-', '_', '' ),
$data );
return $data;
}
-/* stolen from http://www.php.net/manual/en/function.base64-encode.php#63543 */
+/**
+ * stolen from http://www.php.net/manual/en/function.base64-encode.php#63543
+ *
+ * @param $string string
+ */
function urlsafe_b64decode( $string ) {
$data = str_replace( array( '-', '_' ), array( '+', '/' ), $string );
$mod4 = strlen( $data ) % 4;
@@ -30,6 +38,10 @@
return base64_decode( $data );
}
+/**
+ * @param $title Title
+ * @return mixed|string
+ */
function shorturlEncode ( $title ) {
global $wgMemc;
@@ -59,6 +71,10 @@
return urlsafe_b64encode( $id );
}
+/**
+ * @param $data string
+ * @return Title
+ */
function shorturlDecode ( $data ) {
global $wgMemc;
Modified: trunk/extensions/ShortUrl/ShortUrl.hooks.php
===================================================================
--- trunk/extensions/ShortUrl/ShortUrl.hooks.php 2011-05-25 19:38:24 UTC
(rev 88821)
+++ trunk/extensions/ShortUrl/ShortUrl.hooks.php 2011-05-25 19:41:01 UTC
(rev 88822)
@@ -16,6 +16,10 @@
require_once "ShortUrl.functions.php";
class ShortUrlHooks {
+ /**
+ * @param $tpl
+ * @return bool
+ */
public static function AddToolboxLink( &$tpl ) {
global $wgOut, $wgShortUrlPrefix;
if ( ! $wgOut->getTitle()->equals( Title::newMainPage() ) ) {
@@ -23,7 +27,11 @@
$shortId = shorturlEncode( $title );
$shortURL = $wgShortUrlPrefix . $shortId;
$html = Html::rawElement( 'li', array( 'id' =>
't-shorturl' ),
- Html::Element( 'a', array( 'href' => $shortURL,
'title' => wfMsg( 'shorturl-toolbox-title' ) ), wfMsg ( 'shorturl-toolbox-text'
) )
+ Html::Element( 'a', array(
+ 'href'
=> $shortURL,
+ 'title'
=> wfMsg( 'shorturl-toolbox-title' )
+ ),
+ wfMsg (
'shorturl-toolbox-text' ) )
);
echo $html;
@@ -31,6 +39,10 @@
return true;
}
+ /**
+ * @param $du DatabaseUpdater
+ * @return bool
+ */
public static function SetupSchema( DatabaseUpdater $du ) {
$base = dirname( __FILE__ ) . '/schemas';
$du->addExtensionTable( "shorturls", "$base/shorturls.sql" );
Modified: trunk/extensions/ShortUrl/ShortUrl.php
===================================================================
--- trunk/extensions/ShortUrl/ShortUrl.php 2011-05-25 19:38:24 UTC (rev
88821)
+++ trunk/extensions/ShortUrl/ShortUrl.php 2011-05-25 19:41:01 UTC (rev
88822)
@@ -28,7 +28,6 @@
$dir = dirname( __FILE__ ) . '/';
$wgExtensionMessagesFiles['ShortUrl'] = $dir . 'ShortUrl.i18n.php';
-
$wgAutoloadClasses['ShortUrlHooks'] = $dir . 'ShortUrl.hooks.php';
$wgAutoloadClasses['SpecialShortUrl'] = $dir . 'SpecialShortUrl.php';
$wgSpecialPages['ShortUrl'] = 'SpecialShortUrl';
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs