/**
  * @since       3.6.1
  * @return      string      The generate HTML output.
  */
 public function _replyToProcessShortcode_embed($aAttributes, $sURL, $sShortcode = '')
 {
     $sURL = isset($aAttributes['src']) ? $aAttributes['src'] : $sURL;
     $_sHTML = wp_oembed_get($sURL);
     // If there was a result, return it
     if ($_sHTML) {
         // This filter is documented in wp-includes/class-wp-embed.php
         return "<div class='video oembed'>" . apply_filters('embed_oembed_html', $_sHTML, $sURL, $aAttributes, 0) . "</div>";
     }
     // If not found, return the link.
     $_oWPEmbed = new WP_Embed();
     return "<div class='video oembed'>" . $_oWPEmbed->maybe_make_link($sURL) . "</div>";
 }
コード例 #2
0
ファイル: video.php プロジェクト: iq007/MadScape
 /**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  * @since 1.0.0
  *
  * @param array $args     Widget arguments.
  * @param array $instance Saved values from database.
  */
 function widget($args, $instance)
 {
     $title = isset($instance['title']) ? apply_filters('widget_title', $instance['title']) : '';
     $video_url = isset($instance['video_url']) ? $instance['video_url'] : '';
     $description = isset($instance['video_description']) ? $instance['video_description'] : '';
     // Before widget WP hook
     echo $args['before_widget'];
     // Show widget title
     if ($title) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     // Show video
     if ($video_url) {
         echo '<div class="responsive-video-wrap clr">';
         echo wp_oembed_get($video_url, array('width' => 270));
         echo '</div>';
     } else {
         esc_html_e('You forgot to enter a video URL.', 'total');
     }
     // Show video description if field isn't empty
     if ($description) {
         echo '<div class="wpex-video-widget-description">' . wpex_sanitize_data($description, 'html') . '</div>';
     }
     // After widget WP hook
     echo $args['after_widget'];
 }
コード例 #3
0
    /**
     * Front-end display of widget
     **/
    public function widget($args, $instance)
    {
        global $before_widget, $after_widget, $before_title, $after_title;
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $video_url = $instance['video_url'];
        $video_title = $instance['video_title'];
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        $video_embed = wp_oembed_get($video_url);
        ?>

            <div class="widget-body">
                <div class="module-body">
                    <div class="magazilla_featured_video">
                        <?php 
        echo '<figure class="magazilla_featured_video_wrapper">' . $video_embed . '</figure>';
        ?>
                        
                    </div>
                    
                    <h4 class="heading"><?php 
        echo $video_title;
        ?>
</h4>
                </div>	
            </div>
			
	    <?php 
        echo $after_widget;
    }
コード例 #4
0
ファイル: core.php プロジェクト: pacificano/pacificano
function et_pb_video_get_oembed_thumbnail()
{
    if (!wp_verify_nonce($_POST['et_admin_load_nonce'], 'et_admin_load_nonce')) {
        die(-1);
    }
    if (!current_user_can('edit_posts')) {
        die(-1);
    }
    $video_url = esc_url($_POST['et_video_url']);
    if (false !== wp_oembed_get($video_url)) {
        // Get image thumbnail
        add_filter('oembed_dataparse', 'et_pb_video_oembed_data_parse', 10, 3);
        // Save thumbnail
        $image_src = wp_oembed_get($video_url);
        // Set back to normal
        remove_filter('oembed_dataparse', 'et_pb_video_oembed_data_parse', 10, 3);
        if ('' === $image_src) {
            die(-1);
        }
        echo esc_url($image_src);
    } else {
        die(-1);
    }
    die;
}
コード例 #5
0
ファイル: widget-video.php プロジェクト: phupx/genco
 function widget($args, $instance)
 {
     extract($args);
     /* Our variables from the widget settings. */
     $title = apply_filters('widget_title', $instance['title']);
     $content = $instance['content'];
     $link = $instance['link'];
     $include_border = $instance['include_border'];
     /* Before widget (defined by themes). */
     echo $before_widget;
     /* Display the widget title if one was input (before and after defined by themes). */
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     echo '<p>' . do_shortcode($content) . '</p>';
     $embed_code = wp_oembed_get($link, array('width' => 247, 'height' => 139));
     $inc_border = "";
     if ($include_border == 'yes') {
         $inc_border = " hb-box-frame";
     }
     if ($embed_code) {
         echo '<div class="fitVids' . $inc_border . '"><span>';
         echo $embed_code;
         echo '</span></div>';
     } else {
         echo "[Video Widget Error] Sorry, but the URL you entered is not supported. Check <a href=\"http://codex.wordpress.org/Embeds\">http://codex.wordpress.org/Embeds</a> for more info.";
     }
     /* After widget (defined by themes). */
     echo $after_widget;
 }
コード例 #6
0
ファイル: data.php プロジェクト: ahmedghazi/hornof
function handle_get_oembed_by_url()
{
    $url = $_REQUEST['url'];
    $embed_code = wp_oembed_get($url, array('width' => '100%', 'height' => '100%', 'autoplay' => 1));
    echo $embed_code;
    die;
}
コード例 #7
0
/**
 * The Shortcode
 */
function ebor_hero_video_popup_shortcode($atts, $content = null)
{
    extract(shortcode_atts(array('embed' => '', 'image' => ''), $atts));
    $output = '
		<div class="cta-video imagebg space--lg" data-overlay="4">
			<div class="background-image-holder">
				' . wp_get_attachment_image($image, 'full') . '
			</div>
			<div class="container-fluid">
				<div class="row">
					<div class="col-sm-10 col-sm-offset-1 text-center">
						<div class="modal-instance">
							<div class="video-play-icon modal-trigger"></div>
							<div class="modal-container">
								<div class="modal-content bg--dark" data-width="70%" data-height="70%">
									' . wp_oembed_get($embed) . '
								</div><!--end of modal-content-->
							</div><!--end of modal-container-->
						</div><!--end of modal instance-->
						<div class="wpb_text_column">
						' . do_shortcode(htmlspecialchars_decode($content)) . '
						</div>
					</div>
				</div><!--end of row-->
			</div><!--end of container-->
		</div>
	';
    return $output;
}
コード例 #8
0
 function ut_get_video_player()
 {
     /* get video to check */
     $video = $_POST['video'];
     /* needed variables */
     $embed_code = NULL;
     /* check if youtube has been used */
     preg_match('~(?:http|https|)(?::\\/\\/|)(?:www.|)(?:youtu\\.be\\/|youtube\\.com(?:\\/embed\\/|\\/v\\/|\\/watch\\?v=|\\/ytscreeningroom\\?v=|\\/feeds\\/api\\/videos\\/|\\/user\\S*[^\\w\\-\\s]|\\S*[^\\w\\-\\s]))([\\w\\-]{11})[a-z0-9;:@#?&%=+\\/\\$_.-]*~i', trim($video), $matches);
     if (!empty($matches[1])) {
         $embed_code = '<iframe height="315" width="560" src="http://www.youtube.com/embed/' . trim($matches[1]) . '?wmode=transparent&vq=hd720&autoplay=1" wmode="Opaque" allowfullscreen="" frameborder="0"></iframe>';
     }
     /* no video found so far , try to create a player  */
     if (empty($embed_code)) {
         $video_embed = wp_oembed_get(trim($video));
         if (!empty($video_embed)) {
             $embed_code = $video_embed;
         }
     }
     /* still no video found , let's try to apply a shortcode */
     if (empty($embed_code)) {
         $embed_code = do_shortcode(stripslashes($video));
     }
     echo $embed_code;
     die(1);
 }
コード例 #9
0
ファイル: video_block.php プロジェクト: misfist/loom-theme
 function block($instance)
 {
     extract($instance);
     if ($link) {
         echo '<figure class="media-wrapper player portfolio">' . wp_oembed_get(esc_url($link)) . '</figure>';
     }
 }
コード例 #10
0
ファイル: widget-video.php プロジェクト: sergey-h/naman
 /**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  * @since 1.0.0
  *
  * @param array $args     Widget arguments.
  * @param array $instance Saved values from database.
  */
 function widget($args, $instance)
 {
     // Extract args
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     $video_url = isset($instance['video_url']) ? $instance['video_url'] : '';
     $description = isset($instance['video_description']) ? $instance['video_description'] : '';
     // Before widget WP hook
     echo $before_widget;
     // Show widget title
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     // Define video height and width
     $video_size = array('width' => 270);
     // Show video
     if ($video_url) {
         echo '<div class="wpex-video-embed clr">' . wp_oembed_get($video_url, $video_size) . '</div>';
     } else {
         _e('You forgot to enter a video URL.', 'wpex');
     }
     // Show video description if field isn't empty
     if ($description) {
         echo '<div class="wpex-video-widget-description">' . $description . '</div>';
     }
     // After widget WP hook
     echo $after_widget;
 }
コード例 #11
0
/**
 * The Shortcode
 */
function ebor_video_inline_shortcode($atts)
{
    extract(shortcode_atts(array('layout' => 'local', 'image' => '', 'video' => '', 'mpfour' => '', 'ogv' => '', 'webm' => '', 'embed' => ''), $atts));
    if ('local' == $layout) {
        $output = '
			<div class="video-cover">
				<div class="background-image-holder">
					' . wp_get_attachment_image($image, 'full') . '
				</div>
				<div class="video-play-icon"></div>
				<video controls>
					<source src="' . esc_url($webm) . '" type="video/webm">
					<source src="' . esc_url($mpfour) . '" type="video/mp4">
					<source src="' . esc_url($ogv) . '" type="video/ogg">	
				</video>
			</div>
		';
    } elseif ('embed' == $layout) {
        $output = '
			<div class="video-cover">
				<div class="background-image-holder">
					' . wp_get_attachment_image($image, 'full') . '
				</div>
				<div class="video-play-icon "></div>
				' . wp_oembed_get($embed, array('height' => '300')) . '
			</div>
		';
    }
    return $output;
}
コード例 #12
0
 /**
  * Test m.youtube.com embeds
  *
  * @ticket 32714
  */
 function test_youtube_com_mobile_embed()
 {
     $out = wp_oembed_get('http://m.youtube.com/watch?v=oHg5SJYRHA0');
     $this->assertContains('https://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed', $out);
     $out = wp_oembed_get('https://m.youtube.com/watch?v=oHg5SJYRHA0');
     $this->assertContains('https://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed', $out);
 }
コード例 #13
0
 function video_code($videos, $classes = array())
 {
     if (empty($videos)) {
         return;
     }
     $video_element = '<video class="' . esc_attr(implode(',', $classes)) . '" autoplay loop muted>';
     foreach ($videos as $video) {
         if (empty($video['file']) && empty($video['url'])) {
             continue;
         }
         if (empty($video['url'])) {
             $video_file = wp_get_attachment_url($video['file']);
             $video_element .= '<source src="' . sow_esc_url($video_file) . '" type="' . esc_attr($video['format']) . '">';
         } else {
             $args = '';
             if (!empty($video['height'])) {
                 $args['height'] = $video['height'];
             }
             echo wp_oembed_get($video['url'], $args);
         }
     }
     if (strpos($video_element, 'source') !== false) {
         $video_element .= '</video>';
         echo $video_element;
     }
 }
コード例 #14
0
/**
 * The Shortcode
 */
function ebor_modal_shortcode($atts, $content = null)
{
    extract(shortcode_atts(array('image' => false, 'fullscreen' => 'no', 'button_text' => '', 'icon' => '', 'delay' => false, 'align' => 'text-center', 'cookie' => false, 'manual_id' => false, 'video' => '', 'width' => '60', 'height' => '60'), $atts));
    if ($delay) {
        $delay = 'data-autoshow="' . (int) $delay . '"';
    }
    if ($video) {
        $output = '
			<div class="modal-instance modal-video-1">
				<div class="' . $align . '">
					<a class="btn modal-trigger" href="#">
						<span class="btn__text">
							&#9658; ' . $button_text . '
						</span>
					</a>
				</div>
				<div class="modal-container" ' . $delay . '>
					<div class="modal-content bg-dark" data-width="' . (int) $width . '%" data-height="' . (int) $height . '%">
						' . wp_oembed_get($video) . '
					</div><!--end of modal-content-->
				</div><!--end of modal-container-->
			</div><!--end of modal instance-->
		';
    } else {
        $output = '
			<div class="modal-instance">
				<div class="' . $align . '">
					<a class="btn modal-trigger" href="#">
						<span class="btn__text"><i class="' . $icon . '"></i> ' . $button_text . '</span>
					</a>
				</div>
				<div class="modal-container" ' . $delay . '>
		';
        if ($image) {
            $output .= '
					<div class="modal-content bg-white imagebg" data-width="' . (int) $width . '%" data-height="' . (int) $height . '%" data-overlay="5">
						<div class="background-image-holder">
							' . wp_get_attachment_image($image, 'full') . '
						</div>
						<div class="pos-vertical-center clearfix">
							<div class="col-sm-6 col-sm-offset-1">
			';
        } else {
            $output .= '
				<div class="modal-content bg--white height--natural">
					<div class="form-subscribe-1 boxed boxed--lg bg--white box-shadow-wide">
							<div class="subscribe__title text-center">
			';
        }
        $output .= do_shortcode($content) . '
							</div>
						</div>
					</div><!--end of modal-content-->
				</div><!--end of modal-container-->
			</div><!--end of modal instance-->
		';
    }
    return $output;
}
コード例 #15
0
 function st_restaurent_video($attr = array())
 {
     if (is_singular('st_restaurent')) {
         if ($video = get_post_meta(get_the_ID(), 'video', true)) {
             return "<div class='media-responsive'>" . wp_oembed_get($video) . "</div>";
         }
     }
 }
コード例 #16
0
function ale_featured_video($atts, $content = null)
{
    extract(shortcode_atts(array('url' => ''), $atts));
    if (!$url) {
        return '';
    }
    return '<p class="video">' . wp_oembed_get($url, array('width' => '900', 'height' => '600')) . '</p>';
}
コード例 #17
0
ファイル: oembed.php プロジェクト: luskyj89/mt-wordpress
 static function get_embed($url)
 {
     $embed = wp_oembed_get(esc_url($url));
     if ($embed) {
         return $embed;
     } else {
         return 'Embed not available.';
     }
 }
コード例 #18
0
 /**
  * Display widget content on frontend
  *
  * @param array  $data
  * @param string $id
  * @param int    $number
  */
 public static function render_widget(array $data, $id, $number)
 {
     if (!empty($data['video'])) {
         echo wp_oembed_get($data['video']);
     }
     if (!empty($data['thumbnail']) && ($image_id = absint(attachment_url_to_postid($data['thumbnail']))) && wp_attachment_is_image($image_id)) {
         echo wp_get_attachment_image($image_id, 'medium');
     }
 }
コード例 #19
0
ファイル: backend.php プロジェクト: jimmitjoo/mnh
 public function ajax_Video_Popup()
 {
     $postconfig = get_post_meta($_POST['id'], 'wpo_portfolio', true);
     $content = wp_oembed_get($postconfig['video_link']);
     echo '<div class="video-responsive">';
     echo $content;
     echo '</div>';
     die;
 }
コード例 #20
0
ファイル: extras.php プロジェクト: estrategasdigitales/flazam
function hippo_shortcode_hippo_oembed($atts, $contents = '')
{
    $attributes = shortcode_atts(array('link' => ''), $atts);
    ob_start();
    echo '<div class="hippo-oembed">';
    echo wp_oembed_get($attributes['link']);
    echo '</div>';
    return ob_get_clean();
}
コード例 #21
0
ファイル: oembed.php プロジェクト: jorgesoulness/mexifilter
 function wp_oembed_get($url = '', $width = 0, $height = 0)
 {
     // vars
     $embed = '';
     $res = array('width' => $width, 'height' => $height);
     // get emebed
     $embed = @wp_oembed_get($url, $res);
     // return
     return $embed;
 }
コード例 #22
0
ファイル: video.php プロジェクト: WestBayResidential/wbrsorg
 public function widget($args, $instance)
 {
     extract($args);
     extract($instance);
     $title = apply_filters('widget_title', esc_attr($instance['title']));
     $embed_code = wp_oembed_get($instance['video_link'], array('width' => $instance['video_width']));
     echo $before_widget;
     require $this->renderLayout('default');
     echo $after_widget;
 }
コード例 #23
0
 public static function display_footage($data, $provider = 'http://www.youtube.com/watch?v=')
 {
     $output = '';
     if (is_array($data)) {
         foreach ($data as $label => $id) {
             $output .= '<div class="inbl"><h3 id="' . $id . '">' . $label . '</h3>' . '<p>' . wp_oembed_get(esc_url($provider . $id)) . '</p></div>';
         }
     }
     return $output;
 }
コード例 #24
0
ファイル: video.php プロジェクト: k2jysy/mergeshop
    public function render($atts)
    {
        $class = $atts['class'] != '' ? " " . $atts['class'] : "";
        $output = '
				<div class="video-responsive' . $class . '">
					' . wp_oembed_get($atts["link"]) . '
				</div>
			';
        return $output;
    }
コード例 #25
0
ファイル: oembed.php プロジェクト: dsasko/meta-box
 /**
  * Get embed html from url
  *
  * @param string $url
  *
  * @return string
  */
 static function get_embed($url)
 {
     // Try oembed first
     $embed = wp_oembed_get($url);
     // If no oembed provides found, try WordPress auto embed
     if (!$embed) {
         $embed = $GLOBALS['wp_embed']->shortcode(array(), $url);
     }
     return $embed ? $embed : __('Embed HTML not available.', 'meta-box');
 }
コード例 #26
0
ファイル: meta-boxes.php プロジェクト: narendra-addweb/m1
/**
 * Render "Featured Video" meta box
 *
 * @since 1.0.0
 *
 * @param WP_Post $post Post object
 */
function appica_render_video_meta_box($post)
{
    wp_nonce_field('appica_mb_nonce', 'appica_mb_nonce_field');
    $meta_box_name = '_appica_featured_video';
    $meta_box_value = get_post_meta($post->ID, $meta_box_name, true);
    $video = '';
    if (!empty($meta_box_value)) {
        $video = wp_oembed_get($meta_box_value);
    }
    printf('<div class="appica-video-holder">%1$s</div>', $video);
    printf('<input type="text" class="%2$s widefat" id="appica-featured-video" name="%2$s" value="%1$s" placeholder="%3$s">', esc_url_raw($meta_box_value), $meta_box_name, __('Video URL', 'appica'));
}
コード例 #27
0
 public static function _action_get_oembed_response()
 {
     if (wp_verify_nonce(FW_Request::POST('_nonce'), '_action_get_oembed_response')) {
         $url = FW_Request::POST('url');
         $width = FW_Request::POST('preview/width');
         $height = FW_Request::POST('preview/height');
         $keep_ratio = FW_Request::POST('preview/keep_ratio') === 'true';
         $iframe = empty($keep_ratio) ? fw_oembed_get($url, compact('width', 'height')) : wp_oembed_get($url, compact('width', 'height'));
         wp_send_json_success(array('response' => $iframe));
     }
     wp_send_json_error(array('message' => 'Invalid nonce'));
 }
コード例 #28
0
ファイル: content.php プロジェクト: devmoonshine/development
function mediaholder($type, $format, $imagesize, $videoURL, $audioURL, $gallery)
{
    $out = $post_thumbnail_big = $thumbnail_big = '';
    $rand = rand();
    $out .= '<div class="single-media clearfix">';
    if ($format == 'Video' && $videoURL) {
        $out .= '<div class="video-container">';
        $embed_args = array('title' => 0, 'byline' => 0, 'portrait' => 0, 'color' => 'ffffff', 'rel' => 0, 'showinfo' => 0);
        $out .= wp_oembed_get($videoURL, $embed_args);
        $out .= '</div>';
    } else {
        if ($format == 'Audio' && $audioURL) {
            $out .= '<div class="audio-container">';
            $out .= wp_oembed_get($audioURL);
            $out .= '</div>';
        } else {
            if ($format == 'Gallery' && $gallery) {
                wp_enqueue_style('owl-carousel');
                wp_enqueue_script('owl-carousel');
                $out .= '<div class="rd_slides" data-navigation="yes" data-auto="5">';
                foreach ($gallery as $image) {
                    if (!empty($image['alt'])) {
                        $alt = $image['alt'];
                    } else {
                        $alt = $image['title'];
                    }
                    $img_src = $image['sizes'][$imagesize];
                    $size = GetImageSize($img_src);
                    $out .= '<div>';
                    $out .= '<a href="' . $image['url'] . '" title="' . $alt . '" data-gal="lightbox[' . $rand . ']" class="prettyphoto">';
                    $out .= '<img src="' . $img_src . '" alt="' . $alt . '" width="' . $size[0] . '" height="' . $size[1] . '" />';
                    $out .= '</a>';
                    $out .= '</div>';
                }
                $out .= '</div>';
            } else {
                if (has_post_thumbnail()) {
                    $thumbnail_big = get_the_post_thumbnail(get_the_ID(), $imagesize);
                    $image_attributes = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full');
                    if ($type == 'single') {
                        $out .= '<a href="' . $image_attributes[0] . '" title="' . get_the_title(get_post_thumbnail_id(get_the_ID())) . '" data-gal="lightbox" class="prettyphoto">' . $thumbnail_big . '</a>';
                    } else {
                        $out .= '<a href="' . get_permalink(get_the_ID()) . '" title="' . get_the_title(get_the_ID()) . '">' . $thumbnail_big . '</a>';
                    }
                } else {
                }
            }
        }
    }
    $out .= '</div>';
    return $out;
}
コード例 #29
0
ファイル: gabfire-media.php プロジェクト: wpmonty/99-demos
    function gabfire_call_iframe($parameters)
    {
        global $gab_iframe;
        $videourl = wp_oembed_get($gab_iframe);
        preg_match('/src="([^"]+)"/', $videourl, $match);
        $videourl = $match[1];
        echo '
			<span class="cf_video ' . $parameters['thumb_align'] . '">		
				<iframe title="';
        the_title('');
        echo '" src="' . esc_url($videourl) . '?wmode=opaque&amp;wmode=opaque&amp;showinfo=0&amp;autohide=1" width="' . $parameters['media_width'] . '" height="' . $parameters['media_height'] . '" allowfullscreen></iframe>
			</span>';
    }
コード例 #30
0
 function wpex_post_video()
 {
     global $post;
     $post_id = $post->ID;
     $video_url = get_post_meta($post_id, 'wpex_post_video', true);
     if ($video_url == '') {
         return;
     }
     $embed_code = wp_oembed_get($video_url);
     if ($video_url !== '' && !is_wp_error($embed_code)) {
         echo '<div class="post-video wpex-video-embed clr">' . $embed_code . '</div>';
     }
 }