Пример #1
0
/**
 * Returns array of builder settings' configuration
 *
 * @return array builder settings' configuration
 */
function et_pb_get_builder_settings_configurations()
{
    $settings = array();
    if (et_pb_is_allowed('ab_testing')) {
        $ab_testing_settings = array(array('type' => 'yes_or_no', 'id' => 'et_pb_enable_ab_testing', 'label' => esc_html__('Enable Split Testing', 'et_builder'), 'autoload' => false, 'class' => 'et-pb-visible', 'affects' => array('et_pb_ab_bounce_rate_limit', 'et_pb_ab_refresh_interval', 'et_pb_enable_shortcode_tracking')), array('type' => 'range', 'id' => 'et_pb_ab_bounce_rate_limit', 'label' => esc_html__('Bounce Rate Limit', 'et_builder'), 'default' => 5, 'step' => 1, 'min' => 3, 'max' => 60, 'depends_show_if' => 'on'), array('type' => 'select', 'id' => 'et_pb_ab_refresh_interval', 'label' => esc_html__('Stats refresh interval', 'et_builder'), 'autoload' => false, 'depends_show_if' => 'on', 'values' => array('hourly' => esc_html__('Hourly', 'et_builder'), 'daily' => esc_html__('Daily', 'et_builder'))), array('type' => 'yes_or_no', 'id' => 'et_pb_enable_shortcode_tracking', 'label' => esc_html__('Shortcode Tracking', 'et_builder'), 'depends_show_if' => 'on', 'affects' => array('et_pb_ab_current_shortcode')), array('type' => 'textarea', 'id' => 'et_pb_ab_current_shortcode', 'label' => esc_html__('Shortcode for Tracking:', 'et_builder'), 'autoload' => false, 'readonly' => 'readonly', 'depends_show_if' => 'on'));
        $settings = array_merge($settings, $ab_testing_settings);
    }
    $standard_settings = array(array('type' => 'textarea', 'id' => 'et_pb_custom_css', 'label' => esc_html__('Custom CSS', 'et_builder')), array('type' => 'colorpalette', 'id' => 'et_pb_color_palette', 'label' => esc_html__('Color Picker Color Pallete', 'et_builder'), 'default' => implode('|', et_pb_get_default_color_palette())), array('type' => 'range', 'id' => 'et_pb_gutter_width', 'label' => esc_html__('Gutter Width', 'et_builder'), 'step' => 1, 'min' => 1, 'max' => 4, 'default' => et_get_option('gutter_width', 3)), array('type' => 'colorpicker', 'id' => 'et_pb_light_text_color', 'label' => esc_html__('Light Text Color', 'et_builder'), 'default' => '#FFFFFF'), array('type' => 'colorpicker', 'id' => 'et_pb_dark_text_color', 'label' => esc_html__('Dark Text Color', 'et_builder'), 'default' => '#666666'), array('type' => 'colorpicker', 'id' => 'et_pb_content_area_background_color', 'label' => esc_html__('Content Area Background Color', 'et_builder')), array('type' => 'colorpicker', 'id' => 'et_pb_section_background_color', 'label' => esc_html__('Section Background Color', 'et_builder'), 'default' => '#FFFFFF'));
    $settings = array_merge($settings, $standard_settings);
    return apply_filters('et_pb_get_builder_settings_configurations', $settings);
}
Пример #2
0
/**
 * Returns array of builder settings' value
 *
 * @return array of builder settings' value
 */
function et_pb_get_builder_settings_values($post_id = false)
{
    // Get post ID
    $post_id = $post_id ? $post_id : get_the_ID();
    // Page settings config
    $config = et_pb_get_builder_settings_configurations();
    // Defaults
    $default_bounce_rate_limit = 5;
    // Get values;
    $ab_bounce_rate_limit = get_post_meta($post_id, '_et_pb_ab_bounce_rate_limit', true);
    $et_pb_ab_bounce_rate_limit = '' !== $ab_bounce_rate_limit ? $ab_bounce_rate_limit : $default_bounce_rate_limit;
    $color_palette = get_post_meta($post_id, '_et_pb_color_palette', true);
    $et_pb_color_palette = '' !== $color_palette ? $color_palette : implode('|', et_pb_get_default_color_palette());
    $gutter_width = get_post_meta($post_id, '_et_pb_gutter_width', true);
    $et_pb_gutter_width = '' !== $gutter_width ? $gutter_width : $config['et_pb_gutter_width']['default'];
    $light_text_color = get_post_meta($post_id, '_et_pb_light_text_color', true);
    $et_pb_light_text_color = $config['et_pb_light_text_color']['default'] !== $light_text_color ? $light_text_color : $config['et_pb_light_text_color']['default'];
    $dark_text_color = get_post_meta($post_id, '_et_pb_dark_text_color', true);
    $et_pb_dark_text_color = $config['et_pb_dark_text_color']['default'] !== $dark_text_color ? $dark_text_color : $config['et_pb_dark_text_color']['default'];
    $content_area_background_color = get_post_meta($post_id, '_et_pb_content_area_background_color', true);
    $et_pb_content_area_background_color = '' === $content_area_background_color ? $config['et_pb_content_area_background_color']['default'] : $content_area_background_color;
    $section_background_color = get_post_meta($post_id, '_et_pb_section_background_color', true);
    $et_pb_section_background_color = '' === $section_background_color ? $config['et_pb_section_background_color']['default'] : $section_background_color;
    return apply_filters('et_pb_get_builder_settings_values', array('et_pb_enable_ab_testing' => et_is_ab_testing_active() ? 'on' : 'off', 'et_pb_ab_bounce_rate_limit' => $et_pb_ab_bounce_rate_limit, 'et_pb_ab_refresh_interval' => et_pb_ab_get_refresh_interval($post_id), 'et_pb_enable_shortcode_tracking' => get_post_meta($post_id, '_et_pb_enable_shortcode_tracking', true), 'et_pb_ab_current_shortcode' => '[et_pb_split_track id="' . $post_id . '" /]', 'et_pb_custom_css' => get_post_meta($post_id, '_et_pb_custom_css', true), 'et_pb_color_palette' => $et_pb_color_palette, 'et_pb_gutter_width' => $et_pb_gutter_width, 'et_pb_light_text_color' => strtolower($et_pb_light_text_color), 'et_pb_dark_text_color' => strtolower($et_pb_dark_text_color), 'et_pb_content_area_background_color' => strtolower($et_pb_content_area_background_color), 'et_pb_section_background_color' => strtolower($et_pb_section_background_color)), $post_id);
}