Will this function below be able to prevent XSS attacks and sql injections ?
require_once('security.class.php');
function secure_data($data) {
    $data = mysql_real_escape_string($data);
    $filtered_data = filter_var($data, FILTER_SANITIZE_STRING);
    $secure_class = new security_class();
    $clean_data = $secure_class->xss_clean($filtered_data);         
    return $clean_data;
}
The security class is from codeigniter.
 
    