Index: trunk/extensions/ShortUrl/ShortUrl.php |
— | — | @@ -45,4 +45,4 @@ |
46 | 46 | ); |
47 | 47 | |
48 | 48 | // Configuration |
49 | | -$wgShortUrlPrefix = '/wiki/Special:ShortUrl/'; |
| 49 | +$wgShortUrlPrefix = NULL; |
Index: trunk/extensions/ShortUrl/ShortUrl.hooks.php |
— | — | @@ -22,10 +22,16 @@ |
23 | 23 | */ |
24 | 24 | public static function AddToolboxLink( &$tpl ) { |
25 | 25 | global $wgOut, $wgShortUrlPrefix; |
| 26 | + if ( $wgShortUrlPrefix == NULL) { |
| 27 | + $urlPrefix = SpecialPage::getTitleFor( 'ShortUrl' )->getFullURL() . '/'; |
| 28 | + } else { |
| 29 | + $urlPrefix = $wgShortUrlPrefix; |
| 30 | + } |
| 31 | + |
26 | 32 | $title = $wgOut->getTitle(); |
27 | 33 | if ( needsShortUrl( $title ) ) { |
28 | 34 | $shortId = shorturlEncode( $title ); |
29 | | - $shortURL = $wgShortUrlPrefix . $shortId; |
| 35 | + $shortURL = $urlPrefix . $shortId; |
30 | 36 | $html = Html::rawElement( 'li', array( 'id' => 't-shorturl' ), |
31 | 37 | Html::Element( 'a', array( |
32 | 38 | 'href' => $shortURL, |
— | — | @@ -35,7 +41,6 @@ |
36 | 42 | ); |
37 | 43 | |
38 | 44 | echo $html; |
39 | | - // echo '<script type="text/javascript">mediaWiki.loader.load( "ext.shortUrl" );</script>'; |
40 | 45 | } |
41 | 46 | return true; |
42 | 47 | } |
Index: trunk/extensions/ShortUrl/README |
— | — | @@ -4,11 +4,6 @@ |
5 | 5 | Licenses: GNU General Public Licence (GPL) |
6 | 6 | -------------------------------------------------------------------------- |
7 | 7 | |
8 | | -The ShortUrl extension implements a URL Shortener |
9 | | -creates a special page Special:Contact, which is similar to |
10 | | -Special:Emailuser, but it has a fixed recipient, and can be used |
11 | | -anonymously. |
12 | | - |
13 | 8 | <http://mediawiki.org/wiki/Extension:ShortUrl> |
14 | 9 | |
15 | 10 | == Installing == |
— | — | @@ -21,4 +16,6 @@ |
22 | 17 | |
23 | 18 | == Configuration == |
24 | 19 | |
25 | | -There are no configuration options available as of now. |
| 20 | +$wgShortUrlPrefix specifies the prefix to use before the shorturl. |
| 21 | +Defaults to using the longer form (with Special:ShortUrl). Can be |
| 22 | +condensed down to use anything else, via mod_rewrite rules |