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/thumbnail.php

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

/*
 * AMP : Post Thumbnail
 *
*/
function mwp_amp_thumbnail($width, $height, $class, $postid) {
	echo '<amp-img src="'.mwp_thumb_size_src($width, $height, $class, $postid).'" layout="responsive" width="'.$width.'" height="'.$height.'"></amp-img>';
}
function mwp_amp_thumbnail_default($width, $height) {
	echo '<amp-img src="'.mwp_thumb_size_default_src().'" layout="responsive" width="'.$width.'" height="'.$height.'"></amp-img>';
}

/*
 * AMP : Single Post Thumbnail
 *
*/
function mwp_amp_post_thumbnail($postid) {
	
	$get_categories 	= mwp_option('remove-post-thumbnail');
	$instead_thumbnail 	= get_post_meta($postid, 'instead_thumbnail' , true);
	$instead_gallery 	= get_post_meta($postid, 'instead_gallery' , true);
	
	if (mwp_option('post-thumbnail') == 1) {
		
		if (!get_post_meta($postid, 'thumbnail_hide' , true)) {
	
			if (!in_category($get_categories, $postid)) {
				
				if (!empty($instead_thumbnail)) { 
					return '<div class="amp-wp-article-thumb">'.mwp_optional_video_amp($postid).'</div>';
				} elseif (!empty($instead_gallery)) {
					mwp_optional_gallery_amp($postid);
				} else {
					$image 	= mwp_thumb_size_src(772, 434, 'full', $postid);
					if(!empty($image)) {
						$image_src = $image;
					} else {
						$image_src = mwp_thumb_size_default_src();
					}
					return '<div class="amp-wp-article-thumb"><div class="amp-featured"><amp-img src="'.$image_src.'" layout="responsive" height="434" width="772"></amp-img></div></div>';
				}
			}
		}
	}
}

/*
 * Display Youtube image
 * Note	: this function is important do not remove from here
 *
*/
function mwp_amp_yt_img($id, $width, $height) {
	if (!is_array($id)) {
		echo '<div class="crop"><amp-img src="https://img.youtube.com/vi/'.$id.'/mqdefault.jpg" layout="responsive" height="'.$height.'" width="'.$width.'"></amp-img></div>';
	} else {
		$url = mwp_option('thumbnail_default');
		$title = get_the_title();
		echo '<div class="crop"><amp-img src="' .mwp_thumb_size_default_src(). '" layout="responsive" height="'.$height.'" width="'.$width.'"></amp-img></div>';
	}
}
/*
 * Display Vimeo image
 * 
*/
function mwp_amp_vi_img($link, $width, $height) {
	if (!empty($link)) {
		echo '<div class="crop"><amp-img src="'.$link.'" layout="responsive" height="'.$height.'" width="'.$width.'"></amp-img></div>';
	} else {
		$url = mwp_option('thumbnail_default');
		$title = get_the_title();
		echo '<div class="crop"><amp-img src="' .mwp_thumb_size_default_src(). '" layout="responsive" height="'.$height.'" width="'.$width.'"></amp-img></div>';
	}
}
/*
 * Display Dailymotion image
 * 
*/
function mwp_amp_dm_img($link, $width, $height) {
	if (!empty($link)) {
		echo '<div class="crop"><amp-img src="'.$link.'" layout="responsive" height="'.$height.'" width="'.$width.'"></amp-img></div>';
	} else {
		echo '<div class="crop"><amp-img src="' .mwp_thumb_size_default_src(). '" layout="responsive" height="'.$height.'" width="'.$width.'"></amp-img></div>';
	}
}
/*
 * Display Facebook image
 * 
*/
function mwp_amp_fb_img($id, $width, $height) {
	if (!is_array($id)) {
		echo '<div class="crop"><amp-img src="'.mwp_fb_get_thumb($id).'" layout="responsive" height="'.$height.'" width="'.$width.'"></amp-img></div>';
	} else {
		echo '<div class="crop"><amp-img src="' .mwp_thumb_size_default_src(). '" layout="responsive" height="'.$height.'" width="'.$width.'"></amp-img></div>';
	}
}

/*
 * Get Video Image and display it
 *
*/
function mwp_smart_thumb_amp($postid, $width, $height) {

	if (mwp_option('thumbnail-vyd') == 0 || has_post_thumbnail() ) {
		mwp_amp_thumbnail($width, $height, 'mwp-medium', $postid);
	} else {
		// New custom field Youtube & Vimeo & Dailymotion
		$key_exists_yt = metadata_exists( 'post', $postid, 'mwp_yt_id' );
		$key_exists_vi = metadata_exists( 'post', $postid, 'mwp_vi_thumbnail' );
		$key_exists_dm = metadata_exists( 'post', $postid, 'mwp_dm_thumbnail' );
		$key_exists_fb = metadata_exists( 'post', $postid, 'mwp_fb_id' );
		// Get New custom field value (Video ID)
		$check_y = get_post_meta($postid, 'mwp_yt_id' , true);
		$check_v = get_post_meta($postid, 'mwp_vi_thumbnail' , true);
		$check_d = get_post_meta($postid, 'mwp_dm_thumbnail' , true);
		$check_f = get_post_meta($postid, 'mwp_fb_id' , true);

		if ($key_exists_yt == true && !empty($check_y)) :
			mwp_amp_yt_img($check_y, $width, $height);
		elseif ($key_exists_vi == true && !empty($check_v)) :
			mwp_amp_vi_img($check_v, $width, $height);
		elseif ($key_exists_dm == true && !empty($check_d)) :
			mwp_amp_dm_img($check_d, $width, $height);
		elseif ($key_exists_fb == true && !empty($check_f)) :
			mwp_amp_fb_img($check_f, $width, $height);
		else :
			mwp_amp_thumbnail_default($width, $height);
		endif;
	}
}

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