Sindbad~EG File Manager

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

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

/*
 * Custom Posts Type Helper
 *
*/
function mwp_cpt_list(){
	$args = array(
		'public'   => true,
	);
	$output 	= 'names';
	$operator 	= 'and';
	$post_types = get_post_types( $args, $output, $operator ); 
	return $post_types;
}
/*
 * Get All Posts Type
 *
*/
function mwp_get_all_post_types() {
	$types 		= array();
	$get_types 	= mwp_cpt_list(); 
	$pt_remove 	= array(
		"post",
		"page",
		"attachment",
		"nav_menu_item",
		"customize_changeset",
		"revision",
	);
	foreach ( $get_types  as $post_type ) :
		if ( in_array($post_type, $pt_remove) ) continue;
		$types[] = $post_type;
	endforeach;
	$types[] = array('post');
	return $types;
}

if (class_exists('All_in_One_SEO_Pack') || class_exists('WPSEO_Options')) {
	/*! 
	 * SEO Helper
	 * Add Namespaces Video to HTML tag
	 * @author : Mouad Achemli
	 *
	*/
	add_filter( 'wpseo_html_namespaces', 'mwp_opengraph_url' );
	function mwp_opengraph_url( $url ) {
		if ( class_exists('WPSEO_Options') ) {
			$videos_ids = mwp_option('category-videos');
			if (!empty($videos_ids) && in_category($videos_ids) && is_singular('post')) {
				return array(
					'fb: http://ogp.me/ns/fb#',
					'video: http://ogp.me/ns/video#'
				);
			} else {
				return array(
					'fb: http://ogp.me/ns/fb#',
				);	
			}
		}
	}
	/*! 
	 * SEO Helper
	 * Disable Yoast Open Graph
	 * @author : Mouad Achemli
	 *
	*/
	add_action('wp_head', 'mwp_disable_yoast', 1);
	function mwp_disable_yoast() {
		if ( class_exists('WPSEO_Options') ) {
			$videos_ids = mwp_option('category-videos');
			if (!empty($videos_ids) && in_category($videos_ids) && is_singular('post')) {
				remove_action( 'wpseo_head', array( $GLOBALS['wpseo_og'], 'opengraph' ), 30 );
				remove_action( 'wpseo_head', array( 'WPSEO_Twitter', 'get_instance' ), 40 );
			}
		}
	}
	/*! 
	 * SEO Helper
	 * Disable All in one SEO Pack Meta Tag
	 * @author : Mouad Achemli
	 *
	*/
	add_filter( 'aiosp_disable', 'mwp_disable_aioseop', 10, 1 );
	function mwp_disable_aioseop( $disable ){
		if ( class_exists('All_in_One_SEO_Pack') ) {
			$videos_ids = mwp_option('category-videos');
			if (!empty($videos_ids) && in_category($videos_ids) && is_singular('post'))
			return true;
		}
	}
	/*! 
	 * SEO Helper
	 * Remove JSON output by yaost
	 * @author : Mouad Achemli
	 *
	*/
	function mwp_remove_yoast_json($data){
		$queried_object 	= get_queried_object();
		$videos_ids = mwp_option('category-videos');
		if (!empty($videos_ids) && in_category($videos_ids) && is_singular('post')) {
			$data = array();
		}
		return $data;
	}
	add_filter('wpseo_json_ld_output', 'mwp_remove_yoast_json', 10, 1);

}

/*! 
 * SEO Helper 
 * Add Opengraph and JSON-based linked data to Post Video
 * @author : Mouad Achemli
 *
*/

add_action('wp_head', 'mwp_video_opengraph', 3);
function mwp_video_opengraph(){
	if (class_exists('All_in_One_SEO_Pack') || class_exists('WPSEO_Options')) {
		$queried_object 	= get_queried_object();
		$videos_ids = mwp_option('category-videos');
		if (!empty($videos_ids) && in_category($videos_ids) && is_singular('post')) {
			
			$check = str_replace("&nbsp;", '', get_the_excerpt($queried_object->ID));
			$title = content(20, $queried_object->ID);
			
			if ( !empty( $check ) ) {
				$title_content = $title;
			} else {
				$title_content = get_the_title($queried_object->ID);
			}
			$twitter_user = mwp_option('twitter-user');
			if (!empty($twitter_user)) {
				$twitter_site = '@'.$twitter_user;
			} else {
				$twitter_site = '';
			}
			echo '<meta name="description" 		  content="'.$title_content.'" />', " \n";
			echo '<meta name="twitter:card"       content="summary_large_image" />', " \n";
			echo '<meta name="twitter:site" 	  content="'.$twitter_site.'" />', " \n";
			echo '<meta property="og:type"        content="video.other"/>', " \n";
			echo '<meta property="og:locale" 	  content="'.mwp_locale().'" />', " \n";
			echo '<meta property="og:url"         content="'.get_permalink($queried_object->ID).'" />', " \n";
			echo '<meta property="og:site_name"   content="'.get_bloginfo('name').'" />', " \n";
			echo '<meta property="og:title"       content="'.get_the_title($queried_object->ID).'" />', " \n";
			echo '<meta property="og:description" content="'.$title_content.'" />', " \n";
			echo '<meta property="og:image"       content="'.mwp_seo_image_video($queried_object->ID, 600, 315).'" />', " \n";
		}
	}
}

function mwp_video_schema(){
	$queried_object 	= get_queried_object();
	$seo_keywords 		= mwp_seo_keywords($queried_object->ID);
	$schema_duration 	= check_duration_seo($queried_object->ID);
	
	$check = str_replace("&nbsp;", '', get_the_excerpt($queried_object->ID));
	$title = content(20, $queried_object->ID);
	if ( !empty( $check) ) {
		$title_content = $title;
	} else {
		$title_content = get_the_title($queried_object->ID);
	}
	
	if ( get_option('permalink_structure') ) {
		$embed_url =  mwp_get_endpoint_url('embed', '1', get_permalink($queried_object->ID));
	} else {
		$embed_url =  esc_url(add_query_arg('embed', 1, get_permalink($queried_object->ID)));
	}
	
	if ( get_the_modified_time( 'U' ) > get_the_time( 'U' ) ) {
		$itemprop_meta = 'dateModified';
		$itemprop_content = get_the_modified_time('c');
	} else {
		$itemprop_meta = 'datePublished';
		$itemprop_content = get_the_time('c');
	}
	if (function_exists( 'is_amp_endpoint' ) && is_amp_endpoint()) {
		$meta_name = '<meta itemprop="name" content="'.get_the_title($queried_object->ID).'" />';
	} else {
		$meta_name = '';
	}
	echo $meta_name.'
		<meta itemprop="description" content="'.$title_content.'" />
		<meta itemprop="duration" content="'.duration_iso8601_seo($schema_duration).'" />
		<meta itemprop="thumbnailUrl" content="'.mwp_seo_image_video($queried_object->ID, 772, 433).'" />
		<meta itemprop="image" content="'.mwp_seo_image_video($queried_object->ID, 772, 433).'" />
		<meta itemprop="embedURL" content="'.$embed_url.'" />
        <meta itemprop="uploadDate" content="'.get_the_time('c').'" />
		<meta itemprop="'.$itemprop_meta.'" content="'.$itemprop_content.'" />
		<meta itemprop="keywords" content="'.$seo_keywords.'" />
		<meta itemprop="url" content="'.get_permalink($queried_object->ID).'" />
		<meta itemprop="isFamilyFriendly" content="True" />
		<meta itemprop="playertype" content="HTML" />';
}

function mwp_get_endpoint_url( $endpoint, $value = '', $permalink = '' ) { 
    if ( ! $permalink ) { 
        $permalink = get_permalink(); 
    } 
    // Map endpoint to options 
    $endpoint = 'embed'; 
    $value = '';
	
    if ( get_option( 'permalink_structure' ) ) { 
        if ( strstr( $permalink, '?' ) ) { 
            $query_string = '?' . parse_url( $permalink, PHP_URL_QUERY ); 
            $permalink = current( explode( '?', $permalink ) ); 
        } else { 
            $query_string = ''; 
        } 
        $url = trailingslashit( $permalink ) . $endpoint . '/' . $value . $query_string; 
    } else { 
        $url = add_query_arg( $endpoint, $value, $permalink ); 
    } 
 
    return apply_filters( 'mwp_get_endpoint_url', $url, $endpoint, $value, $permalink ); 
}

/*! 
 * SEO Helper 
 * Add Extra Endpoint To Post Video
 * @author : Mouad Achemli
 *
*/
function wpa_read_endpoint(){
    add_rewrite_endpoint( 'embed', EP_PERMALINK, $query_vars = false);
}
add_action( 'init', 'wpa_read_endpoint' );

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