Sindbad~EG File Manager

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

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

function mwp_amp_generate_share_btn() {
	
	$data 		= '';
	$btn_height = mwp_option('amp-scoial-btn-height');
	$btn_width 	= mwp_option('amp-scoial-btn-width');
	$socials 	= mwp_option('amp-scoial-select');
	$fb_app_id 	= mwp_option('facebook-app-id');
	$text 		= get_bloginfo('name') . ' - ' . get_the_permalink();
	
	if (!empty($socials)) {
			foreach ($socials as $social => $name) {
				$data .= '<amp-social-share type="system"></amp-social-share>';
				if ($name == 'facebook'):
					$data .= '<amp-social-share type="facebook" data-param-app_id="'.$fb_app_id.'" width="'.$btn_width.'" height="'.$btn_height.'"></amp-social-share>';
				endif;
				if ($name == 'twitter'):
					$data .= '<amp-social-share type="twitter" width="'.$btn_width.'" height="'.$btn_height.'"></amp-social-share>';
				endif;
				if ($name == 'whatsapp'):
					$data .= '<amp-social-share type="whatsapp" width="'.$btn_width.'" height="'.$btn_height.'" role="link" data-share-endpoint="whatsapp://send" data-param-text="'.$text.'"></amp-social-share>';
				endif;
				if ($name == 'pinterest'):
					$data .= '<amp-social-share type="pinterest" width="'.$btn_width.'" height="'.$btn_height.'"></amp-social-share>';
				endif;
				if ($name == 'linkedin'):
					$data .= '<amp-social-share type="linkedin" width="'.$btn_width.'" height="'.$btn_height.'"></amp-social-share>';
				endif;
				if ($name == 'email'):
					$data .= '<amp-social-share type="email" width="'.$btn_width.'" height="'.$btn_height.'"></amp-social-share>';
				endif;
			}
		return $data;
	}
	return $data;
}

function mwp_amp_share() {
	
	$data 		= '';
	$btn_height = mwp_option('amp-scoial-btn-height');
	$btn_width 	= mwp_option('amp-scoial-btn-width');
	$btn 		= mwp_amp_generate_share_btn();
	$text 		= get_bloginfo('name') . ' - ' . get_the_permalink();
	$output 	= '';
	
	if (!empty($btn)) {
		$output .= '<div class="social">';
		$output .= $btn;
		$output .= '</div>';
	} else {
		$output .= '<div class="social">';
			$data .= '<amp-social-share type="system"></amp-social-share>';
			$data .= '<amp-social-share type="facebook" data-param-app_id="'.mwp_option('facebook-app-id') . '" width="' . $btn_width . '" height="' . $btn_height . '"></amp-social-share>';
			$data .= '<amp-social-share type="twitter" width="' . $btn_width . '" height="' . $btn_height . '"></amp-social-share>';
			$data .= '<amp-social-share type="whatsapp" width="' . $btn_width . '" height="' . $btn_height . '" role="link" data-share-endpoint="whatsapp://send" data-param-text="'.$text.'"></amp-social-share>';
			$data .= '<amp-social-share type="pinterest" width="' . $btn_width . '" height="' . $btn_height . '"></amp-social-share>';
			$data .= '<amp-social-share type="linkedin" width="' . $btn_width . '" height="' . $btn_height . '"></amp-social-share>';
			$data .= '<amp-social-share type="email" width="' . $btn_width . '" height="' . $btn_height . '"></amp-social-share>';
			$output .= $data;
		$output .= '</div>';
	}
	return $output;
}

function mwp_amp_share_sticky() {
	
	$btn_height = 28;
	$btn_width 	= 40;
	$btn 		= mwp_amp_generate_share_btn();
	$text 		= get_bloginfo('name') . ' - ' . get_the_permalink();
	$output 	= '';
	if (!empty($btn)) {
		$output .= '<div class="sticky_social"><div class="social">';
		$output .= $btn;
		$output .= '</div></div>';
	} else {
		$output .= '<div class="sticky_social"><div class="social">';
			$output .= '<amp-social-share type="facebook" data-param-app_id="'.mwp_option('facebook-app-id') . '" width="' . $btn_width . '" height="' . $btn_height . '"></amp-social-share>';
			$output .= '<amp-social-share type="twitter" width="' . $btn_width . '" height="' . $btn_height . '"></amp-social-share>';
			$output .= '<amp-social-share type="whatsapp" width="' . $btn_width . '" height="' . $btn_height . '" role="link" data-share-endpoint="whatsapp://send" data-param-text="'.$text.'"></amp-social-share>';
			$output .= '<amp-social-share type="pinterest" width="' . $btn_width . '" height="' . $btn_height . '"></amp-social-share>';
			$output .= '<amp-social-share type="linkedin" width="' . $btn_width . '" height="' . $btn_height . '"></amp-social-share>';
			$output .= '<amp-social-share type="email" width="' . $btn_width . '" height="' . $btn_height . '"></amp-social-share>';
		$output .=  '</div></div>';
	}
	return $output;
}

if (mwp_option('amp-scoial-sticky') == 1) {
	add_filter( 'the_content', 'mwp_amp_share_sticky_content', 999999, 1  );
}
function mwp_amp_share_sticky_content( $content ) {
	if (function_exists( 'is_amp_endpoint' ) && is_amp_endpoint()) {
		$data_btn = mwp_amp_share_sticky();
		$content = $content.$data_btn;
		return $content;
	} else {
		return $content;
	}
}

if (mwp_option('amp-scoial-top') == 1) {
	add_filter( 'the_content', 'mwp_amp_share_top_content', 12, 1  );
}
function mwp_amp_share_top_content( $content ) {
	if (function_exists( 'is_amp_endpoint' ) && is_amp_endpoint()) {
		$data_btn = mwp_amp_share();
		$content = $data_btn.$content;
		return $content;
	} else {
		return $content;
	}
}

if (mwp_option('amp-scoial-bottom') == 1) {
	add_filter( 'the_content', 'mwp_amp_share_bottom_content', 13, 1  );
}
function mwp_amp_share_bottom_content( $content ) {
	if (function_exists( 'is_amp_endpoint' ) && is_amp_endpoint()) {
		$data_btn = mwp_amp_share();
		$content = $content.$data_btn;
		return $content;
	} else {
		return $content;
	}
}

/*
 * AMP : Share Buttons
*/
function mwp_amp_addthis_head() {
	if (mwp_option('amp-scoial-addthis') == 1) {
		echo "<!-- Displays an AddThis website tools embed. -->\n";
		echo "<script async custom-element='amp-addthis' src='https://cdn.ampproject.org/v0/amp-addthis-0.1.js'></script>\n";
	}
}
add_action('amp_post_template_head','mwp_amp_addthis_head');

function mwp_amp_addthis() {
	if (mwp_option('amp-scoial-addthis') == 1) {
		$output 			= '';
		$addthis_pub_id 	= mwp_option('amp-scoial-addthis-pub-id');
		$addthis_widget_id 	= mwp_option('amp-scoial-addthis-widget-id');
		
		if(!empty($addthis_pub_id) && !empty($addthis_widget_id)) {
			$output .= '<div class="addthis">';
			$output .= '<amp-addthis width="320" height="92" layout="responsive" data-pub-id="'.$addthis_pub_id.'" data-widget-id="'.$addthis_widget_id.'"></amp-addthis>';
			$output .= '</div>';
		}
		return $output;
	}
}

if (mwp_option('amp-scoial-facebook-like') == 1) {
add_filter( 'the_content', 'mwp_amp_like_button', 13, 1  );
}
function mwp_amp_like_button( $content ) {
	
		global $post;
		if (function_exists( 'is_amp_endpoint' ) && is_amp_endpoint()) {
			$like_btn = '<amp-facebook-like width=90 height=20 layout="flex-item" data-locale="'.mwp_locale().'" data-colorscheme="dark" data-layout="button_count" data-href="'.get_permalink($post->ID).'"></amp-facebook-like>';
			$content = $like_btn.$content;
			return $content;
		} else {
			return $content;
		}

}

/*
 * AMP : Facebook SDK
*/
function mwp_amp_facebook_head() {
	if (mwp_option('amp-scoial-facebook-page') == 1) {
		echo "<!-- Embeds the Facebook page plugin. -->\n";
		echo "<script async custom-element='amp-facebook-page' src='https://cdn.ampproject.org/v0/amp-facebook-page-0.1.js'></script>\n";
	}
}
add_action('amp_post_template_head','mwp_amp_facebook_head');

function mwp_amp_page_box() {
	if (mwp_option('amp-scoial-facebook-page') == 1) {
		global $post;
		echo '<amp-facebook-page width="340" height="130" layout="responsive"  data-locale="'.mwp_locale().'" data-hide-cover="true" data-href="'.mwp_option('facebook-link').'"></amp-facebook-page>';	
	}
}


/*
 * AMP : Facebook SDK
*/
function mwp_amp_follow_head() {
	if (mwp_option('amp-scoial-sticky') == 0 && mwp_option('amp-scoial-top') == 0 && mwp_option('amp-scoial-bottom') == 0) {
		echo "<!-- Embeds the Facebook page plugin. -->\n";
		echo "<script type='text/javascript' src='https://cdn.ampproject.org/v0/amp-social-share-latest.js' async custom-element='amp-social-share'></script>\n";
	}
}
add_action('amp_post_template_head','mwp_amp_follow_head');

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