function secure_html5_video_player_media_url($secure_html5_video_player_video_dir, $plugin_dir, $access_key, $file, $ext) { $dynamic_url = "{$plugin_dir}/getvideo.php?k=" . urlencode($access_key) . "&file=" . urlencode($file . '.' . $ext); $secure_html5_video_player_serve_method = get_option('secure_html5_video_player_serve_method'); if ($secure_html5_video_player_serve_method == '') { $secure_html5_video_player_serve_method = 'file'; } if ($secure_html5_video_player_serve_method == 'dynamic') { file_get_contents("{$plugin_dir}/prepvideo.php?k=" . urlencode($access_key) . "&onlyclean=1&file=" . urlencode($file . '.' . $ext)); return $dynamic_url; } $script_tz = date_default_timezone_get(); date_default_timezone_set(get_option('timezone_string')); $date_str = date('Ymd'); date_default_timezone_set($script_tz); $sh5vp_cache = secure_html5_video_player_parent_path_with_file(__FILE__, 'wp-config.php', 10) . '/wp-content/sh5vp_cache/'; $sh5vp_cache_index = $sh5vp_cache . 'index.php'; if (!file_exists($sh5vp_cache_index)) { secure_html5_video_player_write_silence_file($sh5vp_cache_index); } $filename_normalized_ext = secure_html5_video_player_filename_normalized_ext($file . '.' . $ext); $video_orig = "{$secure_html5_video_player_video_dir}/{$file}.{$ext}"; $video_cache_dir = $sh5vp_cache . $date_str . '/' . $access_key . '/'; $video_cache = $video_cache_dir . $filename_normalized_ext; $video_cache_dir_index = $sh5vp_cache . $date_str . '/' . 'index.php'; $video_cache_dir_index2 = $video_cache_dir . 'index.php'; $video_cache_dir_index3 = ''; $last_slash_pos = strrpos($filename_normalized_ext, '/'); if (last_slash_pos !== FALSE) { $video_cache_dir_index3 = $video_cache_dir . substr($filename_normalized_ext, 0, $last_slash_pos); } if (!is_dir($video_cache_dir)) { mkdir($video_cache_dir, 0777, TRUE); } if ($video_cache_dir_index3 != '' && !is_dir($video_cache_dir_index3)) { mkdir($video_cache_dir_index3, 0777, TRUE); } if (!file_exists($video_cache_dir_index)) { secure_html5_video_player_write_silence_file($video_cache_dir_index); } if (!file_exists($video_cache_dir_index2)) { secure_html5_video_player_write_silence_file($video_cache_dir_index2); } if (!file_exists($video_cache) || abs(filesize($video_orig) - filesize($video_cache)) > 512) { file_get_contents("{$plugin_dir}/prepvideo.php?k=" . urlencode($access_key) . "&file=" . urlencode($file . '.' . $ext)); } if (file_exists($video_cache)) { return content_url() . '/sh5vp_cache/' . $date_str . '/' . $access_key . '/' . $filename_normalized_ext; } return $dynamic_url; }
$video_cache_dir_index3 = ''; $last_slash_pos = strrpos($filename_normalized_ext, '/'); if (last_slash_pos !== FALSE) { $video_cache_dir_index3 = $video_cache_dir . substr($filename_normalized_ext, 0, $last_slash_pos); } if (!is_dir($video_cache_dir)) { mkdir($video_cache_dir, 0777, TRUE); } if ($video_cache_dir_index3 != '' && !is_dir($video_cache_dir_index3)) { mkdir($video_cache_dir_index3, 0777, TRUE); } if (!file_exists($video_cache_dir_index)) { secure_html5_video_player_write_silence_file($video_cache_dir_index); } if (!file_exists($video_cache_dir_index2)) { secure_html5_video_player_write_silence_file($video_cache_dir_index2); } $in_progress_file = $video_cache . '.busy'; if (!file_exists($video_cache) || abs(filesize($video_orig) - filesize($video_cache)) > 512 && !file_exists($in_progress_file)) { $fp = fopen($in_progress_file, 'w'); fwrite($fp, "1"); fclose($fp); $secure_html5_video_player_serve_method = get_option('secure_html5_video_player_serve_method'); if ($secure_html5_video_player_serve_method == 'link') { if (!symlink($video_orig, $video_cache)) { copy($video_orig, $video_cache); } } else { if (!link($video_orig, $video_cache)) { copy($video_orig, $video_cache); }