/**
     * @used to save the fonts
     */
    private static function update_td_fonts($user_custom_fonts_array)
    {
        //get defaults array
        $default_array = $_POST['td_default'];
        /*
        $js_buffer = used for fonts who use javascript to add @font-face (typekit.com)
        $css_buffer = used for font link to files
        $css_files = used to pull fonts from google
        */
        //declare variable
        $js_buffer = $css_buffer = $css_files = $temp_css_google_files = '';
        //collect google fonts from all fields
        $temp_google_fonts = array();
        //collect all place_name arrays in this array
        $td_fonts_save = array();
        foreach ($user_custom_fonts_array as $font_place => $font_options) {
            $td_fonts_save[$font_place] = array();
            foreach ($font_options as $font_option_id => $font_option_value) {
                //if the $font_option_value is not empty then added to the place name font array
                if (!empty($font_option_value)) {
                    $td_fonts_save[$font_place][$font_option_id] = $font_option_value;
                    //check field values for buffer outputs
                    if ($font_option_id == 'font_family') {
                        $explode_font_family = explode('_', $font_option_value);
                        $id_font = $explode_font_family[1];
                        switch ($explode_font_family[0]) {
                            //fonts from files (links to files)
                            case 'file':
                                $font_file_link = td_global::$td_options['td_fonts_user_inserted']['font_file_' . $id_font];
                                $font_file_family = td_global::$td_options['td_fonts_user_inserted']['font_family_' . $id_font];
                                $css_buffer .= '
                                                @font-face {
                                                  font-family: "' . $font_file_family . '";
                                                  src: local("' . $font_file_family . '"), url("' . $font_file_link . '") format("woff");
}
                                ';
                                break;
                                //fonts from type kit
                            //fonts from type kit
                            case 'tk':
                                $js_buffer = td_global::$td_options['td_fonts_user_inserted']['typekit_js'];
                                break;
                                //fonts from font stacks
                            //fonts from font stacks
                            case 'fs':
                                /*$css_buffer .= '
                                      @font-face {
                                          font-family: ' . td_fonts::$font_stack_list['fs_' . $id_font] .';
                                      }
                                  ';*/
                                break;
                                //fonts from google
                            //fonts from google
                            case 'g':
                                if (!in_array($id_font, $temp_google_fonts)) {
                                    $temp_google_fonts[] = $id_font;
                                }
                                break;
                        }
                    }
                }
                //check the color font option for non empty values
                if (!empty($default_array['td_fonts'][$font_place]['color'])) {
                    $td_fonts_save[$font_place]['color'] = $default_array['td_fonts'][$font_place]['color'];
                }
            }
            //if the array for the place name is empty then remove it from the td_fonts array
            if (empty($td_fonts_save[$font_place])) {
                unset($td_fonts_save[$font_place]);
            }
        }
        /**
         * form css_files buffer for google
         **/
        //add to google style link the fonts names
        if (!empty($temp_google_fonts)) {
            foreach ($temp_google_fonts as $font_id_from_list) {
                if (!empty($temp_css_google_files)) {
                    $temp_css_google_files .= '|';
                }
                $temp_css_google_files .= str_replace(' ', '+', td_fonts::$font_names_google_list[$font_id_from_list]) . ':400,700';
            }
        }
        //check sections from db and add them to the saving array if ar not set to empty by the user
        $font_sections_from_db = td_util::get_option('td_fonts');
        //get the fonts from db
        foreach (td_global::$typography_settings_list as $panel_section => $font_settings_array) {
            foreach ($font_settings_array as $font_setting_id => $font_setting_name) {
                //check each item from section, and delete the empty ones
                $typo_section = array_filter($user_custom_fonts_array[$font_setting_id]);
                //if the section is set but empty, don't added to the  $td_fonts_save
                if (isset($user_custom_fonts_array[$font_setting_id]) and empty($typo_section)) {
                    //do nothing
                } else {
                    //if the section exists in the database but is not in the saving array, then added to the saving array
                    if (array_key_exists($font_setting_id, $font_sections_from_db) and !empty($font_sections_from_db[$font_setting_id]) and !array_key_exists($font_setting_id, $td_fonts_save)) {
                        $td_fonts_save[$font_setting_id] = $font_sections_from_db[$font_setting_id];
                    }
                }
            }
        }
        //form the google css files buffer
        if (!empty($temp_css_google_files)) {
            $css_files = "://fonts.googleapis.com/css?family=" . $temp_css_google_files . td_fonts::get_google_fonts_subset_query();
        }
        //add the user font settings to the option string that going to the database
        td_global::$td_options['td_fonts'] = $td_fonts_save;
        //add the font buffers to the option string that going to the database
        td_global::$td_options['td_fonts_js_buffer'] = $js_buffer;
        td_global::$td_options['td_fonts_css_buffer'] = $css_buffer;
        td_global::$td_options['td_fonts_css_files'] = $css_files;
    }
function td_load_css_fonts()
{
    $td_user_fonts_list = array();
    $td_user_fonts_db = td_util::get_option('td_fonts');
    if (!empty($td_user_fonts_db)) {
        foreach ($td_user_fonts_db as $td_font_setting_key => $td_font_setting_val) {
            if (!empty($td_font_setting_val) and !empty($td_font_setting_val['font_family'])) {
                $td_user_fonts_list[] = $td_font_setting_val['font_family'];
            }
        }
    }
    foreach (td_global::$default_google_fonts_list as $default_font_id => $default_font_params) {
        if (!in_array('g_' . $default_font_id, $td_user_fonts_list)) {
            wp_enqueue_style($default_font_params['css_style_id'], $default_font_params['url'] . td_fonts::get_google_fonts_subset_query());
            //used on menus/small text
        }
    }
    /*
     * add the google link for fonts used by user
     *
     * td_fonts_css_files : holds the link to fonts.googleapis.com in the database
     *
     * this section will appear in the header of the source of the page
     */
    $td_fonts_css_files = td_util::get_option('td_fonts_css_files');
    if (!empty($td_fonts_css_files)) {
        wp_enqueue_style('google-fonts-style', td_global::$http_or_https . $td_fonts_css_files);
    }
}