Index: trunk/extensions/RecordAdmin/RecordAdmin_body.php |
— | — | @@ -419,17 +419,17 @@ |
420 | 420 | $form = $form->getContent(); |
421 | 421 | |
422 | 422 | # Extract form's class and other attributes (except method and action) |
423 | | - if ( preg_match( "|<form\s*([^>]+)\s*>.+</form>|s", $form, $atts )) { |
| 423 | + if ( preg_match( "|<form\s*([^>]+)\s*>.+</form>|is", $form, $atts )) { |
424 | 424 | if ( preg_match( "|class\s*=\s*[\"'](.+?)['\"]|", $atts[1], $m ) ) $this->formClass .= ' ' . $m[1]; |
425 | 425 | $this->formAtts = ' ' . trim( preg_replace( "/(class|action|method)\s*=\s*[\"'](.*?)['\"]/", "", $atts[1] ) ); |
426 | 426 | } |
427 | 427 | |
428 | 428 | # Process content |
429 | | - $form = preg_replace( '#<input.+?type=[\'"]?submit["\']?.+?/(input| *)>#', '', $form ); # remove submits |
430 | | - $form = preg_replace( '#^.+?<form.*?>#s', '', $form ); # remove up to and including form open |
431 | | - $form = preg_replace( '#</form>.+?$#s', '', $form ); # remove form close and everything after |
432 | | - $form = preg_replace( '#name\s*=\s*([\'"])(.*?)\\1#s', 'name="ra_$2"', $form ); # prefix input names with ra_ |
433 | | - $form = preg_replace( '#(<select.+?>)\s*(?!<option/>)#s', '$1<option selected/>', $form ); # ensure all select lists have default blank |
| 429 | + $form = preg_replace( '#<input.+?type=[\'"]?submit["\']?.+?/(input| *)>#i', '', $form ); # remove submits |
| 430 | + $form = preg_replace( '#^.+?<form.*?>#is', '', $form ); # remove up to and including form open |
| 431 | + $form = preg_replace( '#</form>.+?$#is', '', $form ); # remove form close and everything after |
| 432 | + $form = preg_replace( '#name\s*=\s*([\'"])(.*?)\\1#is', 'name="ra_$2"', $form ); # prefix input names with ra_ |
| 433 | + $form = preg_replace( '#(<select.+?>)\s*(?!<option/>)#is', '$1<option selected/>', $form ); # ensure all select lists have default blank |
434 | 434 | } |
435 | 435 | else { |
436 | 436 | |
— | — | @@ -456,7 +456,7 @@ |
457 | 457 | foreach( $this->types as $k => $type ) { |
458 | 458 | |
459 | 459 | # Get this input element's html text and position and length |
460 | | - preg_match( "|<([a-zA-Z]+)[^<]+?name=\"ra_$k\\[?\\]?\".*?>(.*?</\\1>)?|s", $this->form, $m, PREG_OFFSET_CAPTURE ); |
| 460 | + preg_match( "|<([a-z]+)[^<]+?name=\"ra_$k\\[?\\]?\".*?>(.*?</\\1>)?|is", $this->form, $m, PREG_OFFSET_CAPTURE ); |
461 | 461 | list( $html, $pos ) = $m[0]; |
462 | 462 | $len = strlen( $html ); |
463 | 463 | |
— | — | @@ -465,27 +465,27 @@ |
466 | 466 | $v = isset( $values[$k] ) ? $values[$k] : ''; |
467 | 467 | switch ( $type ) { |
468 | 468 | case 'text': |
469 | | - $html = preg_replace( "|value\s*=\s*\".*?\"|", "", $html ); |
| 469 | + $html = preg_replace( "|value\s*=\s*\".*?\"|i", "", $html ); |
470 | 470 | if ( $v ) $html = preg_replace( "|(/?>)$|", " value=\"$v\" $1", $html ); |
471 | 471 | break; |
472 | 472 | case 'bool': |
473 | | - $html = preg_replace( "|checked|", "", $html ); |
| 473 | + $html = preg_replace( "|checked|i", "", $html ); |
474 | 474 | if ( $v ) $html = preg_replace( "|(/?>)$|", " checked $1", $html ); |
475 | 475 | break; |
476 | 476 | case 'list': |
477 | 477 | $html = preg_replace_callback("|\{\{.+\}\}|s", array($this, 'parsePart'), $html); # parse any braces |
478 | 478 | #if ( empty( $this->record ) ) |
479 | | - $html = preg_replace( "|(<option[^<>]*) selected|", "$1", $html ); # remove the currently selected option |
| 479 | + $html = preg_replace( "|(<option[^<>]*) selected|i", "$1", $html ); # remove the currently selected option |
480 | 480 | if ( $v ) { |
481 | 481 | foreach( split( "\n", $v ) as $v ) { |
482 | | - $html = preg_match( "|<option[^>]+value\s*=|s", $html ) |
483 | | - ? preg_replace( "|(<option)([^>]+value\s*=\s*[\"']{$v}['\"])|s", "$1 selected$2", $html ) |
484 | | - : preg_replace( "|(<option[^>]*)(?=>$v</option>)|s", "$1 selected", $html ); |
| 482 | + $html = preg_match( "|<option[^>]+value\s*=|is", $html ) |
| 483 | + ? preg_replace( "|(<option)([^>]+value\s*=\s*[\"']{$v}['\"])|is", "$1 selected$2", $html ) |
| 484 | + : preg_replace( "|(<option[^>]*)(?=>$v</option>)|is", "$1 selected", $html ); |
485 | 485 | } |
486 | 486 | } |
487 | 487 | break; |
488 | 488 | case 'blob': |
489 | | - $html = preg_replace( "|>.*?(?=</textarea>)|s", ">$v", $html ); |
| 489 | + $html = preg_replace( "|>.*?(?=</textarea>)|is", ">$v", $html ); |
490 | 490 | break; |
491 | 491 | } |
492 | 492 | |
— | — | @@ -501,7 +501,7 @@ |
502 | 502 | global $wgUser, $wgParser; |
503 | 503 | $options = ParserOptions::newFromUser( $wgUser ); |
504 | 504 | $html = $wgParser->parse($part[0], $this->title, $options, true, true )->getText(); |
505 | | - return preg_match("|(<option.+</option>)|s", $html, $m) ? $m[1] : ''; |
| 505 | + return preg_match("|(<option.+</option>)|is", $html, $m) ? $m[1] : ''; |
506 | 506 | } |
507 | 507 | |
508 | 508 | /** |
— | — | @@ -510,10 +510,10 @@ |
511 | 511 | */ |
512 | 512 | function examineForm() { |
513 | 513 | $this->types = array(); |
514 | | - preg_match_all( "|<([a-zA-Z]+)[^<]+?name=\"ra_(.+?)\\[?\\]?\".*?>|", $this->form, $m ); |
| 514 | + preg_match_all( "|<([a-z]+)[^<]+?name=\"ra_(.+?)\\[?\\]?\".*?>|i", $this->form, $m ); |
515 | 515 | foreach ( $m[2] as $i => $k ) { |
516 | 516 | $tag = $m[1][$i]; |
517 | | - $type = preg_match( "|type\s*=\s*\"(.+?)\"|", $m[0][$i], $n ) ? $n[1] : ''; |
| 517 | + $type = preg_match( "|type\s*=\s*\"(.+?)\"|i", $m[0][$i], $n ) ? $n[1] : ''; |
518 | 518 | switch ( $tag ) { |
519 | 519 | case 'input': |
520 | 520 | switch ( $type ) { |
— | — | @@ -672,7 +672,7 @@ |
673 | 673 | $template = false; |
674 | 674 | $count = false; |
675 | 675 | foreach ( func_get_args() as $arg ) if ( !is_object( $arg ) ) { |
676 | | - if ( preg_match( "/^(.+?)\\s*=\\s*(.+)$/", $arg, $match ) ) { |
| 676 | + if ( preg_match( "|^(.+?)\s*=\s*(.+)$|i", $arg, $match ) ) { |
677 | 677 | list( , $k, $v ) = $match; |
678 | 678 | if ( $k == 'title' ) $title = $v; |
679 | 679 | elseif ( $k == 'name' ) $name = $v; |
— | — | @@ -700,7 +700,7 @@ |
701 | 701 | $parser->mOutput->mCacheTime = -1; |
702 | 702 | $regexp = ''; |
703 | 703 | foreach ( func_get_args() as $arg ) if ( !is_object( $arg ) ) { |
704 | | - if ( preg_match( "/^(.+?)\\s*=\\s*(.+)$/", $arg, $match ) ) { |
| 704 | + if ( preg_match( "|^(.+?)\s*=\s*(.+)$|", $arg, $match ) ) { |
705 | 705 | list( , $k, $v ) = $match; |
706 | 706 | if ( $k == 'type' ) $type = $v; |
707 | 707 | elseif ( $k == 'record' ) $record = $v; |
Index: trunk/extensions/RecordAdmin/RecordAdmin.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | * @licence GNU General Public Licence 2.0 or later |
13 | 13 | */ |
14 | 14 | |
15 | | -define( 'RECORDADMIN_VERSION', '0.8.4, 2009-08-06' ); |
| 15 | +define( 'RECORDADMIN_VERSION', '0.8.5, 2009-08-14' ); |
16 | 16 | |
17 | 17 | $wgRecordAdminUseNamespaces = false; # Whether record articles should be in a namespace of the same name as their type |
18 | 18 | $wgRecordAdminCategory = 'Records'; # Category containing record types |