code/libraries/joomlatools/library/database/table/abstract.php
public function filter(array $data, $base = true)
    {
        // Filter out any extra columns.
        $data = array_intersect_key($data, $this->getColumns($base));

        // Filter data based on column type
        foreach ($data as $key => $value)
        {
            $column = $this->getColumn($key, $base);

            if ($column->filter) {
                $data[$key] = $this->getObject('filter.factory')->createChain($column->filter)->sanitize($value);
            }

            // If NULL is allowed and default is NULL, set value to NULL in the following cases.
            if (!$column->required && is_null($column->default))
            {
                // If value is empty.
                if (empty($data[$key])) {
                    $data[$key] = null;
                }

                // If type is date, time or datetime and value is like 0000-00-00 00:00:00.
                $date_types = array('date', 'time', 'datetime');
                if (in_array($column->type, $date_types) && !preg_match('/[^-0:\s]/', $data[$key])) {
                    $data[$key] = null;
                }
            }
        }

        return $data;
    }
public function filter(array $data, $base = true)
    {
        // Filter out any extra columns.
        $data = array_intersect_key($data, $this->getColumns($base));

        // Filter data based on column type
        foreach ($data as $key => $value)
        {
            $column = $this->getColumn($key, $base);

            if ($column->filter) {
                $data[$key] = $this->getObject('filter.factory')->createChain($column->filter)->sanitize($value);
            }

            // If NULL is allowed and default is NULL, set value to NULL in the following cases.
            if (!$column->required && is_null($column->default))
            {
                // If value is empty.
                if (empty($data[$key])) {
                    $data[$key] = null;
                }

                // If type is date, time or datetime and value is like 0000-00-00 00:00:00.
                $date_types = array('date', 'time', 'datetime');
                if (in_array($column->type, $date_types) && !preg_match('/[^-0:\s]/', $data[$key])) {
                    $data[$key] = null;
                }
            }
        }

        return $data;
    }
public function filter ( array $ data , $ base = true ) { // Filter out any extra columns. $ data = array_intersect_key ( $ data , $ this -> getColumns ( $ base ) ) ; // Filter data based on column type foreach ( $ data as $ key => $ value ) { $ column = $ this -> getColumn ( $ key , $ base ) ; if ( $ column -> filter ) { $ data [ $ key ] = $ this -> getObject ( 'filter.factory' ) -> createChain ( $ column -> filter ) -> sanitize ( $ value ) ; } // If NULL is allowed and default is NULL, set value to NULL in the following cases. if ( ! $ column -> required && is_null ( $ column -> default ) ) { // If value is empty. if ( empty ( $ data [ $ key ] ) ) { $ data [ $ key ] = null ; } // If type is date, time or datetime and value is like 0000-00-00 00:00:00. $ date_types = array ( 'date' , 'time' , 'datetime' ) ; if ( in_array ( $ column -> type , $ date_types ) && ! preg_match ( '/[^-0:\s]/' , $ data [ $ key ] ) ) { $ data [ $ key ] = null ; } } } return $ data ; }
Table filter method

This function removes extra columns based on the table columns taking any table mappings into account and
filters the data based on each column type.

@param  array   $data    An associative array of data to be filtered
@param  boolean $base    If TRUE, get the column information from the base table.
@return array    The filtered data
Table filter method