r59870 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59869‎ | r59870 | r59871 >
Date:02:44, 9 December 2009
Author:nad
Status:deferred
Tags:
Comment:
store operator against arg key ready for use
Modified paths:
  • /trunk/extensions/RecordAdmin/RecordAdmin_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/RecordAdmin/RecordAdmin_body.php
@@ -829,6 +829,7 @@
830830 global $wgTitle;
831831 $parser->mOutput->mCacheTime = -1;
832832 $filter = array();
 833+ $op = array();
833834 $title = '';
834835 $name = 'wpSelect';
835836 $invert = false;
@@ -839,8 +840,8 @@
840841 $count = false;
841842 $export = false;
842843 foreach ( func_get_args() as $arg ) if ( !is_object( $arg ) ) {
843 - if ( preg_match( "|^(.+?)\s*([<>!=]+)\s*(.+)$|i", $arg, $match ) ) {
844 - list( , $k, $op, $v ) = $match;
 844+ if ( preg_match( "|^(.+?)\s*([=!<>]+)\s*(.+)$|i", $arg, $match ) ) {
 845+ list( , $k, $o, $v ) = $match;
845846 if ( $k == 'title' ) $title = $v;
846847 elseif ( $k == 'name' ) $name = $v;
847848 elseif ( $k == 'invert' ) $invert = $v;
@@ -850,7 +851,10 @@
851852 elseif ( $k == 'template' ) $template = $v;
852853 elseif ( $k == 'count' ) $count = $v;
853854 elseif ( $k == 'export' ) $export = $v;
854 - else $filter[$match[1]] = $match[2];
 855+ else {
 856+ $filter[$k] = $v;
 857+ $op[$k] = $o;
 858+ }
855859 }
856860 }
857861 $this->filter = $filter;

Status & tagging log