/**
  * Returns fonts
  * @return array
  */
 public function get_fonts()
 {
     if ($this->fonts === null) {
         $this->fonts = array('standard' => apply_filters('fw_option_type_typography_standard_fonts', array("Arial", "Verdana", "Trebuchet", "Georgia", "Times New Roman", "Tahoma", "Palatino", "Helvetica", "Calibri", "Myriad Pro", "Lucida", "Arial Black", "Gill Sans", "Geneva", "Impact", "Serif")), 'google' => fw_get_google_fonts());
     }
     return $this->fonts;
 }
 /**
  * @internal
  */
 public function _theme_action_print_styling_switcher()
 {
     echo $this->render_view('panel', array('options' => $this->options, 'description' => fw_get_db_ext_settings_option($this->get_parent()->get_name(), 'switch_style_panel_description')));
     wp_enqueue_style('fw-ext-' . $this->get_name(), $this->locate_URI('/static/css/panel.css'), array(), fw()->theme->manifest->get_version());
     wp_enqueue_script('fw-ext-' . $this->get_name(), $this->locate_URI('/static/js/panel.js'), array('jquery'), fw()->theme->manifest->get_version());
     wp_localize_script('fw-ext-' . $this->get_name(), 'fwGoogleFonts', fw_get_google_fonts());
     wp_localize_script('fw-ext-' . $this->get_name(), 'fwSwitchStylePanel', array('cache_key' => $this->cache_key));
 }
 public static function get_css($blocks, $style_options)
 {
     if (!self::$initialized) {
         self::$google_fonts = fw_get_google_fonts();
         self::$initialized = true;
     }
     return array('css' => self::generate_css($blocks, $style_options['blocks']), 'google_fonts' => self::get_remote_fonts());
 }
 public static function get_css($theme_options, $saved_data)
 {
     if (!self::$initialized) {
         self::$google_fonts = fw_get_google_fonts();
         self::$initialized = true;
     }
     //generate css
     $css = '';
     foreach ($theme_options as $option_name => $option_settings) {
         if ($option_settings['type'] !== 'style') {
             unset($theme_options[$option_name]);
             continue;
         }
         $css .= self::generate_option_css($option_settings['blocks'], $saved_data[$option_name]);
         break;
     }
     if (!empty($css)) {
         $css = self::get_remote_fonts() . "\n<style type='text/css'>\n" . $css . "\n</style>";
     }
     return $css;
 }
 /**
  * @internal
  */
 public static function _init()
 {
     self::$fonts = array('standard' => array("Arial", "Verdana", "Trebuchet", "Georgia", "Times New Roman", "Tohama", "Palatino", "Helvetica", "Calibri", "Myriad Pro", "Lucida", "Arial Black", "Gill Sans", "Geneva", "Impact", "Serif"), 'google' => fw_get_google_fonts());
 }
示例#6
0
 function _action_ssd_process_google_fonts()
 {
     $include_from_google = array();
     $google_fonts = fw_get_google_fonts();
     $body_font = fw_get_db_settings_option('body_font');
     $heading_font = fw_get_db_settings_option('heading_font');
     // if is google font
     if (isset($google_fonts[$body_font['family']])) {
         $include_from_google[$body_font['family']] = $google_fonts[$body_font['family']];
     }
     if (isset($google_fonts[$heading_font['family']])) {
         $include_from_google[$heading_font['family']] = $google_fonts[$heading_font['family']];
     }
     $google_fonts_links = fw_ssd_get_remote_fonts($include_from_google);
     // set a option in db for save google fonts link
     update_option('fw_ssd_google_fonts_link', $google_fonts_links);
 }
示例#7
0
/**
 * Generates and outputs google fonts string
 */
function thshpr_load_fonts()
{
    $include_from_google = array();
    $google_fonts = fw_get_google_fonts();
    $h1 = fw_get_db_customizer_option('opt_h1');
    $h1_archives = fw_get_db_customizer_option('opt_h1_archives');
    $h2 = fw_get_db_customizer_option('opt_h2');
    $h3 = fw_get_db_customizer_option('opt_h3');
    $h4 = fw_get_db_customizer_option('opt_h4');
    $h5 = fw_get_db_customizer_option('opt_h5');
    $h6 = fw_get_db_customizer_option('opt_h6');
    $body = fw_get_db_customizer_option('opt_body');
    $small_italic = fw_get_db_customizer_option('opt_small_italic');
    $large_italic = fw_get_db_customizer_option('opt_large_italic');
    $categories_tags = fw_get_db_customizer_option('opt_category_tag');
    $large_description = fw_get_db_customizer_option('opt_large_description');
    $other_meta = fw_get_db_customizer_option('opt_other_meta');
    $article_lead = fw_get_db_customizer_option('opt_article_lead');
    $blockquote = fw_get_db_customizer_option('opt_blockquote');
    $subtitle = fw_get_db_customizer_option('opt_subtitle');
    $archive_description = fw_get_db_customizer_option('opt_archive_description');
    $read_more = fw_get_db_customizer_option('opt_read_more');
    $top_level_menu = fw_get_db_customizer_option('opt_top_level_menu');
    $sub_level_menu = fw_get_db_customizer_option('opt_sub_level_menu');
    /* gets google fonts and adds to the array */
    if (isset($google_fonts[$h1['family']])) {
        $include_from_google[$h1['family']] = $google_fonts[$h1['family']];
    }
    if (isset($google_fonts[$h1_archives['family']])) {
        $include_from_google[$h1_archives['family']] = $google_fonts[$h1_archives['family']];
    }
    if (isset($google_fonts[$h2['family']])) {
        $include_from_google[$h2['family']] = $google_fonts[$h2['family']];
    }
    if (isset($google_fonts[$h3['family']])) {
        $include_from_google[$h3['family']] = $google_fonts[$h3['family']];
    }
    if (isset($google_fonts[$h4['family']])) {
        $include_from_google[$h4['family']] = $google_fonts[$h4['family']];
    }
    if (isset($google_fonts[$h5['family']])) {
        $include_from_google[$h5['family']] = $google_fonts[$h5['family']];
    }
    if (isset($google_fonts[$h6['family']])) {
        $include_from_google[$h6['family']] = $google_fonts[$h6['family']];
    }
    if (isset($google_fonts[$body['family']])) {
        $include_from_google[$body['family']] = $google_fonts[$body['family']];
    }
    if (isset($google_fonts[$large_italic['family']])) {
        $include_from_google[$large_italic['family']] = $google_fonts[$large_italic['family']];
    }
    if (isset($google_fonts[$small_italic['family']])) {
        $include_from_google[$small_italic['family']] = $google_fonts[$small_italic['family']];
    }
    if (isset($google_fonts[$article_lead['family']])) {
        $include_from_google[$article_lead['family']] = $google_fonts[$article_lead['family']];
    }
    if (isset($google_fonts[$blockquote['family']])) {
        $include_from_google[$blockquote['family']] = $google_fonts[$blockquote['family']];
    }
    if (isset($google_fonts[$subtitle['family']])) {
        $include_from_google[$subtitle['family']] = $google_fonts[$subtitle['family']];
    }
    if (isset($google_fonts[$archive_description['family']])) {
        $include_from_google[$archive_description['family']] = $google_fonts[$archive_description['family']];
    }
    if (isset($google_fonts[$read_more['family']])) {
        $include_from_google[$read_more['family']] = $google_fonts[$read_more['family']];
    }
    if (isset($google_fonts[$categories_tags['family']])) {
        $include_from_google[$categories_tags['family']] = $google_fonts[$categories_tags['family']];
    }
    if (isset($google_fonts[$large_description['family']])) {
        $include_from_google[$large_description['family']] = $google_fonts[$large_description['family']];
    }
    if (isset($google_fonts[$other_meta['family']])) {
        $include_from_google[$other_meta['family']] = $google_fonts[$other_meta['family']];
    }
    if (isset($google_fonts[$top_level_menu['family']])) {
        $include_from_google[$top_level_menu['family']] = $google_fonts[$top_level_menu['family']];
    }
    if (isset($google_fonts[$sub_level_menu['family']])) {
        $include_from_google[$sub_level_menu['family']] = $google_fonts[$sub_level_menu['family']];
    }
    if (!sizeof($include_from_google)) {
        return '';
    }
    $font_string = 'http://fonts.googleapis.com/css?family=';
    foreach ($include_from_google as $font => $styles) {
        $font_string .= str_replace(' ', '+', $font) . ':' . implode(',', $styles['variants']) . '|';
    }
    $font_string = substr($font_string, 0, -1);
    wp_register_style('thshpr-google-fonts', esc_url($font_string));
    wp_enqueue_style('thshpr-google-fonts');
}