function bizz_get_embed($key = 'embed', $width, $height, $class = 'video', $id = null)
{
    // Run new function
    return bizz_embed('key=' . $key . '&width=' . $width . '&height=' . $height . '&class=' . $class . '&id=' . $id);
}
Example #2
0
 /**
  * Outputs the widget based on the arguments input through the widget controls. 
  * @since 0.6
  */
 function widget($args, $instance)
 {
     global $post, $widget_id;
     extract($args);
     $args = array();
     $args['post_type'] = $instance['post_type'];
     $args['include'] = isset($instance['include']) ? $instance['include'] : array();
     $args['include'] = !is_array($args['include']) && !empty($args['include']) ? explode(",", $args['include']) : $args['include'];
     $args['exclude'] = isset($instance['exclude']) ? $instance['exclude'] : array();
     $args['exclude'] = !is_array($args['exclude']) && !empty($args['exclude']) ? explode(",", $args['exclude']) : $args['exclude'];
     $args['order'] = $instance['order'];
     $args['orderby'] = $instance['orderby'];
     $args['number'] = intval($instance['number']);
     $args['height'] = isset($instance['height']) ? $instance['height'] : 365;
     $args['start'] = isset($instance['start']) ? $instance['start'] - 1 : 0;
     $args['slidespeed'] = isset($instance['slidespeed']) ? $instance['slidespeed'] : 7;
     $args['animationspeed'] = isset($instance['animationspeed']) ? $instance['animationspeed'] : 6;
     $args['pausehover'] = isset($instance['pausehover']) ? $instance['pausehover'] : true;
     $args['nextprev'] = isset($instance['nextprev']) ? $instance['nextprev'] : true;
     $args['slidecontrols'] = isset($instance['slidecontrols']) ? $instance['slidecontrols'] : true;
     $args['smoothheight'] = isset($instance['smoothheight']) ? $instance['smoothheight'] : true;
     /* START
     		------------------------------------------------------ */
     echo $before_widget;
     /* If there is a title given, add it along with the $before_title and $after_title variables. */
     if ($instance['title']) {
         echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
     }
     // slider options
     $slide_options = array('featured_entries' => $args['number'], 'featured_height' => $args['height'], 'featured_tags' => '', 'featured_sliding_direction' => 'horizontal', 'featured_effect' => 'fade', 'featured_start' => $args['start'], 'featured_speed' => $args['slidespeed'], 'featured_hover' => $args['pausehover'], 'featured_touchswipe' => 'true', 'featured_animation_speed' => $args['animationspeed'], 'featured_slidecontrols' => $args['slidecontrols'], 'featured_smoothheight' => $args['smoothheight'], 'featured_nextprev' => $args['nextprev']);
     $settings = apply_filters('wslider_options', $slide_options);
     // query options
     $slide_args = array('post_type' => $args['post_type'], 'include' => $args['include'], 'exclude' => $args['exclude'], 'order' => $args['order'], 'orderby' => $args['orderby'], 'numberposts' => $args['number'], 'suppress_filters' => false);
     $slides = get_posts(apply_filters('wslider_args', $slide_args));
     // Set up variables
     $height = $settings['featured_height'];
     // get widget id
     $widget_id = preg_replace("/[^0-9\\.]/", '', $widget_id);
     echo "<div class=\"slide-container\">\n";
     echo "<section id=\"bizz_fs_{$widget_id}\" class=\"bizz_fs\">\n";
     echo "<ul class=\"slides clearfix\">\n";
     $exclude = array();
     $count = 0;
     foreach ($slides as $post) {
         setup_postdata($post);
         $count++;
         $full_width = get_post_meta($post->ID, 'bizzthemes_slide_full', true);
         $has_video = get_post_meta($post->ID, 'bizzthemes_slide_vid', true);
         $has_image = get_post_meta($post->ID, 'bizzthemes_slide_img', true);
         $has_content = get_post_meta($post->ID, "bizzthemes_slide_textarea", true);
         if ($post->post_type != 'revision' && $post->post_type != 'nav_menu_item' && $post->post_type != 'bizz_widget' && $post->post_type != 'bizz_grid') {
             echo "<li id=\"slide-" . $count . "\" class=\"slide slide-id-" . get_the_ID() . "\">\n";
             if ($has_image) {
                 $flnofl = !isset($full_width) ? ' fl' : '';
                 echo bizz_image('key=bizzthemes_slide_img&width=1200&class=simage' . $flnofl . '&link=img&return=true&cropp=c');
                 if (!isset($full_width)) {
                     echo '<div class="format_text">';
                     echo apply_filters('wslider_post_title', '<h3 class="stitle">' . get_the_title() . '</h3>');
                     echo apply_filters('the_content', $has_content);
                     if (empty($has_content)) {
                         the_content(__('Continue Reading &rarr;'));
                     }
                     echo '</div>';
                 }
             } elseif ($has_video) {
                 $flnofl = !isset($full_width) ? ' fl' : '';
                 echo bizz_embed('key=bizzthemes_slide_vid&width=840&class=svideo' . $flnofl);
                 if (!isset($full_width)) {
                     echo '<div class="format_text">';
                     echo apply_filters('wslider_post_title', '<h3 class="stitle">' . get_the_title() . '</h3>');
                     echo apply_filters('the_content', $has_content);
                     if (empty($has_content)) {
                         the_content(__('Continue Reading &rarr;'));
                     }
                     echo '</div>';
                 }
             } else {
                 echo '<div class="format_text clearfix">';
                 echo apply_filters('wslider_post_title', '<h3 class="stitle">' . get_the_title() . '</h3>');
                 echo apply_filters('the_content', $has_content);
                 if (empty($has_content)) {
                     the_content(__('Continue Reading &rarr;'));
                 }
                 echo '</div>';
             }
             echo '</li>';
         }
     }
     /* Reset query. */
     wp_reset_query();
     echo "</ul>\n";
     echo "</section>\n";
     echo "</div>\n";
     // Slider Settings
     $slideDirection = $settings['featured_sliding_direction'];
     $animation = $settings['featured_effect'];
     $slideshow = $settings['featured_speed'] == 0 ? 'false' : 'true';
     $slideToStart = $settings['featured_start'];
     $pauseOnHover = $settings['featured_hover'];
     $touchSwipe = $settings['featured_touchswipe'];
     $slideshowSpeed = $settings['featured_speed'] * 1000;
     // milliseconds
     $animationDuration = $settings['featured_animation_speed'] * 100;
     // milliseconds
     $slidecontrols = $settings['featured_slidecontrols'];
     $smoothheight = $settings['featured_smoothheight'];
     $nextprev = $settings['featured_nextprev'];
     $slideshow_js = "\r\r\n<script type='text/javascript'>\r\r\n\tjQuery(document).ready(function() {\r\r\n\t\r\r\n\t\tvar firstElement = jQuery('#bizz_fs_{$widget_id}').find('img, object, video').filter(':first');\r\r\n\t\tif ( firstElement.length ) {\r\r\n\t\t\tvar element = firstElement.get(0);\r\r\n\t\t\tvar checkforloaded = setInterval( function() {\r\r\n\t\t\t\tif ( element.complete || element.readyState == 'complete' || element.readyState == 4 ) {\r\r\n\t\t\t\t\tclearInterval( checkforloaded );\r\r\n\t\t\t\t\tjQuery('#bizz_fs_{$widget_id}').flexslider({\r\r\n\t\t\t\t\t\t\r\r\n\t\t\t\t\t\t// your options\r\r\n\t\t\t\t\t\tcontrolsContainer: \t'.slide-container',\r\r\n\t\t\t\t\t\tslideDirection: \t'{$slideDirection}',\r\r\n\t\t\t\t\t\tanimation: \t\t\t'{$animation}',\r\r\n\t\t\t\t\t\tslideshow: \t\t\t{$slideshow},\r\r\n\t\t\t\t\t\tstartAt: \t\t\t{$slideToStart},\r\r\n\t\t\t\t\t\tdirectionNav: \t\t{$nextprev},\r\r\n\t\t\t\t\t\tcontrolNav: \t\t{$slidecontrols},\r\r\n\t\t\t\t\t\tpauseOnHover: \t\t{$pauseOnHover},\r\r\n\t\t\t\t\t\tslideshowSpeed: \t{$slideshowSpeed}, \r\r\n\t\t\t\t\t\tanimationSpeed: \t{$animationDuration},\r\r\n\t\t\t\t\t\tsmoothHeight:\t\t{$smoothheight},\r\r\n\t\t\t\t\t\ttouch: \t\t\t\t'touch',\r\r\n\t\t\t\t\t\tstart: function( slider ){\r\r\n\t\t\t\t\t\t\tjQuery('#bizz_fs_{$widget_id}').addClass('loaded');\r\r\n\t\t\t\t\t\t}\r\r\n\t\t\t\t\t\t\r\r\n\t\t\t\t\t});\r\r\n\t\t\t\t}\r\r\n\r\r\n\t\t\t}, 20 );\r\r\n\t\t}\r\r\n\t\telse {\r\r\n\t\t\tjQuery(window).load(function(){\r\r\n\t\t\t\tjQuery('#bizz_fs_{$widget_id}').flexslider({\r\r\n\t\t\t\t\t\r\r\n\t\t\t\t\t// your options\r\r\n\t\t\t\t\tcontrolsContainer: \t'.slide-container',\r\r\n\t\t\t\t\tslideDirection: \t'{$slideDirection}',\r\r\n\t\t\t\t\tanimation: \t\t\t'{$animation}',\r\r\n\t\t\t\t\tslideshow: \t\t\t{$slideshow},\r\r\n\t\t\t\t\tstartAt: \t\t\t{$slideToStart},\r\r\n\t\t\t\t\tdirectionNav: \t\t{$nextprev},\r\r\n\t\t\t\t\tcontrolNav: \t\t{$slidecontrols},\r\r\n\t\t\t\t\tpauseOnHover: \t\t{$pauseOnHover},\r\r\n\t\t\t\t\tslideshowSpeed: \t{$slideshowSpeed}, \r\r\n\t\t\t\t\tanimationSpeed: \t{$animationDuration},\r\r\n\t\t\t\t\tsmoothHeight:\t\t{$smoothheight},\r\r\n\t\t\t\t\ttouch: \t\t\t\t'touch',\r\r\n\t\t\t\t\tstart: function( slider ){\r\r\n\t\t\t\t\t\tjQuery('#bizz_fs_{$widget_id}').addClass('loaded');\r\r\n\t\t\t\t\t}\r\r\n\t\t\t\t\t\r\r\n\t\t\t\t});\r\r\n\t\t\t});\r\r\n\t\t}\r\r\n\r\r\n\t});\r\r\n</script>\r\r\n\t\t";
     echo apply_filters('wslider_js', $slideshow_js);
     echo $after_widget;
     /* END
     		------------------------------------------------------ */
 }