function ap_html5_video_code($file, $params) { $video_code = ""; if ($file['mime_type'] == "video/mp4" || $file['mime_type'] == "video/webm" || $file['mime_type'] == "video/ogg" || $file['mime_type'] == "video/ogv") { $path_parts = pathinfo($file['url']); //print_r($path_parts); $video_code .= '<video ' . $params . '>'; $mp4 = $path_parts['dirname'] . '/' . $path_parts['filename'] . '.mp4'; if (is_file(url_to_abs_path($mp4))) { $video_code .= '<source src="' . $mp4 . '" type="video/mp4">' . "\n\r"; } $webm = $path_parts['dirname'] . '/' . $path_parts['filename'] . '.webm'; if (is_file(url_to_abs_path($webm))) { $video_code .= '<source src="' . $webm . '" type="video/webm" />' . "\n\r"; } $ogv = $path_parts['dirname'] . '/' . $path_parts['filename'] . '.ogv'; if (is_file(url_to_abs_path($ogv))) { $video_code .= '<source src="' . $ogv . '" type="video/ogg">' . "\n\r"; } else { // check if it's ogg just to be sure $ogg = $path_parts['dirname'] . '/' . $path_parts['filename'] . '.ogg'; if (is_file(url_to_abs_path($ogg))) { $video_code .= '<source src="' . $ogg . '" type="video/ogg">' . "\n\r"; } } $video_code .= '</video>'; } return $video_code; }
$ctype = "application/pdf"; break; case "zip": $ctype = "application/zip"; break; default: $ctype = "application/force-download"; } header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: {$ctype}"); $header = "Content-Disposition: attachment; filename=" . $filename . ";"; header($header); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $len); @readfile($file); exit; } $abs_img_path = url_to_abs_path($image); if (is_file($abs_img_path)) { if (stristr($image, "wp-content/uploads") !== FALSE) { dl_file($abs_img_path); } else { die("Sorry, error."); } } else { die("Sorry, couldn't find the file."); }