function url_to_path_converter($src_file_url) { // Attempts to convert $src_file_url into either a relative path, or an absolute path, if possible. If no // conversion is possible, returns $src_file_url. Reasons for why no conversion takes place are that // $src_file_url is not a qualified URL, or it is outside the scope of either the WP root directory or the // SERVER_NAME document root directory. Also, trying to pass the path of a file, instead of its URL will // also result in a non-conversion. // -- The Assurer, 2010-10-07. // Attempt to convert into both relative and absolute paths... $relative = eStore_dlfilepath::relative_to_eStore_from_url($src_file_url); $absolute = eStore_dlfilepath::absolute_from_url($src_file_url); switch (get_option('eStore_auto_convert_to_relative_url')) { // Return conversion, based on user preference... case 0: // Absolute path... if ($absolute != FALSE && eStore_dlfilepath::dl_file_exists($absolute)) { return $absolute; } break; case 1: // Relative path... if ($relative != FALSE && eStore_dlfilepath::dl_file_exists($relative)) { return $relative; } break; case 2: // Do not convert... break; } //If the preferred URL conversions failed, or if "No Conversion" was choosen, then return the original URL. return $src_file_url; }