Index: trunk/extensions/Cite/Cite_body.php |
— | — | @@ -155,7 +155,7 @@ |
156 | 156 | return $this->error( 'cite_error_ref_numeric_key' ); |
157 | 157 | } |
158 | 158 | |
159 | | - #Split these into groups. |
| 159 | + # Split these into groups. |
160 | 160 | if( $group === null ) { |
161 | 161 | $group = $default_group; |
162 | 162 | } |
— | — | @@ -195,14 +195,14 @@ |
196 | 196 | else if ( $cnt >= 1 ) { |
197 | 197 | if ( isset( $argv['name'] ) ) { |
198 | 198 | // Key given. |
199 | | - $key = $this->validateName( $argv['name'] ); |
| 199 | + $key = Sanitizer::escapeId( $argv['name'] ); |
200 | 200 | unset( $argv['name']); |
201 | 201 | --$cnt; |
202 | 202 | } |
203 | 203 | if ( isset( $argv['group'] ) ){ |
204 | 204 | if (! $wgAllowCiteGroups ) return array(false); //remove when groups are fully tested. |
205 | 205 | // Group given. |
206 | | - $group = $argv['group'];//don't apply validateName for group display |
| 206 | + $group = $argv['group']; |
207 | 207 | unset( $argv['group']); |
208 | 208 | --$cnt; |
209 | 209 | } |
— | — | @@ -217,32 +217,6 @@ |
218 | 218 | // No key |
219 | 219 | return array(null,$group); |
220 | 220 | } |
221 | | - |
222 | | - /** |
223 | | - * Since the key name is used in an XHTML id attribute, it must |
224 | | - * conform to the validity rules. The restriction to begin with |
225 | | - * a letter is lifted since references have their own prefix. |
226 | | - * |
227 | | - * @fixme merge this code with the various section name transformations |
228 | | - * @fixme double-check for complete validity |
229 | | - * @return string if valid, false if invalid |
230 | | - */ |
231 | | - function validateName( $name ) { |
232 | | - if( preg_match( '/^[A-Za-z0-9:_.-]*$/i', $name ) ) { |
233 | | - return $name; |
234 | | - } else { |
235 | | - // WARNING: CRAPPY CUT AND PASTE MAKES BABY JESUS CRY |
236 | | - $text = urlencode( str_replace( ' ', '_', $name ) ); |
237 | | - $replacearray = array( |
238 | | - '%3A' => ':', |
239 | | - '%' => '.' |
240 | | - ); |
241 | | - return str_replace( |
242 | | - array_keys( $replacearray ), |
243 | | - array_values( $replacearray ), |
244 | | - $text ); |
245 | | - } |
246 | | - } |
247 | 221 | |
248 | 222 | /** |
249 | 223 | * Populate $this->mRefs based on input and arguments to <ref> |