Beispiel #1
1
 /**
  * Returns the featured video html, ready to echo.
  *
  * @since 1.0.0
  *
  * @param int $post_id
  * @param string|array $size
  */
 public function get_the_post_video($post_id = null, $size = null)
 {
     $post_id = null === $post_id ? get_the_ID() : $post_id;
     if (!has_post_video($post_id)) {
         return '';
     }
     $meta = get_post_meta($post_id, '_fvp_video', true);
     $options = get_option('fvp-settings');
     // Extract default and default->general options for easy access.
     $defaults = !empty($options['default_args']) ? $options['default_args'] : array();
     $general = !empty($defaults['general']) ? $defaults['general'] : array();
     // Autoplay option. Suppressed when viewing admin.
     $general['autoplay'] = (defined('DOING_AJAX') && DOING_AJAX || !is_admin()) && !empty($general['autoplay']) && $general['autoplay'] ? '1' : null;
     // Responsive scaling option. Not used when viewing the admin screen.
     $responsive = !empty($options['sizing']['responsive']) && $options['sizing']['responsive'] && (defined('DOING_AJAX') && DOING_AJAX || !is_admin());
     // Alignment option
     $align = !empty($options['alignment']) ? $options['alignment'] : 'center';
     $args = array('id' => !empty($meta['id']) ? $meta['id'] : null, 'provider' => !empty($meta['provider']) ? $meta['provider'] : null);
     $provider = $args['provider'];
     switch ($provider) {
         case 'local':
             $img_meta = wp_get_attachment_metadata($meta['id']);
             $size = $this->get_size($size, array('width' => !empty($img_meta['width']) ? $img_meta['width'] : null, 'height' => !empty($img_meta['height']) ? $img_meta['height'] : null));
             $atts = array('src' => wp_get_attachment_url($meta['id']), 'autoplay' => $general['autoplay'] ? 'on' : null, 'loop' => !empty($general['loop']) ? 'on' : null, 'width' => $responsive ? $size['width'] * 8 : $size['width'], 'height' => $responsive ? $size['height'] * 8 : $size['height']);
             $args = array_merge($args, $atts);
             $embed = wp_video_shortcode($atts);
             $embed = apply_filters('fvp-local', $embed, $args);
             break;
         case 'raw':
             $embed = $meta['full'];
             break;
         default:
             $atts = array_merge($general, $this->get_size($size), !empty($defaults[$provider]) ? $defaults[$provider] : array(), isset($meta['parameters']) ? $meta['parameters'] : array());
             $args = array_merge($args, $atts);
             $embed = $this->oembed->get_html($meta['full'], $atts, $provider);
             $embed = apply_filters('fvp-oembed', $embed, $args);
             break;
     }
     if (empty($embed)) {
         return '';
     }
     $classnames = array('featured-video-plus' => true, 'post-thumbnail' => true, 'fvp-responsive' => $responsive);
     $classnames['fvp-' . $provider] = !empty($provider);
     $classnames['fvp-' . $align] = !empty($align);
     $embed = sprintf("<!-- Featured Video Plus v%s -->\n<div%s>%s</div>\n\n", FVP_VERSION, FVP_HTML::class_names($classnames, true, true), $embed);
     return $embed;
 }
Beispiel #2
1
while (have_posts()) {
    the_post();
    ?>
				<article <?php 
    post_class();
    ?>
>
					<header class="entry-header">
						<h1 class="entry-title"><?php 
    the_title();
    ?>
</h1>
					</header><!-- .entry-header -->
					<div class="entry-content entry-attachment">
						<?php 
    echo wp_video_shortcode(array('src' => wp_get_attachment_url()));
    ?>

						<p><strong><?php 
    _e('URL:', 'odin');
    ?>
</strong> <a href="<?php 
    echo wp_get_attachment_url();
    ?>
" title="<?php 
    the_title_attribute();
    ?>
" rel="attachment"><span><?php 
    echo basename(wp_get_attachment_url());
    ?>
</span></a></p>
 public function get_html($media)
 {
     if (!$media) {
         return '';
     }
     $html = '';
     $args = array('src' => mpp_get_media_src($media), 'poster' => mpp_get_media_src('thumbnail', $media));
     return wp_video_shortcode($args);
 }
function tm_player($player = '', $args = array())
{
    if (empty($player) || empty($args['files'])) {
        return;
    }
    $defaults = array('files' => array(), 'poster' => '', 'autoplay' => false);
    $args = wp_parse_args($args, $defaults);
    extract($args);
    /* JWPlayer */
    if ($player == 'jwplayer') {
        $options = array('file' => trim($files[0]), 'image' => $poster);
        $atts = arr2atts($options);
        $jwplayer_shortcode = '[jwplayer' . $atts . ']';
        echo apply_filters('tm_video_filter', $jwplayer_shortcode);
    } elseif ($player == 'flowplayer' && function_exists('flowplayer_content_handle')) {
        $atts = array('splash' => $poster);
        foreach ($files as $key => $file) {
            $att = $key == 0 ? 'src' : 'src' . $key;
            $atts[$att] = $file;
        }
        echo flowplayer_content_handle($atts, '', '');
        tm_flowplayer_script();
    } elseif ($player == 'videojs' && function_exists('video_shortcode')) {
        $atts = array('poster' => $poster);
        foreach ($files as $key => $file) {
            $att = $key == 0 ? 'src' : 'src' . $key;
            if (strpos($file, '.mp4') !== false) {
                $atts['mp4'] = $file;
            }
            if (strpos($file, '.webm') !== false) {
                $atts['webm'] = $file;
            }
            if (strpos($file, '.ogg') !== false) {
                $atts['ogg'] = $file;
            }
        }
        echo video_shortcode($atts, '', '');
        tm_add_videojs_swf();
    } else {
        $atts = array();
        foreach ($files as $file) {
            $file = trim($file);
            if (strpos($file, 'youtube.com') !== false) {
                $atts['youtube'] = $file;
            } else {
                $type = wp_check_filetype($file, wp_get_mime_types());
                $atts[$type['ext']] = $file;
            }
        }
        echo wp_video_shortcode($atts);
    }
}
Beispiel #5
0
/**
 * This will add portfolio media content to the start of the content
 * Override this functionality in a theme by removing the filter.
 * 
 * @param  string $content The content
 * @return string          The updated content
 */
function tzp_add_portfolio_post_media($content)
{
    global $post;
    if ($post->post_type == 'portfolio') {
        $display_gallery = get_post_meta($post->ID, '_tzp_display_gallery', true);
        $display_audio = get_post_meta($post->ID, '_tzp_display_audio', true);
        $display_video = get_post_meta($post->ID, '_tzp_display_video', true);
        if ($display_gallery || $display_audio || $display_video) {
            $output = '<div class="portfolio-media">';
            if ($display_gallery) {
                $output .= tzp_portfolio_gallery($post->ID);
            }
            if ($display_audio) {
                $poster = get_post_meta($post->ID, '_tzp_audio_poster_url', true);
                if ($poster) {
                    $output .= sprintf('<img src="%1$s" alt="" />', esc_url($poster));
                }
                $mp3 = get_post_meta($post->ID, '_tzp_audio_file_mp3', true);
                $ogg = get_post_meta($post->ID, '_tzp_audio_file_ogg', true);
                $attr = array('mp3' => $mp3, 'ogg' => $ogg);
                $output .= wp_audio_shortcode($attr);
            }
            if ($display_video) {
                $embed = get_post_meta($post->ID, '_tzp_video_embed', true);
                if ($embed) {
                    $output .= html_entity_decode(esc_html($embed));
                } else {
                    $poster = get_post_meta($post->ID, '_tzp_video_poster_url', true);
                    $m4v = get_post_meta($post->ID, '_tzp_video_file_m4v', true);
                    $ogv = get_post_meta($post->ID, '_tzp_video_file_ogv', true);
                    $mp4 = get_post_meta($post->ID, '_tzp_video_file_mp4', true);
                    $attr = array('poster' => $poster, 'm4v' => $m4v, 'ogv' => $ogv, 'mp4' => $mp4);
                    $output .= wp_video_shortcode($attr);
                }
            }
            $output .= '</div>';
            return $output . $content;
        }
        return $content;
    } else {
        return $content;
    }
}
Beispiel #6
0
</h3>
				<?php 
echo wp_video_shortcode(array('mp4' => 'https://s.w.org/images/core/4.7/edit-shortcuts-v1.mp4', 'poster' => 'https://s.w.org/images/core/4.7/edit-shortcuts.jpg?v2', 'loop' => true, 'autoplay' => true, 'width' => 2520, 'height' => 1454));
?>
				<p><?php 
_e('Visible icons appear to show you which parts of your site can be customized while live previewing. Click on a shortcut and get straight to editing. Paired with starter content, getting started with customizing your site is faster than ever.');
?>
</p>
			</div>
			<div class="col">
				<h3><?php 
_e('Video Headers');
?>
</h3>
				<?php 
echo wp_video_shortcode(array('mp4' => 'https://s.w.org/images/core/4.7/header-video-v1.mp4', 'poster' => 'https://s.w.org/images/core/4.7/header-video.jpg?v2', 'loop' => true, 'autoplay' => true, 'width' => 2520, 'height' => 1454));
?>
				<p><?php 
_e('Sometimes a big atmospheric video as a moving header image is just what you need to showcase your wares; go ahead and try it out with Twenty Seventeen. Need some video inspiration? Try searching for sites with video headers available for download and use.');
?>
</p>
			</div>
		</div>

		<div class="feature-section two-col">
			<div class="col">
				<h3><?php 
_e('Smoother Menu Building');
?>
</h3>
				<img src="https://s.w.org/images/core/4.7/nav-menus-760.jpg?v2" srcset="https://s.w.org/images/core/4.7/nav-menus-760.jpg?v2 760w, https://s.w.org/images/core/4.7/nav-menus-280.jpg?v2 280w, https://s.w.org/images/core/4.7/nav-menus-536.jpg?v2 536w, https://s.w.org/images/core/4.7/nav-menus-745.jpg?v2 745w" sizes="(max-width: 500px) calc(100vw - 40px), (max-width: 781px) calc((100vw - 70px) * .466), (max-width: 959px) calc((100vw - 116px) * .469), (max-width: 1290px) calc((100vw - 240px) * .472), 496px" alt="" />
Beispiel #7
0
						</h2>
						
						<?php 
        if ($video_type_option != '') {
            switch ($video_type_option) {
                case 'youtubelink':
                    $clipid = get_post_meta($post->ID, 'video_youtube_link', true);
                    echo iva_youtube(array('clipid' => $clipid, 'width' => '', 'height' => '600'));
                    break;
                case 'vimeolink':
                    $clipid = get_post_meta($post->ID, 'video_vimeo_link', true);
                    echo iva_vimeo(array('clip_id' => $clipid, 'width' => '', 'height' => '600'));
                    break;
                case 'selfvideo':
                    $clipid = get_post_meta($post->ID, 'video_selfhost_video', true);
                    echo wp_video_shortcode(array('src' => $clipid, 'autoplay' => '', 'height' => 470, 'width' => empty($content_width) ? 740 : $content_width));
                    break;
            }
        }
        ?>
					</div><!-- .custompost_details -->

				</div><!-- .custompost_entry -->
			
			<div class="demospace" style="height:20px;"></div>

			<?php 
        the_content();
        ?>

			<?php 
Beispiel #8
0
/**
 * Displays the image and editor in the post editor
 *
 * @since 3.5.0
 */
function edit_form_image_editor($post)
{
    $open = isset($_GET['image-editor']);
    if ($open) {
        require_once ABSPATH . 'wp-admin/includes/image-edit.php';
    }
    $thumb_url = false;
    if ($attachment_id = intval($post->ID)) {
        $thumb_url = wp_get_attachment_image_src($attachment_id, array(900, 450), true);
    }
    $alt_text = get_post_meta($post->ID, '_wp_attachment_image_alt', true);
    $att_url = wp_get_attachment_url($post->ID);
    ?>
	<div class="wp_attachment_holder">
	<?php 
    if (wp_attachment_is_image($post->ID)) {
        $image_edit_button = '';
        if (wp_image_editor_supports(array('mime_type' => $post->post_mime_type))) {
            $nonce = wp_create_nonce("image_editor-{$post->ID}");
            $image_edit_button = "<input type='button' id='imgedit-open-btn-{$post->ID}' onclick='imageEdit.open( {$post->ID}, \"{$nonce}\" )' class='button' value='" . esc_attr__('Edit Image') . "' /> <span class='spinner'></span>";
        }
        ?>

		<div class="imgedit-response" id="imgedit-response-<?php 
        echo $attachment_id;
        ?>
"></div>

		<div<?php 
        if ($open) {
            echo ' style="display:none"';
        }
        ?>
 class="wp_attachment_image" id="media-head-<?php 
        echo $attachment_id;
        ?>
">
			<p id="thumbnail-head-<?php 
        echo $attachment_id;
        ?>
"><img class="thumbnail" src="<?php 
        echo set_url_scheme($thumb_url[0]);
        ?>
" style="max-width:100%" alt="" /></p>
			<p><?php 
        echo $image_edit_button;
        ?>
</p>
		</div>
		<div<?php 
        if (!$open) {
            echo ' style="display:none"';
        }
        ?>
 class="image-editor" id="image-editor-<?php 
        echo $attachment_id;
        ?>
">
			<?php 
        if ($open) {
            wp_image_editor($attachment_id);
        }
        ?>
		</div>
	<?php 
    } elseif ($attachment_id && 0 === strpos($post->post_mime_type, 'audio/')) {
        wp_maybe_generate_attachment_metadata($post);
        echo wp_audio_shortcode(array('src' => $att_url));
    } elseif ($attachment_id && 0 === strpos($post->post_mime_type, 'video/')) {
        wp_maybe_generate_attachment_metadata($post);
        $meta = wp_get_attachment_metadata($attachment_id);
        $w = !empty($meta['width']) ? min($meta['width'], 640) : 0;
        $h = !empty($meta['height']) ? $meta['height'] : 0;
        if ($h && $w < $meta['width']) {
            $h = round($meta['height'] * $w / $meta['width']);
        }
        $attr = array('src' => $att_url);
        if (!empty($w) && !empty($h)) {
            $attr['width'] = $w;
            $attr['height'] = $h;
        }
        $thumb_id = get_post_thumbnail_id($attachment_id);
        if (!empty($thumb_id)) {
            $attr['poster'] = wp_get_attachment_url($thumb_id);
        }
        echo wp_video_shortcode($attr);
    }
    ?>
	</div>
	<div class="wp_attachment_details edit-form-section">
		<p>
			<label for="attachment_caption"><strong><?php 
    _e('Caption');
    ?>
</strong></label><br />
			<textarea class="widefat" name="excerpt" id="attachment_caption"><?php 
    echo $post->post_excerpt;
    ?>
</textarea>
		</p>


	<?php 
    if ('image' === substr($post->post_mime_type, 0, 5)) {
        ?>
		<p>
			<label for="attachment_alt"><strong><?php 
        _e('Alternative Text');
        ?>
</strong></label><br />
			<input type="text" class="widefat" name="_wp_attachment_image_alt" id="attachment_alt" value="<?php 
        echo esc_attr($alt_text);
        ?>
" />
		</p>
	<?php 
    }
    ?>

	<?php 
    $quicktags_settings = array('buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close');
    $editor_args = array('textarea_name' => 'content', 'textarea_rows' => 5, 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings);
    ?>

	<label for="content"><strong><?php 
    _e('Description');
    ?>
</strong><?php 
    if (preg_match('#^(audio|video)/#', $post->post_mime_type)) {
        echo ': ' . __('Displayed on attachment pages.');
    }
    ?>
</label>
	<?php 
    wp_editor($post->post_content, 'attachment_content', $editor_args);
    ?>

	</div>
	<?php 
    $extras = get_compat_media_markup($post->ID);
    echo $extras['item'];
    echo '<input type="hidden" id="image-edit-context" value="edit-attachment" />' . "\n";
}
/**
 * Output a video field as a video player.
 *
 * @uses wp_video_shortcode()
 *
 * @since 2.5
 *
 * @param string|array   $url   Can be a URL of the source file, or a Pods video field.
 * @param bool|array     $args  Optional. Additional arguments to pass to wp_video_shortcode()
 *
 * @return string
 */
function pods_video($url, $args = false)
{
    if (is_array($url)) {
        if (!is_null(pods_v('ID', $url))) {
            $id = pods_v('ID', $url);
            $url = wp_get_attachment_url($id);
        } else {
            return;
        }
    }
    $video_args = array('src' => $url);
    if (is_array($args)) {
        $video_args = array_merge($video_args, $args);
    }
    return wp_video_shortcode($video_args);
}
Beispiel #10
0
// Exit if the file is accessed directly over web
if (!defined('ABSPATH')) {
    exit;
}
/**
 * List videos attached to activity
 * 
 */
?>
<div class=" mpp-activity-media-list mpp-activity-video-list mpp-activity-video-player">
<?php 
$ids = $media_ids;
//is there only one video attached?
if (count($ids) == 1) {
    $ids = array_pop($ids);
    $media = mpp_get_media($ids);
    $args = array('src' => mpp_get_media_src('', $media), 'poster' => mpp_get_media_src('thumbnail', $media));
    //show single video with poster
    echo wp_video_shortcode($args);
} else {
    //show all videos as playlist
    echo wp_playlist_shortcode(array('ids' => $ids, 'type' => 'video'));
}
?>
<script type='text/javascript'>
	mpp_mejs_activate(<?php 
echo bp_get_activity_id();
?>
);
</script>
</div>
 /**
  * Wrapper for wp_oembed_get/wp_video_shortcode
  *
  * @since  0.1.1
  *
  * @param  array $args Optional. Args are passed to either WP_Embed::shortcode,
  *                     or wp_video_shortcode.
  * @return mixed       The video player if successful.
  */
 public function get_video_player($args = array())
 {
     global $wp_embed;
     $media = empty($this->media) ? $this->init_media() : $this->media;
     $video = isset($media['video']) ? $media['video'] : array();
     if (!isset($video['type'])) {
         return '';
     }
     $video_url = '';
     if ('url' === $video['type']) {
         $wp_embed->post_ID = $this->ID;
         $video_player = $wp_embed->shortcode($args, $video['value']);
     } elseif ('attachment_id' === $video['type']) {
         $args['src'] = $video['attachment_url'];
         if ($video_player = wp_video_shortcode($args)) {
             $video_player = '<div class="gc-video-wrap">' . $video_player . '</div><!-- .gc-video-wrap -->';
         }
     }
     return $video_player;
 }
function powerpressplayer_build_mediaelementvideo($media_url, $EpisodeData = array(), $embed = false)
{
    if (!function_exists('wp_video_shortcode')) {
        // Return the HTML5 video shortcode instead
        return powerpressplayer_build_html5video($media_url, $EpisodeData, $embed);
    }
    $player_id = powerpressplayer_get_next_id();
    $cover_image = '';
    $player_width = '';
    $player_height = '';
    $autoplay = false;
    // Global Settings
    $Settings = get_option('powerpress_general');
    if (!empty($Settings['player_width'])) {
        $player_width = $Settings['player_width'];
    }
    if (!empty($Settings['player_height'])) {
        $player_height = $Settings['player_height'];
    }
    if (!empty($Settings['poster_image'])) {
        $cover_image = $Settings['poster_image'];
    }
    // Episode Settings
    if (!empty($EpisodeData['image'])) {
        $cover_image = $EpisodeData['image'];
    }
    if (!empty($EpisodeData['width'])) {
        $player_width = $EpisodeData['width'];
    }
    if (!empty($EpisodeData['height'])) {
        $player_height = $EpisodeData['height'];
    }
    if (!empty($EpisodeData['autoplay'])) {
        $autoplay = true;
    }
    if ($embed) {
        $player_height = '123';
        $player_width = '456';
    }
    $content = '';
    $content .= '<div class="powerpress_player" id="powerpress_player_' . $player_id . '">' . PHP_EOL;
    $attr = array('src' => $media_url, 'poster' => '', 'loop' => '', 'autoplay' => '', 'preload' => 'none');
    // , 'width'=>'', 'height'=>'');
    if (!empty($player_width)) {
        $attr['width'] = $player_width;
    }
    if (!empty($player_height)) {
        $attr['height'] = $player_height;
    }
    if (!empty($cover_image)) {
        $attr['poster'] = $cover_image;
    }
    if (!empty($autoplay)) {
        $attr['autoplay'] = 'on';
    }
    if (!empty($EpisodeData['webm_src'])) {
        $attr['webm'] = powerpress_add_flag_to_redirect_url($EpisodeData['webm_src'], 'p');
    }
    $shortcode = wp_video_shortcode($attr);
    if ($embed) {
        $shortcode = str_replace(array('"123"', '"456"', '456px;'), array('"100%"', '"100%"', '100%;'), $shortcode);
    }
    $content .= $shortcode;
    $content .= '</div>' . PHP_EOL;
    return $content;
}
			<h4><?php _e( 'Do more with audio and video' ); ?></h4>
			<p><?php _e( 'Images have galleries; now we&#8217;ve added simple audio and video playlists, so you can showcase your music and clips.' ); ?></p>
		</div>
	</div>
</div>

<hr>

<div class="changelog customize">
	<div class="feature-section col two-col">
		<div>
			<?php
				echo wp_video_shortcode( array(
					'mp4'      => '//s.w.org/images/core/3.9/widgets.mp4',
					'ogv'      => '//s.w.org/images/core/3.9/widgets.ogv',
					'webm'     => '//s.w.org/images/core/3.9/widgets.webm',
					'loop'     => true,
					'autoplay' => true,
					'width'    => 499
				) );
			?>
			<h4><?php _e( 'Live widget and header previews' ); ?></h4>
			<p><?php _e( 'Add, edit, and rearrange your site&#8217;s widgets right in the theme customizer. No &#8220;save and surprise&#8221; &mdash; preview your changes live and only save them when you&#8217;re ready.' ); ?></p>
			<p><?php _e( 'The improved header image tool also lets you upload, crop, and manage headers while customizing your theme.' ); ?></p>
		</div>
		<div class="last-feature">
			<img src="//s.w.org/images/core/3.9/theme.jpg?0" />
			<h4><?php _e( 'Stunning new theme browser' ); ?></h4>
			<p><?php _e( 'Looking for a new theme should be easy and fun. Lose yourself in the boundless supply of free WordPress.org themes with the beautiful new theme browser.' ); ?></p>
		<?php if ( current_user_can( 'install_themes' ) ) { ?>
			<p><a href="<?php echo network_admin_url( 'theme-install.php' ); ?>" class="button button-large button-primary"><?php _e( 'Browse Themes' ); ?></a></p>
		<?php } ?>
/**
 * Output the candidate video
 */
function the_candidate_video($post = null)
{
    $video = get_the_candidate_video($post);
    $video = is_ssl() ? str_replace('http:', 'https:', $video) : $video;
    $filetype = wp_check_filetype($video);
    if (!empty($filetype['ext'])) {
        $video_embed = wp_video_shortcode(array('src' => $video));
    } else {
        $video_embed = wp_oembed_get($video);
    }
    if ($video_embed) {
        echo '<div class="candidate-video">' . $video_embed . '</div>';
    }
}
	<hr />

	<div class="feature-section col two-col">
		<div class="col-1">
			<h3><?php _e( 'Focus on your content' ); ?></h3>
			<p><?php _e( 'Writing and editing is smoother and more immersive with an editor that expands to fit your content as you write, and keeps the formatting tools available at all times.' ); ?></p>
		</div>
		<div class="col-2 last-feature">
			<div class="about-video about-video-focus">
				<?php
					echo wp_video_shortcode( array(
						'mp4'      => '//s.w.org/images/core/4.0/focus.mp4',
						'ogv'      => '//s.w.org/images/core/4.0/focus.ogv',
						'webm'      => '//s.w.org/images/core/4.0/focus.webm',
						'loop'     => true,
						'autoplay' => true,
						'width'    => 500,
						'height'   => 281
					) );
				?>
			</div>
		</div>
	</div>

	<hr />

	<div class="feature-section col two-col">
		<div class="col-1">
			<img src="//s.w.org/images/core/4.0/plugins.png" />
		</div>
 function dt_sc_post($attrs, $content = null)
 {
     extract(shortcode_atts(array('id' => '1', 'read_more_text' => __('Read More', 'dt_themes'), 'excerpt_length' => 10, 'columns' => 1), $attrs));
     $p = get_post($id, 'ARRAY_A');
     $link = get_permalink($id);
     $format = get_post_format($id);
     $title = $p['post_title'];
     $author_id = $p['post_author'];
     $class = get_post_class("blog-entry no-border", $id);
     $class = implode(" ", $class);
     $tags = "";
     $terms = wp_get_post_tags($id);
     $post_meta = is_array(get_post_meta($id, '_dt_post_settings', TRUE)) ? get_post_meta($id, '_dt_post_settings', TRUE) : array();
     if (!empty($terms)) {
         $tags .= '<p class="tags"><i class="fa fa-tags"> </i>';
         foreach ($terms as $term) {
             $tags .= '<a href="' . get_term_link($term->slug, 'post_tag') . '"> ' . $term->name . '</a>,';
         }
         $tags = substr($tags, 0, -1);
         $tags .= '</p> <span> | </span> ';
     }
     $thumbnail_sidebar = '';
     $tpl_default_settings = get_post_meta(get_the_ID(), '_tpl_default_settings', TRUE);
     $tpl_default_settings = is_array($tpl_default_settings) ? $tpl_default_settings : array();
     $page_layout = array_key_exists("layout", $tpl_default_settings) ? $tpl_default_settings['layout'] : "content-full-width";
     if ($page_layout == 'with-left-sidebar' || $page_layout == 'with-right-sidebar') {
         $thumbnail_sidebar = '-single-sidebar';
     } elseif ($page_layout == 'both-sidebar') {
         $thumbnail_sidebar = '-both-sidebar';
     }
     if ($columns == 2) {
         if ($thumbnail_sidebar == "-single-sidebar") {
             $post_thumbnail = 'blog-two-column';
         } else {
             $post_thumbnail = 'blogcourse-two-column';
         }
     } elseif ($columns == 3) {
         $post_thumbnail = 'blogcourse-three-column';
     } else {
         $post_thumbnail = 'blog-one-column';
     }
     $post_thumbnail = $post_thumbnail . $thumbnail_sidebar;
     $out = '<article class="' . esc_attr($class) . '">';
     $out .= '	<div class="blog-entry-inner">';
     $out .= '		<div class="entry-thumb">';
     if ($format === "image" || empty($format)) {
         $out .= '<a href="' . esc_url($link) . '">';
         if (has_post_thumbnail($id)) {
             $out .= get_the_post_thumbnail($id, $post_thumbnail);
         } else {
             $out .= '<img src="http://placehold.it/1170x822&text=Image" alt="' . $title . '" />';
         }
         $out .= "</a>";
     } elseif ($format === "gallery" && array_key_exists("items", $post_meta)) {
         $out .= "<ul class='entry-gallery-post-slider'>";
         foreach ($post_meta['items'] as $item) {
             $attachment_id = dt_get_attachment_id_from_url($item);
             $img_attributes = wp_get_attachment_image_src($attachment_id, $post_thumbnail);
             $out .= "<li><img src='" . $img_attributes[0] . "' width='" . $img_attributes[1] . "' height='" . $img_attributes[2] . "' /></li>";
         }
         $out .= "</ul>";
     } elseif ($format === "video" && (array_key_exists('oembed-url', $post_meta) || array_key_exists('self-hosted-url', $post_meta))) {
         if (array_key_exists('oembed-url', $post_meta)) {
             $out .= "<div class='dt-video-wrap'>" . wp_oembed_get($post_meta['oembed-url']) . '</div>';
         } elseif (array_key_exists('self-hosted-url', $post_meta)) {
             $out .= "<div class='dt-video-wrap'>" . wp_video_shortcode(array('src' => $post_meta['self-hosted-url'])) . '</div>';
         }
     } elseif ($format === "audio" && (array_key_exists('oembed-url', $post_meta) || array_key_exists('self-hosted-url', $post_meta))) {
         if (array_key_exists('oembed-url', $post_meta)) {
             $out .= wp_oembed_get($post_meta['oembed-url']);
         } elseif (array_key_exists('self-hosted-url', $post_meta)) {
             $out .= wp_audio_shortcode(array('src' => $post_meta['self-hosted-url']));
         }
     } else {
         $out .= '<a href="' . esc_url($link) . '">';
         if (has_post_thumbnail($id)) {
             $out .= get_the_post_thumbnail($id, $post_thumbnail);
         } else {
             $out .= '<img src="http://placehold.it/1170x822&text=Image" alt="' . $title . '" />';
         }
         $out .= "</a>";
     }
     $excerpt = explode(' ', do_shortcode($p['post_content']), $excerpt_length);
     $excerpt = array_filter($excerpt);
     if (!empty($excerpt)) {
         if (count($excerpt) >= $excerpt_length) {
             array_pop($excerpt);
             $excerpt = implode(" ", $excerpt) . '...';
         } else {
             $excerpt = implode(" ", $excerpt);
         }
         $excerpt = preg_replace('`\\[[^\\]]*\\]`', '', $excerpt);
         $out .= '<div class="entry-thumb-desc"><p>' . $excerpt . '</p></div>';
     }
     $out .= '		</div> <!-- .entry-thumb -->';
     $out .= '		<div class="entry-details">';
     if (is_sticky()) {
         $out .= '<div class="featured-post"> <span class="fa fa-trophy"> </span> <span class="text">' . __('Featured', 'dt_themes') . '</span></div>';
     }
     $out .= '			<div class="entry-meta">';
     $out .= '				<div class="date">';
     $out .= get_the_time('d M', $id);
     $out .= '				</div>';
     $out .= "\t\t\t\t<a href='{$link}' class='entry_format'></a>";
     $out .= '			</div>';
     $out .= "\t\t\t<div class='entry-title'><h4><a href='{$link}'>{$title}</a></h4></div>";
     $out .= '			<div class="entry-metadata">';
     $out .= "\t\t\t\t<p class='author'><i class='fa fa-user'> </i> <a href='" . get_author_posts_url($author_id) . "'>" . get_the_author_meta('display_name', $author_id) . "</a></p><span> | </span>";
     $out .= $tags;
     $commtext = "";
     if (wp_count_comments($id)->approved == 0) {
         $commtext = '0';
     } else {
         $commtext = wp_count_comments($id)->approved;
     }
     $out .= "\t\t\t\t<p class='comments'><a href='{$link}/#respond' class='comments'><span class='fa fa-comments'> </span> {$commtext}</a></p>";
     $out .= '			</div>';
     $out .= '		</div>';
     $out .= '	</div>';
     $out .= '</article>';
     return $out;
 }
Beispiel #17
0
    protected function render()
    {
        $settings = $this->get_settings();
        if ('hosted' !== $settings['video_type']) {
            add_filter('oembed_result', [$this, 'filter_oembed_result'], 50, 3);
            $video_link = 'youtube' === $settings['video_type'] ? $settings['link'] : $settings['vimeo_link'];
            if (empty($video_link)) {
                return;
            }
            $video_html = wp_oembed_get($video_link, wp_embed_defaults());
            remove_filter('oembed_result', [$this, 'filter_oembed_result'], 50);
        } else {
            $video_html = wp_video_shortcode($this->get_hosted_params());
        }
        if ($video_html) {
            ?>
			<div class="elementor-video-wrapper">
				<?php 
            echo $video_html;
            if ($this->has_image_overlay()) {
                ?>
					<div class="elementor-custom-embed-image-overlay" style="background-image: url(<?php 
                echo $settings['image_overlay']['url'];
                ?>
);">
						<?php 
                if ('yes' === $settings['show_play_icon']) {
                    ?>
							<div class="elementor-custom-embed-play">
								<i class="fa fa-play-circle"></i>
							</div>
						<?php 
                }
                ?>
					</div>
				<?php 
            }
            ?>
			</div>
		<?php 
        } else {
            echo $settings['link'];
        }
    }
 /**
  * @ticket  35367
  * @depends test_video_shortcode_body
  */
 function test_wp_video_shortcode_attributes()
 {
     $actual = wp_video_shortcode(array('src' => 'https://example.com/foo.mp4'));
     $this->assertContains('src="https://example.com/foo.mp4', $actual);
     $this->assertNotContains('loop', $actual);
     $this->assertNotContains('autoplay', $actual);
     $this->assertContains('preload="metadata"', $actual);
     $this->assertContains('width="640"', $actual);
     $this->assertContains('height="360"', $actual);
     $this->assertContains('class="wp-video-shortcode"', $actual);
     $actual = wp_video_shortcode(array('src' => 'https://example.com/foo.mp4', 'poster' => 'https://example.com/foo.png', 'loop' => true, 'autoplay' => true, 'preload' => true, 'width' => 123, 'height' => 456, 'class' => 'foobar'));
     $this->assertContains('src="https://example.com/foo.mp4', $actual);
     $this->assertContains('poster="https://example.com/foo.png', $actual);
     $this->assertContains('loop="1"', $actual);
     $this->assertContains('autoplay="1"', $actual);
     $this->assertContains('preload="1"', $actual);
     $this->assertContains('width="123"', $actual);
     $this->assertContains('height="456"', $actual);
     $this->assertContains('class="foobar"', $actual);
 }
Beispiel #19
0
            <div class="dt-sc-clear"></div>
            <div class="dt-sc-hr-invisible"></div>
            
            <?php 
        $course_video = get_post_meta($the_id, 'course-video', true);
        if (isset($course_video) && $course_video != '') {
            ?>
                <h4 class="border-title"><?php 
            _e('Course Intro Video', 'dt_themes');
            ?>
<span></span></h4>
                <div class="course-video"><?php 
            if (wp_oembed_get($course_video) != '') {
                echo wp_oembed_get($course_video);
            } else {
                echo wp_video_shortcode(array('src' => $course_video));
            }
            ?>
</div>
                <div class="dt-sc-clear"></div>
                <div class="dt-sc-hr-invisible-medium"></div>
            <?php 
        }
        ?>

            <?php 
        $lessons_array = $staffs_id = array();
        $lesson_args = array('sort_order' => 'ASC', 'sort_column' => 'menu_order', 'hierarchical' => 1, 'post_type' => 'dt_lessons', 'posts_per_page' => -1, 'meta_key' => 'dt_lesson_course', 'meta_value' => $the_id);
        $lessons_array = get_pages($lesson_args);
        if (isset($lessons_array) && !empty($lessons_array)) {
            echo '<div class="dt-lesson-wrapper">
Beispiel #20
0
 static function get_video_embed($args = array(), $conditonal_args = array(), $current_page = array())
 {
     global $wp_embed;
     $video_url = esc_url($args['video_url']);
     $autoembed = $wp_embed->autoembed($video_url);
     $is_local_video = has_shortcode($autoembed, 'video');
     $video_embed = '';
     if ($is_local_video) {
         $video_embed = wp_video_shortcode(array('src' => $video_url));
     } else {
         $video_embed = wp_oembed_get($video_url);
         $video_embed = preg_replace('/<embed /', '<embed wmode="transparent" ', $video_embed);
         $video_embed = preg_replace('/<\\/object>/', '<param name="wmode" value="transparent" /></object>', $video_embed);
     }
     return $video_embed;
 }
            $question_media_type = $mimetype_array[0];
            $question_media_url = wp_get_attachment_url($question_media);
            $attachment = get_post($question_media);
            $question_media_title = $attachment->post_title;
            $question_media_description = $attachment->post_content;
            switch ($question_media_type) {
                case 'image':
                    $image_size = apply_filters('sensei_question_image_size', 'medium', $question_id);
                    $attachment_src = wp_get_attachment_image_src($question_media, $image_size);
                    $question_media_link = '<a class="' . esc_attr($question_media_type) . '" title="' . esc_attr($question_media_title) . '" href="' . esc_url($question_media_url) . '" target="_blank"><img src="' . $attachment_src[0] . '" width="' . $attachment_src[1] . '" height="' . $attachment_src[2] . '" /></a>';
                    break;
                case 'audio':
                    $question_media_link = wp_audio_shortcode(array('src' => $question_media_url));
                    break;
                case 'video':
                    $question_media_link = wp_video_shortcode(array('src' => $question_media_url));
                    break;
                default:
                    $question_media_filename = basename($question_media_url);
                    $question_media_link = '<a class="' . esc_attr($question_media_type) . '" title="' . esc_attr($question_media_title) . '" href="' . esc_url($question_media_url) . '" target="_blank">' . $question_media_filename . '</a>';
                    break;
            }
        }
    }
}
// Merge right and wrong answers and randomize
array_push($question_wrong_answers, $question_right_answer);
shuffle($question_wrong_answers);
$question_text = get_the_title($question_item);
$question_description = apply_filters('the_content', $question_item->post_content);
$answer_message = false;
Beispiel #22
0
 /**
  * Prints the WP Vidio Shortcode to output the HTML for video
  * @param  int $postid The post ID
  * @return string         The "html" for printing video elements
  */
 function base_print_video_html($postid)
 {
     $output = '';
     $posttype = get_post_type($postid);
     $keys = array('post' => array('embed' => '_zilla_video_embed_code', 'poster' => '_zilla_video_poster_url', 'm4v' => '_zilla_video_m4v', 'ogv' => '_zilla_video_ogv', 'mp4' => 'a_field'), 'portfolio' => array('embed' => '_tzp_video_embed', 'poster' => '_tzp_video_poster_url', 'm4v' => '_tzp_video_file_m4v', 'ogv' => '_tzp_video_file_ogv', 'mp4' => '_tzp_video_file_mp4'));
     $embed = get_post_meta($postid, $keys[$posttype]['embed'], true);
     if ($embed) {
         // Output the embed code if provided
         $output .= html_entity_decode(esc_html($embed));
     } else {
         // Build the video "shortcode"
         $poster = get_post_meta($postid, $keys[$posttype]['poster'], true);
         $m4v = get_post_meta($postid, $keys[$posttype]['m4v'], true);
         $ogv = get_post_meta($postid, $keys[$posttype]['ogv'], true);
         $mp4 = get_post_meta($postid, $keys[$posttype]['mp4'], true);
         $attr = array('width' => '2000');
         if ($poster) {
             $attr['poster'] = $poster;
         }
         if ($m4v) {
             $attr['m4v'] = $m4v;
         }
         if ($ogv) {
             $attr['ogv'] = $ogv;
         }
         if ($mp4) {
             $attr['mp4'] = $mp4;
         }
         $output .= wp_video_shortcode($attr);
     }
     return $output;
 }
	/**
	 * Shortcode handler for FLV and WMV which are supported natively by WordPress via the [video] shortcode.
	 * This reformats the parameters to match what WordPress expects and then lets WordPress do the work.
	 *
	 * @see   wp_video_shortcode()
	 *
	 * @since 1.2.0
	 *
	 * @param array|string $attr Shortcode attributes. Optional.
	 * @param string       $url  The URL attempting to be embedded.
	 * @param string       $tag  The shortcode tag being used.
	 *
	 * @return string|void The result of wp_video_shortcode(), ideally HTML content to display the video.
	 */
	public function video_shortcode_wrapper( $attr, $url, $tag ) {
		$attr['src'] = $url;

		return wp_video_shortcode( $attr );
	}
Beispiel #24
0
		<hr>

		<div class="streamlined-updates feature-section one-col">
			<h2><?php 
_e('Streamlined Updates');
?>
</h2>
			<p><?php 
_e('Don&#8217;t lose your place: stay on the same page while you update, install, and delete your plugins and themes.');
?>
</p>
			<?php 
if (!wp_is_mobile()) {
    add_filter('wp_video_shortcode', '_wp_override_admin_video_width_limit');
    echo wp_video_shortcode(array('mp4' => 'https://s.w.org/images/core/4.6/streamlined-updates.mp4', 'webm' => 'https://s.w.org/images/core/4.6/streamlined-updates.webm', 'poster' => 'https://s.w.org/images/core/4.6/streamlined-updates-2000.png?v1', 'loop' => true, 'autoplay' => true, 'width' => 1050, 'height' => 630, 'class' => 'wp-video-shortcode feature-video'));
    remove_filter('wp_video_shortcode', '_wp_override_admin_video_width_limit');
} else {
    echo '<img src="https://s.w.org/images/core/4.6/streamlined-updates-1057.png?v1" alt="" srcset="https://s.w.org/images/core/4.6/streamlined-updates-1664.png?v1 1664w, https://s.w.org/images/core/4.6/streamlined-updates-200.png?v1 200w, https://s.w.org/images/core/4.6/streamlined-updates-1057.png?v1 1057w, https://s.w.org/images/core/4.6/streamlined-updates-2000.png?v1 2000w"  sizes="(max-width: 500px) calc(100vw - 40px), (max-width: 782px) calc(100vw - 70px), (max-width: 959px) calc(100vw - 116px), (max-width: 1290px) calc(100vw - 240px), 1050px" />';
}
?>
		</div>

		<hr />

		<div class="native-fonts feature-section one-col">
			<h2><?php 
_e('Native Fonts');
?>
</h2>
			<p><?php 
 /**
  * Gets the correct HTML embeds/elements for a given media type.
  *
  * @param string $type One of 'video', 'audio', or 'image'
  * @param int $post_id The WP post ID of the attachment media.
  *
  * @return string
  */
 private static function getIncidentMediaHtml($type, $post_id)
 {
     $html = '';
     switch ($type) {
         case 'video':
             $html .= wp_video_shortcode(array('src' => wp_get_attachment_url($post_id)));
             break;
         case 'image':
             $html .= '<a href="' . wp_get_attachment_url($post_id) . '" target="_blank">';
             $html .= wp_get_attachment_image($post_id);
             $html .= '</a>';
             break;
         case 'audio':
         default:
             $html .= wp_audio_shortcode(array('src' => wp_get_attachment_url($post_id)));
             break;
     }
     return $html;
 }
Beispiel #26
0
" frameborder="0" allowfullscreen></iframe>
			<script src="https://videopress.com/videopress-iframe.js"></script>
		</div>

		<hr/>

		<div class="feature-section two-col">
			<?php 
foreach ($major_features as $feature) {
    ?>
			<div class="col">
				<div class="media-container">
					<?php 
    // Video.
    if (is_array($feature['src'])) {
        echo wp_video_shortcode(array('mp4' => $feature['src']['mp4'], 'ogv' => $feature['src']['ogv'], 'webm' => $feature['src']['webm'], 'loop' => true, 'autoplay' => true, 'width' => 500, 'height' => 284));
        // Image.
    } else {
        ?>
					<img src="<?php 
        echo esc_url($feature['src']);
        ?>
" alt="" />
					<?php 
    }
    ?>
				</div>
				<h3><?php 
    echo $feature['heading'];
    ?>
</h3>
    }
    ?>
				</a>
		<?php 
} elseif ($format === "gallery" && array_key_exists("items", $tpl_default_settings)) {
    echo "<ul class='entry-gallery-post-slider'>";
    foreach ($tpl_default_settings['items'] as $item) {
        echo "<li><img src='{$item}' alt='' /></li>";
    }
    echo "</ul>";
} elseif ($format === "video" && (array_key_exists('oembed-url', $tpl_default_settings) || array_key_exists('self-hosted-url', $tpl_default_settings))) {
    echo "<div class='dt-video-wrap'>";
    if (array_key_exists("oembed-url", $tpl_default_settings)) {
        echo wp_oembed_get($tpl_default_settings['oembed-url']);
    } elseif (array_key_exists("self-hosted-url", $tpl_default_settings)) {
        echo wp_video_shortcode(array('src' => $post_meta['self-hosted-url']));
    }
    echo "</div>";
} elseif ($format === "audio" && (array_key_exists('oembed-url', $tpl_default_settings) || array_key_exists('self-hosted-url', $tpl_default_settings))) {
    if (array_key_exists("oembed-url", $tpl_default_settings)) {
        echo wp_oembed_get($tpl_default_settings['oembed-url']);
    } elseif (array_key_exists("self-hosted-url", $tpl_default_settings)) {
        echo wp_audio_shortcode(array('src' => $post_meta['self-hosted-url']));
    }
} elseif (!array_key_exists("disable-featured-image", $tpl_default_settings)) {
    ?>
                  	<a href="<?php 
    the_permalink();
    ?>
" title="<?php 
    printf(esc_attr__('%s'), the_title_attribute('echo=0'));
Beispiel #28
0
 /**
  * Return an array of files prepared for output.
  *
  * Processes files by file type and generates unique output for each.
  *
  * Returns array for each file, with the following keys:
  *
  * `file_path` => The file path of the file, with a line break
  * `html` => The file output HTML formatted
  *
  * @since  1.2
  * @todo  Support `playlist` shortcode for playlist of video/audio
  * @usedby gravityview_get_files_array()
  * @param  string $value    Field value passed by Gravity Forms. String of file URL, or serialized string of file URL array
  * @param  string $gv_class Field class to add to the output HTML
  * @return array           Array of file output, with `file_path` and `html` keys (see comments above)
  */
 static function get_files_array($value, $gv_class)
 {
     $gravityview_view = GravityView_View::getInstance();
     extract($gravityview_view->getCurrentField());
     $output_arr = array();
     // Get an array of file paths for the field.
     $file_paths = rgar($field, 'multipleFiles') ? json_decode($value) : array($value);
     // Process each file path
     foreach ($file_paths as $file_path) {
         // If the site is HTTPS, use HTTPS
         if (function_exists('set_url_scheme')) {
             $file_path = set_url_scheme($file_path);
         }
         // This is from Gravity Forms's code
         $file_path = esc_attr(str_replace(" ", "%20", $file_path));
         // If the field is set to link to the single entry, link to it.
         $link = !empty($field_settings['show_as_link']) ? GravityView_API::entry_link($entry, $field) : $file_path;
         // Get file path information
         $file_path_info = pathinfo($file_path);
         $html_format = NULL;
         $disable_lightbox = false;
         $disable_wrapped_link = false;
         // Is this an image?
         $image = new GravityView_Image(array('src' => $file_path, 'class' => 'gv-image gv-field-id-' . $field_settings['id'], 'alt' => $field_settings['label'], 'width' => gravityview_get_context() === 'single' ? NULL : 250));
         $content = $image->html();
         // The new default content is the image, if it exists. If not, use the file name as the content.
         $content = !empty($content) ? $content : $file_path_info['basename'];
         // If pathinfo() gave us the extension of the file, run the switch statement using that.
         $extension = empty($file_path_info['extension']) ? NULL : strtolower($file_path_info['extension']);
         switch (true) {
             // Audio file
             case in_array($extension, wp_get_audio_extensions()):
                 $disable_lightbox = true;
                 if (shortcode_exists('audio')) {
                     $disable_wrapped_link = true;
                     /**
                      * Modify the settings passed to the `wp_video_shortcode()` function
                      *
                      * @since  1.2
                      * @var array
                      */
                     $audio_settings = apply_filters('gravityview_audio_settings', array('src' => $file_path, 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings['id']));
                     /**
                      * Generate the audio shortcode
                      * @link http://codex.wordpress.org/Audio_Shortcode
                      * @link https://developer.wordpress.org/reference/functions/wp_audio_shortcode/
                      */
                     $content = wp_audio_shortcode($audio_settings);
                 }
                 break;
                 // Video file
             // Video file
             case in_array($extension, wp_get_video_extensions()):
                 $disable_lightbox = true;
                 if (shortcode_exists('video')) {
                     $disable_wrapped_link = true;
                     /**
                      * Modify the settings passed to the `wp_video_shortcode()` function
                      *
                      * @since  1.2
                      * @var array
                      */
                     $video_settings = apply_filters('gravityview_video_settings', array('src' => $file_path, 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings['id']));
                     /**
                      * Generate the video shortcode
                      * @link http://codex.wordpress.org/Video_Shortcode
                      * @link https://developer.wordpress.org/reference/functions/wp_video_shortcode/
                      */
                     $content = wp_video_shortcode($video_settings);
                 }
                 break;
                 // PDF
             // PDF
             case $extension === 'pdf':
                 // PDF needs to be displayed in an IFRAME
                 $link = add_query_arg(array('TB_iframe' => 'true'), $link);
                 break;
                 // if not image, do not set the lightbox (@since 1.5.3)
             // if not image, do not set the lightbox (@since 1.5.3)
             case !in_array($extension, array('jpg', 'jpeg', 'jpe', 'gif', 'png')):
                 $disable_lightbox = true;
                 break;
         }
         // If using Link to File, override the content.
         // (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.)
         if (!empty($field_settings['link_to_file'])) {
             // Force the content to be the file name
             $content = $file_path_info["basename"];
             // Restore the wrapped link
             $disable_wrapped_link = false;
         }
         // Whether to use lightbox or not
         if ($disable_lightbox || empty($gravityview_view->atts['lightbox']) || !empty($field_settings['show_as_link'])) {
             $link_atts = empty($field_settings['show_as_link']) ? "target='_blank'" : '';
             $link_atts = apply_filters('gravityview/fields/fileupload/link_atts', $link_atts, $gravityview_view->getCurrentField());
         } else {
             $link_atts = sprintf("rel='%s-{$entry['id']}' class='thickbox' target='_blank'", $gv_class);
         }
         /**
          * Filter to alter the default behaviour of wrapping images (or image names) with a link to the content object
          *
          * @since 1.5.1
          *
          * @param bool $disable_wrapped_link whether to wrap the content with a link to the content object.
          * @param array $gravityview_view->field_data
          *
          * @see GravityView_API:field_value() for info about $gravityview_view->field_data
          *
          */
         $disable_wrapped_link = apply_filters('gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $gravityview_view->getCurrentField());
         // If the HTML output hasn't been overridden by the switch statement above, use the default format
         if (!empty($content) && empty($disable_wrapped_link)) {
             /**
              * Modify the link text (defaults to the file name)
              *
              * @since 1.7
              *
              * @param string $content The existing anchor content. Could be `<img>` tag, audio/video embed or the file name
              * @param array $field GravityView array of the current field being processed
              */
             $content = apply_filters('gravityview/fields/fileupload/link_content', $content, $gravityview_view->getCurrentField());
             $content = '<a href="' . esc_url_raw($link) . '" ' . $link_atts . '>' . $content . '</a>';
         }
         $output_arr[] = array('file_path' => $file_path, 'content' => $content);
     }
     // End foreach loop
     /**
      * Modify the files array
      *
      * @since 1.7
      *
      * @param array $output_arr Associative array of files {
      *      @type string $file_path The path to the file as stored in Gravity Forms
      *      @type string $content The generated output for the file
      * }
      * @param array $field GravityView array of the current field being processed
      */
     $output_arr = apply_filters('gravityview/fields/fileupload/files_array', $output_arr, $gravityview_view->getCurrentField());
     return $output_arr;
 }
/**
 * Wrap attachment in paragraph tag before content.
 *
 * @since 2.0.0
 *
 * @param string $content
 * @return string
 */
function prepend_attachment($content)
{
    $post = get_post();
    if (empty($post->post_type) || $post->post_type != 'attachment') {
        return $content;
    }
    if (wp_attachment_is('video', $post)) {
        $meta = wp_get_attachment_metadata(get_the_ID());
        $atts = array('src' => wp_get_attachment_url());
        if (!empty($meta['width']) && !empty($meta['height'])) {
            $atts['width'] = (int) $meta['width'];
            $atts['height'] = (int) $meta['height'];
        }
        if (has_post_thumbnail()) {
            $atts['poster'] = wp_get_attachment_url(get_post_thumbnail_id());
        }
        $p = wp_video_shortcode($atts);
    } elseif (wp_attachment_is('audio', $post)) {
        $p = wp_audio_shortcode(array('src' => wp_get_attachment_url()));
    } else {
        $p = '<p class="attachment">';
        // show the medium sized image representation of the attachment if available, and link to the raw file
        $p .= wp_get_attachment_link(0, 'medium', false);
        $p .= '</p>';
    }
    /**
     * Filters the attachment markup to be prepended to the post content.
     *
     * @since 2.0.0
     *
     * @see prepend_attachment()
     *
     * @param string $p The attachment HTML output.
     */
    $p = apply_filters('prepend_attachment', $p);
    return "{$p}\n{$content}";
}
 function ajax_video_preview()
 {
     check_ajax_referer('zwetschgenbremmel', 'ajax_nonce');
     $attr = array('src' => $_POST['video_url'], 'poster' => $_POST['video_poster'], 'loop' => @$_POST['video_loop'], 'autoplay' => @$_POST['video_autoplay'], 'preload' => $_POST['video_preload'], 'class' => $_POST['video_class'], 'id' => $_POST['video_id']);
     if (!empty($_POST['video_height'])) {
         $attr['height'] = $_POST['video_height'];
     }
     if (!empty($_POST['video_width'])) {
         $attr['width'] = $_POST['video_width'];
     }
     echo wp_video_shortcode($attr);
     die;
 }