null, 'license' => null, 'title' => null, 'description' => null, 'thumbnail' => null ); $settings = array_merge($default, array_intersect_key($args, $default)); foreach ($settings as $key => $value) { $this->{$key} = $value; } // TODO: Name can't have extension in it. // TODO: Get attachment ID... so we can mark postmeta when needed. // Get name, file, and type from the URL // First, strip of any query params $url = strtok($url, '?'); $path = ABSPATH . str_replace(home_url(), '', $url); error_log($path); $type = mime_content_type($path); $name = wp_basename($url); $this->name = $name; $this->file = new CURLFile($path, $type, $name); $this->type = $type; } }