Example #1
0
function extra_get_google_font_css_value($setting_name, $property, $unformatted_value)
{
    if (!extra_callback_is_customizer()) {
        et_builder_enqueue_font($unformatted_value);
    }
    if (empty($unformatted_value) || 'none' == $unformatted_value) {
        $formatted_value = '';
    } else {
        $formatted_value = et_builder_get_font_family($unformatted_value, false);
    }
    return $formatted_value;
}
Example #2
0
function et_divi_load_scripts_styles()
{
    global $wp_styles;
    $template_dir = get_template_directory_uri();
    $theme_version = et_get_theme_version();
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    $dependencies_array = array('jquery', 'et-jquery-touch-mobile');
    // load 'jquery-effects-core' if SlideIn/Fullscreen header used or if customizer opened
    if (is_customize_preview() || 'slide' === et_get_option('header_style', 'left') || 'fullscreen' === et_get_option('header_style', 'left')) {
        $dependencies_array[] = 'jquery-effects-core';
    }
    wp_enqueue_script('et-jquery-touch-mobile', $template_dir . '/includes/builder/scripts/jquery.mobile.custom.min.js', array('jquery'), $theme_version, true);
    wp_enqueue_script('divi-custom-script', $template_dir . '/js/custom.js', $dependencies_array, $theme_version, true);
    if ('on' === et_get_option('divi_smooth_scroll', false)) {
        wp_enqueue_script('smooth-scroll', $template_dir . '/js/smoothscroll.js', array('jquery'), $theme_version, true);
    }
    $et_gf_enqueue_fonts = array();
    $et_gf_heading_font = sanitize_text_field(et_get_option('heading_font', 'none'));
    $et_gf_body_font = sanitize_text_field(et_get_option('body_font', 'none'));
    $et_gf_button_font = sanitize_text_field(et_get_option('all_buttons_font', 'none'));
    $et_gf_primary_nav_font = sanitize_text_field(et_get_option('primary_nav_font', 'none'));
    $et_gf_secondary_nav_font = sanitize_text_field(et_get_option('secondary_nav_font', 'none'));
    $et_gf_slide_nav_font = sanitize_text_field(et_get_option('slide_nav_font', 'none'));
    $site_domain = get_locale();
    $et_one_font_languages = et_get_one_font_languages();
    if ('none' != $et_gf_heading_font) {
        $et_gf_enqueue_fonts[] = $et_gf_heading_font;
    }
    if ('none' != $et_gf_body_font) {
        $et_gf_enqueue_fonts[] = $et_gf_body_font;
    }
    if ('none' != $et_gf_button_font) {
        $et_gf_enqueue_fonts[] = $et_gf_button_font;
    }
    if ('none' != $et_gf_primary_nav_font) {
        $et_gf_enqueue_fonts[] = $et_gf_primary_nav_font;
    }
    if ('none' != $et_gf_secondary_nav_font) {
        $et_gf_enqueue_fonts[] = $et_gf_secondary_nav_font;
    }
    if ('none' != $et_gf_slide_nav_font) {
        $et_gf_enqueue_fonts[] = $et_gf_slide_nav_font;
    }
    if (isset($et_one_font_languages[$site_domain])) {
        $et_gf_font_name_slug = strtolower(str_replace(' ', '-', $et_one_font_languages[$site_domain]['language_name']));
        wp_enqueue_style('et-gf-' . $et_gf_font_name_slug, $et_one_font_languages[$site_domain]['google_font_url'], array(), null);
    } else {
        if (!empty($et_gf_enqueue_fonts)) {
            foreach ($et_gf_enqueue_fonts as $single_font) {
                et_builder_enqueue_font($single_font);
            }
        }
    }
    /*
     * Loads the main stylesheet.
     */
    wp_enqueue_style('divi-style', get_stylesheet_uri(), array(), $theme_version);
}
Example #3
0
function et_divi_load_scripts_styles()
{
    global $wp_styles;
    $template_dir = get_template_directory_uri();
    $theme_version = et_get_theme_version();
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    wp_register_script('google-maps-api', esc_url(add_query_arg(array('v' => 3, 'sensor' => 'false'), is_ssl() ? 'https://maps-api-ssl.google.com/maps/api/js' : 'http://maps.google.com/maps/api/js')), array(), $theme_version, true);
    wp_enqueue_script('divi-fitvids', $template_dir . '/js/jquery.fitvids.js', array('jquery'), $theme_version, true);
    wp_enqueue_script('waypoints', $template_dir . '/js/waypoints.min.js', array('jquery'), $theme_version, true);
    wp_enqueue_script('magnific-popup', $template_dir . '/js/jquery.magnific-popup.js', array('jquery'), $theme_version, true);
    wp_register_script('hashchange', $template_dir . '/js/jquery.hashchange.js', array('jquery'), $theme_version, true);
    wp_register_script('salvattore', $template_dir . '/js/salvattore.min.js', array(), $theme_version, true);
    wp_register_script('easypiechart', $template_dir . '/js/jquery.easypiechart.js', array('jquery'), $theme_version, true);
    wp_enqueue_script('divi-custom-script', $template_dir . '/js/custom.js', array('jquery'), $theme_version, true);
    wp_localize_script('divi-custom-script', 'et_custom', array('ajaxurl' => admin_url('admin-ajax.php'), 'images_uri' => get_template_directory_uri() . '/images', 'builder_images_uri' => get_template_directory_uri() . '/includes/builder/images', 'et_load_nonce' => wp_create_nonce('et_load_nonce'), 'subscription_failed' => __('Please, check the fields below to make sure you entered the correct information.', 'Divi'), 'fill' => esc_html__('Fill', 'Divi'), 'field' => esc_html__('field', 'Divi'), 'invalid' => esc_html__('Invalid email', 'Divi'), 'captcha' => esc_html__('Captcha', 'Divi'), 'prev' => esc_html__('Prev', 'Divi'), 'previous' => esc_html__('Previous', 'Divi'), 'next' => esc_html__('Next', 'Divi')));
    if ('on' === et_get_option('divi_smooth_scroll', false)) {
        wp_enqueue_script('smooth-scroll', $template_dir . '/js/smoothscroll.js', array('jquery'), $theme_version, true);
    }
    $et_gf_enqueue_fonts = array();
    $et_gf_heading_font = sanitize_text_field(et_get_option('heading_font', 'none'));
    $et_gf_body_font = sanitize_text_field(et_get_option('body_font', 'none'));
    $et_gf_button_font = sanitize_text_field(et_get_option('all_buttons_font', 'none'));
    $et_gf_primary_nav_font = sanitize_text_field(et_get_option('primary_nav_font', 'none'));
    $et_gf_secondary_nav_font = sanitize_text_field(et_get_option('secondary_nav_font', 'none'));
    $site_domain = get_locale();
    $et_one_font_languages = et_get_one_font_languages();
    if ('none' != $et_gf_heading_font) {
        $et_gf_enqueue_fonts[] = $et_gf_heading_font;
    }
    if ('none' != $et_gf_body_font) {
        $et_gf_enqueue_fonts[] = $et_gf_body_font;
    }
    if ('none' != $et_gf_button_font) {
        $et_gf_enqueue_fonts[] = $et_gf_button_font;
    }
    if ('none' != $et_gf_primary_nav_font) {
        $et_gf_enqueue_fonts[] = $et_gf_primary_nav_font;
    }
    if ('none' != $et_gf_secondary_nav_font) {
        $et_gf_enqueue_fonts[] = $et_gf_secondary_nav_font;
    }
    if (isset($et_one_font_languages[$site_domain])) {
        $et_gf_font_name_slug = strtolower(str_replace(' ', '-', $et_one_font_languages[$site_domain]['language_name']));
        wp_enqueue_style('et-gf-' . $et_gf_font_name_slug, $et_one_font_languages[$site_domain]['google_font_url'], array(), null);
    } else {
        if (!empty($et_gf_enqueue_fonts)) {
            foreach ($et_gf_enqueue_fonts as $single_font) {
                et_builder_enqueue_font($single_font);
            }
        }
    }
    /*
     * Loads the main stylesheet.
     */
    wp_enqueue_style('divi-style', get_stylesheet_uri(), array(), $theme_version);
}
Example #4
0
function et_divi_load_scripts_styles()
{
    global $wp_styles;
    $template_dir = get_template_directory_uri();
    $theme_version = et_get_theme_version();
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    wp_enqueue_script('divi-custom-script', $template_dir . '/js/custom.js', array('jquery'), $theme_version, true);
    if ('on' === et_get_option('divi_smooth_scroll', false)) {
        wp_enqueue_script('smooth-scroll', $template_dir . '/js/smoothscroll.js', array('jquery'), $theme_version, true);
    }
    $et_gf_enqueue_fonts = array();
    $et_gf_heading_font = sanitize_text_field(et_get_option('heading_font', 'none'));
    $et_gf_body_font = sanitize_text_field(et_get_option('body_font', 'none'));
    $et_gf_button_font = sanitize_text_field(et_get_option('all_buttons_font', 'none'));
    $et_gf_primary_nav_font = sanitize_text_field(et_get_option('primary_nav_font', 'none'));
    $et_gf_secondary_nav_font = sanitize_text_field(et_get_option('secondary_nav_font', 'none'));
    $site_domain = get_locale();
    $et_one_font_languages = et_get_one_font_languages();
    if ('none' != $et_gf_heading_font) {
        $et_gf_enqueue_fonts[] = $et_gf_heading_font;
    }
    if ('none' != $et_gf_body_font) {
        $et_gf_enqueue_fonts[] = $et_gf_body_font;
    }
    if ('none' != $et_gf_button_font) {
        $et_gf_enqueue_fonts[] = $et_gf_button_font;
    }
    if ('none' != $et_gf_primary_nav_font) {
        $et_gf_enqueue_fonts[] = $et_gf_primary_nav_font;
    }
    if ('none' != $et_gf_secondary_nav_font) {
        $et_gf_enqueue_fonts[] = $et_gf_secondary_nav_font;
    }
    if (isset($et_one_font_languages[$site_domain])) {
        $et_gf_font_name_slug = strtolower(str_replace(' ', '-', $et_one_font_languages[$site_domain]['language_name']));
        wp_enqueue_style('et-gf-' . $et_gf_font_name_slug, $et_one_font_languages[$site_domain]['google_font_url'], array(), null);
    } else {
        if (!empty($et_gf_enqueue_fonts)) {
            foreach ($et_gf_enqueue_fonts as $single_font) {
                et_builder_enqueue_font($single_font);
            }
        }
    }
    /*
     * Loads the main stylesheet.
     */
    wp_enqueue_style('divi-style', get_stylesheet_uri(), array(), $theme_version);
}
Example #5
0
 function et_builder_set_element_font($font, $use_important = false)
 {
     $style = '';
     if ('' === $font) {
         return $style;
     }
     $font_values = explode('|', $font);
     if (!empty($font_values)) {
         $font_values = array_map('trim', $font_values);
         $font_name = $font_values[0];
         $is_font_bold = 'on' === $font_values[1] ? true : false;
         $is_font_italic = 'on' === $font_values[2] ? true : false;
         $is_font_uppercase = 'on' === $font_values[3] ? true : false;
         $is_font_underline = 'on' === $font_values[4] ? true : false;
         if ('' !== $font_name) {
             et_builder_enqueue_font($font_name);
             $style .= et_builder_get_font_family($font_name, $use_important) . ' ';
         }
         if ($is_font_bold) {
             $style .= sprintf('font-weight: bold%1$s; ', $use_important ? ' !important' : '');
         }
         if ($is_font_italic) {
             $style .= sprintf('font-style: italic%1$s; ', $use_important ? ' !important' : '');
         }
         if ($is_font_uppercase) {
             $style .= sprintf('text-transform: uppercase%1$s; ', $use_important ? ' !important' : '');
         }
         if ($is_font_underline) {
             $style .= sprintf('text-decoration: underline%1$s; ', $use_important ? ' !important' : '');
         }
         $style = rtrim($style);
     }
     return $style;
 }
Example #6
0
 function et_builder_set_element_font($font, $use_important = false, $default = false)
 {
     $style = '';
     if ('' === $font) {
         return $style;
     }
     $font_values = explode('|', $font);
     $default = !$default ? "||||" : $default;
     $font_values_default = explode('|', $default);
     if (!empty($font_values)) {
         $font_values = array_map('trim', $font_values);
         $font_name = $font_values[0];
         $is_font_bold = 'on' === $font_values[1] ? true : false;
         $is_font_italic = 'on' === $font_values[2] ? true : false;
         $is_font_uppercase = 'on' === $font_values[3] ? true : false;
         $is_font_underline = 'on' === $font_values[4] ? true : false;
         $font_name_default = $font_values_default[0];
         $is_font_bold_default = 'on' === $font_values_default[1] ? true : false;
         $is_font_italic_default = 'on' === $font_values_default[2] ? true : false;
         $is_font_uppercase_default = 'on' === $font_values_default[3] ? true : false;
         $is_font_underline_default = 'on' === $font_values_default[4] ? true : false;
         if ('' !== $font_name && $font_name_default !== $font_name) {
             et_builder_enqueue_font($font_name);
             $style .= et_builder_get_font_family($font_name, $use_important) . ' ';
         }
         $style .= et_builder_set_element_font_style('font-weight', $is_font_bold_default, $is_font_bold, 'normal', 'bold', $use_important);
         $style .= et_builder_set_element_font_style('font-style', $is_font_italic_default, $is_font_italic, 'none', 'italic', $use_important);
         $style .= et_builder_set_element_font_style('text-transform', $is_font_uppercase_default, $is_font_uppercase, 'none', 'uppercase', $use_important);
         $style .= et_builder_set_element_font_style('text-decoration', $is_font_underline_default, $is_font_underline, 'none', 'underline', $use_important);
         $style = rtrim($style);
     }
     return $style;
 }
 function process_inline_fonts_option($fonts_list)
 {
     if ('' === $fonts_list) {
         return;
     }
     $fonts_list_array = explode(',', $fonts_list);
     foreach ($fonts_list_array as $font_name) {
         et_builder_enqueue_font($font_name);
     }
 }