Sindbad~EG File Manager
<?php
/*
* Security : blocking direct access
* Source : http://codex.wordpress.org/Theme_Development#Template_Files
*/
defined('ABSPATH') or die("Access Restricted");
/*
* Remove Google Fonts
*
*/
function mwp_amp_remove_font() {
remove_action( 'amp_post_template_head', 'amp_post_template_add_fonts' );
}
add_action( 'amp_post_template_head', 'mwp_amp_remove_font', 2 );
/*
* Function Description : DNS Preconnect
* Author Name : Mouad Achemli
* Function Source : https://www.mwordpress.net
* Note : this function is important do not remove from here
*
*/
function mwp_amp_dns_preconnect_controll() {
if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'photon' ) ) {
$hosts = array (
'https://s1.wp.com',
'https://i0.wp.com',
'https://i1.wp.com',
'https://i2.wp.com',
'https://i3.wp.com',
'https://google-analytics.com',
'https://www.google-analytics.com',
'https://ajax.googleapis.com',
'https://googleads.g.doubleclick.net',
'https://static.doubleclick.net',
'https://www.googleadservices.com',
);
echo '<!-- DNS Preconnect -->',"\n";
foreach ($hosts as $host) {
echo "<link rel='preconnect dns-prefetch' href='".$host."' crossorigin>";
}
echo "\n".'<!-- / DNS Preconnect -->',"\n";
}
}
add_action('amp_post_template_head', 'mwp_amp_dns_preconnect_controll', 0);
/*
* Skip Specific Posts
*
*/
function mwp_amp_skip_posts( $skip, $post_id, $post ) {
global $post;
$amp_skip = get_post_meta($post->ID, '_mwp_amp_skip' , true);
if ( $amp_skip == '1' && $post_id ) {
$skip = true;
}
return $skip;
}
add_filter( 'amp_skip_post', 'mwp_amp_skip_posts', 10, 3 );
/*
* Skip Specific Categories
*
*/
function mwp_amp_skip_categories( $skip, $post_id, $post ) {
global $post;
$amp_skip_ids = mwp_option('amp-skip-categories');
if ( !empty($amp_skip_ids) && in_category($amp_skip_ids) && $post_id) {
$skip = true;
}
return $skip;
}
add_filter( 'amp_skip_post', 'mwp_amp_skip_categories', 10, 3 );
/*
* AMP
*
* Post Meta - Time
*
*/
if ( ! function_exists( 'mwp_amp_posted_on' ) ):
function mwp_amp_posted_on() {
$time_string = sprintf( '<time class="entry-date" datetime="%1$s">%2$s</time>',
esc_attr( get_the_modified_time( 'c' ) ),
esc_html( get_the_date('j F Y') )
);
$posted_on = sprintf( esc_html_x( '%s', 'post date', '' ), $time_string );
echo $posted_on;
}
endif;
/*!
* Single
*
* Phone Specs
*
*/
function mwp_single_phone_info_amp($postid) {
$check = get_post_meta($postid, 'phone_info' , true);
$cpu = get_post_meta($postid, 'phone_info_cpu' , true);
$ram = get_post_meta($postid, 'phone_info_ram' , true);
$storage = get_post_meta($postid, 'phone_info_storage' , true);
$display = get_post_meta($postid, 'phone_info_display' , true);
$camera = get_post_meta($postid, 'phone_info_camera' , true);
$os = get_post_meta($postid, 'phone_info_os' , true);
$battery = get_post_meta($postid, 'phone_info_battery' , true);
if ($check == 'on') {
?>
<div class="phone-data">
<div class="phone-thumbnail">
<?php echo mwp_amp_thumbnail(486, 486, '', $postid); ?>
</div>
<div class="phone-info">
<ul>
<li title="<?php esc_html_e($cpu); ?>">
<div class="phone-info-anim">
<i><amp-img src="<?php echo get_template_directory_uri(); ?>/amp/images/microchip.svg" alt="" width="22" height="22"></amp-img></i>
<div class="phone-info-content">
<strong><?php esc_html_e( 'CPU', MWP_TEXT_DOMAIN ); ?></strong>: <span><?php esc_html_e($cpu); ?></span>
</div>
</div>
</li>
<li title="<?php esc_html_e($ram); ?>">
<div class="phone-info-anim">
<i><amp-img src="<?php echo get_template_directory_uri(); ?>/amp/images/tasks.svg" alt="" width="22" height="22"></amp-img></i>
<div class="phone-info-content">
<strong><?php esc_html_e( 'RAM', MWP_TEXT_DOMAIN ); ?></strong>: <span><?php esc_html_e($ram); ?></span>
</div>
</div>
</li>
<li title="<?php esc_html_e($storage); ?>">
<div class="phone-info-anim">
<i><amp-img src="<?php echo get_template_directory_uri(); ?>/amp/images/hdd-o.svg" alt="" width="22" height="22"></amp-img></i>
<div class="phone-info-content">
<strong><?php esc_html_e( 'Storage', MWP_TEXT_DOMAIN ); ?></strong>: <span><?php esc_html_e($storage); ?></span>
</div>
</div>
</li>
<li title="<?php esc_html_e($display); ?>">
<div class="phone-info-anim">
<i><amp-img src="<?php echo get_template_directory_uri(); ?>/amp/images/television.svg" alt="" width="22" height="22"></amp-img></i>
<div class="phone-info-content">
<strong><?php esc_html_e( 'Display', MWP_TEXT_DOMAIN ); ?></strong>: <span><?php esc_html_e($display); ?></span>
</div>
</div>
</li>
<li title="<?php esc_html_e($camera); ?>">
<div class="phone-info-anim">
<i><amp-img src="<?php echo get_template_directory_uri(); ?>/amp/images/camera.svg" alt="" width="22" height="22"></amp-img></i>
<div class="phone-info-content">
<strong><?php esc_html_e( 'Camera', MWP_TEXT_DOMAIN ); ?></strong>: <span><?php esc_html_e($camera); ?></span>
</div>
</div>
</li>
<li title="<?php esc_html_e($os); ?>">
<div class="phone-info-anim">
<i><amp-img src="<?php echo get_template_directory_uri(); ?>/amp/images/cog.svg" alt="" width="22" height="22"></amp-img></i>
<div class="phone-info-content">
<strong><?php esc_html_e( 'OS', MWP_TEXT_DOMAIN ); ?></strong>: <span><?php esc_html_e($os); ?></span>
</div>
</div>
</li>
<li title="<?php esc_html_e($battery); ?>">
<div class="phone-info-anim">
<i><amp-img src="<?php echo get_template_directory_uri(); ?>/amp/images/battery-full.svg" alt="" width="22" height="22"></amp-img></i>
<div class="phone-info-content">
<strong><?php esc_html_e( 'Battery', MWP_TEXT_DOMAIN ); ?></strong>: <span><?php esc_html_e($battery); ?></span>
</div>
</div>
</li>
</ul>
</div>
</div>
<?php
}
}
/*
* Desciption : Display Custom Author Name
* Author : Mouad Achemli
* Source : http://www.mwordpress.net
*
*/
function mwp_amp_custom_name($postid) {
$article_ids = mwp_option('category-article');
$source_name = mwp_option('author_name');
$name = get_post_meta($postid, $source_name , true);
if ( !empty($article_ids) && in_category($article_ids) ) {
} elseif (!empty($name) && mwp_option('metapost-style') == 1) {
return '<div class="post-by"><span>'.$name.'</span></div>';
}
}
/*
* Desciption : Display source post
* Author : Mouad Achemli
* Source : http://www.mwordpress.net
*
*/
function mwp_amp_news_source($postid) {
$source_name = mwp_option('source_name');
$name = get_post_meta($postid, $source_name , true);
$source_link = mwp_option('source_link');
$source = get_post_meta($postid, $source_link , true);
if (!empty($name) && !empty($source)) {
return '<div class="post-source"><strong>'. __( 'Source', MWP_TEXT_DOMAIN ).'</strong><span><a rel="nofollow" target="_blank" href="'.$source.'" title="'.$name.'" >'.$name.'</a></span></div>';
} elseif (!empty($name) && empty($source)) {
return '<div class="post-source"><strong>'. __( 'Source', MWP_TEXT_DOMAIN ).'</strong><span>'.$name.'</span></div>';
} elseif (empty($name) && !empty($source)) {
return '<div class="post-source"><strong>'. __( 'Source', MWP_TEXT_DOMAIN ).'</strong><span>'.$source.'</span></div>';
}
}
function mwp_amp_source($content) {
global $post;
if (function_exists( 'is_amp_endpoint' ) && is_amp_endpoint()) {
$source = mwp_amp_news_source($post->ID);
$content = $content.$source;
return $content;
} else {
return $content;
}
}
add_filter('the_content','mwp_amp_source', 11, 1);
function mwp_amp_cname($content) {
global $post;
if (function_exists( 'is_amp_endpoint' ) && is_amp_endpoint()) {
$name = mwp_amp_custom_name($post->ID);
$content = $name.$content;
return $content;
} else {
return $content;
}
}
add_filter('the_content','mwp_amp_cname', 11, 1);
/*!
* Single
*
* Custom Author Thumbnail
*
*/
function mwp_amp_authors_info($postid) {
$article_ids = mwp_option('category-article');
$source_name = mwp_option('author_name');
$name = get_post_meta($postid, $source_name , true);
if (is_rtl()) {
$align = 'alignright';
} else {
$align = 'alignleft';
}
if ( !empty($article_ids) && in_category($article_ids) && mwp_option('metapost-style') == 1 ) :
?>
<figure class="wp-caption <?php echo $align; ?>">
<?php
if(mwp_option('ac-thumbnail') == 1) {
mwp_thumb_size('mwp_small', 100, 100, 'img-responsive', true );
echo '<figcaption class="wp-caption-text">'.get_the_author($postid).'</figcaption>';
} elseif(mwp_option('ac-thumbnail') == 2) {
$author_image = get_the_author_meta('custom_avatar');
$author_name = get_the_author_meta('display_name');
$meta_image = mwp_option('author_photo');
$print_image = get_post_meta($postid, $meta_image, true);
$meta_name = mwp_option('author_name');
$print_name = get_post_meta($postid, $meta_name, true);
if (!empty($print_image) && !empty($print_name)) {
echo '<amp-img class="img-responsive" alt="' .$print_name. '" src="' .$print_image. '" width="100" height="100"></amp-img>';
echo '<figcaption class="wp-caption-text">'.$print_name.'</figcaption>';
} elseif (!empty($author_image)) {
echo '<amp-img class="img-responsive" alt="' .$author_name. '" src="' .$author_image. '" width="100" height="100" ></amp-img>';
echo '<figcaption class="wp-caption-text">'.$author_name.'</figcaption>';
} elseif (function_exists('get_wp_user_avatar')) {
get_wp_user_avatar($author->ID, 100);
echo '<figcaption class="wp-caption-text">'.get_the_author($postid).'</figcaption>';
} elseif (function_exists('get_avatar')) {
echo get_avatar( get_the_author_meta('email'), '100' );
echo '<figcaption class="wp-caption-text">'.get_the_author($postid).'</figcaption>';
}
} ?>
</figure>
<?php
endif;
}
function mwp_amp_cai($content) {
global $post;
if (function_exists( 'is_amp_endpoint' ) && is_amp_endpoint()) {
ob_start();
mwp_amp_authors_info($post->ID);
$html_ad_code = ob_get_contents();
ob_end_clean();
$content = $html_ad_code.$content;
} else {
$content = $content;
}
return $content;
}
add_filter('the_content','mwp_amp_cai', 0, 1);
/*
* AMP : Cookie Consent Script
*/
function mwp_gdpr_cookie_message_head() {
if (mwp_option('cookie-consent') == 1) {
echo "<script async custom-element='amp-user-notification' src='https://cdn.ampproject.org/v0/amp-user-notification-0.1.js'></script>\n";
}
}
add_action('amp_post_template_head','mwp_gdpr_cookie_message_head');
/*
* AMP : Cookie Consent
*/
function mwp_gdpr_cookie_message_amp() {
$enable = mwp_option('cookie-consent');
$privacy_url = mwp_option('cookie-learn-more-url');
$privacy_text = mwp_option('cookie-learn-more-text');
$accept_text = mwp_option('cookie-accept-btn');
$cookie_message = mwp_option('cookie-message');
$cookie_skin = mwp_option('cookie-consent-color');
if (!empty($cookie_skin)) {
$cookie_color = $cookie_skin;
} else {
$cookie_color = '#4477cc';
}
if(!empty($accept_text)) {
$accept_button = $accept_text;
} else {
$accept_button = __( 'Accept', MWP_TEXT_DOMAIN );
}
if ($enable == 1) {
?>
<amp-user-notification layout="nodisplay" id="referrer-notification" style="
display:flex;
justify-content:center;
align-items:center;
background:<?php echo esc_attr($cookie_color); ?>;
padding:5px;
text-align:center;
color:white;
font-weight:700;
font-size:.875rem;">
<?php
if ($cookie_message <> "") {
echo stripslashes(stripslashes($cookie_message));
} else {
if (!empty($privacy_url)) {
$learn_url = $privacy_url;
} else {
$learn_url = '#';
}
if (!empty($privacy_text)) {
$learn_text = $privacy_text;
} else {
$learn_text = __( 'Learn More', MWP_TEXT_DOMAIN );
}
echo __( 'We use cookies to personalize content and ads , to provide social media features and to analyze our traffic...', MWP_TEXT_DOMAIN ).'<a href="'.$learn_url.'">'.$learn_text.'</a>';
} ?>
<span on="tap:referrer-notification.dismiss" tabindex="0" role="button" style="
padding: 5px;
background: white;
color: <?php echo esc_attr($cookie_color); ?>;
margin: 4px 8px;
display: inline-block;
border-radius: 4px;
cursor:pointer;
"><?php echo esc_attr($accept_button); ?></span>
</amp-user-notification>
<?php
}
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists