public static function escape($data)
    {
        if (is_string($data)) {
            $data = static::getConnection()->quote($data);
            $data = substr($data, 1, strlen($data)-2);
            return $data;
        } elseif (is_array($data)) {
            foreach ($data as $key=>$string) {
                if (is_string($string)) {
                    $data[$key] = static::escape($string);
                }
            }
            return $data;
        }
        return $data;
    }
public static function escape($data)
    {
        if (is_string($data)) {
            $data = static::getConnection()->quote($data);
            $data = substr($data, 1, strlen($data)-2);
            return $data;
        } elseif (is_array($data)) {
            foreach ($data as $key=>$string) {
                if (is_string($string)) {
                    $data[$key] = static::escape($string);
                }
            }
            return $data;
        }
        return $data;
    }
public static function escape ( $ data ) { if ( is_string ( $ data ) ) { $ data = static :: getConnection ( ) -> quote ( $ data ) ; $ data = substr ( $ data , 1 , strlen ( $ data ) - 2 ) ; return $ data ; } elseif ( is_array ( $ data ) ) { foreach ( $ data as $ key => $ string ) { if ( is_string ( $ string ) ) { $ data [ $ key ] = static :: escape ( $ string ) ; } } return $ data ; } return $ data ; }
Recursive escape for strings or arrays of strings.

@param mixed $data If string will do a simple escape. If array will iterate over array members recursively and escape any found strings.
@return mixed Same as $data input but with all found strings escaped in place.
Recursive escape for strings or arrays of strings .