english/libraries/joomla/form/form.php
/**
	 * 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   11.1
	 */
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.


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