english/libraries/joomla/form/form.php
/**
	 * Method to apply an input filter to a value based on field data.
	 *
	 * @param   string  $element  The XML element object representation of the form field.
	 * @param   mixed   $value    The value to filter for the field.
	 *
	 * @return  mixed   The filtered value.
	 * @since   11.1
	 */
Method to apply an input filter to a value based on field data.
@param   string  $element  The XML element object representation of the form field.
@param   mixed   $value    The value to filter for the field.

@return  mixed   The filtered value.
Method to apply an input filter to a value based on field data . @param string $element The XML element object representation of the form field . @param mixed $value The value to filter for the field . @return mixed The filtered value .
protected function filterField($element, $value)
	{
		if (!($element instanceof JXMLElement)) {
			return false;
		}
		$filter = (string) $element['filter'];
		$return = null;
		switch (strtoupper($filter))
		{
			case 'RULES':
				$return = array();
				foreach ((array) $value as $action => $ids)
				{
					$return[$action] = array();
					foreach ($ids as $id => $p)
					{
						if ($p !== '') {
							$return[$action][$id] = ($p == '1' || $p == 'true') ? true : false;
						}
					}
				}
				break;
			case 'UNSET':
				break;
			case 'RAW':
				$return = $value;
				break;
			case 'INT_ARRAY':
				if (is_object($value)) {
					$value = get_object_vars($value);
				}
				$value = is_array($value) ? $value : array($value);
				JArrayHelper::toInteger($value);
				$return = $value;
				break;
			case 'SAFEHTML':
				$return = JFilterInput::getInstance(null, null, 1, 1)->clean($value, 'string');
				break;
			case 'SERVER_UTC':
				if (intval($value) > 0) {
					$offset	= JFactory::getConfig()->get('offset');
					$return = JFactory::getDate($value, $offset)->toMySQL();
				}
				else {
					$return = '';
				}
				break;
			case 'USER_UTC':
				if (intval($value) > 0) {
					$offset	= JFactory::getUser()->getParam('timezone', JFactory::getConfig()->get('offset'));
					$return = JFactory::getDate($value, $offset)->toMySQL();
				}
				else {
					$return = '';
				}
				break;
			default:
				if (strpos($filter, '::') !== false && is_callable(explode('::', $filter))) {
					$return = call_user_func(explode('::', $filter), $value);
				}
				else if (function_exists($filter)) {
					$return = call_user_func($filter, $value);
				}
				else {
					$return = JFilterInput::getInstance()->clean($value, $filter);
				}
				break;
		}
		return $return;
	}
protected function filterField ( $ element , $ value ) { if ( ! ( $ element instanceof JXMLElement ) ) { return false ; } $ filter = ( string ) $ element [ 'filter' ] ; $ return = null ; switch ( strtoupper ( $ filter ) ) { case 'RULES' : $ return = array ( ) ; foreach ( ( array ) $ value as $ action => $ ids ) { $ return [ $ action ] = array ( ) ; foreach ( $ ids as $ id => $ p ) { if ( $ p !== '' ) { $ return [ $ action ] [ $ id ] = ( $ p == '1' || $ p == 'true' ) ? true : false ; } } } break ; case 'UNSET' : break ; case 'RAW' : $ return = $ value ; break ; case 'INT_ARRAY' : if ( is_object ( $ value ) ) { $ value = get_object_vars ( $ value ) ; } $ value = is_array ( $ value ) ? $ value : array ( $ value ) ; JArrayHelper :: toInteger ( $ value ) ; $ return = $ value ; break ; case 'SAFEHTML' : $ return = JFilterInput :: getInstance ( null , null , 1 , 1 ) -> clean ( $ value , 'string' ) ; break ; case 'SERVER_UTC' : if ( intval ( $ value ) > 0 ) { $ offset = JFactory :: getConfig ( ) -> get ( 'offset' ) ; $ return = JFactory :: getDate ( $ value , $ offset ) -> toMySQL ( ) ; } else { $ return = '' ; } break ; case 'USER_UTC' : if ( intval ( $ value ) > 0 ) { $ offset = JFactory :: getUser ( ) -> getParam ( 'timezone' , JFactory :: getConfig ( ) -> get ( 'offset' ) ) ; $ return = JFactory :: getDate ( $ value , $ offset ) -> toMySQL ( ) ; } else { $ return = '' ; } break ; default : if ( strpos ( $ filter , '::' ) !== false && is_callable ( explode ( '::' , $ filter ) ) ) { $ return = call_user_func ( explode ( '::' , $ filter ) , $ value ) ; } else if ( function_exists ( $ filter ) ) { $ return = call_user_func ( $ filter , $ value ) ; } else { $ return = JFilterInput :: getInstance ( ) -> clean ( $ value , $ filter ) ; } break ; } return $ return ; }
Method to apply an input filter to a value based on field data.
Method to apply an input filter to a value based on field data .
// Make sure there is a valid JXMLElement. // Get the field filter type. // Process the input value based on the filter. // Access Control Rules. // Build the rules array. // Do nothing, thus leaving the return value as null. // No Filter. // Filter the input as an array of integers. // Make sure the input is an array. // Filter safe HTML. // Convert a date to UTC based on the server timezone offset. // Get the server timezone setting. // Return a MySQL formatted datetime string in UTC. // Convert a date to UTC based on the user timezone offset. // Get the user timezone setting defaulting to the server timezone setting. // Return a MySQL formatted datetime string in UTC. // Check for a callback filter. // Filter using a callback function if specified. // Filter using JFilterInput. All HTML code is filtered by default.