0

Is there any way to output all filtered data from the class Zend_Filter_Input?

4
  • How do you mean? The filtered data? Why? $data = $myFilter->filter($data); is not direct enough? Commented Jul 23, 2009 at 10:12
  • $_data: array Input data, before processing. Why would you need that value? Commented Jul 23, 2009 at 11:03
  • To tharkun: Yes, I need the filtered data but Zend_Filter_Input doesn't have a filter() function Commented Jul 24, 2009 at 1:45
  • To smoove666: Sorry I have made a mistake. Actually I need the data after processing. Commented Jul 24, 2009 at 1:47

2 Answers 2

3

Zend_Filter_Input offers numerous methods for retrieving filtered and validated data. First, you can retrieve an associative array of all fields:

$data = $input->getEscaped(); // Retrieve all data, escaped with Zend_Filter_HtmlEntities
$data = $input->getUnescaped(); // Retrieve all data, not escaped.

You can also get an associative array of certain segments of you data, the method names are very clear:

  $invalidFields = $input->getInvalid(); // Fields that failed validation

  $missingFields = $input->getMissing(); // Fields that were declared as 'required' using the 'presence' metacommand, but not in the input

  $unknownFields = $input->getUnknown(); // Fields that were not declared in the validator rules, but were present in the input.

On top of all that, Zend_Filter_Input offers an object accessor, through an implementation of the __get magic method:

$oneField = $input->oneFieldName
Sign up to request clarification or add additional context in comments.

Comments

-1

In form you can get unfiltered values. Check the manual ;)

1 Comment

Sorry I have made a mistake. I need to get an array storing all filtered data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.