r86320 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86319‎ | r86320 | r86321 >
Date:16:39, 18 April 2011
Author:kwisatz
Status:deferred
Tags:
Comment:
fixed problem where label could not contain equal sign
Modified paths:
  • /trunk/extensions/QrCode/QrCode.php (modified) (history)

Diff [purge]

Index: trunk/extensions/QrCode/QrCode.php
@@ -68,19 +68,11 @@
6969 $margin = $ecc = $size = $label = false;
7070
7171 foreach( $params as $pair ) {
72 - $rpms = explode( '=', $pair );
73 - if( $rpms[0] == 'ecc' ) {
74 - $ecc = $rpms[1];
 72+ $firstEqual = strpos( $pair, '=' );
 73+ $tmpKey = substr( $pair, 0, $firstEqual );
 74+ if ( $tmpKey != 'parser' ) { // don't let users overwrite the parser object
 75+ $$tmpKey = substr( $pair, $firstEqual + 1 );
7576 }
76 - if( $rpms[0] == 'size' ) {
77 - $size = $rpms[1];
78 - }
79 - if( $rpms[0] == 'boundary' ) {
80 - $margin = $rpms[1];
81 - }
82 - if( $rpms[0] == 'label' ) {
83 - $label = $rpms[1];
84 - }
8577 }
8678
8779 $newQrCode = new MWQrCode( $parser, $ecc, $size, $margin );
@@ -174,7 +166,7 @@
175167 $tmpName = tempnam( $wgTmpDirectory, 'qrcode' );
176168
177169 QRcode::png( $this->_label, $tmpName, $this->_ecc, $this->_size, $this->_margin );
178 - wfDebug( "QrCode::_generate: Generated qrcode file $tmpName with ecc ".$this->_ecc
 170+ wfDebug( "QrCode::_generate: Generated qrcode file $tmpName containing \"".$this->_label."\" with ecc ".$this->_ecc
179171 .", ".$this->_size." and boundary ".$this->_margin.".\n" );
180172
181173 $jobParams = array( 'tmpName' => $tmpName, 'dstName' => $this->_dstFileName, 'comment' => $this->_uploadComment );

Status & tagging log