return ($xss_clean === TRUE)
        ? $this->security->xss_clean($value)
        : $value;

... and delete the rest below.