} $curr_path = dirname($curr_path); } return NULL; } } define('WP_USE_THEMES', false); define('ABSPATH', secure_html5_video_player_parent_path_with_file(__FILE__, 'wp-config.php', 10) . '/'); require_once ABSPATH . 'wp-config.php'; require_once 'sh5vp-functions.php'; $info = $_GET['info']; $filename = ''; if (isset($_GET['file'])) { $filename = $_GET['file']; } $access_key = secure_html5_video_player_accessKey($filename); if ($_GET['k'] != $access_key) { exit; } header('Content-Type: text/plain'); $secure_html5_video_player_video_dir = get_option('secure_html5_video_player_video_dir'); $plugin_dir = plugins_url('secure-html5-video-player'); $filepath = $secure_html5_video_player_video_dir . '/' . $filename; $filename_no_ext = secure_html5_video_player_filename_no_ext($filename); $original_filename_no_ext = $filename_no_ext; $found = false; if ($info == 'exists') { $secure_html5_video_player_video_dir = get_option('secure_html5_video_player_video_dir'); $filedir = $secure_html5_video_player_video_dir; $last_slash_pos = strrpos($filename, '/'); if ($last_slash_pos !== FALSE) {
function secure_html5_video_player_media_iframe_url($opts) { //$opts - hash with keys: file, youtube, vimeo, width, height, preload, autoplay, loop $youtube_override_type = get_option('secure_html5_video_player_youtube_override_type'); if ('primary' == $youtube_override_type) { if (secure_html5_video_player_youtube_exists($opts['youtube'])) { $youtube = $opts['youtube']; $autoplay_youtube = '0'; if ($opts['autoplay'] == 'yes' || $opts['autoplay'] == 'true') { $autoplay_youtube = '1'; } $origin = urlencode(site_url()); return "http://www.youtube.com/embed/{$youtube}?autoplay={$autoplay_youtube}&origin={$origin}"; } else { if (secure_html5_video_player_vimeo_exists($opts['vimeo'])) { $vimeo = $opts['vimeo']; $autoplay_vimeo = '0'; if ($opts['autoplay'] == 'yes' || $opts['autoplay'] == 'true') { $autoplay_vimeo = '1'; } $loop_vimeo = '0'; if ($opts['loop'] == 'yes' || $opts['loop'] == 'true') { $loop_vimeo = '1'; } return "http://player.vimeo.com/video/{$vimeo}?autoplay={$autoplay_vimeo}&loop={$loop_vimeo}"; } } } $access_key = secure_html5_video_player_accessKey($file); $plugin_dir = plugins_url('secure-html5-video-player'); return "{$plugin_dir}/getiframe.php?k=" . urlencode($access_key) . "&file=" . urlencode($opts['file']) . "&youtube=" . urlencode($opts['youtube']) . "&vimeo=" . urlencode($opts['vimeo']) . "&preload=" . urlencode($opts['preload']) . "&autoplay=" . urlencode($opts['autoplay']) . "&loop=" . urlencode($opts['loop']); }
function secure_html5_video_player_inner_custom_box($post) { wp_nonce_field(plugin_basename(__FILE__), 'secure_html5_video_player_noncename'); $secure_html5_video_player_video_shortcode = get_option('secure_html5_video_player_video_shortcode', 'video'); $defaults = array('width' => get_option('secure_html5_video_player_default_width'), 'height' => get_option('secure_html5_video_player_default_height'), 'preload' => get_option('secure_html5_video_player_default_preload'), 'autoplay' => get_option('secure_html5_video_player_default_autoplay'), 'loop' => get_option('secure_html5_video_player_default_loop')); $instance = array('video' => get_post_meta($post->ID, 'sh5vp-video', true), 'youtube_video_id' => get_post_meta($post->ID, 'sh5vp-youtube_video_id', true), 'vimeo_video_id' => get_post_meta($post->ID, 'sh5vp-vimeo_video_id', true), 'width' => get_post_meta($post->ID, 'sh5vp-width', true), 'height' => get_post_meta($post->ID, 'sh5vp-height', true), 'preload' => get_post_meta($post->ID, 'sh5vp-preload', true), 'autoplay' => get_post_meta($post->ID, 'sh5vp-autoplay', true), 'loop' => get_post_meta($post->ID, 'sh5vp-loop', true)); foreach ($defaults as $key => $value) { if (!$instance[$key]) { $instance[$key] = $value; } } ?> <table> <tr> <td><label for="sh5vp-video"><?php _e('Video', 'secure-html5-video-player'); ?> :</label></td> <td> <?php $video_files = secure_html5_video_player_filelist(true); if (!empty($video_files)) { $preview_key = secure_html5_video_player_accessKey('preview-iframe'); ?> <select id="sh5vp-video" name="sh5vp-video" > <option value=""></option> <?php foreach ($video_files as $curr_video_file => $server_addr) { ?> <option data-key="<?php print $preview_key; ?> " value="<?php print $curr_video_file; ?> " <?php if ($instance['video'] == $curr_video_file) { ?> selected="selected" <?php } ?> ><?php print $curr_video_file; //if (count($server_addr) > 0) { // print ' (' . implode(', ', $server_addr) . ')'; //} ?> </option><?php } ?> </select><?php } else { ?> <input type="text" id="sh5vp-video" name="sh5vp-video" value="<?php print $instance['video']; ?> " /><?php } ?> </td> </tr> <tr> <td><label for="sh5vp-youtube_video_id"><?php _e('Youtube video ID', 'secure-html5-video-player'); ?> :</label></td> <td><input type="text" id="sh5vp-youtube_video_id" name="sh5vp-youtube_video_id" value="<?php print $instance['youtube_video_id']; ?> " /></td> </tr> <tr> <td><label for="sh5vp-vimeo_video_id"><?php _e('Vimeo video ID', 'secure-html5-video-player'); ?> :</label></td> <td><input type="text" id="sh5vp-vimeo_video_id" name="sh5vp-vimeo_video_id" value="<?php print $instance['vimeo_video_id']; ?> " /></td> </tr> <tr> <td><label for="sh5vp-width"><?php _e('Width', 'secure-html5-video-player'); ?> :</label></td> <td><input type="text" id="sh5vp-width" name="sh5vp-width" value="<?php print $instance['width']; ?> " size="5" /> px</td> </tr> <tr> <td><label for="sh5vp-height"><?php _e('Height', 'secure-html5-video-player'); ?> :</label></td> <td><input type="text" id="sh5vp-height" name="sh5vp-height" value="<?php print $instance['height']; ?> " size="5" /> px</td> </tr> <tr> <td></td> <td> <input type="checkbox" id="sh5vp-preload" name="sh5vp-preload" value="yes" <?php if ($instance['preload'] == 'yes') { ?> checked="checked" <?php } ?> /> <label for="sh5vp-preload"><?php _e('Preload', 'secure-html5-video-player'); ?> </label> </td> </tr> <tr> <td></td> <td> <input type="checkbox" id="sh5vp-autoplay" name="sh5vp-autoplay" value="yes" <?php if ($instance['autoplay'] == 'yes') { ?> checked="checked" <?php } ?> /> <label for="sh5vp-autoplay"><?php _e('Autoplay', 'secure-html5-video-player'); ?> </label> </td> </tr> <tr> <td></td> <td> <input type="checkbox" id="sh5vp-loop" name="sh5vp-loop" value="yes" <?php if ($instance['loop'] == 'yes') { ?> checked="checked" <?php } ?> /> <label for="sh5vp-loop"><?php _e('Loop', 'secure-html5-video-player'); ?> </label> </td> </tr> <tr> <td colspan="2"> <input type="button" class="button-secondary" value="<?php _e('Insert Into Post', 'secure-html5-video-player'); ?> " onclick="sh5vp_insertIntoPost();"/> <input type="button" class="button-secondary" value="<?php _e('Preview Video', 'secure-html5-video-player'); ?> " onclick="sh5vp_previewVideo();"/> </td> </tr> </table> <div class="sh5vp-video-modal" id="sh5vp-video-modal" data-video-shortcode="<?php echo $secure_html5_video_player_video_shortcode; ?> " data-youtube_override_type="<?php echo get_option('secure_html5_video_player_youtube_override_type'); ?> " data-plugin_dir="<?php echo plugins_url('secure-html5-video-player'); ?> " <?php foreach ($defaults as $key => $value) { echo " data-default-{$key}=\"{$value}\""; } ?> > <div class="sh5vp-modal-bg"></div> <div class="sh5vp-modal-inner"> <div class="sh5vp-modal-close"></div> <h1 class="sh5vp-modal-title">Secure HTML5 Video Preview</h1> <iframe class="sh5vp-modal-iframe" width="560" height="315" src="" frameborder="0" allowfullscreen scrolling="no"></iframe> <div> <table> <tr><td class="sh5vp-preview-label">Video:</td><td class="sh5vp-preview-selected-video"></td></tr> <tr><td class="sh5vp-preview-label">Youtube:</td><td class="sh5vp-preview-selected-youtube"></td></tr> <tr><td class="sh5vp-preview-label">Vimeo:</td><td class="sh5vp-preview-selected-vimeo"></td></tr> </table> </div> </div> </div> <p><?php _e('To use the video in your template, call the function: <code>get_sh5vp_featured_video($post_id, $width, $height)</code>, which returns the appropriate video tag. Or call: <code>sh5vp_featured_video($post_id, $width, $height)</code> which prints the appropriate video tag. The arguments: <code>$width</code> and <code>$height</code> are optional, and taken from the settings above if not specified.', 'secure-html5-video-player'); ?> </p> <p><?php _e('Alternatively, you may insert the video into the post as a shortcode by placing the text cursor into the editor and pressing the <em>Insert Into Post</em> button, above.', 'secure-html5-video-player'); ?> </p> <?php }
} video, object, iframe { width:100%; height:100%; min-width:100%; min-height:100%; max-width:100%; max-height:100%; position:absolute; top:0px; left:0px; background-color:#000; } .sh5vp-download-links { display:none; } </style> </head> <body> <?php $access_key = secure_html5_video_player_accessKey($filename); $access_key2 = secure_html5_video_player_accessKey('preview-iframe'); if ($_GET['k'] != $access_key && $_GET['k'] != $access_key2) { print 'Access Denied'; } else { $secure_html5_video_player_video_shortcode = get_option('secure_html5_video_player_video_shortcode', 'video'); print do_shortcode('[' . $secure_html5_video_player_video_shortcode . ' file="' . $_GET['file'] . '" ' . ' youtube="' . $_GET['youtube'] . '" vimeo="' . $_GET['vimeo'] . '" ' . ' preload="' . $_GET['preload'] . '" autoplay="' . $_GET['autoplay'] . '" loop="' . $_GET['loop'] . '" ]'); } ?> </body> </html>
function form($instance) { $defaults = array('title' => '', 'video' => '', 'youtube_video_id' => '', 'vimeo_video_id' => '', 'width' => get_option('secure_html5_video_player_default_width'), 'height' => get_option('secure_html5_video_player_default_height'), 'preload' => get_option('secure_html5_video_player_default_preload'), 'autoplay' => get_option('secure_html5_video_player_default_autoplay'), 'loop' => get_option('secure_html5_video_player_default_loop'), 'caption' => ''); $instance = wp_parse_args((array) $instance, $defaults); ?> <table> <tr> <td colspan="2"><label for="<?php print $this->get_field_id('title'); ?> "><?php _e('Title', 'secure-html5-video-player'); ?> :</label></td> </tr> <tr> <td colspan="2"><input type="text" id="<?php print $this->get_field_id('title'); ?> " name="<?php print $this->get_field_name('title'); ?> " value="<?php print $instance['title']; ?> " style="width:400px;"/></td> </tr> <tr> <td colspan="2"><label for="<?php print $this->get_field_id('video'); ?> "><?php _e('Video', 'secure-html5-video-player'); ?> :</label></td></tr> <tr> <td colspan="2"><?php $video_files = secure_html5_video_player_filelist(true); if (!empty($video_files)) { ?> <select id="<?php print $this->get_field_id('video'); ?> " name="<?php print $this->get_field_name('video'); ?> " style="width:400px;"> <option value=""></option> <?php $preview_key = secure_html5_video_player_accessKey('preview-iframe'); foreach ($video_files as $curr_video_file => $server_addr) { ?> <option data-key="<?php print $preview_key; ?> " value="<?php print $curr_video_file; ?> " <?php if ($instance['video'] == $curr_video_file) { ?> selected="selected" <?php } ?> ><?php print $curr_video_file; //if (count($server_addr) > 0) { // print ' (' . implode(', ', $server_addr) . ')'; //} ?> </option><?php } ?> </select><?php } else { ?> <input type="text" id="<?php print $this->get_field_id('video'); ?> " name="<?php print $this->get_field_name('video'); ?> " value="<?php print $instance['video']; ?> " style="width:400px;"/><?php } ?> </td> </tr> <tr> <td colspan="2"><label for="<?php print $this->get_field_id('youtube_video_id'); ?> "><?php _e('Youtube video ID', 'secure-html5-video-player'); ?> :</label></td> </tr> <tr> <td colspan="2"><input type="text" id="<?php print $this->get_field_id('youtube_video_id'); ?> " name="<?php print $this->get_field_name('youtube_video_id'); ?> " value="<?php print $instance['youtube_video_id']; ?> " style="width:400px;"/></td> </tr> <tr> <td colspan="2"><label for="<?php print $this->get_field_id('vimeo_video_id'); ?> "><?php _e('Vimeo video ID', 'secure-html5-video-player'); ?> :</label></td> </tr> <tr> <td colspan="2"><input type="text" id="<?php print $this->get_field_id('vimeo_video_id'); ?> " name="<?php print $this->get_field_name('vimeo_video_id'); ?> " value="<?php print $instance['vimeo_video_id']; ?> " style="width:400px;"/></td> </tr> <tr> <td><label for="<?php print $this->get_field_id('width'); ?> "><?php _e('Width', 'secure-html5-video-player'); ?> :</label></td> <td style="width:100%;"><input type="text" id="<?php print $this->get_field_id('width'); ?> " name="<?php print $this->get_field_name('width'); ?> " value="<?php print $instance['width']; ?> " size="5" /> px</td> </tr> <tr> <td><label for="<?php print $this->get_field_id('height'); ?> "><?php _e('Height', 'secure-html5-video-player'); ?> :</label></td> <td><input type="text" id="<?php print $this->get_field_id('height'); ?> " name="<?php print $this->get_field_name('height'); ?> " value="<?php print $instance['height']; ?> " size="5" /> px</td> </tr> <tr> <td colspan="2"> <input type="checkbox" id="<?php print $this->get_field_id('preload'); ?> " name="<?php print $this->get_field_name('preload'); ?> " value="yes" <?php if ($instance['preload'] == 'yes') { ?> checked="checked" <?php } ?> /> <label for="<?php print $this->get_field_id('preload'); ?> "><?php _e('Preload', 'secure-html5-video-player'); ?> </label> </td> </tr> <tr> <td colspan="2"> <input type="checkbox" id="<?php print $this->get_field_id('autoplay'); ?> " name="<?php print $this->get_field_name('autoplay'); ?> " value="yes" <?php if ($instance['autoplay'] == 'yes') { ?> checked="checked" <?php } ?> /> <label for="<?php print $this->get_field_id('autoplay'); ?> "><?php _e('Autoplay', 'secure-html5-video-player'); ?> </label> </td> </tr> <tr> <td colspan="2"> <input type="checkbox" id="<?php print $this->get_field_id('loop'); ?> " name="<?php print $this->get_field_name('loop'); ?> " value="yes" <?php if ($instance['loop'] == 'yes') { ?> checked="checked" <?php } ?> /> <label for="<?php print $this->get_field_id('loop'); ?> "><?php _e('Loop', 'secure-html5-video-player'); ?> </label> </td> </tr> <tr><td colspan="2"><label for="<?php print $this->get_field_id('caption'); ?> "><?php _e('Caption (Text or HTML)', 'secure-html5-video-player'); ?> :</label></td></tr> <tr><td colspan="2"><textarea id="<?php print $this->get_field_id('caption'); ?> " name="<?php print $this->get_field_name('caption'); ?> " rows="5" cols="29" class="widefat" ><?php print $instance['caption']; ?> </textarea></td></tr> <tr><td colspan="2" class="sh5vp-widget-preview"><input type="button" class="button-secondary" value="<?php _e('Preview Video', 'secure-html5-video-player'); ?> " onclick="sh5vp_previewVideo({ video: '<?php print $this->get_field_id('video'); ?> ', youtube: '<?php print $this->get_field_id('youtube_video_id'); ?> ', vimeo: '<?php print $this->get_field_id('vimeo_video_id'); ?> ', width: '<?php print $this->get_field_id('width'); ?> ', height: '<?php print $this->get_field_id('height'); ?> ', preload: '<?php print $this->get_field_id('preload'); ?> ', autoplay: '<?php print $this->get_field_id('autoplay'); ?> ', loop: '<?php print $this->get_field_id('loop'); ?> ', modal: '<?php print $this->get_field_id('modal'); ?> ' });"/></td></tr> </table> <div class="sh5vp-video-modal" id="<?php print $this->get_field_id('modal'); ?> " data-video-shortcode="<?php echo get_option('secure_html5_video_player_video_shortcode', 'video'); ?> " data-youtube_override_type="<?php echo get_option('secure_html5_video_player_youtube_override_type'); ?> " data-plugin_dir="<?php echo plugins_url('secure-html5-video-player'); ?> " <?php foreach ($defaults as $key => $value) { echo " data-default-{$key}=\"{$value}\""; } ?> > <div class="sh5vp-modal-bg"></div> <div class="sh5vp-modal-inner"> <div class="sh5vp-modal-close"></div> <h1 class="sh5vp-modal-title">Secure HTML5 Video Preview</h1> <iframe class="sh5vp-modal-iframe" width="560" height="315" src="" frameborder="0" allowfullscreen scrolling="no"></iframe> <div> <table> <tr><td class="sh5vp-preview-label">Video:</td><td class="sh5vp-preview-selected-video"></td></tr> <tr><td class="sh5vp-preview-label">Youtube:</td><td class="sh5vp-preview-selected-youtube"></td></tr> <tr><td class="sh5vp-preview-label">Vimeo:</td><td class="sh5vp-preview-selected-vimeo"></td></tr> </table> </div> </div> </div> <?php }