protected function checkValidAttachment($filename, &$error) {
    if (!is_string($filename)) {
      $error = sprintf("Filename must be a string but was type %s",
                       gettype($filename));
      return false;
    }

    $path_parts = pathinfo($filename);
    if (isset($path_parts['extension'])) {
      if (in_array($path_parts['extension'], self::$extension_blacklist)) {
        $error = sprintf("'%s' is a blacklisted file extension.",
                         $path_parts['extension']);
        return false;
      }
    }

    return true;
  }
protected function checkValidAttachment($filename, &$error) {
    if (!is_string($filename)) {
      $error = sprintf("Filename must be a string but was type %s",
                       gettype($filename));
      return false;
    }

    $path_parts = pathinfo($filename);
    if (isset($path_parts['extension'])) {
      if (in_array($path_parts['extension'], self::$extension_blacklist)) {
        $error = sprintf("'%s' is a blacklisted file extension.",
                         $path_parts['extension']);
        return false;
      }
    }

    return true;
  }
protected function checkValidAttachment ( $ filename , & $ error ) { if ( ! is_string ( $ filename ) ) { $ error = sprintf ( "Filename must be a string but was type %s" , gettype ( $ filename ) ) ; return false ; } $ path_parts = pathinfo ( $ filename ) ; if ( isset ( $ path_parts [ 'extension' ] ) ) { if ( in_array ( $ path_parts [ 'extension' ] , self :: $ extension_blacklist ) ) { $ error = sprintf ( "'%s' is a blacklisted file extension." , $ path_parts [ 'extension' ] ) ; return false ; } } return true ; }
Checks that an attachment is valid.

@param string $filename Filename of the attachment.
@return bool True if successful, false otherwise.
@param string &$error Error message to be set if the header is invalid.
Checks that an attachment is valid .