function sp_ev_display_gallery($width, $height, $link) { global $wp_query, $post, $features_3_0; ?> <?php // if ( $wp_query->max_num_pages > 1 ) : ?> <!-- see http://core.trac.wordpress.org/ticket/6453 --> <script type="text/javascript"> //<![CDATA[ var tb_pathToImage = "wp-includes/js/thickbox/loadingAnimation.gif"; var tb_closeImage = "wp-includes/js/thickbox/tb-close.png"; //]]> </script> <div id="nav-above" class="navigation"> <div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">←</span> Older videos', 'external-videos')); ?> </div> <div class="nav-next"><?php previous_posts_link(__('Newer videos <span class="meta-nav">→</span>', 'external-videos')); ?> </div> </div><!-- #nav-above --> <?php // endif; ?> <div class="gallerycontainer" style="clear:all;"> <?php while (have_posts()) { the_post(); $thumbnail = get_post_meta(get_the_ID(), 'thumbnail_url'); $thumb = $thumbnail[0]; $videourl = get_post_meta(get_the_ID(), 'video_url'); $video = trim($videourl[0]); $description = get_post_meta(get_the_ID(), 'description'); $desc = $description[0]; $short_title = sp_ev_shorten_text(get_the_title(), 33); $thickbox_title = sp_ev_shorten_text(get_the_title(), 90); // get oEmbed code $oembed = new WP_Embed(); $html = $oembed->shortcode(null, $video); // replace width with 600, height with 360 $html = preg_replace('/width="\\d+"/', 'width="' . $width . '"', $html); $html = preg_replace('/height="\\d+"/', 'height="' . $height . '"', $html); ?> <div style="margin:2px; height:auto; width:auto; float:left;"> <?php // display overlay if requested if ($link == "page") { ?> <a href="<?php the_permalink(); ?> " title="<?php echo $thickbox_title; ?> "> <div style="display:box; width:120px; height:90px;"> <img title="<?php the_title(); ?> " src="<?php echo $thumb; ?> " style="display:inline; margin:0; border:1px solid black; width:120px; height:90px"/> </div> </a> <div style="width:120px; height: 12px; margin-bottom:7px; line-height: 90%"> <small><i><?php echo get_the_time('F j, Y'); ?> </i></small> </div> <div style="width:120px; height: 30px; margin-bottom:20px; line-height: 80%"> <small><?php echo $short_title; ?> </small> </div> <?php // display overlay if requested } else { ?> <a href="#TB_inline?height=500&width=700&inlineId=hiddenModalContent_<?php the_ID(); ?> " title="<?php echo $thickbox_title; ?> " class="thickbox"> <div style="display:box; width:120px; height:90px;"> <img title="<?php the_title(); ?> " src="<?php echo $thumb; ?> " style="display:inline; margin:0; border:1px solid black; width:120px; height:90px"/> </div> </a> <div style="width:120px; height: 12px; margin-bottom:7px; line-height: 90%"> <small><i><?php echo get_the_time('F j, Y'); ?> </i></small> </div> <div style="width:120px; height: 30px; margin-bottom:20px; line-height: 80%"> <small><?php echo $short_title; ?> </small> </div> <!-- Hidden content for the thickbox --> <div id="hiddenModalContent_<?php echo $post->ID; ?> " style="display:none;"> <p align="center" style="margin-bottom:10px;"> <?php echo $html; ?> </p> <div style="margin-bottom:10px;"> <?php if ($post->post_parent > 0) { ?> <a href="<?php echo get_permalink($post->post_parent); ?> "><?php _e('Blog post related to this video', 'external-videos'); ?> </a> <?php } ?> <br /> <?php if ($features_3_0) { ?> <a href="<?php the_permalink(); ?> "><?php _e('Video page', 'external-videos'); ?> </a> <?php } ?> </div> <div style="margin-bottom:10px;"> <?php echo $desc; ?> </div> <div style="text-align: center;"> <input type="submit" id="Login" value="OK" onclick="tb_remove()"/> </div> </div> <?php } ?> </div> <?php } ?> <div style="clear: both;"></div> </div> <?php // if ( $wp_the_query->max_num_pages > 1 ) : ?> <br /> <div id="nav-below" class="navigation"> <div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">←</span> Older videos', 'external-videos')); ?> </div> <div class="nav-next"><?php previous_posts_link(__('Newer videos <span class="meta-nav">→</span>', 'external-videos')); ?> </div> </div><!-- #nav-below --> <?php // endif; ?> <?php }
public function test_shortcode_should_make_link_for_unknown_url() { $url = 'http://example.com/embed/foo'; $actual = $this->wp_embed->shortcode(array(), $url); $this->assertEquals('<a href="' . esc_url($url) . '">' . esc_html($url) . '</a>', $actual); }
/** * * * @param null $id * @param null $type */ function focus_post_video($id = null, $type = null) { if (empty($id)) { $id = get_the_ID(); } if (empty($type)) { $type = 'public'; } $video = get_post_meta(get_the_ID(), 'focus_video', true); // Gives child themes a chance to change the video type being displayed $type = apply_filters('focus_video_type', $type, $video, $id); if (empty($video[$type]['type'])) { return; } if (empty($video[$type][$video[$type]['type']])) { return; } switch ($video[$type]['type']) { case 'self': case 'remote': $file = $video[$type]['type'] == 'self' ? wp_get_attachment_url($video[$type]['self']) : esc_url($video[$type]['remote']); ?> <div class="jp-video"> <div class="jp-type-single" id="jp_interface_1"> <div id="jquery_jplayer_1" class="jp-jplayer" data-video="<?php echo esc_attr($file); ?> " <?php do_action('focus_video_selfhosted_attrs'); ?> ></div> <?php do_action('focus_video_play_button'); ?> <div class="jp-gui"> <ul class="jp-controls"> <li><a href="#" class="jp-play" tabindex="1"><?php esc_html_e('play', 'focus'); ?> </a></li> <li><a href="#" class="jp-pause" tabindex="1"><?php esc_html_e('pause', 'focus'); ?> </a></li> <li><a href="#" class="jp-stop" tabindex="1"><?php esc_html_e('stop', 'focus'); ?> </a></li> <li><a href="#" class="jp-full-screen" tabindex="1"><?php esc_html_e('full screen', 'focus'); ?> </a></li> <li><a href="#" class="jp-restore-screen" tabindex="1"><?php esc_html_e('restore screen', 'focus'); ?> </a></li> <li><a href="#" class="jp-mute" tabindex="1"><?php esc_html_e('mute', 'focus'); ?> </a></li> <li><a href="#" class="jp-unmute" tabindex="1"><?php esc_html_e('unmute', 'focus'); ?> </a></li> </ul> <div class="sep jp-controls-sep"></div> <div class="jp-progress"> <div class="jp-seek-bar"> <div class="jp-play-bar"><div class="jp-play-bar-marker"></div></div> </div> </div> <div class="jp-time-info"> <div class="jp-current-time"></div> / <div class="jp-duration"></div> </div> <div class="sep jp-time-sep"></div> <div class="jp-volume-bar"> <div class="jp-volume-bar-value"></div> </div> <div class="sep jp-full-sep"></div> </div> </div> </div> <?php break; case 'external': $embed = new WP_Embed(); $code = $embed->shortcode(array('autoplay' => 1, 'width' => 960), $video[$type]['external']); $code = apply_filters('focus_video_embed_code', $code); echo $code; break; case 'custom': if (!empty($video[$type]['custom'])) { echo apply_filters('focus_video_embed_code', $video[$type]['custom']); } break; } }