r73584 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73583‎ | r73584 | r73585 >
Date:23:59, 22 September 2010
Author:kwisatz
Status:deferred
Tags:
Comment:
strip non-alphanumeric characters from labels in QrCode
Modified paths:
  • /trunk/extensions/QrCode/QrCode.php (modified) (history)

Diff [purge]

Index: trunk/extensions/QrCode/QrCode.php
@@ -22,7 +22,7 @@
2323 $wgExtensionCredits['parserhook'][] = array(
2424 'path' => __FILE__,
2525 'name' => 'QrCode',
26 - 'version' => '0.03',
 26+ 'version' => '0.05',
2727 'author' => array( 'David Raison' ),
2828 'url' => 'http://www.mediawiki.org/wiki/Extension:QrCode',
2929 'descriptionmsg' => 'qrcode-desc'
@@ -109,9 +109,10 @@
110110 global $wgTitle;
111111
112112 // Check for a provided label and use the page URL as default.
 113+ // Also strip all non-alphanumeric characters
113114 if ( $label ) {
114115 $this->_label = $label;
115 - $append = '-'.$label;
 116+ $append = '-'.preg_replace("/\W+/", "", $label);
116117 } else {
117118 $this->_label = $wgTitle->getFullURL();
118119 $append = '';

Status & tagging log