本文整理汇总了PHP中wp_oembed_get函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_oembed_get函数的具体用法?PHP wp_oembed_get怎么用?PHP wp_oembed_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_oembed_get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: widget
/**
* 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'];
}
开发者ID:iq007,项目名称:MadScape,代码行数:35,代码来源:video.php
示例2: widget
/**
* 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;
}
开发者ID:phuthuytinhoc,项目名称:Demo1,代码行数:36,代码来源:magazilla-video.php
示例3: handle_get_oembed_by_url
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;
}
开发者ID:ahmedghazi,项目名称:hornof,代码行数:7,代码来源:data.php
示例4: et_pb_video_get_oembed_thumbnail
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;
}
开发者ID:pacificano,项目名称:pacificano,代码行数:25,代码来源:core.php
示例5: ut_get_video_player
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);
}
开发者ID:amptdesign,项目名称:ampt-2016,代码行数:25,代码来源:ut-ajax-player.php
示例6: widget
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;
}
开发者ID:phupx,项目名称:genco,代码行数:30,代码来源:widget-video.php
示例7: ebor_hero_video_popup_shortcode
/**
* 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;
}
开发者ID:tommusrhodus,项目名称:Ebor-Framework,代码行数:32,代码来源:vc_hero_video_block.php
示例8: block
function block($instance)
{
extract($instance);
if ($link) {
echo '<figure class="media-wrapper player portfolio">' . wp_oembed_get(esc_url($link)) . '</figure>';
}
}
开发者ID:misfist,项目名称:loom-theme,代码行数:7,代码来源:video_block.php
示例9: ebor_video_inline_shortcode
/**
* 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;
}
开发者ID:tommusrhodus,项目名称:Ebor-Framework,代码行数:33,代码来源:vc_inline_video_block.php
示例10: widget
/**
* 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;
}
开发者ID:sergey-h,项目名称:naman,代码行数:37,代码来源:widget-video.php
示例11: test_youtube_com_mobile_embed
/**
* 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);
}
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:12,代码来源:oembed.php
示例12: video_code
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;
}
}
开发者ID:DonMehdi,项目名称:wordpress_website,代码行数:26,代码来源:so-slider-widget.php
示例13: ebor_modal_shortcode
/**
* 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">
► ' . $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;
}
开发者ID:tommusrhodus,项目名称:Ebor-Framework,代码行数:62,代码来源:vc_modal_block.php
示例14: ale_featured_video
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>';
}
开发者ID:BMNTeam,项目名称:myFirstThemeToTf,代码行数:8,代码来源:shortcodes.php
示例15: st_restaurent_video
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>";
}
}
}
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:8,代码来源:restaurent.php
示例16: get_embed
static function get_embed($url)
{
$embed = wp_oembed_get(esc_url($url));
if ($embed) {
return $embed;
} else {
return 'Embed not available.';
}
}
开发者ID:luskyj89,项目名称:mt-wordpress,代码行数:9,代码来源:oembed.php
示例17: ajax_Video_Popup
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;
}
开发者ID:jimmitjoo,项目名称:mnh,代码行数:9,代码来源:backend.php
示例18: render_widget
/**
* 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');
}
}
开发者ID:Viktor777,项目名称:wp-customize-builder,代码行数:16,代码来源:Video.php
示例19: hippo_shortcode_hippo_oembed
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();
}
开发者ID:estrategasdigitales,项目名称:flazam,代码行数:9,代码来源:extras.php
示例20: wp_oembed_get
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;
}
开发者ID:jorgesoulness,项目名称:mexifilter,代码行数:10,代码来源:oembed.php
注:本文中的wp_oembed_get函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论