Sindbad~EG File Manager
<?php
/*
* Security : blocking direct access
* Source : http://codex.wordpress.org/Theme_Development#Template_Files
*/
defined('ABSPATH') or die("Access Restricted");
function mwp_seo_page() {
/*!
* Get SEO info
*/
if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
$viewport = 'width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no';
$http_equiv = '';
$http_equiv_compatible = '';
} else {
$viewport = 'width=device-width, initial-scale=1';
$http_equiv = 'text/html; charset=utf-8';
$http_equiv_compatible = 'IE=edge,chrome=1';
}
$referrer = 'unsafe-url'; // https://moz.com/blog/meta-referrer-tag
$profile = 'http://gmpg.org/xfn/11';
$robots = 'NOODP'; // https://moz.com/blog/why-wont-google-use-my-meta-description
$apple_capable = 'yes';
$twitter_summary = 'summary_large_image';
$twitter_user = mwp_option('twitter-user');
$get_site_name = mwp_option('seo-home-title');
$queried_object = get_queried_object();
$seo_url = get_permalink($queried_object->ID);
$seo_title = mwp_page_title($queried_object->ID);
$seo_description = mwp_seo_description($queried_object->ID);
$seo_keywords = mwp_seo_page_keywords($queried_object->ID);
$seo_image = mwp_seo_image($queried_object->ID, 696, 315);
/*
* Site Name
*
*/
if (!empty($get_site_name)) {
$site_name = $get_site_name;
} else {
$site_name = get_bloginfo('name');
}
/*!
* Standard Meta
*/
$standar_data = array (
'title' => $seo_title,
'X-UA-Compatible' => $http_equiv_compatible,
'Content-Type' => $http_equiv,
'viewport' => $viewport,
'description' => $seo_description,
'keywords' => $seo_keywords,
'robots' => $robots,
'referrer' => $referrer,
'apple-mobile-web-app-capable' => $apple_capable,
'profile' => $profile,
);
// Removing empty array slots
$standar = array_filter( $standar_data );
echo '<!-- Standard Meta -->',"\n";
foreach ($standar as $key => $value) {
switch ($key) {
case 'title':
$standar_output = "<title>".$value."</title>\n";
break;
case 'X-UA-Compatible':
case 'Content-Type':
case 'viewport':
case 'description':
case 'keywords':
case 'robots':
case 'referrer':
case 'apple-mobile-web-app-capable':
$standar_output = "<meta name='".$key."' content='".$value."'/>\n";
break;
case 'profile':
$standar_output = "<link rel='".$key."' href='".$value."'/>\n";
break;
}
echo $standar_output;
}
/*
* Twitter Site Name
*
*/
$twitter_site = '';
if (!empty($twitter_user)) {
$twitter_site = '@'.$twitter_user;
}
/*
* Twitter Cards and Open Graph mix
*
* NO need for twitter:title, twitter:description, twitter:image
* see : https://dev.twitter.com/cards/getting-started#opengraph
* Twitter Cards and Open Graph mix
*
*/
$twitter_card = array (
'twitter:card' => $twitter_summary,
'twitter:site' => $twitter_site,
);
// Removing empty array slots
$twitter = array_filter( $twitter_card );
echo "<!-- Twitter Card data -->\n";
$twitter_output = '';
foreach ($twitter as $property => $content) {
if (!empty($content))
$twitter_output .= "<meta property='".$property."' content='".$content."' />\n";
}
echo $twitter_output;
/*
* Facebook - APP ID & USER ID
*
*/
if (mwp_option('facebook-app-enable') == 1) {
$facebook_appid = mwp_option('facebook-app-id');
$facebook_admins = mwp_option('facebook-user-id');
} else {
$facebook_appid = '';
$facebook_admins = '';
}
/*
* Facebook - OG Description Remove Check
*
*/
if (mwp_option('opengraph-og-desc') == 1) {
$og_social_description = '';
} else {
$og_social_description = $seo_description;
}
/*!
* Facebook Open Graph data
*/
$opengraph_data = array (
'og:locale' => mwp_locale(),
'og:title' => $seo_title,
'og:type' => 'article',
'og:url' => $seo_url,
'og:image' => $seo_image,
'og:description' => $seo_description,
'og:site_name' => $site_name,
'fb:admins' => $facebook_admins,
'fb:app_id' => $facebook_appid
);
// Removing empty array slots
$opengraph = array_filter( $opengraph_data );
echo "<!-- Open Graph data -->\n";
$facebook_output = '';
foreach ($opengraph as $property => $content) {
$facebook_output .= "<meta property='".$property."' content='".$content."' />\n";
}
echo $facebook_output;
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists