Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/Divi/includes/builder
File: class-et-builder-settings.php
),
[500] Fix | Delete
'et_pb_static_css_file' => self::_get_static_css_generation_field( 'page' ),
[501] Fix | Delete
) );
[502] Fix | Delete
[503] Fix | Delete
return $fields;
[504] Fix | Delete
}
[505] Fix | Delete
[506] Fix | Delete
/**
[507] Fix | Delete
* Get page setting fields' meta_key map. Most page settings' field meta key is identical to
[508] Fix | Delete
* its field['id'] but some fields use different meta_key. Map might need in some situations
[509] Fix | Delete
*
[510] Fix | Delete
* @since 3.20
[511] Fix | Delete
*
[512] Fix | Delete
* @param bool $meta_key_to_id reverse mapping if set to false
[513] Fix | Delete
*
[514] Fix | Delete
* @return array
[515] Fix | Delete
*/
[516] Fix | Delete
public static function get_page_setting_meta_key_map( $meta_key_to_id = true ) {
[517] Fix | Delete
static $map = array();
[518] Fix | Delete
[519] Fix | Delete
// Less likely to change, populate it once will be sufficient
[520] Fix | Delete
if ( empty( $map ) ) {
[521] Fix | Delete
foreach ( self::_get_page_settings_fields() as $field_id => $field ) {
[522] Fix | Delete
if ( isset( $field['meta_key'] ) ) {
[523] Fix | Delete
// The map can be reversed if needed
[524] Fix | Delete
if ( $meta_key_to_id ) {
[525] Fix | Delete
$map[ $field['meta_key'] ] = $field_id;
[526] Fix | Delete
} else {
[527] Fix | Delete
$map[ $field_id ] = $field['meta_key'];
[528] Fix | Delete
}
[529] Fix | Delete
}
[530] Fix | Delete
}
[531] Fix | Delete
}
[532] Fix | Delete
[533] Fix | Delete
return $map;
[534] Fix | Delete
}
[535] Fix | Delete
[536] Fix | Delete
protected static function _get_page_settings_values( $post_id ) {
[537] Fix | Delete
$post_id = $post_id ? $post_id : get_the_ID();
[538] Fix | Delete
[539] Fix | Delete
if ( ! empty( self::$_PAGE_SETTINGS_VALUES[ $post_id ] ) ) {
[540] Fix | Delete
return self::$_PAGE_SETTINGS_VALUES[ $post_id ];
[541] Fix | Delete
}
[542] Fix | Delete
[543] Fix | Delete
$overflow = et_pb_overflow();
[544] Fix | Delete
$OVERFLOW_DEFAULT = ET_Builder_Module_Helper_Overflow::OVERFLOW_DEFAULT;
[545] Fix | Delete
$is_default = array();
[546] Fix | Delete
[547] Fix | Delete
// Page settings fields
[548] Fix | Delete
$fields = self::$_PAGE_SETTINGS_FIELDS;
[549] Fix | Delete
[550] Fix | Delete
// Defaults
[551] Fix | Delete
$default_bounce_rate_limit = 5;
[552] Fix | Delete
[553] Fix | Delete
// Get values
[554] Fix | Delete
$ab_bounce_rate_limit = get_post_meta( $post_id, '_et_pb_ab_bounce_rate_limit', true );
[555] Fix | Delete
$et_pb_ab_bounce_rate_limit = '' !== $ab_bounce_rate_limit ? $ab_bounce_rate_limit : $default_bounce_rate_limit;
[556] Fix | Delete
$is_default[] = $et_pb_ab_bounce_rate_limit === $default_bounce_rate_limit ? 'et_pb_ab_bounce_rate_limit' : '';
[557] Fix | Delete
[558] Fix | Delete
$color_palette = get_post_meta( $post_id, '_et_pb_color_palette', true );
[559] Fix | Delete
$default = $fields['et_pb_color_palette']['default'];
[560] Fix | Delete
$et_pb_color_palette = '' !== $color_palette ? $color_palette : $default;
[561] Fix | Delete
$is_default[] = $et_pb_color_palette === $default ? 'et_pb_color_palette' : '';
[562] Fix | Delete
[563] Fix | Delete
$gutter_width = get_post_meta( $post_id, '_et_pb_gutter_width', true );
[564] Fix | Delete
$default = $fields['et_pb_page_gutter_width']['default'];
[565] Fix | Delete
$et_pb_page_gutter_width = '' !== $gutter_width ? $gutter_width : $default;
[566] Fix | Delete
$is_default[] = $et_pb_page_gutter_width === $default ? 'et_pb_page_gutter_width' : '';
[567] Fix | Delete
[568] Fix | Delete
$light_text_color = get_post_meta( $post_id, '_et_pb_light_text_color', true );
[569] Fix | Delete
$default = $fields['et_pb_light_text_color']['default'];
[570] Fix | Delete
$et_pb_light_text_color = '' !== $light_text_color ? $light_text_color : $default;
[571] Fix | Delete
$is_default[] = strtolower( $et_pb_light_text_color ) === $default ? 'et_pb_light_text_color' : '';
[572] Fix | Delete
[573] Fix | Delete
$dark_text_color = get_post_meta( $post_id, '_et_pb_dark_text_color', true );
[574] Fix | Delete
$default = $fields['et_pb_dark_text_color']['default'];
[575] Fix | Delete
$et_pb_dark_text_color = '' !== $dark_text_color ? $dark_text_color : $default;
[576] Fix | Delete
$is_default[] = strtolower( $et_pb_dark_text_color ) === $default ? 'et_pb_dark_text_color' : '';
[577] Fix | Delete
[578] Fix | Delete
$content_area_background_color = get_post_meta( $post_id, '_et_pb_content_area_background_color', true );
[579] Fix | Delete
$default = $fields['et_pb_content_area_background_color']['default'];
[580] Fix | Delete
$et_pb_content_area_background_color = '' !== $content_area_background_color ? $content_area_background_color : $default;
[581] Fix | Delete
$is_default[] = strtolower( $et_pb_content_area_background_color ) === $default ? 'et_pb_content_area_background_color' : '';
[582] Fix | Delete
[583] Fix | Delete
$section_background_color = get_post_meta( $post_id, '_et_pb_section_background_color', true );
[584] Fix | Delete
[585] Fix | Delete
$default = $fields['et_pb_section_background_color']['default'];
[586] Fix | Delete
$et_pb_section_background_color = '' !== $section_background_color ? $section_background_color : $default;
[587] Fix | Delete
$is_default[] = strtolower( $et_pb_section_background_color ) === $default ? 'et_pb_section_background_color' : '';
[588] Fix | Delete
[589] Fix | Delete
$overflow_x = (string) get_post_meta( $post_id, $overflow->get_field_x( '_et_pb_' ), true );
[590] Fix | Delete
$is_default[] = empty( $overflow_x ) || $overflow_x == $OVERFLOW_DEFAULT ? $overflow->get_field_x( 'et_pb_' ) : '';
[591] Fix | Delete
[592] Fix | Delete
$overflow_y = (string) get_post_meta( $post_id, $overflow->get_field_y( '_et_pb_' ), true );
[593] Fix | Delete
$is_default[] = empty( $overflow_y ) || $overflow_y == $OVERFLOW_DEFAULT ? $overflow->get_field_y( 'et_pb_' ) : '';
[594] Fix | Delete
[595] Fix | Delete
$static_css_file = get_post_meta( $post_id, '_et_pb_static_css_file', true );
[596] Fix | Delete
$default = $fields['et_pb_static_css_file']['default'];
[597] Fix | Delete
$et_pb_static_css_file = '' !== $static_css_file ? $static_css_file : $default;
[598] Fix | Delete
$is_default[] = $et_pb_static_css_file === $default ? 'et_pb_static_css_file' : '';
[599] Fix | Delete
[600] Fix | Delete
self::$_PAGE_SETTINGS_IS_DEFAULT[ $post_id ] = $is_default;
[601] Fix | Delete
[602] Fix | Delete
$post = get_post( $post_id );
[603] Fix | Delete
$values = array(
[604] Fix | Delete
'et_pb_enable_ab_testing' => et_is_ab_testing_active() ? 'on' : 'off',
[605] Fix | Delete
'et_pb_ab_bounce_rate_limit' => $et_pb_ab_bounce_rate_limit,
[606] Fix | Delete
'et_pb_ab_stats_refresh_interval' => et_pb_ab_get_refresh_interval( $post_id ),
[607] Fix | Delete
'et_pb_ab_subjects' => et_pb_ab_get_subjects( $post_id ),
[608] Fix | Delete
'et_pb_enable_shortcode_tracking' => get_post_meta( $post_id, '_et_pb_enable_shortcode_tracking', true ),
[609] Fix | Delete
'et_pb_ab_current_shortcode' => '[et_pb_split_track id="' . $post_id . '" /]',
[610] Fix | Delete
'et_pb_custom_css' => get_post_meta( $post_id, '_et_pb_custom_css', true ),
[611] Fix | Delete
'et_pb_color_palette' => $et_pb_color_palette,
[612] Fix | Delete
'et_pb_page_gutter_width' => $et_pb_page_gutter_width,
[613] Fix | Delete
'et_pb_light_text_color' => strtolower( $et_pb_light_text_color ),
[614] Fix | Delete
'et_pb_dark_text_color' => strtolower( $et_pb_dark_text_color ),
[615] Fix | Delete
'et_pb_content_area_background_color' => strtolower( $et_pb_content_area_background_color ),
[616] Fix | Delete
'et_pb_section_background_color' => strtolower( $et_pb_section_background_color ),
[617] Fix | Delete
'et_pb_static_css_file' => $et_pb_static_css_file,
[618] Fix | Delete
'et_pb_post_settings_title' => $post ? $post->post_title : '',
[619] Fix | Delete
'et_pb_post_settings_excerpt' => $post ? $post->post_excerpt : '',
[620] Fix | Delete
'et_pb_post_settings_image' => get_post_thumbnail_id( $post_id ),
[621] Fix | Delete
'et_pb_post_settings_categories' => self::_get_object_terms( $post_id, 'category' ),
[622] Fix | Delete
'et_pb_post_settings_tags' => self::_get_object_terms( $post_id, 'post_tag' ),
[623] Fix | Delete
'et_pb_post_settings_project_categories' => self::_get_object_terms( $post_id, 'project_category' ),
[624] Fix | Delete
'et_pb_post_settings_project_tags' => self::_get_object_terms( $post_id, 'project_tag' ),
[625] Fix | Delete
et_pb_overflow()->get_field_x( 'et_pb_' ) => $overflow_x,
[626] Fix | Delete
et_pb_overflow()->get_field_y( 'et_pb_' ) => $overflow_y,
[627] Fix | Delete
'et_pb_page_z_index' => get_post_meta( $post_id, '_et_pb_page_z_index', true )
[628] Fix | Delete
);
[629] Fix | Delete
/**
[630] Fix | Delete
* Filters Divi Builder page settings values.
[631] Fix | Delete
*
[632] Fix | Delete
* @since 3.0.45
[633] Fix | Delete
*
[634] Fix | Delete
* @param mixed[] $builder_settings {
[635] Fix | Delete
* Builder Settings Values
[636] Fix | Delete
*
[637] Fix | Delete
* @type string $setting_name Setting value.
[638] Fix | Delete
* ...
[639] Fix | Delete
* }
[640] Fix | Delete
* @param string|int $post_id
[641] Fix | Delete
*/
[642] Fix | Delete
$values = self::$_PAGE_SETTINGS_VALUES[ $post_id ] = apply_filters( 'et_builder_page_settings_values', $values, $post_id );
[643] Fix | Delete
[644] Fix | Delete
/**
[645] Fix | Delete
* Filters the Divi Builder's page settings values.
[646] Fix | Delete
*
[647] Fix | Delete
* @deprecated {@see 'et_builder_page_settings_values'}
[648] Fix | Delete
*
[649] Fix | Delete
* @since 2.7.0
[650] Fix | Delete
* @since 3.0.45 Deprecation.
[651] Fix | Delete
*/
[652] Fix | Delete
return apply_filters( 'et_pb_get_builder_settings_values', $values, $post_id );
[653] Fix | Delete
}
[654] Fix | Delete
[655] Fix | Delete
protected static function _get_static_css_generation_field( $scope ) {
[656] Fix | Delete
$description = array(
[657] Fix | Delete
'page' => esc_html__( "When this option is enabled, the builder's inline CSS styles for this page will be cached and served as a static file. Enabling this option can help improve performance.", 'et_builder' ),
[658] Fix | Delete
'builder' => esc_html__( "When this option is enabled, the builder's inline CSS styles for all pages will be cached and served as static files. Enabling this option can help improve performance.", 'et_builder' ),
[659] Fix | Delete
);
[660] Fix | Delete
[661] Fix | Delete
return array(
[662] Fix | Delete
'type' => 'yes_no_button',
[663] Fix | Delete
'id' => 'et_pb_static_css_file',
[664] Fix | Delete
'index' => -1,
[665] Fix | Delete
'label' => esc_html__( 'Static CSS File Generation', 'et_builder' ),
[666] Fix | Delete
'description' => $description[ $scope ],
[667] Fix | Delete
'options' => array(
[668] Fix | Delete
'on' => __( 'On', 'et_builder' ),
[669] Fix | Delete
'off' => __( 'Off', 'et_builder' ),
[670] Fix | Delete
),
[671] Fix | Delete
'default' => 'on',
[672] Fix | Delete
'validation_type' => 'simple_text',
[673] Fix | Delete
'after' => array(
[674] Fix | Delete
'type' => 'button',
[675] Fix | Delete
'link' => '#',
[676] Fix | Delete
'class' => 'et_builder_clear_static_css',
[677] Fix | Delete
'title' => esc_html_x( 'Clear', 'clear static css files', 'et_builder' ),
[678] Fix | Delete
'authorize' => false,
[679] Fix | Delete
'is_after_element' => true,
[680] Fix | Delete
),
[681] Fix | Delete
'tab_slug' => 'advanced',
[682] Fix | Delete
'toggle_slug' => 'performance',
[683] Fix | Delete
);
[684] Fix | Delete
}
[685] Fix | Delete
[686] Fix | Delete
protected static function _get_post_type_options_defaults() {
[687] Fix | Delete
$post_types = et_builder_get_enabled_builder_post_types();
[688] Fix | Delete
$post_type_options = array();
[689] Fix | Delete
[690] Fix | Delete
foreach ( $post_types as $post_type ) {
[691] Fix | Delete
$post_type_options[ $post_type ] = 'on';
[692] Fix | Delete
}
[693] Fix | Delete
[694] Fix | Delete
return $post_type_options;
[695] Fix | Delete
}
[696] Fix | Delete
[697] Fix | Delete
/**
[698] Fix | Delete
* Returns all taxonomy terms for a given post.
[699] Fix | Delete
*
[700] Fix | Delete
* @param int $post_id Post ID.
[701] Fix | Delete
* @param string $taxonomy Taxonomy name.
[702] Fix | Delete
*
[703] Fix | Delete
* @return string
[704] Fix | Delete
*/
[705] Fix | Delete
protected static function _get_object_terms( $post_id, $taxonomy ) {
[706] Fix | Delete
$terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'ids' ) );
[707] Fix | Delete
return is_array( $terms ) ? implode( ',', $terms ) : '';
[708] Fix | Delete
}
[709] Fix | Delete
[710] Fix | Delete
public static function get_registered_post_type_options() {
[711] Fix | Delete
return et_get_registered_post_type_options( 'ET_Builder_Settings::sort_post_types' );
[712] Fix | Delete
}
[713] Fix | Delete
[714] Fix | Delete
public static function sort_post_types( $a, $b ) {
[715] Fix | Delete
// ASCII has a total of 127 characters, so 500 as the interval
[716] Fix | Delete
// should be a sufficiently high number.
[717] Fix | Delete
$rank_priority = array( 'page' => 1500, 'post' => 1000, 'project' => 500 );
[718] Fix | Delete
$a_rank = isset( $rank_priority[ $a->name ] ) ? $rank_priority[ $a->name ] : 0;
[719] Fix | Delete
$b_rank = isset( $rank_priority[ $b->name ] ) ? $rank_priority[ $b->name ] : 0;
[720] Fix | Delete
[721] Fix | Delete
return strcasecmp( $a->label, $b->label ) - $a_rank + $b_rank;
[722] Fix | Delete
}
[723] Fix | Delete
[724] Fix | Delete
protected function _initialize() {
[725] Fix | Delete
/**
[726] Fix | Delete
* Filters Divi Builder settings field definitions.
[727] Fix | Delete
*
[728] Fix | Delete
* @since 3.0.45
[729] Fix | Delete
*/
[730] Fix | Delete
self::$_BUILDER_SETTINGS_FIELDS = apply_filters( 'et_builder_settings_definitions', self::_get_builder_settings_fields() );
[731] Fix | Delete
[732] Fix | Delete
/**
[733] Fix | Delete
* Filters Divi Builder settings values.
[734] Fix | Delete
*
[735] Fix | Delete
* @since 3.0.45
[736] Fix | Delete
*
[737] Fix | Delete
* @param mixed[] $builder_settings {
[738] Fix | Delete
* Builder Settings Values
[739] Fix | Delete
*
[740] Fix | Delete
* @type string $setting_name Setting value.
[741] Fix | Delete
* ...
[742] Fix | Delete
* }
[743] Fix | Delete
*/
[744] Fix | Delete
self::$_BUILDER_SETTINGS_VALUES = apply_filters( 'et_builder_settings_values', self::_get_builder_settings_values() );
[745] Fix | Delete
[746] Fix | Delete
if ( function_exists( 'is_product' ) && is_product() ) {
[747] Fix | Delete
self::$_PAGE_SETTINGS_FIELDS = self::_get_page_settings_fields( 'product' );
[748] Fix | Delete
} else {
[749] Fix | Delete
self::$_PAGE_SETTINGS_FIELDS = self::_get_page_settings_fields();
[750] Fix | Delete
}
[751] Fix | Delete
[752] Fix | Delete
/**
[753] Fix | Delete
* Filters Divi Builder page settings field definitions.
[754] Fix | Delete
*
[755] Fix | Delete
* @since 3.29 Customize Page Settings Fields for Product CPT.
[756] Fix | Delete
* @since 3.0.45
[757] Fix | Delete
*/
[758] Fix | Delete
self::$_PAGE_SETTINGS_FIELDS = apply_filters( 'et_builder_page_settings_definitions',
[759] Fix | Delete
self::$_PAGE_SETTINGS_FIELDS );
[760] Fix | Delete
[761] Fix | Delete
/**
[762] Fix | Delete
* Filters Divi Builder page settings field definitions.
[763] Fix | Delete
*
[764] Fix | Delete
* @deprecated {@see 'et_builder_page_settings_definitions'}
[765] Fix | Delete
*
[766] Fix | Delete
* @since 2.7.0
[767] Fix | Delete
* @since 3.0.45 Deprecation.
[768] Fix | Delete
*/
[769] Fix | Delete
self::$_PAGE_SETTINGS_FIELDS = apply_filters( 'et_pb_get_builder_settings_configurations', self::$_PAGE_SETTINGS_FIELDS );
[770] Fix | Delete
[771] Fix | Delete
self::$_PAGE_SETTINGS_VALUES = array();
[772] Fix | Delete
}
[773] Fix | Delete
[774] Fix | Delete
protected static function _maybe_clear_cached_static_css_files( $setting, $setting_value ) {
[775] Fix | Delete
if ( in_array( $setting, array( 'et_pb_css_in_footer', 'et_pb_static_css_file' ) ) ) {
[776] Fix | Delete
ET_Core_PageResource::remove_static_resources( 'all', 'all' );
[777] Fix | Delete
}
[778] Fix | Delete
}
[779] Fix | Delete
[780] Fix | Delete
protected function _register_callbacks() {
[781] Fix | Delete
$class = get_class( $this );
[782] Fix | Delete
[783] Fix | Delete
if ( ! is_admin() ) {
[784] Fix | Delete
// Setup post meta callback registration on preview page. Priority has to be less than 10
[785] Fix | Delete
// so get_post_meta used on self::_get_page_settings_values() are affected
[786] Fix | Delete
add_action( 'wp', array( $this, '_register_preview_post_metadata' ), 5 );
[787] Fix | Delete
[788] Fix | Delete
return;
[789] Fix | Delete
}
[790] Fix | Delete
[791] Fix | Delete
add_action( 'et_builder_settings_update_option', array( $class, 'update_option_cb'), 10, 3 );
[792] Fix | Delete
[793] Fix | Delete
// setup plugin style options, rather than epanel
[794] Fix | Delete
if ( et_is_builder_plugin_active() ) {
[795] Fix | Delete
add_filter( 'et_builder_plugin_dashboard_sections', array( $class, 'add_plugin_dashboard_sections' ) );
[796] Fix | Delete
add_filter( 'et_builder_plugin_dashboard_fields_data', array( $class, 'add_plugin_dashboard_fields_data' ) );
[797] Fix | Delete
add_action( 'et_pb_builder_after_save_options', array( $class, 'plugin_dashboard_option_saved_cb' ), 10, 4 );
[798] Fix | Delete
add_action( 'et_pb_builder_option_value', array( $class, 'plugin_dashboard_option_value_cb' ), 10, 2 );
[799] Fix | Delete
} else {
[800] Fix | Delete
add_filter( 'et_epanel_tab_names', array( $class, 'add_epanel_tab' ) );
[801] Fix | Delete
add_filter( 'et_epanel_layout_data', array( $class, 'add_epanel_tab_content' ) );
[802] Fix | Delete
add_action( 'et_epanel_update_option', array( $class, 'update_option_cb' ), 10, 3 );
[803] Fix | Delete
}
[804] Fix | Delete
}
[805] Fix | Delete
[806] Fix | Delete
/**
[807] Fix | Delete
* Adds a tab for the builder to ePanel's tabs array.
[808] Fix | Delete
* {@see 'et_epanel_tab_names'}
[809] Fix | Delete
*
[810] Fix | Delete
* @param string[] $tabs
[811] Fix | Delete
*
[812] Fix | Delete
* @return string[] $tabs
[813] Fix | Delete
*/
[814] Fix | Delete
public static function add_epanel_tab( $tabs ) {
[815] Fix | Delete
$builder_tab = esc_html_x( 'Builder', 'Divi Builder', 'et_builder' );
[816] Fix | Delete
$keys = array_keys( $tabs );
[817] Fix | Delete
$values = array_values( $tabs );
[818] Fix | Delete
[819] Fix | Delete
array_splice( $keys, 2, 0, 'builder' );
[820] Fix | Delete
array_splice( $values, 2, 0, $builder_tab );
[821] Fix | Delete
[822] Fix | Delete
return array_combine( $keys, $values );
[823] Fix | Delete
}
[824] Fix | Delete
[825] Fix | Delete
/**
[826] Fix | Delete
* Adds builder settings fields data to the builder plugin's options dashboard.
[827] Fix | Delete
* {@see 'et_builder_plugin_dashboard_fields_data'}
[828] Fix | Delete
*
[829] Fix | Delete
* @param array[] $dashboard_data
[830] Fix | Delete
*
[831] Fix | Delete
* @return array[] $dashboard_data
[832] Fix | Delete
*/
[833] Fix | Delete
public static function add_plugin_dashboard_fields_data( $dashboard_data ) {
[834] Fix | Delete
$tabs = self::get_tabs( 'builder' );
[835] Fix | Delete
$fields = self::get_fields( 'builder' );
[836] Fix | Delete
$toggles = self::get_toggles();
[837] Fix | Delete
[838] Fix | Delete
foreach ( $tabs as $tab_slug => $tab_name ) {
[839] Fix | Delete
$section = $tab_slug . '_main_options';
[840] Fix | Delete
[841] Fix | Delete
if ( ! isset( $dashboard_data[ $section ] ) ) {
[842] Fix | Delete
$dashboard_data[ $section ] = array();
[843] Fix | Delete
}
[844] Fix | Delete
[845] Fix | Delete
$dashboard_data[ $section ][] = array( 'type' => 'main_title', 'title' => '' );
[846] Fix | Delete
[847] Fix | Delete
foreach ( $toggles as $toggle_slug => $toggle ) {
[848] Fix | Delete
$section_started = false;
[849] Fix | Delete
[850] Fix | Delete
foreach ( $fields as $field_slug => $field_info ) {
[851] Fix | Delete
if ( $tab_slug !== $field_info['tab_slug'] || $toggle_slug !== $field_info['toggle_slug'] ) {
[852] Fix | Delete
continue;
[853] Fix | Delete
}
[854] Fix | Delete
[855] Fix | Delete
if ( 'et_pb_css_in_footer' === $field_info['id'] ) {
[856] Fix | Delete
continue;
[857] Fix | Delete
}
[858] Fix | Delete
[859] Fix | Delete
if ( ! $section_started ) {
[860] Fix | Delete
$dashboard_data[ $section ][] = array( 'type' => 'section_start', 'title' => $toggles[ $toggle_slug ] );
[861] Fix | Delete
$section_started = true;
[862] Fix | Delete
}
[863] Fix | Delete
[864] Fix | Delete
$field_info['hint_text'] = $field_info['description'];
[865] Fix | Delete
$field_info['name'] = $field_info['id'];
[866] Fix | Delete
$field_info['title'] = $field_info['label'];
[867] Fix | Delete
[868] Fix | Delete
$dashboard_data[ $section ][] = $field_info;
[869] Fix | Delete
[870] Fix | Delete
if ( isset( $field_info['after'] ) ) {
[871] Fix | Delete
$dashboard_data[ $section ][] = $field_info['after'];
[872] Fix | Delete
}
[873] Fix | Delete
}
[874] Fix | Delete
[875] Fix | Delete
if ( $section_started ) {
[876] Fix | Delete
$dashboard_data[ $section ][] = array( 'type' => 'section_end' );
[877] Fix | Delete
}
[878] Fix | Delete
}
[879] Fix | Delete
}
[880] Fix | Delete
[881] Fix | Delete
return $dashboard_data;
[882] Fix | Delete
}
[883] Fix | Delete
[884] Fix | Delete
/**
[885] Fix | Delete
* Adds tabs for builder settings to the builder plugin's options dashboard.
[886] Fix | Delete
* {@see 'et_builder_plugin_dashboard_sections'}
[887] Fix | Delete
*
[888] Fix | Delete
* @param array[] $sections
[889] Fix | Delete
*
[890] Fix | Delete
* @return array[] $sections
[891] Fix | Delete
*/
[892] Fix | Delete
public static function add_plugin_dashboard_sections( $sections ) {
[893] Fix | Delete
$tabs = self::get_tabs( 'builder' );
[894] Fix | Delete
[895] Fix | Delete
foreach ( $tabs as $tab_slug => $tab_name ) {
[896] Fix | Delete
$sections[ $tab_slug ] = array(
[897] Fix | Delete
'title' => et_core_esc_previously( $tab_name ),
[898] Fix | Delete
'contents' => array(
[899] Fix | Delete
'main' => esc_html__( 'Main', 'et_builder' ),
[900] Fix | Delete
),
[901] Fix | Delete
);
[902] Fix | Delete
}
[903] Fix | Delete
[904] Fix | Delete
return $sections;
[905] Fix | Delete
}
[906] Fix | Delete
[907] Fix | Delete
/**
[908] Fix | Delete
* Adds builder settings to ePanel. {@see 'et_epanel_layout_data'}
[909] Fix | Delete
*
[910] Fix | Delete
* @param array $layout_data
[911] Fix | Delete
*
[912] Fix | Delete
* @return array $data
[913] Fix | Delete
*/
[914] Fix | Delete
public static function add_epanel_tab_content( $layout_data ) {
[915] Fix | Delete
$result = array();
[916] Fix | Delete
$done = false;
[917] Fix | Delete
[918] Fix | Delete
foreach ( $layout_data as $data ) {
[919] Fix | Delete
$result[] = $data;
[920] Fix | Delete
[921] Fix | Delete
if ( $done || ! isset( $data['name'], $data['type'] ) ) {
[922] Fix | Delete
continue;
[923] Fix | Delete
}
[924] Fix | Delete
[925] Fix | Delete
if ( 'wrap-navigation' === $data['name'] && 'contenttab-wrapend' === $data['type'] ) {
[926] Fix | Delete
$builder_options = self::_get_builder_settings_in_epanel_format();
[927] Fix | Delete
$result = array_merge( $result, $builder_options );
[928] Fix | Delete
$done = true;
[929] Fix | Delete
}
[930] Fix | Delete
}
[931] Fix | Delete
[932] Fix | Delete
return $result;
[933] Fix | Delete
}
[934] Fix | Delete
[935] Fix | Delete
public static function update_option_cb( $setting, $setting_value, $post_id = 'global' ) {
[936] Fix | Delete
if ( did_action( 'wp_ajax_et_fb_ajax_save' ) ) {
[937] Fix | Delete
return;
[938] Fix | Delete
}
[939] Fix | Delete
[940] Fix | Delete
self::_maybe_clear_cached_static_css_files( $setting, $setting_value );
[941] Fix | Delete
}
[942] Fix | Delete
[943] Fix | Delete
/**
[944] Fix | Delete
* Returns builder settings fields data for the provided settings scope.
[945] Fix | Delete
*
[946] Fix | Delete
* @param string $scope Get settings fields for scope (page|builder|all). Default 'page'.
[947] Fix | Delete
*
[948] Fix | Delete
* @return array[] See {@link ET_Builder_Element::get_fields()} for structure.
[949] Fix | Delete
*/
[950] Fix | Delete
public static function get_fields( $scope = 'page' ) {
[951] Fix | Delete
$fields = array();
[952] Fix | Delete
[953] Fix | Delete
if ( 'builder' === $scope ) {
[954] Fix | Delete
$fields = self::$_BUILDER_SETTINGS_FIELDS;
[955] Fix | Delete
} else if ( 'page' === $scope ) {
[956] Fix | Delete
$fields = self::$_PAGE_SETTINGS_FIELDS;
[957] Fix | Delete
}
[958] Fix | Delete
[959] Fix | Delete
return $fields;
[960] Fix | Delete
}
[961] Fix | Delete
[962] Fix | Delete
/**
[963] Fix | Delete
* @return ET_Builder_Settings
[964] Fix | Delete
*/
[965] Fix | Delete
public static function get_instance() {
[966] Fix | Delete
if ( null === self::$_instance ) {
[967] Fix | Delete
self::$_instance = new ET_Builder_Settings();
[968] Fix | Delete
}
[969] Fix | Delete
[970] Fix | Delete
return self::$_instance;
[971] Fix | Delete
}
[972] Fix | Delete
[973] Fix | Delete
/**
[974] Fix | Delete
* Returns the localized tab names for the builder settings.
[975] Fix | Delete
*
[976] Fix | Delete
* @param string $scope
[977] Fix | Delete
*
[978] Fix | Delete
* @return string[] {
[979] Fix | Delete
* Localized Tab Names.
[980] Fix | Delete
*
[981] Fix | Delete
* @type string $tab_slug Tab name
[982] Fix | Delete
* ...
[983] Fix | Delete
* }
[984] Fix | Delete
*/
[985] Fix | Delete
public static function get_tabs( $scope = 'page' ) {
[986] Fix | Delete
$result = array();
[987] Fix | Delete
$advanced = esc_html_x( 'Advanced', 'Design Settings', 'et_builder' );
[988] Fix | Delete
$post_type_integration = esc_html_x( 'Post Type Integration', 'Builder Settings', 'et_builder' );
[989] Fix | Delete
[990] Fix | Delete
if ( 'page' === $scope ) {
[991] Fix | Delete
$result = array(
[992] Fix | Delete
'content' => esc_html_x( 'Content', 'Content Settings', 'et_builder' ),
[993] Fix | Delete
'design' => esc_html_x( 'Design', 'Design Settings', 'et_builder' ),
[994] Fix | Delete
'advanced' => $advanced,
[995] Fix | Delete
);
[996] Fix | Delete
} else if ( 'builder' === $scope ) {
[997] Fix | Delete
$result = array(
[998] Fix | Delete
'post_type_integration' => $post_type_integration,
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function