/** * Returns the list of criteria set forth from the * filter form. If there is no criteria, returns an * emtpy list. * * @return an array of criteria by which to filter (or an empty list) */ function pullFilterCriteria() { $filterCriteria = array(); $filterSelections = array('filterStatus' => 'ap_status', 'filterLastName' => 'ap_lastname', 'filterSession' => 'ap_session'); if (filterButtonClicked()) { foreach ($filterSelections as $name => $column) { if ($_POST[$name] != "[BLANK]") { $filterCriteria[$column] = trim(sanitize_text_field($_POST[$name])); } } } return $filterCriteria; }
/** * Returns the list of criteria set forth from the * filter form. If there is no criteria, returns an * emtpy list. * * @return an array of criteria by which to filter (or an empty list) */ function pullFilterCriteria($filters) { $filterCriteria = array(); if (filterButtonClicked()) { foreach ($filters as $filter) { if ($_POST[$filter["name"]] != "[BLANK]") { $filterCriteria[$filter["column"]] = trim(sanitize_text_field($_POST[$filter["name"]])); } } } return $filterCriteria; }