/** * collects filter value from request variables (GET or POST). */ protected function collectRequestValue() { $value = Validation::collectRequestVar($this->key); if ($value) { $this->value = $value; return; } }
/** * Specialized routine for collectin the "display listings" setting. * - Don't check cookies for this filter's value. * - If the input value is set to "filter", set the object's property value * to TRUE. */ protected function collectDisplayListingsSetting() { /* don't get "display listings" value from cookies */ $this->displayListings->collectValue(false); if ($this->displayListings->value === null) { $str_value = Validation::collectRequestVar($this->displayListings->key); if (strtolower($str_value) == "filter") { $this->displayListings->value = true; } } }
/** * Searches POST, GET and session data, in that order, for a property * corresponding to $key. * @param string $key Key of the variable value to collect. * @param string $filter Filter token corresponding to the 3rd parameter of * PHP's built-in filter_input() routine. * @return mixed Value found for the requested key. Returns an empty string * if none of the collections contain the requested key. */ public static function collectStringInput($key, $filter = FILTER_SANITIZE_STRING) { $value = Validation::collectRequestVar($key, $filter); if (!$value && isset($_SESSION[$key]) && strlen(trim($_SESSION[$key])) > 0) { $value = trim($_SESSION[$key]); } return $value; }