/** * Recognize download URL. */ function download_redirect() { global $wp; if (preg_match('/^' . $this->options['general']['download_link'] . '\\/(\\d+)$/', $wp->request, $vars) === 1) { da_download_attachment((int) $vars[1]); } }
<?php // get the path $path_raw = $_SERVER['SCRIPT_FILENAME']; // sanitize path $path_raw = str_replace("\"", "", $path_raw); $path_raw = str_replace("`", "", $path_raw); $path_raw = str_replace("..", "", $path_raw); $path_raw = str_replace("./", "", $path_raw); #$path_raw = str_replace( ":", "", $path_raw ); $path = explode('wp-content', $path_raw); // load wp core include_once $path[0] . 'wp-load.php'; if (function_exists('da_download_attachment')) { da_download_attachment(isset($_GET['id']) ? (int) $_GET['id'] : 0); }