Sindbad~EG File Manager

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

<?php
/*
 * Security 	: blocking direct access
 * Source		: http://codex.wordpress.org/Theme_Development#Template_Files
*/
defined('ABSPATH') or die("Access Restricted");
if ( function_exists( 'register_block_type' ) ) {
/*
 * Gutenberg : Add Custom Block Categories
 *
*/
function mwp_theme_blocks_category( $categories, $post ) {
	return array_merge(
		$categories,
		array(
			array(
				'slug' => 'mwp-all-blocks',
				'title' => __( 'NewsBT Blocks', 'mwp-all-blocks' ),
			),
		)
	);
}
add_filter( 'block_categories', 'mwp_theme_blocks_category', 10, 2);

/*
 * Gutenberg : Bootstrap Alerts Scripts
 *
*/
function mwp_gutenberg_block_alert() {
	$editor_url 	= get_template_directory_uri() . '/panel/gutenberg/editor.css';
	$editor_path 	= get_template_directory() . '/panel/gutenberg/editor.css' ;
	wp_register_style(
		'mwp-gutenberg-editor',
		$editor_url,
		array( 'wp-edit-blocks' ),
		filemtime( $editor_path  )
	);
	$alert_uri 	= get_template_directory_uri() . '/panel/gutenberg/alert.js';
	$alert_path 	= get_template_directory() . '/panel/gutenberg/alert.js';
	wp_register_script(
		'alert-script',
		$alert_uri,
		array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor' ),
		filemtime( $alert_path )
	);
	// Alert Info
    register_block_type( 'mwp/alert-info', array(
        'editor_script' => 'alert-script',
        'editor_style'  => 'mwp-gutenberg-editor',
    ));
	// Alert Success
    register_block_type( 'mwp/alert-success', array(
        'editor_script' => 'alert-script',
        'editor_style'  => 'mwp-gutenberg-editor',
    ));
	// Alert Warning
    register_block_type( 'mwp/alert-warning', array(
        'editor_script' => 'alert-script',
        'editor_style'  => 'mwp-gutenberg-editor',
    ));
	// Alert Danger
    register_block_type( 'mwp/alert-danger', array(
        'editor_script' => 'alert-script',
        'editor_style'  => 'mwp-gutenberg-editor',
    ));
}
add_action( 'init', 'mwp_gutenberg_block_alert' );
/*
 * Gutenberg : Adsense Block Scripts
 *
*/
function mwp_gutenberg_block_adsense() {
	$adsense_uri 	= get_template_directory_uri() . '/panel/gutenberg/adsense.js';
	$adsense_path 	= get_template_directory() . '/panel/gutenberg/adsense.js';
	wp_register_script(
		'adsense-script',
		$adsense_uri,
		array(
			'wp-element',
			'wp-rich-text',
			'wp-format-library',
			'wp-i18n',
			'wp-editor',
			'wp-compose',
			'wp-components',
		),
		filemtime( $adsense_path )
	);
	wp_localize_script('adsense-script', 'ads_lang', array(
		'screen' 	=> __('Select Devices size', MWP_TEXT_DOMAIN),
		'screen_1' 	=> __('All Screen', MWP_TEXT_DOMAIN),
		'screen_2' 	=> __('Large + Medium', MWP_TEXT_DOMAIN),
		'screen_3' 	=> __('Large + Small', MWP_TEXT_DOMAIN),
		'screen_4' 	=> __('Medium + Small', MWP_TEXT_DOMAIN),
		'screen_5' 	=> __('Small', MWP_TEXT_DOMAIN),
		'screen_6' 	=> __('Medium', MWP_TEXT_DOMAIN),
		'screen_7' 	=> __('Large device', MWP_TEXT_DOMAIN),
		'rs' 		=> __('Revenu Share', MWP_TEXT_DOMAIN),
		'rs_format' => __('Revenu Share : data-ad-format', MWP_TEXT_DOMAIN),
		
	));
	wp_enqueue_script('adsense-script');
	wp_enqueue_style( 'prefix-font-awesome',  get_template_directory_uri() .'/css/assets.css', array(), '4.7.0' );
}
add_action( 'enqueue_block_editor_assets', 'mwp_gutenberg_block_adsense' );
/*
 * Gutenberg : Adsense Shortcode.
 *
*/
function mwp_gutenberg_block_adsense_shortcode( $attr ) {
	extract(shortcode_atts(array( 
		"client" 	=> '',
		"slot" 		=> '',
		"screen" 	=> '',
		"rs" 		=> '',
		"format" 	=> '',
	),
	$attr));
	// check if adsense on scroll enabled
	if(mwp_option('adsense-on-scroll') == 0) {
		$tag_script = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>';
	} else {
		$tag_script = '';	
	}
	if (!empty($rs)) {
		return '<div class="skip_css '.$screen.'">
			'.mwp_ads_revenu_share(false, $format).'
		</div>';
	} else {
		return '<div class="skip_css '.$screen.'">
			'.$tag_script.'
			<ins class="adsbygoogle"
				 style="display:block"
				 data-ad-format="'.$format.'"
				 data-ad-client="'.$client.'"
				 data-ad-slot="'.$slot.'"
				 data-full-width-responsive="true"></ins>
			<script>
			(adsbygoogle = window.adsbygoogle || []).push({});
		</script></div>';	
	}
}
add_shortcode( 'mwpads', 'mwp_gutenberg_block_adsense_shortcode' );

/*
 * Gutenberg : Adsense Block Initializer.
 *
*/
function mwp_gutenberg_block_adsense_init() {
	if ( function_exists( 'register_block_type' ) ) {
		register_block_type( 'mwp/adsense', 
			array(
				'render_callback' 	=> 'mwp_gutenberg_block_adsense_callback',
				'attributes' 		=> array(
					'DataAdClient'	 => array(
						'type' => 'string',
					),
					'DataAdSlot' => array(
						'type' => 'string',
					),
					'AdScreen'	 => array(
						'type' => 'string',
					),
					'RevenuShare'	=> array(
						'type'	=> 'boolean',
					),
					'DataAdFormat'	 => array(
						'type' => 'string',
					),
				),
			)
		);
	}
}
add_action('init', 'mwp_gutenberg_block_adsense_init');
/*
 * Gutenberg : Adsense Block callback.
 *
*/
function mwp_gutenberg_block_adsense_callback( $attr ) {
	extract( $attr );
	if ( isset( $DataAdClient ) &&  isset( $DataAdSlot ) ) {
		if (!empty($RevenuShare)) {
			$rs = $RevenuShare;
		} else {
			$rs = '';
		}
		$shortcode_string = '[mwpads client="%s" slot="%s" screen="%s" rs="%s" format="%s"]';
        return sprintf( $shortcode_string, $DataAdClient, $DataAdSlot, $AdScreen, $rs, $DataAdFormat );
	}
}

/*
 * Gutenberg : Google Doc Viewer Script.
 *
*/
function mwp_gutenberg_block_docs() {
	$docs_uri 	= get_template_directory_uri() . '/panel/gutenberg/docs.js';
	$docs_path 	= get_template_directory() . '/panel/gutenberg/docs.js';
	wp_register_script(
		'docs-script',
		$docs_uri,
		array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor' ),
		filemtime( $docs_path )
	);
	wp_localize_script('docs-script', 'docs_lang', array(
		'embed_url' => __('File URL', MWP_TEXT_DOMAIN),
		'embed_download' => __('Show Download Link', MWP_TEXT_DOMAIN),
		'embed_text' => __('Download Text', MWP_TEXT_DOMAIN),
	));
	wp_enqueue_script('docs-script');
}
add_action( 'enqueue_block_editor_assets', 'mwp_gutenberg_block_docs' );
/*
 * Gutenberg : Google Doc Viewer Shortcode.
 *
*/
function mwp_gutenberg_block_docs_shortcode( $attr ) {
	extract(shortcode_atts(array( 
		"url" 		=> '',
		"download" 	=> '',
		"text" 	=> '',
	),
	$attr));
	if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
		return '<div class="docview"><a class="embed" target="_blank" href="https://docs.google.com/viewerng/viewer?embedded=true&url='.$link.'">View File in Google Docs</a></div>';
	} else {
		if (!empty($download)) {
			$display = 'block';
		} else {
			$display = 'none';
		}
		return '<div class="docview"><a class="embed" style="text-align: center; display: '.$display.';" href="'.$url.'">'.$text.'</a></div>';
	}
}
add_shortcode( 'mwpdoc', 'mwp_gutenberg_block_docs_shortcode' );

/*
 * Gutenberg : Google Doc Viewer Block Initializer.
 *
*/
function mwp_gutenberg_block_docs_init() {
	if ( function_exists( 'register_block_type' ) ) {
		register_block_type( 'mwp/doc-viewer', 
			array(
				'render_callback' 	=> 'mwp_gutenberg_block_docs_callback',
				'attributes' 		=> array(
					'embedUrl'	 => array(
						'type' => 'string',
					),
					'downloadLink'	=> array(
						'type'	=> 'boolean',
					),
					'downloadText'	=> array(
						'type'	=> 'string',
					),
				),
			)
		);
	}
}
add_action('init', 'mwp_gutenberg_block_docs_init');
/*
 * Gutenberg : Google Doc Viewer Callback
 *
*/
function mwp_gutenberg_block_docs_callback( $attr ) {
	extract( $attr );
	if ( isset( $embedUrl ) ) {
		if (!empty($downloadLink)) {
			$dl_btn = $downloadLink;
		} else {
			$dl_btn = '';
		}
		if ( isset( $downloadText ) ) {
			$dl_text = $downloadText;
		} else {
			$dl_text = '';
		}
		$shortcode_string = '[mwpdoc url="%s" download="%s" text="%s"]';
        return sprintf( $shortcode_string, $embedUrl, $dl_btn, $dl_text );
	}
}
/*
 * Gutenberg : Font Family Helper
 *
*/
function mwp_gutenberg_fontfamily_data(){
	
	$custom1 = null;
	$custom2 = null;
	$custom3 = null;
	$custom_font_1 = mwp_option('typo-custom-font1-name');
	$custom_font_2 = mwp_option('typo-custom-font2-name');
	$custom_font_3 = mwp_option('typo-custom-font3-name');
	
	if (!empty($custom_font_1)) {
		$custom1 = $custom_font_1;
	}
	if (!empty($custom_font_2)) {
		$custom2 = $custom_font_2;
	}
	if (!empty($custom_font_3)) {
		$custom3 = $custom_font_3;
	}
	
	$default = array(	
		array(
			'label' => __('Default Font Family', MWP_TEXT_DOMAIN),
			'value'	=> 'font-default',
		),
	);
	if (is_rtl()) {
		$data_fonts = array();
		$fonts = array(
			'Droid Arabic Kufi',
			'Droid Arabic Naskh',
			'Thabit',
			'Cairo',
			'Amiri',
			'Changa',
			'Lateef',
			'Reem Kufi',
			'Lalezar',
			'Scheherazade',
			'Baloo Bhaijaan',
			'Mada',
			'Lemonada',
			'El Messiri',
			'Harmattan',
			'Aref Ruqaa',
			'Mirza',
			'Rakkas',
			'Katibeh',
			'Jomhuria',
			'Arial',
			'Tahoma',
			$custom1,
			$custom2,
			$custom3,
		);
		$fonts_filter = array_filter($fonts);
		foreach ($fonts_filter as $index => $val) {
			$data_fonts[] = array(
				'label' => $val,
				'value'	=> 'font-'.strtolower(str_replace(' ', '-', $val)),
				'style' => '.font-'.strtolower(str_replace(' ', '-', $val)).'{font-family:'.$val.'}'
			);
		}
	} else {
		$fonts = array(	
			'Lato',
			'Droid Sans',
			'Vollkorn',
			'Ubuntu',
			'PT Serif',
			'Old Standard TT',
			'Open Sans',
			'Josefin Slab',
			'Roboto',
			'Arial',
			'Tahoma',
			$custom1,
			$custom2,
			$custom3,
		);
		$fonts_filter = array_filter($fonts);
		foreach ($fonts_filter as $index => $val) {
			$data_fonts[] = array(
				'label' => $val,
				'value'	=> 'font-'.strtolower(str_replace(' ', '-', $val)),
				'style' => '.font-'.strtolower(str_replace(' ', '-', $val)).'{font-family:'.$val.'}'
			);
		}
	}
	return array_merge($default, $data_fonts);
}
/*
 * Gutenberg : Global Filters
 *
*/
function mwp_gutenberg_global_filters() {
	$docs_uri 	= get_template_directory_uri() . '/panel/gutenberg/global-fitlers.js';
	$docs_path 	= get_template_directory() . '/panel/gutenberg/global-fitlers.js';
	
	$data = mwp_gutenberg_fontfamily_data();
	$dataJson = json_encode($data);
	
	
	$default = array(	
		array(
			'label' => __('Select', MWP_TEXT_DOMAIN),
			'value'	=> 'font-default',
		),
	);
	$font_weight = array(
		'100',
		'200',
		'300',
		'400',
		'500',
		'600',
		'700',
		'800',
		'900',
	);
	$fonts_filter = array_filter($font_weight);
	foreach ($fonts_filter as $index => $val) {
		$data_weight[] = array(
			'label' => $val,
			'value'	=> 'font-weight-'.strtolower(str_replace(' ', '-', $val)),
		);
	}
	$output_fontweight 		= array_merge($default, $data_weight);
	$dataJson_fontweight 	= json_encode($output_fontweight);
	
	wp_register_script(
		'global-fitlers-script',
		$docs_uri,
		array( 
			'wp-blocks', 
			'wp-element', 
			'wp-edit-post',
			'wp-i18n'
		),
		filemtime( $docs_path )
	);
	wp_localize_script('global-fitlers-script', 'global_fitlers_lang', array(
		'font_family' => __('Font Family', MWP_TEXT_DOMAIN),
		'select_type' => __('Select Type', MWP_TEXT_DOMAIN),
		'font_weight' => __('Font Weight', MWP_TEXT_DOMAIN),
	));
	wp_localize_script('global-fitlers-script', 'global_fitlers_data', $dataJson);
	wp_localize_script('global-fitlers-script', 'global_fitlers_fontweight', $dataJson_fontweight);
	wp_enqueue_script('global-fitlers-script');
	
	$custom_font_1_key		= null;
	$custom_font_1_value	= null;
	$custom_font_2_key		= null;
	$custom_font_2_value	= null;
	$custom_font_3_key		= null;
	$custom_font_3_value	= null;
	
	$custom_font_1	= mwp_option('typo-custom-font1-name');
	$custom_font_2	= mwp_option('typo-custom-font2-name');
	$custom_font_3	= mwp_option('typo-custom-font3-name');
	
	if (!empty($custom_font_1)) {
		$custom_font_1_key 		= $custom_font_1.':custom';
		$custom_font_1_value 	= $custom_font_1;
	}
	if (!empty($custom_font_2)) {
		$custom_font_2_key 		= $custom_font_2.':custom';
		$custom_font_2_value 	= $custom_font_2;
	}
	if (!empty($custom_font_3)) {
		$custom_font_3_key 		= $custom_font_3.':custom';
		$custom_font_3_value 	= $custom_font_3;
	}
	if (is_rtl()) {
		$fonts = array(	
			'0' 	=> 'Droid Arabic Kufi',
			'1'		=> 'Droid Arabic Naskh',
			'2' 	=> 'Thabit',
			'3' 	=> 'Cairo',
			'4' 	=> 'Amiri',
			'5' 	=> 'Changa',
			'6' 	=> 'Lateef',
			'7' 	=> 'Reem Kufi',
			'8' 	=> 'Lalezar',
			'9' 	=> 'Scheherazade',
			'10' 	=> 'Baloo Bhaijaan',
			'11' 	=> 'Mada',
			'12' 	=> 'Lemonada',
			'13' 	=> 'El Messiri',
			'14' 	=> 'Harmattan',
			'15' 	=> 'Aref Ruqaa',
			'16'	=> 'Mirza',
			'17' 	=> 'Rakkas',
			'18' 	=> 'Katibeh',
			'19' 	=> 'Jomhuria',
			'20' 	=> $custom_font_1_value,
			'21' 	=> $custom_font_2_value,
			'22' 	=> $custom_font_3_value,	
		);
	} else {
		$fonts = array(	
			'0' 	=>  'Lato',
			'1' 	=>  'Droid Sans',
			'2' 	=>  'Vollkorn',
			'3' 	=>  'Ubuntu',
			'4' 	=>  'PT Serif',
			'5' 	=>  'Old Standard TT',
			'6' 	=>  'Open Sans',
			'7' 	=>  'Josefin Slab',
			'8' 	=>  'Roboto',
			'9' 	=> $custom_font_1_value,
			'10' 	=> $custom_font_2_value,
			'11' 	=> $custom_font_3_value,	
		);	
	}
	
	$list = array();
	$font_size = '300,400,500,700,900';
	
	foreach ($fonts as $index => $font) {
		if ( $font == $custom_font_1_value || $font == $custom_font_2_value || $font == $custom_font_3_value ) {
			// no font load
		} else {	
			$list[$font] = $font_size;
		}
	}
	$google_fonts_url = mwp_google_fonts_url(array_filter($list), 'latin,latin-ext');
	wp_enqueue_style( 'gb-google-fonts', $google_fonts_url );
}
add_action( 'enqueue_block_editor_assets', 'mwp_gutenberg_global_filters' );


/*
 * Gutenberg : Pros & Cons
 *
*/
function mwp_gutenberg_block_proscons() {
	$proscons_uri 	= get_template_directory_uri() . '/panel/gutenberg/proscons.js';
	$proscons_path 	= get_template_directory() . '/panel/gutenberg/proscons.js';
	wp_enqueue_script(
		'proscons',
		$proscons_uri,
		array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor' ),
		filemtime( $proscons_path )
	);
}
add_action( 'enqueue_block_editor_assets', 'mwp_gutenberg_block_proscons' );

function mwp_gutenberg_block_proscons_init() {
	// Only load if Gutenberg is available.
	if ( ! function_exists( 'register_block_type' ) ) {
		return;
	}
	// Hook server side rendering into render callback
	register_block_type( 'mwp/pros-cons', array(
		'render_callback' => 'mwp_gutenberg_block_proscons_render',
	) );
}
add_action('init', 'mwp_gutenberg_block_proscons_init');

function mwp_gutenberg_block_proscons_render( $attributes, $content ) {
	
	if ( is_admin() ) {
		return $content;
	}

	wp_set_internal_encoding();
	$doc = new DOMDocument();
	libxml_use_internal_errors(true);
	if (extension_loaded('mbstring')) {
		$doc->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'));
	} else {
		$doc->loadHTML($content);
	}
	
	$i 			= 0;
	$para 		= $doc->getElementsByTagName('p');
	$list 		= $doc->getElementsByTagName('ul');
	$paragraph 	= array();
	$lists 		= array();
	
	foreach ($para as $p) :
		$paragraph[] = $p->nodeValue;
	$i++;
	endforeach;

	foreach ($list as $ul) :
		$lists[] = $ul->ownerDocument->saveHTML($ul);
	$i++;
	endforeach;
	
	$out = '<div class="proscons-wrapper">';
	$out .= '<div class="proscons-column">';
	$out .= '<div class="proscons-title proscons-title-bg1">'.$paragraph[0].'</div><div class="proscons-column-ul">';
	$out .= $lists[0];
	$out .= '</div></div>';
	$out .= '<div class="proscons-column">';
	$out .= '<div class="proscons-title proscons-title-bg2">'.$paragraph[1].'</div><div class="proscons-column-ul">';
	$out .= $lists[1];
	$out .= '</div></div>';
	$out.='</div>';
	
	return $out;
}


/*
 * Gutenberg : Facebook Script.
 *
*/
function mwp_gutenberg_block_fb_video() {
	$fbvid_uri 	= get_template_directory_uri() . '/panel/gutenberg/facebook.js';
	$fbvid_path 	= get_template_directory() . '/panel/gutenberg/facebook.js';
	wp_enqueue_script(
		'facebook-video-script',
		$fbvid_uri,
		array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor' ),
		filemtime( $fbvid_path )
	);
}
add_action( 'enqueue_block_editor_assets', 'mwp_gutenberg_block_fb_video' );
/*
 * Function Description	: check if custom field have full URL Facebook and return id
 * Author Name			: Mouad Achemli
 * Function Source		: https://stackoverflow.com/a/3062053/2535061
 * 						: https://stackoverflow.com/a/45399559/2535061
 * 						: https://stackoverflow.com/a/42805590/2535061
 * Note					: this function is important do not remove from here
 *
*/
function mwp_fb_url_extract_id_gb($url) {
	if(filter_var($url, FILTER_VALIDATE_URL)){
		if (strpos($url, '?') !== false) {
			$url_parsed = parse_url($url);
			parse_str($url_parsed['query'], $url_parts);
			return $url_parts['v'];
		} else {
			preg_match("#(\d+)/$#", $url, $vid);
			return $vid[1];
		}
	}
}
/*
 * Gutenberg : Facebook Shortcode.
 *
*/
function mwp_gutenberg_block_fb_video_shortcode( $attr ) {
	extract(shortcode_atts(array( 
		"url" 		=> '',
	),
	$attr));
	if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
		return '<amp-facebook width="552" height="310" layout="responsive" data-href="https://www.facebook.com/video.php?v='.mwp_fb_url_extract_id_gb($url).'"></amp-facebook>';
	} else {
		if (mwp_option('facebook-player') == 1) {
			return '<div class="vi-responsive"><iframe src="https://www.facebook.com/video/embed?video_id='.mwp_fb_url_extract_id_gb($url).'" width="620" height="320" allowfullscreen></iframe></div>';
		} elseif (mwp_option('facebook-player') == 2) {
			return '<div class="block"><div class="fb-video" data-href="https://www.facebook.com/video.php?v='.mwp_fb_url_extract_id_gb($url).'" data-width="1000" data-allowfullscreen="true" data-autoplay="false" data-show-captions="true"></div></div>';
		}
	}
}
add_shortcode( 'fbvid', 'mwp_gutenberg_block_fb_video_shortcode' );
/*
 * Gutenberg : Facebook Block Initializer.
 *
*/
function mwp_gutenberg_block_fb_video_init() {
	if ( function_exists( 'register_block_type' ) ) {
		register_block_type( 'mwp/facebook-video', 
			array(
				'render_callback' 	=> 'mwp_gutenberg_block_fb_video_callback',
				'attributes' 		=> array(
					'embedUrl'	 => array(
						'type' => 'string',
					),
				),
			)
		);
	}
}
add_action('init', 'mwp_gutenberg_block_fb_video_init');
/*
 * Gutenberg : Facebook Callback
 *
*/
function mwp_gutenberg_block_fb_video_callback( $attr ) {
	extract( $attr );
	if ( isset( $embedUrl ) ) {
		$shortcode_string = '[fbvid url="%s"]';
        return sprintf( $shortcode_string, $embedUrl );
	}
}
/*
 * Gutenberg : Enqueue Font CSS
 *
*/
function mwp_gb_admin_font_css(){
	if ( mwp_option('fonts-library') == 1) {	
		wp_enqueue_style(
			'default-editor-font',
			get_stylesheet_directory_uri() . "/panel/gutenberg/fonts/default.css",
			array(),
			null
		);
	} elseif ( mwp_option('fonts-library') == 4) {
		wp_enqueue_style(
			'droid-editor-font',
			get_stylesheet_directory_uri() . "/panel/gutenberg/fonts/droid.css",
			array(),
			null
		);
	} elseif ( mwp_option('fonts-library') == 5) {
		wp_enqueue_style(
			'roboto-editor-font',
			get_stylesheet_directory_uri() . "/panel/gutenberg/fonts/roboto.css",
			array(),
			null
		);
	} elseif ( mwp_option('fonts-library') == 7) {
		wp_enqueue_style(
			'cairo-editor-font',
			get_stylesheet_directory_uri() . "/panel/gutenberg/fonts/cairo.css",
			array(),
			null
		);
	}
}
add_action( 'enqueue_block_editor_assets', 'mwp_gb_admin_font_css' );
/*
 * Gutenberg : Print Custom Font CSS
 *
*/
function mwp_gb_admin_font_inline(){
	if ( mwp_option('fonts-library') == 2 || mwp_option('fonts-library') == 3) {
		$fontfamily = mwp_option('typo-body');
		if (isset($fontfamily['font-family'])) {
			?>
			<style>
			.editor-writing-flow {
				font-family:<?php echo $fontfamily['font-family']; ?>;
			}
			.editor-post-title *,
			.editor-writing-flow h1,
			.editor-writing-flow h2,
			.editor-writing-flow h3,
			.editor-writing-flow h4,
			.editor-writing-flow h5,
			.editor-writing-flow h6 {
				font-family:<?php echo $fontfamily['font-family']; ?>;
			}
			</style>
			<?php
		}
	} elseif ( mwp_option('fonts-library') == 6) {
		$fontfamily = mwp_option('typo-custom-font1-name');
		if (!empty($fontfamily)) {
			?>
			<style>
			.editor-writing-flow {
				font-family:<?php echo $fontfamily; ?>;
			}
			.editor-post-title *,
			.editor-writing-flow h1,
			.editor-writing-flow h2,
			.editor-writing-flow h3,
			.editor-writing-flow h4,
			.editor-writing-flow h5,
			.editor-writing-flow h6 {
				font-family:<?php echo $fontfamily; ?>;
			}
			</style>
			<?php
		}
	}
}
add_action( 'admin_print_styles', 'mwp_gb_admin_font_inline' );
}

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