wordpress/wp-content/themes/basic/themify/themify-builder/classes/class-themify-builder-stylesheet.php
/**
     * Checks if the builder stylesheet exists and enqueues it.
     * 
     * @since 2.2.5
     * 
     * @return bool True if enqueue was successful, false otherwise.
     */
Checks if the builder stylesheet exists and enqueues it.



@return bool True if enqueue was successful, false otherwise.
Checks if the builder stylesheet exists and enqueues it . @return bool True if enqueue was successful false otherwise .
public static function enqueue_stylesheet( $return = false, $post_id = null ) {
	    $isActive=Themify_Builder::$frontedit_active===true || Themify_Builder_Model::is_front_builder_activate();
	    if(($isActive===false && isset(self::$isLoaded[$post_id])) || themify_is_rest()){
		    return false;
	    }
	    $stylesheet_path = self::get_stylesheet( 'bydir', $post_id );
		if (!self::is_readable_and_not_empty( $stylesheet_path['url'] ) ) {
			if(!isset(self::$generateStyles[$post_id]) && !Themify_Filesystem::is_file(self::getTmpPath($stylesheet_path['url']))){
				self::$generateStyles[$post_id] = true;
				global $ThemifyBuilder;
				$post_data = ThemifyBuilder_Data_Manager::get_data($post_id);
				if($post_data){
					static $strucutre =null;
					if($strucutre===null){
						$strucutre = true;
						Themify_Builder_Component_Module::load_modules();
						wp_enqueue_script('tb_builder_js_style',themify_enque(THEMIFY_URI.'/js/generate-style.js'),null,THEMIFY_VERSION,true);
						add_filter( 'themify_google_fonts_full_list', '__return_true' );
						wp_localize_script('tb_builder_js_style', 'ThemifyBuilderStyle', array(
							'builder_url' => THEMIFY_BUILDER_URI,
							'styles'=>Themify_Builder::getComponentJson(true),
							'points'=>themify_get_breakpoints(),
							'nonce'=>wp_create_nonce('tb_load_nonce'),
							'ajaxurl'=>admin_url('admin-ajax.php'),
							'google'=>themify_get_google_web_fonts_list(),
							'cf'=>Themify_Custom_Fonts::get_list(),
							'cf_api_url' => Themify_Custom_Fonts::$api_url,
						));
						remove_filter( 'themify_google_fonts_full_list', '__return_true' );
					}
					$post_data = self::reSaveData($post_data);
					ThemifyBuilder_Data_Manager::save_data($post_data, $post_id);
					wp_localize_script('tb_builder_js_style', 'themify_builder_data_'.$post_id, $post_data);
					$gs = Themify_Global_Styles::used_global_styles($post_id);
					if(!empty($gs)){
						wp_localize_script('tb_builder_js_style', 'themify_builder_gs_'.$post_id, $gs);
					}
					$gs=$post_data=null;
					TFCache::$stopCache=true;
					$ThemifyBuilder->get_builder_stylesheet('',false,true);
				}
			}
		}
		else{
			$handler = pathinfo( $stylesheet_path['url'] );
			$handlerId=$handler['filename'];
			$version = filemtime( $stylesheet_path['url'] );
			$url = self::get_stylesheet( 'byurl', $post_id);
			$url = themify_https_esc( $url['url'] );
			self::$isLoaded[$post_id]= array(
					'handler' => $handlerId,
					'url' => $url,
					'v'=>$version
				);
			if( $return===true ) {
				return self::$isLoaded[$post_id];
			} else {
				$fonts = self::getFonts( $post_id );
				if ( !empty( $fonts ) ) {
					Themify_Enqueue_Assets::addGoogleFont($fonts);
				}
				$custom_fonts = Themify_Custom_Fonts::load_fonts( $post_id );
				if ( ! empty( $custom_fonts ) ) {
					echo '<style id="' . $handlerId . '-cffonts">' . $custom_fonts . '</style>' . PHP_EOL;
				}
				unset($custom_fonts,$fonts);
				global $ThemifyBuilder; 
				if($isActive===true && $ThemifyBuilder->in_the_loop===true && $post_id!=Themify_Builder::$builder_active_id ){
						echo '<link class="themify-builder-generated-css" id="' . $handlerId . '" rel="stylesheet" href="' . $url . '?ver=' . $version . '" type="text/css">';
				}
			}
			return true;
	    }
	    return false;
	}
public static function enqueue_stylesheet ( $ return = false , $ post_id = null ) { $ isActive = Themify_Builder :: $ frontedit_active === true || Themify_Builder_Model :: is_front_builder_activate ( ) ; if ( ( $ isActive === false && isset ( self :: $ isLoaded [ $ post_id ] ) ) || themify_is_rest ( ) ) { return false ; } $ stylesheet_path = self :: get_stylesheet ( 'bydir' , $ post_id ) ; if ( ! self :: is_readable_and_not_empty ( $ stylesheet_path [ 'url' ] ) ) { if ( ! isset ( self :: $ generateStyles [ $ post_id ] ) && ! Themify_Filesystem :: is_file ( self :: getTmpPath ( $ stylesheet_path [ 'url' ] ) ) ) { self :: $ generateStyles [ $ post_id ] = true ; global $ ThemifyBuilder ; $ post_data = ThemifyBuilder_Data_Manager :: get_data ( $ post_id ) ; if ( $ post_data ) { static $ strucutre = null ; if ( $ strucutre === null ) { $ strucutre = true ; Themify_Builder_Component_Module :: load_modules ( ) ; wp_enqueue_script ( 'tb_builder_js_style' , themify_enque ( THEMIFY_URI . '/js/generate-style.js' ) , null , THEMIFY_VERSION , true ) ; add_filter ( 'themify_google_fonts_full_list' , '__return_true' ) ; wp_localize_script ( 'tb_builder_js_style' , 'ThemifyBuilderStyle' , array ( 'builder_url' => THEMIFY_BUILDER_URI , 'styles' => Themify_Builder :: getComponentJson ( true ) , 'points' => themify_get_breakpoints ( ) , 'nonce' => wp_create_nonce ( 'tb_load_nonce' ) , 'ajaxurl' => admin_url ( 'admin-ajax.php' ) , 'google' => themify_get_google_web_fonts_list ( ) , 'cf' => Themify_Custom_Fonts :: get_list ( ) , 'cf_api_url' => Themify_Custom_Fonts :: $ api_url , ) ) ; remove_filter ( 'themify_google_fonts_full_list' , '__return_true' ) ; } $ post_data = self :: reSaveData ( $ post_data ) ; ThemifyBuilder_Data_Manager :: save_data ( $ post_data , $ post_id ) ; wp_localize_script ( 'tb_builder_js_style' , 'themify_builder_data_' . $ post_id , $ post_data ) ; $ gs = Themify_Global_Styles :: used_global_styles ( $ post_id ) ; if ( ! empty ( $ gs ) ) { wp_localize_script ( 'tb_builder_js_style' , 'themify_builder_gs_' . $ post_id , $ gs ) ; } $ gs = $ post_data = null ; TFCache :: $ stopCache = true ; $ ThemifyBuilder -> get_builder_stylesheet ( '' , false , true ) ; } } } else { $ handler = pathinfo ( $ stylesheet_path [ 'url' ] ) ; $ handlerId = $ handler [ 'filename' ] ; $ version = filemtime ( $ stylesheet_path [ 'url' ] ) ; $ url = self :: get_stylesheet ( 'byurl' , $ post_id ) ; $ url = themify_https_esc ( $ url [ 'url' ] ) ; self :: $ isLoaded [ $ post_id ] = array ( 'handler' => $ handlerId , 'url' => $ url , 'v' => $ version ) ; if ( $ return === true ) { return self :: $ isLoaded [ $ post_id ] ; } else { $ fonts = self :: getFonts ( $ post_id ) ; if ( ! empty ( $ fonts ) ) { Themify_Enqueue_Assets :: addGoogleFont ( $ fonts ) ; } $ custom_fonts = Themify_Custom_Fonts :: load_fonts ( $ post_id ) ; if ( ! empty ( $ custom_fonts ) ) { echo '<style id="' . $ handlerId . '-cffonts">' . $ custom_fonts . '</style>' . PHP_EOL ; } unset ( $ custom_fonts , $ fonts ) ; global $ ThemifyBuilder ; if ( $ isActive === true && $ ThemifyBuilder -> in_the_loop === true && $ post_id != Themify_Builder :: $ builder_active_id ) { echo '<link class="themify-builder-generated-css" id="' . $ handlerId . '" rel="stylesheet" href="' . $ url . '?ver=' . $ version . '" type="text/css">' ; } } return true ; } return false ; }
Checks if the builder stylesheet exists and enqueues it.
Checks if the builder stylesheet exists and enqueues it .
// custom fonts