gorodsb
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Plugins
In reply to: [Duplicate Post] optimization potential on your serverThe OS: Linux PHP Version: 7.4.33 WP Version: 6.1.1 MySQL Version: 5.7.39 Directory Separator: / Copy logs: 21-02-2023 18:40:16 - 1x, [total: 0.22557711601257, avg: 0.22557711601257] (mem: 60.83 MB - 63782776, peak: 40 MB - 41943040) 21-02-2023 18:20:47 - 4x, [total: 1.0138940811157, avg: 0.25347352027893] (mem: 58.76 MB - 61617472, peak: 10 MB - 10485760) 21-02-2023 09:57:00 - 2x, [total: 0.44220995903015, avg: 0.22110497951508] (mem: 59.26 MB - 62142544, peak: 8 MB - 8388608)Me too.
If still actual…
Insert in wp-custom-field-searn.php (version 0.3.16)this:
line 237$inputs.="<td><input type='checkbox' ".($values['numeric']?"checked='true'":"")." name='$pref"."[numeric]'/></td>";
and on line 507class CheckboxField extends Field { function CheckboxField($options=array(),$params=array()){ CheckboxField::__construct($options,$params); } function __construct($params=array()){ parent::__construct($params); if($params['checkboxoptions']){ $options=array(); $optionPairs = explode(',',$params['checkboxoptions']); foreach($optionPairs as $option){ list($k,$v) = explode(':',$option); if(!$v) $v=$k; $options[$k]=$v; } } $this->options = $options; } function getOptions($joiner,$name){ if($this->param('fromDb',!$this->options)){ return $joiner->getAllOptions($name); } else { return $this->options; } } function getInput($name,$joiner,$fieldName=null){ if(!$fieldName) $fieldName=$name; $v = $this->getValue($name); $id = $this->getHTMLName($name); $options = ''; foreach($this->getOptions($joiner,$fieldName) as $option=>$label){ $option = htmlspecialchars($option,ENT_QUOTES); $label = htmlspecialchars($label,ENT_QUOTES); $checked = ($option==$v)?" checked='true'":""; $htmlId = "$id-$option"; $options.=" $label"; } return $options; } function getCSSClass(){ return "checkbox"; } function getConfigForm($id,$values){ return "Checkbox Options"; } } class CheckboxFromValues extends CheckboxField { function CheckboxFromValues($fieldName=null){ CheckboxFromValues::__construct($fieldName); } function __construct($fieldName=null,$params){ $params['fromDb'] = true; parent::__construct($options,$params); } function getConfigForm($id,$values){ return ""; } } class Comparison { function addSQLWhere($field,$value){ die("Unimplemented function ".__CLASS__.".".__FUNCTION__); } function describeSearch($value){ die("Unimplemented function ".__CLASS__.".".__FUNCTION__); } } class EqualComparison extends Comparison { function addSQLWhere($field,$value){ return "$field = '$value'"; } function describeSearch($value){ return sprintf(__(' is "%1$s"','wp-custom-fields-search'),$value); } } class LikeComparison extends Comparison{ function addSQLWhere($field,$value){ return $this->getLikeString($field,$value); } function getLikeString($field,$value){ return "$field LIKE '%$value%'"; } function describeSearch($value){ return sprintf(__(' contains "%1$s"','wp-custom-fields-search'),$value); } } class WordsLikeComparison extends LikeComparison { function addSQLWhere($field,$value){ $words = explode(" ",$value); $like = array(1); foreach($words as $word){ $like[] = $this->getLikeString($field,$word); } return "(".join(" AND ",$like).")"; } function describeSearch($value){ return sprintf(__(' contains "%1$s"','wp-custom-fields-search'),join('"'.__(" and ",'wp-custom-fields-search').'"',explode(" ",$value))); } }
Viewing 2 replies - 1 through 2 (of 2 total)