public function filter($data, $group = null)
	{
		// Make sure there is a valid Form XML document.
		if (!($this->xml instanceof \SimpleXMLElement))
		{
			return false;
		}

		$input = new Registry($data);
		$output = new Registry;

		// Get the fields for which to filter the data.
		$fields = $this->findFieldsByGroup($group);

		if (!$fields)
		{
			// PANIC!
			return false;
		}

		// Filter the fields.
		foreach ($fields as $field)
		{
			$name = (string) $field['name'];

			// Get the field groups for the element.
			$attrs = $field->xpath('ancestor::fields[@name]/@name');
			$groups = array_map('strval', $attrs ? $attrs : array());
			$group = implode('.', $groups);

			// Get the field value from the data input.
			if ($group)
			{
				// Filter the value if it exists.
				if ($input->exists($group . '.' . $name))
				{
					$output->set($group . '.' . $name, $this->filterField($field, $input->get($group . '.' . $name, (string) $field['default'])));
				}
			}
			else
			{
				// Filter the value if it exists.
				if ($input->exists($name))
				{
					$output->set($name, $this->filterField($field, $input->get($name, (string) $field['default'])));
				}
			}
		}

		return $output->toArray();
	}
public function filter($data, $group = null)
	{
		// Make sure there is a valid Form XML document.
		if (!($this->xml instanceof \SimpleXMLElement))
		{
			return false;
		}

		$input = new Registry($data);
		$output = new Registry;

		// Get the fields for which to filter the data.
		$fields = $this->findFieldsByGroup($group);

		if (!$fields)
		{
			// PANIC!
			return false;
		}

		// Filter the fields.
		foreach ($fields as $field)
		{
			$name = (string) $field['name'];

			// Get the field groups for the element.
			$attrs = $field->xpath('ancestor::fields[@name]/@name');
			$groups = array_map('strval', $attrs ? $attrs : array());
			$group = implode('.', $groups);

			// Get the field value from the data input.
			if ($group)
			{
				// Filter the value if it exists.
				if ($input->exists($group . '.' . $name))
				{
					$output->set($group . '.' . $name, $this->filterField($field, $input->get($group . '.' . $name, (string) $field['default'])));
				}
			}
			else
			{
				// Filter the value if it exists.
				if ($input->exists($name))
				{
					$output->set($name, $this->filterField($field, $input->get($name, (string) $field['default'])));
				}
			}
		}

		return $output->toArray();
	}
public function filter ( $ data , $ group = null ) { // Make sure there is a valid Form XML document. if ( ! ( $ this -> xml instanceof \ SimpleXMLElement ) ) { return false ; } $ input = new Registry ( $ data ) ; $ output = new Registry ; // Get the fields for which to filter the data. $ fields = $ this -> findFieldsByGroup ( $ group ) ; if ( ! $ fields ) { // PANIC! return false ; } // Filter the fields. foreach ( $ fields as $ field ) { $ name = ( string ) $ field [ 'name' ] ; // Get the field groups for the element. $ attrs = $ field -> xpath ( 'ancestor::fields[@name]/@name' ) ; $ groups = array_map ( 'strval' , $ attrs ? $ attrs : array ( ) ) ; $ group = implode ( '.' , $ groups ) ; // Get the field value from the data input. if ( $ group ) { // Filter the value if it exists. if ( $ input -> exists ( $ group . '.' . $ name ) ) { $ output -> set ( $ group . '.' . $ name , $ this -> filterField ( $ field , $ input -> get ( $ group . '.' . $ name , ( string ) $ field [ 'default' ] ) ) ) ; } } else { // Filter the value if it exists. if ( $ input -> exists ( $ name ) ) { $ output -> set ( $ name , $ this -> filterField ( $ field , $ input -> get ( $ name , ( string ) $ field [ 'default' ] ) ) ) ; } } } return $ output -> toArray ( ) ; }
Method to filter the form data.

@param   array   $data   An array of field values to filter.
@param   string  $group  The dot-separated form group path on which to filter the fields.

@return  mixed  Array or false.

@since   1.0
Method to filter the form data .