/** * Retreive information passed via the $_POST array. * Can specify a key and return that, else return the whole $_POST array * * @param string [$p_sIndex] Specific $_POST key * @param mixed [$p_sDefaultValue] null if not specified, mixed otherwise * @return string|array Depending if you passed in a value for $p_sIndex */ function post($p_sIndex = null, $p_sDefaultValue = null, $p_aOptions = null) { if ($p_sIndex === null) { return PPI_Helper::getInstance()->arrayTrim($_POST); } else { return PPI_Helper::getInstance()->arrayTrim(isset($_POST[$p_sIndex]) ? $_POST[$p_sIndex] : $p_sDefaultValue); } }
/** * This gets the submitted values from the form. * If $fields is submitted then it only returns the fields specified. Otherwise gets all fields * * @param array [$fields] Key => Value result of the form * @return array */ function getSubmitValues($fields = array()) { // we can only return the fields specified by $fields or we can return all fields if (!empty($fields)) { foreach ($fields as $field) { if (array_key_exists($field, $this->_formFields)) { $submitFields[$field] = $this->_formFields[$field]; } } // We get all the fields by default } else { foreach ($this->_formFields as $fieldName => $fieldVal) { if (array_key_exists($fieldName, $this->_formFields)) { $submitFields[$fieldName] = $this->_formFields[$fieldName]; } } } // Remove all captcha fields from the retreived submit values. foreach ($this->_captchaFields as $val) { if (array_key_exists($val, $submitFields) === true) { unset($submitFields[$val]); unset($submitFields['recaptcha_challenge_field']); unset($submitFields['recaptcha_response_field']); } } // remove our submit button ! if (array_key_exists('submit', $submitFields) === true) { unset($submitFields['submit']); } // Pass these fields to the hooker to clean up and get rid of anything we don't want $submitFields = $this->oHooker->preRetreival($submitFields); // Clean the inputs $submitFields = PPI_Helper::getInstance()->arrayTrim($submitFields); return $submitFields; }