Sindbad~EG File Manager

Current Path : /var/www/html/wordpress_alg24news/wp-content/themes/newsbt-mobile/functions/seo/
Upload File :
Current File : /var/www/html/wordpress_alg24news/wp-content/themes/newsbt-mobile/functions/seo/single-jsonld.php

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

function mwp_seo_single_jsonld() {
		wp_reset_query();
		/*!
		 * 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');
		$facebook_publisher		= mwp_option('facebook-link');
		$get_site_name 			= mwp_option('seo-home-title');
		
		$queried_object 		= get_queried_object();
		$category 				= mwp_display_category_name($queried_object->ID);
		$tags 					= mwp_seo_keywords_opengraph($queried_object->ID);
		$permalink 				= get_permalink($queried_object->ID);
		$page_title 			= mwp_seo_title($queried_object->ID);
		$page_description 		= mwp_seo_description($queried_object->ID);
		$page_keywords 			= mwp_seo_keywords($queried_object->ID);
		$page_image				= mwp_seo_image($queried_object->ID);
		$published_date			= seo_publish_date('c', $queried_object->ID);
		$modified_time			= seo_modified_time('c', $queried_object->ID);
		
		/* Social */
		$social_title			= mwp_social_title($queried_object->ID);
		$social_description		= mwp_social_description($queried_object->ID);
		$social_image			= mwp_social_image($queried_object->ID);
		
		$article 				= mwp_option('rich-snippet-article');
		$news_article 			= mwp_option('rich-snippet-newsarticle');
		$blog_posting 			= mwp_option('rich-snippet-blogposting');
		$meta_disabled 			= metadata_exists( 'post', $queried_object->ID, '_mwp_schema_disable');
		$author_name 			= get_the_author_meta('display_name', $queried_object->post_author);
		$get_richsnippet_logo	= mwp_option('rich-snippet-amp-logo');
		
		if (!empty($get_richsnippet_logo)) {
			$richsnippet_logo		= $get_richsnippet_logo;
			$richsnippet_logo_size	= array('600');
		} else {
			$richsnippet_logo		= get_template_directory_uri().'/images/schema-org-example-logo-size-for-amp-articles.jpg';
			$richsnippet_logo_size	= array('600');
		}
		/*
		 * Facebook - Site Name
		 *
		*/
		if (!empty($get_site_name)) {
			$site_name = $get_site_name;
		} else {
			$site_name = get_bloginfo('name');
		}
		
		/*!
		 * Rich Snippets
		 * JSON-based linked data
		 * @JSON-LD
		*/
		if ( 
			is_singular('post') && in_category($article) && $meta_disabled == false || 
			is_singular('post') && in_category($news_article) && $meta_disabled == false ||
			is_singular('post') && in_category($blog_posting) && $meta_disabled == false ) 
		{
			
			$type = '';
			if (!empty($article) && in_category($article)) {
				$type  = 'Article';
			} elseif (!empty($news_article) && in_category($news_article)) {
				$type  = 'NewsArticle';
			} elseif (!empty($blog_posting) && in_category($blog_posting)) {
				$type  = 'BlogPosting';
			}
			
			$schema["@context"] 		= "http://schema.org";
			$schema["@type"] 			= $type;
			$schema["mainEntityOfPage"]	= array(
				'@type' => 'WebPage',
				'@id' 	=> $permalink
			);
			$schema["headline"] 		= $page_title;
			if (!empty($page_image)) {
				$schema["image"] 			= array(
					'@type' 	=> 'ImageObject',
					'url' 		=> $page_image,
					'height' 	=> 772,
					'width' 	=> 432
				);
			}
			$schema["datePublished"] 	= $published_date;
			$schema["dateModified"] 	= $modified_time;
			$schema["author"] 			= array(
				'@type' => "Person",
				'name' 	=> $author_name
			);
			$schema["publisher"] 		= array(
				'@type' => 'Organization',
				'name' 	=> $site_name,
				'logo' 	=> array (
					'@type' 	=> 'ImageObject',
					'url'		=> $richsnippet_logo,
					'width' 	=> $richsnippet_logo_size[0],
				)
			);
			$schema["description"] 		= $page_description;
			$schema["keywords"] 		= explode(',',$page_keywords);
			
			echo '<!-- Structured Data - JSON/LD -->',"\n";
			echo "<script type='application/ld+json'>". json_encode($schema) ."</script>\n";
			
		}
		
		$array_cpt1 	= mwp_option('cpt-rs-article');
		$array_cpt2 	= mwp_option('cpt-rs-newsarticle');
		$array_cpt3 	= mwp_option('cpt-rs-blogposting');
		$args = array(
		   'public'   => true,
		   '_builtin' => false
		);
		$post_types = get_post_types($args);

		if (!is_singular('post') && !empty($post_types) && is_singular($post_types) && $meta_disabled == false) {
		
			$type_cpt = '';
			if (is_singular($array_cpt1)) {
				$type_cpt  = 'Article';
			} elseif (is_singular($array_cpt2)) {
				$type_cpt  = 'NewsArticle';
			} elseif (is_singular($array_cpt3)) {
				$type_cpt  = 'BlogPosting';
			}

			$schema_cpt["@context"] 		= "http://schema.org";
			$schema_cpt["@type"] 			= $type_cpt;
			$schema_cpt["mainEntityOfPage"]	= array(
				'@type' => 'WebPage',
				'@id' 	=> $permalink
			);
			$schema_cpt["headline"] 		= $page_title;
			if (!empty($page_image)) {
				$schema_cpt["image"] 			= array(
					'@type' 	=> 'ImageObject',
					'url' 		=> $page_image,
					'height' 	=> 772,
					'width' 	=> 432
				);
			}
			$schema_cpt["datePublished"] 	= $published_date;
			$schema_cpt["dateModified"] 	= $modified_time;
			$schema_cpt["author"] 			= array(
				'@type' => "Person",
				'name' 	=> $author_name
			);
			$schema_cpt["publisher"] 		= array(
				'@type' => 'Organization',
				'name' 	=> $site_name,
				'logo' 	=> array (
					'@type' 	=> 'ImageObject',
					'url'		=> $richsnippet_logo,
					'width' 	=> $richsnippet_logo_size[0],
				)
			);
			$schema_cpt["description"] 		= $page_description;
			$schema_cpt["keywords"] 		= explode(',',$page_keywords);
			
			echo '<!-- Structured Data - JSON/LD -->',"\n";
			echo "<script type='application/ld+json'>". json_encode($schema_cpt) ."</script>\n";

		}
}

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