Index: trunk/extensions/QrCode/QrCode.php |
— | — | @@ -68,19 +68,11 @@ |
69 | 69 | $margin = $ecc = $size = $label = false; |
70 | 70 | |
71 | 71 | 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 ); |
75 | 76 | } |
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 | | - } |
85 | 77 | } |
86 | 78 | |
87 | 79 | $newQrCode = new MWQrCode( $parser, $ecc, $size, $margin ); |
— | — | @@ -174,7 +166,7 @@ |
175 | 167 | $tmpName = tempnam( $wgTmpDirectory, 'qrcode' ); |
176 | 168 | |
177 | 169 | 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 |
179 | 171 | .", ".$this->_size." and boundary ".$this->_margin.".\n" ); |
180 | 172 | |
181 | 173 | $jobParams = array( 'tmpName' => $tmpName, 'dstName' => $this->_dstFileName, 'comment' => $this->_uploadComment ); |