r110841 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110840‎ | r110841 | r110842 >
Date:12:41, 7 February 2012
Author:reedy
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/ShortUrl (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ShortUrl/ShortUrl.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ShortUrl/SpecialShortUrl.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ShortUrl/js/ext.shortUrl.js (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/ShortUrl/ShortUrl.php
@@ -18,9 +18,11 @@
1919 /**
2020 * Configuration variables
2121 * Prefix to use for the shortened URL. mod_rewrite (or equivalent) needs to be setup
22 - * to produce a shorter URL
 22+ * to produce a shorter URL. See example redirect.htaccess file.
2323 * Default is false which just uses the (not so short) URL that all Special Pages get
2424 * Eg: http://en.wikipedia.org/wiki/Special:ShortUrl/5234
 25+ * An example value for this variable might be:
 26+ * $wgShortUrlPrefix = '//en.wikipedia.org/r/';
2527 */
2628 $wgShortUrlPrefix = false;
2729
@@ -52,5 +54,6 @@
5355 'scripts' => 'js/ext.shortUrl.js',
5456 'styles' => 'css/ext.shortUrl.css',
5557 'localBasePath' => dirname( __FILE__ ),
56 - 'remoteExtPath' => 'ShortUrl'
 58+ 'remoteExtPath' => 'ShortUrl',
 59+ 'dependencies' => array( 'mediawiki.Uri' ),
5760 );
Index: branches/wmf/1.18wmf1/extensions/ShortUrl/SpecialShortUrl.php
@@ -39,7 +39,8 @@
4040 if ( $title !== false ) {
4141 $wgOut->redirect( $title->getFullURL(), '301' );
4242 } else {
43 - $wgOut->showErrorPage( 'shorturl-not-found-title', 'shorturl-not-found-message', array( $par ) );
 43+ $parEsc = wfEscapeWikiText( $par );
 44+ $wgOut->showErrorPage( 'shorturl-not-found-title', 'shorturl-not-found-message', array( $parEsc ) );
4445 }
4546 }
4647 }
Index: branches/wmf/1.18wmf1/extensions/ShortUrl/js/ext.shortUrl.js
@@ -1,6 +1,15 @@
22 jQuery( function( $ ) {
33 if( $( '#t-shorturl' ).length ) {
44 var url = $( '#t-shorturl a' ).attr( 'href' );
5 - $( '#firstHeading' ).append( $( '<div class="title-shortlink-container"></div>').append( $( '<a>' ).addClass( 'title-shortlink' ).attr( 'href', url ).text( url ) ) );
 5+ /* Add protocol for proto-relative urls */
 6+ var protoNonRelative = ( new mw.Uri( url ) ).toString();
 7+ $( '#firstHeading' ).append(
 8+ $( '<div class="title-shortlink-container"></div>')
 9+ .append( $( '<a>' )
 10+ .addClass( 'title-shortlink' )
 11+ .attr( 'href', url )
 12+ .text( protoNonRelative )
 13+ )
 14+ );
615 }
716 });
Property changes on: branches/wmf/1.18wmf1/extensions/ShortUrl
___________________________________________________________________
Modified: svn:mergeinfo
817 Merged /trunk/extensions/ShortUrl:r110824,110826

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r110824Make it so that going to Special:ShortUrl/f'''o''' doesn't make the o bold (I...bawolff08:04, 7 February 2012
r110826(bug 33551) - Make ShortUrl work properly with protocol relative urls.bawolff08:48, 7 February 2012

Status & tagging log