function __construct( $info, $field ) { global $wf; parent::__construct( $info, $field ); // infer the path, url to the file. $data = $this->data(); if (isset($data)) { $this->valid = false; if (isset($data->val)) { if ($data->val == "") { $this->valid = false; } else { $this->valid = true; } $url = $data->val; $path = WOOF_File::infer_content_path($url); $fc = $wf->get_file_class(); $this->file = new $fc( $path, $url ); if ($this->file->exists()) { $this->valid = TRUE; } else { // try to access the file at the URL if ($path == "" && defined("MASTERPRESS_RESOLVE_EXTERNAL_URLS")) { /* We should ONLY access the URL if this file could not possibly exist on this server. If we try to hit a file that could exist on this server but doesn't, this can cause an infinite httpd loop where a 404 causes another WP page load, which causes additional 404s, which cause more page loads ... Note that infer_content_path above will return an empty string if the URL is external */ $this->file = $wf->file_from_url($url); $this->valid = $this->file->exists(); } } if (!$this->valid) { $this->file = new WOOF_Silent(__("The file could not be found", MASTERPRESS_DOMAIN)); } } else { $this->file = new WOOF_Silent(__("no file path has been set", MASTERPRESS_DOMAIN)); } } }