Ejemplo n.º 1
0
/**
 * Sanitize header styles
 * @param string
 * @return string|bool
 */
function et_divi_legacy_sanitize_header_styles($choosen)
{
    return et_sanitize_key_based_option($choosen, et_divi_legacy_get_header_styles());
}
Ejemplo n.º 2
0
function et_divi_customize_register($wp_customize)
{
    $site_domain = get_locale();
    $google_fonts = et_get_google_fonts();
    $et_domain_fonts = array('ru_RU' => 'cyrillic', 'uk' => 'cyrillic', 'bg_BG' => 'cyrillic', 'vi' => 'vietnamese', 'el' => 'greek');
    $et_one_font_languages = et_get_one_font_languages();
    $font_choices = array();
    $font_choices['none'] = 'Default Theme Font';
    foreach ($google_fonts as $google_font_name => $google_font_properties) {
        if ('' !== $site_domain && isset($et_domain_fonts[$site_domain]) && false === strpos($google_font_properties['character_set'], $et_domain_fonts[$site_domain])) {
            continue;
        }
        $font_choices[$google_font_name] = $google_font_name;
    }
    $wp_customize->remove_section('title_tagline');
    $wp_customize->add_section('et_divi_settings', array('title' => __('Theme Settings', 'Divi'), 'priority' => 40));
    $wp_customize->add_section('et_google_fonts', array('title' => __('Fonts', 'Divi'), 'priority' => 50));
    $wp_customize->add_section('et_color_schemes', array('title' => __('Schemes', 'Divi'), 'priority' => 60, 'description' => __('Note: Color settings set above should be applied to the Default color scheme.', 'Divi')));
    $wp_customize->add_setting('et_divi[link_color]', array('default' => '#2EA3F2', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[link_color]', array('label' => __('Link Color', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[link_color]')));
    $wp_customize->add_setting('et_divi[font_color]', array('default' => '#666666', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[font_color]', array('label' => __('Main Font Color', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[font_color]')));
    $wp_customize->add_setting('et_divi[accent_color]', array('default' => '#2EA3F2', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[accent_color]', array('label' => __('Accent Color', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[accent_color]')));
    $wp_customize->add_setting('et_divi[footer_bg]', array('default' => '#222222', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[footer_bg]', array('label' => __('Footer Background Color', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[footer_bg]')));
    $wp_customize->add_setting('et_divi[menu_link]', array('default' => '#666666', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[menu_link]', array('label' => __('Menu Links Color', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[menu_link]')));
    $wp_customize->add_setting('et_divi[menu_link_active]', array('default' => '#2EA3F2', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[menu_link_active]', array('label' => __('Active Menu Link Color', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[menu_link_active]')));
    $wp_customize->add_setting('et_divi[boxed_layout]', array('type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'wp_validate_boolean'));
    $wp_customize->add_control('et_divi[boxed_layout]', array('label' => __('Boxed Layout', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'checkbox', 'priority' => 10));
    $wp_customize->add_setting('et_divi[cover_background]', array('default' => 'on', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'wp_validate_boolean'));
    $wp_customize->add_control('et_divi[cover_background]', array('label' => __('Stretch Background Image', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'checkbox', 'priority' => 10));
    $wp_customize->add_setting('et_divi[vertical_nav]', array('type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'wp_validate_boolean'));
    $wp_customize->add_control('et_divi[vertical_nav]', array('label' => __('Vertical Navigation', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'checkbox', 'priority' => 20));
    $wp_customize->add_setting('et_divi[show_header_social_icons]', array('type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'wp_validate_boolean'));
    $wp_customize->add_control('et_divi[show_header_social_icons]', array('label' => __('Show Social Icons in Header', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'checkbox', 'priority' => 30));
    $wp_customize->add_setting('et_divi[show_footer_social_icons]', array('default' => 'on', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'wp_validate_boolean'));
    $wp_customize->add_control('et_divi[show_footer_social_icons]', array('label' => __('Show Social Icons in Footer', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'checkbox', 'priority' => 40));
    $wp_customize->add_setting('et_divi[show_search_icon]', array('default' => 'on', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'wp_validate_boolean'));
    $wp_customize->add_control('et_divi[show_search_icon]', array('label' => __('Show Search Icon', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'checkbox', 'priority' => 50));
    $wp_customize->add_setting('et_divi[header_style]', array('default' => 'left', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'et_divi_legacy_sanitize_header_styles'));
    $wp_customize->add_control('et_divi[header_style]', array('label' => __('Header Style', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'select', 'choices' => et_divi_legacy_get_header_styles(), 'priority' => 55));
    $wp_customize->add_setting('et_divi[phone_number]', array('type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('et_divi[phone_number]', array('label' => __('Phone Number', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'text', 'priority' => 60));
    $wp_customize->add_setting('et_divi[header_email]', array('type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_email'));
    $wp_customize->add_control('et_divi[header_email]', array('label' => __('Email', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'text', 'priority' => 70));
    $wp_customize->add_setting('et_divi[primary_nav_bg]', array('default' => '#ffffff', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[primary_nav_bg]', array('label' => __('Primary Navigation Background', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[primary_nav_bg]', 'priority' => 80)));
    $wp_customize->add_setting('et_divi[primary_nav_text_color]', array('default' => 'dark', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'et_divi_legacy_sanitize_dark_light_colors'));
    $wp_customize->add_control('et_divi[primary_nav_text_color]', array('label' => __('Primary Navigation Text Color', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'select', 'choices' => et_divi_legacy_get_dark_light_color(), 'priority' => 90));
    $wp_customize->add_setting('et_divi[secondary_nav_bg]', array('default' => et_get_option('accent_color', '#2EA3F2'), 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[secondary_nav_bg]', array('label' => __('Secondary Navigation Background', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[secondary_nav_bg]', 'priority' => 100)));
    $wp_customize->add_setting('et_divi[secondary_nav_text_color]', array('default' => 'light', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'et_divi_legacy_sanitize_dark_light_colors'));
    $wp_customize->add_control('et_divi[secondary_nav_text_color]', array('label' => __('Secondary Navigation Text Color', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'select', 'choices' => et_divi_legacy_get_dark_light_color(), 'priority' => 110));
    if (!isset($et_one_font_languages[$site_domain])) {
        $wp_customize->add_setting('et_divi[heading_font]', array('default' => 'none', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'et_sanitize_font_choices'));
        $wp_customize->add_control('et_divi[heading_font]', array('label' => __('Header Font', 'Divi'), 'section' => 'et_google_fonts', 'settings' => 'et_divi[heading_font]', 'type' => 'select', 'choices' => $font_choices));
        $wp_customize->add_setting('et_divi[body_font]', array('default' => 'none', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'et_sanitize_font_choices'));
        $wp_customize->add_control('et_divi[body_font]', array('label' => __('Body Font', 'Divi'), 'section' => 'et_google_fonts', 'settings' => 'et_divi[body_font]', 'type' => 'select', 'choices' => $font_choices));
    }
    $wp_customize->add_setting('et_divi[color_schemes]', array('default' => 'none', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'et_sanitize_color_scheme'));
    $wp_customize->add_control('et_divi[color_schemes]', array('label' => __('Color Schemes', 'Divi'), 'section' => 'et_color_schemes', 'settings' => 'et_divi[color_schemes]', 'type' => 'select', 'choices' => et_theme_color_scheme_choices()));
}