public function embed_tag($video, $field = null) { # We use this for previewing too if (isset($field) and $field != "embed") { return $video; } # If they're previewing and the field argument isn't the embed, return the original. $AE = new AutoEmbed(); if ($AE->parseUrl($video)) { $AE->setParam("wmode", "transparent"); return $AE->getEmbedCode(); } else { return $video; } }
function widget($args, $instance) { $AE = new AutoEmbed(); extract($args); $title = apply_filters("widget_title", $instance["title"]); $count = $instance["count"]; echo $before_widget; echo $before_title . $title . $after_title; ?> <?php for ($i = 1; $i <= $count; $i++) { ?> <?php if ($i == 1) { $class = "open"; } else { $class = "hidden"; } ?> <div class="<?php echo $class; ?> " id="widget-zoom-video-cat-<?php echo $i; ?> "> <?php if ($AE->parseUrl($instance["video" . $i])) { $AE->setParam('wmode', 'transparent'); $AE->setParam('autoplay', 'false'); $AE->setHeight(180); $AE->setWidth(250); echo $AE->getEmbedCode(); } else { echo "Could not generate embed. Please try it manualy."; } ?> <p class="description"><?php echo $instance["video" . $i . "-desc"]; ?> </p> </div> <?php } ?> <ul class="items"> <?php for ($i = 1; $i <= $count; $i++) { ?> <?php if ($i == 1) { $class = "active"; } ?> <li> <a class="<?php echo $class; ?> " href="#widget-zoom-video-cat-<?php echo $i; ?> "><?php echo $instance["video" . $i . "-title"]; ?> </a> </li> <?php $class = ""; } ?> </ul> <script type="text/javascript"> $("document").ready(function() { $(".wpzoom_media li a").click(function() { $(".wpzoom_media .open").addClass("hidden").removeClass("open"); $(".wpzoom_media " + $(this).attr("href")).addClass("open").removeClass("hidden"); $(".wpzoom_media li a.active").removeClass("active"); $(this).addClass("active"); return false; }) }); </script> <?php echo $after_widget; }
<?php $videourl = $_GET['videourl']; $video_url = $videourl; #$video_url = "http://tsr2.propvid.tv/tsr3/pv/view.php?sc=0f5f100057"; #$video_url = "http://tsr2.propvid.tv/tsr3/pv/view.php?sc=d1aad7d06e"; if (isset($video_url)) { if (stripos($video_url, 'youtube') !== false) { include 'AutoEmbed.class.php'; $embed = new AutoEmbed(); $embed->parseUrl($videourl); $video_id = preg_replace('/[^0-9]+/', '', $videourl); $embed->setParam('wmode', 'transparent'); $code = $embed->getEmbedCode(); $json = array(); $json['swfobject'] = $code; } else { //$dom = new DomDocument(); //$dom->validateOnParse = true; $html_file = trim($video_url); //@$dom->loadHTMLFile($html_file); //$img = $dom->getElementsByTagName('img'); //var_dump($dom); $html = file_get_contents($video_url); //$re = "@<tr><th[^>]*>([^<]|<[^/]|</[^t]|</t[^a])+</tr>@is"; $re = "@<div style=\"[a-z:;]+?\">[^<]*<table>[^<]*<tr><th[^>]*>([^<]|<[^/]|</[^t]|</t[^a])+</tr>[^<]*</table>[^<]*</div>@is"; $pr = preg_match_all($re, $html, $matches); $embed_re = '/var mediatype = \'(.+?)\';/'; $pr = preg_match_all($embed_re, $html, $embed_matches); $json['swfobject'] = array_pop($embed_matches[1]); $json['agents'] = '<div id="bottom_right_box">';
$videocode = get_post_meta($post->ID, 'wpzoom_post_embed_code', true); ?> <?php if ($wpzoom_autoembed == "Yes") { $AE = new AutoEmbed(); } // loading the AutoEmbed PHP Class ?> <div> <?php if (strlen($videocode) > 1 && $wpzoom_autoembed == "Yes") { if ($videocode && $AE->parseUrl($videocode)) { $AE->setParam('wmode', 'transparent'); $AE->setParam('autoplay', 'false'); $AE->setHeight(280); $AE->setWidth(480); ?> <span class="cover"><?php echo $AE->getEmbedCode(); ?> </span><?php } } elseif (strlen($videocode) > 1 && $wpzoom_autoembed == "No") { $videocode = preg_replace("/(width\\s*=\\s*[\"\\'])[0-9]+([\"\\'])/i", "\$1 480 \$2", $videocode); $videocode = preg_replace("/(height\\s*=\\s*[\"\\'])[0-9]+([\"\\'])/i", "\$1 280 \$2", $videocode); $videocode = str_replace("<embed", "<param name='wmode' value='transparent'></param><embed", $videocode); $videocode = str_replace("<embed", "<embed wmode='transparent' ", $videocode); ?>
function widget($args, $instance) { extract($args); $type = $instance['type']; $slider_title = empty($instance['slider_title']) ? '' : $instance['slider_title']; $choice_title = empty($instance['choice_title']) ? '' : $instance['choice_title']; $video_title = empty($instance['video_title']) ? '' : $instance['video_title']; $category = $instance['category']; $category_perpage = $instance['category_perpage']; $categories1 = $instance['categories1']; $categories2 = $instance['categories2']; $categories3 = $instance['categories3']; $categories4 = $instance['categories4']; $categories_perpage = $instance['categories_perpage']; $video_qty = $instance['video_qty']; $latest_perpage = $instance['latest_perpage']; $postedon_data = array('date' => get_option('unspoken_postedon_date'), 'category' => get_option('unspoken_postedon_cat'), 'comment' => get_option('unspoken_postedon_comm'), 'author' => get_option('unspoken_postedon_author')); global $exl_posts; echo $before_widget; if ($type == 'latest') { ?> <div class="latest clear"> <div class="slider"> <div class="block-title2"><?php echo $slider_title; ?> <a href="javascript:void(0);" class="prev"></a><a href="javascript:void(0);" class="next"></a></div> <div class="slider-inn"> <ul> <?php $args = array('posts_per_page' => -1, 'meta_key' => 'usn_highlight', 'meta_value' => 'on', 'post__not_in' => get_option('sticky_posts')); query_posts($args); while (have_posts()) { the_post(); if (get_option('unspoken_slider_excl')) { $exl_posts[] = get_the_ID(); } ?> <li> <div class="slider-item"> <div class="slider-photo"> <a href="<?php the_permalink(); ?> "><?php if (has_post_thumbnail()) { the_post_thumbnail('slide-home', array('alt' => trim(strip_tags(get_the_title())), 'title' => trim(strip_tags(get_the_title())))); } ?> </a> </div> <div class="slider-item-meta"><?php if (function_exists('unspoken_posted_on')) { unspoken_posted_on($postedon_data); } ?> </div> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php the_excerpt(); ?> </div> </li> <?php } wp_reset_query(); ?> </ul> </div> </div> <script type="text/javascript"> jQuery(document).ready(function() { jQuery('.slider-inn').jCarouselLite({ btnNext: ".slider .next", btnPrev: ".slider .prev", visible: 1, scroll: 1 <?php if (get_option('unspoken_slider_auto') && get_option('unspoken_slider_delay') > 0) { echo ', auto: ' . get_option('unspoken_slider_delay'); } ?> }); }); </script> <div class="latest-news"> <div class="block-title"><?php _e('Latest Entries', 'unspoken'); ?> </div> <ul> <?php $args = array('posts_per_page' => $latest_perpage, 'post__not_in' => get_option('sticky_posts'), 'post__not_in' => $exl_posts); query_posts($args); while (have_posts()) { the_post(); ?> <li> <p class="latest-news-meta"><?php if (function_exists('unspoken_posted_on')) { unspoken_posted_on($postedon_data); } ?> </p> <p class="latest-news-title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></p> </li> <?php } wp_reset_query(); ?> </ul> </div> </div> <?php } if ($type == 'slider') { $args = array('posts_per_page' => -1, 'post_status' => 'publish', 'post_type' => 'product', 'meta_key' => '_featured', 'meta_value' => 'yes'); query_posts($args); if (true or have_posts()) { ?> <div id="mainposts"> <ul> <?php while (have_posts()) { the_post(); ?> <li> <div class="mainpost"> <a href="<?php the_permalink(); ?> "> <?php if (has_post_thumbnail()) { the_post_thumbnail('slide-magazine'); } ?> </a> <div class="mainpost-container"> <div class="bg"></div> <div class="mainpost-data"> <div class="mainpost-meta" style="display:none"><?php echo get_the_date(); ?> · <?php comments_popup_link(__('0 Comments', 'unspoken'), __('1 Comment', 'unspoken'), __('% Comments', 'unspoken'), '', __('Comments off', 'unspoken')); ?> · <?php the_category(', '); ?> </div> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php the_content(); ?> </div> </div> </div> </li> <?php } wp_reset_query(); ?> </ul> <a href="javascript: void(0);" class="prev"></a> <a href="javascript: void(0);" class="next"></a> </div> <script type="text/javascript"> jQuery(document).ready(function() { jQuery('#mainposts').jCarouselLite({ btnNext: "#mainposts .next", btnPrev: "#mainposts .prev", visible: 1, scroll: 1 <?php if (get_option('unspoken_mag_auto') && get_option('unspoken_mag_delay') > 0) { echo ', auto: ' . get_option('unspoken_mag_delay'); } ?> }); }); </script> <?php } ?> <?php } if ($type == 'category' && $category) { ?> <div class="category"> <div class="block-title"><a href="<?php echo get_category_link($category); ?> "><?php echo get_cat_name($category); ?> </a></div> <div class="category-inn clear"> <?php $args = array('cat' => $category, 'posts_per_page' => 1, 'post__not_in' => get_option('sticky_posts'), 'post__not_in' => $exl_posts); query_posts($args); while (have_posts()) { the_post(); ?> <div class="category-item"> <div class="category-item-photo"> <a href="<?php the_permalink(); ?> "><?php if (has_post_thumbnail()) { the_post_thumbnail('general', array('alt' => trim(strip_tags(get_the_title())), 'title' => trim(strip_tags(get_the_title())))); } ?> </a> </div> <div class="category-item-meta"><?php if (function_exists('unspoken_posted_on')) { unspoken_posted_on($postedon_data); } ?> </div> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php the_excerpt(); ?> </div> <?php } wp_reset_query(); ?> <div class="category-list"> <ul> <?php $args = array('cat' => $category, 'posts_per_page' => $category_perpage, 'offset' => 1, 'post__not_in' => get_option('sticky_posts'), 'post__not_in' => $exl_posts); query_posts($args); while (have_posts()) { the_post(); ?> <li> <p class="category-list-meta"><?php if (function_exists('unspoken_posted_on')) { unspoken_posted_on($postedon_data); } ?> </p> <p class="category-list-title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></p> </li> <?php } wp_reset_query(); ?> </ul> </div> </div> </div> <?php } if ($type == 'categories' && ($categories1 || $categories2 || $categories3 || $categories4)) { ?> <div class="categories"> <div class="categories-inn clear"> <?php $catlist = array($categories1, $categories2, $categories3, $categories4); foreach ($catlist as $cat) { if (!empty($cat)) { ?> <div class="catlist"> <div class="block-title"><a href="<?php echo get_category_link($cat); ?> "><?php echo get_cat_name($cat); ?> </a></div> <ul> <?php $args = array('cat' => $cat, 'posts_per_page' => $categories_perpage, 'post__not_in' => get_option('sticky_posts'), 'post__not_in' => $exl_posts); query_posts($args); $i = 0; while (have_posts()) { the_post(); $i++; if ($i == 1) { ?> <li class="catlist-item first"> <a href="<?php the_permalink(); ?> " class="catlist-item-photo"><?php if (has_post_thumbnail()) { the_post_thumbnail('mini', array('alt' => trim(strip_tags(get_the_title())), 'title' => trim(strip_tags(get_the_title())))); } ?> </a> <div class="catlist-item-date"><?php echo get_the_date(); ?> </div> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> </li> <?php } else { ?> <li class="catlist-item"> <div class="catlist-item-date"><?php echo get_the_date(); ?> </div> <p><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></p> </li> <?php } } wp_reset_query(); ?> </ul> </div> <?php } } ?> </div> </div> <?php } if ($type == 'choice') { ?> <div class="choice"> <div class="block-title2"><?php echo __("Editor's Choice", 'unspoken'); ?> <a href="javascript:void(0);" class="prev"></a><a href="javascript:void(0);" class="next"></a></div> <div class="choice-inn"> <ul> <?php $args = array('posts_per_page' => -1, 'meta_key' => 'usn_ec', 'meta_value' => 'on', 'post__not_in' => get_option('sticky_posts'), 'post__not_in' => $exl_posts); query_posts($args); while (have_posts()) { the_post(); ?> <li class="choice-item"> <a href="<?php the_permalink(); ?> " class="choice-photo"><?php if (has_post_thumbnail()) { the_post_thumbnail('mini-ec', array('alt' => trim(strip_tags(get_the_title())), 'title' => trim(strip_tags(get_the_title())))); } ?> </a> <div class="choice-cat"><?php the_category(', '); ?> </div> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> </li> <?php } wp_reset_query(); ?> </ul> </div> </div> <?php } if ($type == 'video') { ?> <div class="video clear"> <div class="block-title"><?php echo __("Video", 'unspoken'); ?> </div> <div class="video-item-container"> <?php $args = array('posts_per_page' => -1, 'meta_key' => 'usn_show_in_video', 'meta_value' => 'on', 'post__not_in' => get_option('sticky_posts'), 'post__not_in' => $exl_posts); query_posts($args); $i = 0; while (have_posts()) { the_post(); $active = ''; $i++; if ($i == 1) { $active = 'active'; } ?> <div class="video-item <?php echo 'item' . $i; ?> <?php echo $active; ?> "> <?php $videourl = get_post_meta(get_the_ID(), 'usn_videolink', true); if (!$videourl) { ?> <a href="<?php the_permalink(); ?> " class="video-item-photo"><?php if (has_post_thumbnail()) { the_post_thumbnail('video', array('alt' => trim(strip_tags(get_the_title())), 'title' => trim(strip_tags(get_the_title())))); } ?> </a> <?php } else { ?> <div class="video-item-photo"><?php $AE = new AutoEmbed(); // loading the AutoEmbed PHP Class if ($videourl && $AE->parseUrl($videourl)) { $AE->setParam('wmode', 'transparent'); $AE->setParam('autoplay', 'false'); $AE->setHeight(260); $AE->setWidth(460); echo $AE->getEmbedCode(); } ?> </div><?php } ?> <div class="video-item-meta"><?php if (function_exists('unspoken_posted_on')) { unspoken_posted_on($postedon_data); } ?> </div> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php the_excerpt(); ?> </div> <?php } wp_reset_query(); ?> </div> <div class="videolist"> <a href="javascript:void(0);" class="prev"></a> <div class="videolist-inn"> <ul> <?php $args = array('meta_key' => 'usn_show_in_video', 'meta_value' => 'on', 'posts_per_page' => $video_qty, 'post__not_in' => get_option('sticky_posts'), 'post__not_in' => $exl_posts); query_posts($args); $i = 0; while (have_posts()) { the_post(); $i++; ?> <li class="videolist-item"> <div class="videolist-thumb"> <?php the_post_thumbnail('video-mini', array('alt' => trim(strip_tags(get_the_title())), 'title' => trim(strip_tags(get_the_title())))); ?> <a class="videolist-play <?php echo $i == 1 ? 'active' : ''; ?> " href="javascript:void(0);" title="<?php the_title(); ?> "></a> </div> </li> <?php } wp_reset_query(); ?> </ul> </div> <a href="javascript:void(0);" class="next"></a> </div> </div> <?php } echo $after_widget; }