Sindbad~EG File Manager

Current Path : /var/www/html/wordpress_alg24news/wp-content/themes/newsbt-mobile/amp/helper/
Upload File :
Current File : /var/www/html/wordpress_alg24news/wp-content/themes/newsbt-mobile/amp/helper/video-optional.php

<?php 
/*
 * Security 	: blocking direct access
 * Source		: http://codex.wordpress.org/Theme_Development#Template_Files
*/
defined('ABSPATH') or die("Access Restricted");

/*
 * AMP : Print Script for Video instead of thumbnail
 *
*/
function mwp_amp_custom_video_head($post) {
	$post = get_post($post->ID);
	$instead = get_post_meta($post->ID, 'instead_thumbnail' , true);
	if (!empty($instead) && is_singular()) :
		$source = get_post_meta($post->ID, 'instead_thumbnail_source' , true);
		if ($source == '1') {
			echo '<script async custom-element="amp-youtube" src="https://cdn.ampproject.org/v0/amp-youtube-0.1.js"></script>';
		} elseif ($source == '2') {
			echo '<script async custom-element="amp-vimeo" src="https://cdn.ampproject.org/v0/amp-vimeo-0.1.js"></script>';
		} elseif ($source == '3') {
			echo '<script async custom-element="amp-dailymotion" src="https://cdn.ampproject.org/v0/amp-dailymotion-0.1.js"></script>';
		}
	endif;
}
add_action('amp_post_template_head','mwp_amp_custom_video_head');

/*!
 * Single
 *
 * Video Optional
 *
*/
function mwp_optional_video_amp($postid) {
	$id = get_post_meta($postid, 'instead_thumbnail' , true);
	if (!empty($id)) {
		$source = get_post_meta($postid, 'instead_thumbnail_source' , true);
		if ($source == '1') {
			return '<amp-youtube data-videoid="'.$id.'" layout="responsive" width="480" height="270"></amp-youtube>';
		} elseif ($source == '2') {
			return '<amp-vimeo data-videoid="'.$id.'" layout="responsive" width="500" height="281"></amp-vimeo>';
		} elseif ($source == '3') {
			return '<amp-dailymotion data-videoid="'.$id.'" layout="responsive" width="480" height="270"></amp-dailymotion>';
		}
	}
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists