HEX
Server: Apache
System: Linux webserver101.turnkeywebspace.com 4.18.0-553.81.1.el8_10.x86_64 #1 SMP Mon Oct 27 11:29:19 EDT 2025 x86_64
User: mastech10 (1521)
PHP: 8.2.30
Disabled: show_source,system,shell_exec,passthru,exec,phpinfo,popen,proc_open,eval
Upload Files
File: /home/mastech10/www/global-trade-news.com/wp-content/themes/visionary-news/inc/google-fonts.php
<?php

if ( ! function_exists( 'visionary_news_get_all_google_fonts' ) ) :
	/**
	 * Returns list of Google fonts.
	 */
	function visionary_news_get_all_google_fonts() {
		$webfonts_json   = get_template_directory() . '/inc/google-webfonts.json';
		$fonts_json_data = file_get_contents( $webfonts_json );

		$all_fonts = json_decode( $fonts_json_data, true );

		$google_fonts = array();
		foreach ( $all_fonts as $font ) {
			$google_fonts[ $font['family'] ] = array(
				'family'   => $font['family'],
				'variants' => $font['variants'],
			);
		}
		return $google_fonts;
	}
endif;

if ( ! function_exists( 'visionary_news_get_all_google_font_families' ) ) :
	/**
	 * Returns list of Google font families.
	 */
	function visionary_news_get_all_google_font_families() {
		$google_fonts  = visionary_news_get_all_google_fonts();
		$font_families = array();
		foreach ( $google_fonts as $font ) {
			$font_families[ $font['family'] ] = $font['family'];
		}
		return $font_families;
	}
endif;

if ( ! function_exists( 'visionary_news_get_fonts_url' ) ) :
	/**
	 * Return Google fonts URL.
	 */
	function visionary_news_get_fonts_url() {
		$fonts_url = '';
		$fonts     = array();

		$all_fonts = visionary_news_get_all_google_fonts();

		if ( ! empty( get_theme_mod( 'visionary_news_site_title_font', 'Hind' ) ) ) {
			$fonts[] = get_theme_mod( 'visionary_news_site_title_font', 'Hind' );
		}

		if ( ! empty( get_theme_mod( 'visionary_news_site_description_font', 'Roboto' ) ) ) {
			$fonts[] = get_theme_mod( 'visionary_news_site_description_font', 'Roboto' );
		}

		if ( ! empty( get_theme_mod( 'visionary_news_header_font', 'Exo' ) ) ) {
			$fonts[] = get_theme_mod( 'visionary_news_header_font', 'Exo' );
		}

		if ( ! empty( get_theme_mod( 'visionary_news_body_font', 'Roboto' ) ) ) {
			$fonts[] = get_theme_mod( 'visionary_news_body_font', 'Roboto' );
		}

		$fonts = array_unique( $fonts );

		foreach ( $fonts as $font ) {
			$variants      = $all_fonts[ $font ]['variants'];
			$font_family[] = $font . ':' . implode( ',', $variants );
		}

		$query_args = array(
			'family' => urlencode( implode( '|', $font_family ) ),
		);

		if ( ! empty( $font_family ) ) {
			$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
		}

		return $fonts_url;
	}
endif;