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
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/Divi/includes/builder/module/settings/migratio...
File: UIImprovements.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Migration for modules fields prior to UI Improvement Release. Some defaults are changes for better UI, these
[2] Fix | Delete
* migrations makes affected modules made prior UI Improvement to keep its current UI output
[3] Fix | Delete
*
[4] Fix | Delete
* @since 3.2
[5] Fix | Delete
*/
[6] Fix | Delete
class ET_Builder_Module_Settings_Migration_UIImprovement extends ET_Builder_Module_Settings_Migration {
[7] Fix | Delete
public $version = '3.2';
[8] Fix | Delete
[9] Fix | Delete
public function get_modules( $group = '' ) {
[10] Fix | Delete
$modules = array();
[11] Fix | Delete
[12] Fix | Delete
if ( in_array( $group, array( '', 'testimonial', 'background_layout', 'version' ) ) ) {
[13] Fix | Delete
$modules[] = 'et_pb_testimonial';
[14] Fix | Delete
}
[15] Fix | Delete
[16] Fix | Delete
if ( in_array( $group, array( '', 'slide', 'background_color' ) ) ) {
[17] Fix | Delete
$modules[] = 'et_pb_slide';
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
if ( in_array( $group, array( '', 'post_slider', 'background_color' ) ) ) {
[21] Fix | Delete
$modules[] = 'et_pb_post_slider';
[22] Fix | Delete
$modules[] = 'et_pb_fullwidth_post_slider';
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
if ( in_array( $group, array( '', 'fullwidth_header', 'background_layout', 'background_color', 'version' ) ) ) {
[26] Fix | Delete
$modules[] = 'et_pb_fullwidth_header';
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
if ( in_array( $group, array( '', 'divider', 'version' ) ) ) {
[30] Fix | Delete
$modules[] = 'et_pb_divider';
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
return $modules;
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
public function get_fields() {
[37] Fix | Delete
return array(
[38] Fix | Delete
'background_layout' => array(
[39] Fix | Delete
'affected_fields' => array(
[40] Fix | Delete
'background_layout' => $this->get_modules( 'background_layout' ),
[41] Fix | Delete
),
[42] Fix | Delete
),
[43] Fix | Delete
'background_color' => array(
[44] Fix | Delete
'affected_fields' => array(
[45] Fix | Delete
'background_color' => $this->get_modules( 'background_color' ),
[46] Fix | Delete
),
[47] Fix | Delete
),
[48] Fix | Delete
'color' => array(
[49] Fix | Delete
'affected_fields' => array(
[50] Fix | Delete
'color' => $this->get_modules( 'divider' ),
[51] Fix | Delete
),
[52] Fix | Delete
),
[53] Fix | Delete
'show_divider' => array(
[54] Fix | Delete
'affected_fields' => array(
[55] Fix | Delete
'show_divider' => $this->get_modules( 'divider' ),
[56] Fix | Delete
),
[57] Fix | Delete
),
[58] Fix | Delete
'_builder_version' => array(
[59] Fix | Delete
'affected_fields' => array(
[60] Fix | Delete
'_builder_version' => $this->get_modules( 'version' ),
[61] Fix | Delete
),
[62] Fix | Delete
),
[63] Fix | Delete
);
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
public function migrate( $field_name, $current_value, $module_slug, $saved_value, $saved_field_name, $attrs, $content, $module_address ) {
[67] Fix | Delete
$is_current_value_empty = '' === $current_value;
[68] Fix | Delete
[69] Fix | Delete
if ( $is_current_value_empty ) {
[70] Fix | Delete
// Background Layout
[71] Fix | Delete
if ( 'background_layout' === $field_name ) {
[72] Fix | Delete
// Testimonial
[73] Fix | Delete
if ( 'et_pb_testimonial' === $module_slug ) {
[74] Fix | Delete
$current_value = 'dark';
[75] Fix | Delete
}
[76] Fix | Delete
[77] Fix | Delete
if ( 'et_pb_fullwidth_header' === $module_slug ) {
[78] Fix | Delete
$current_value = 'light';
[79] Fix | Delete
}
[80] Fix | Delete
}
[81] Fix | Delete
[82] Fix | Delete
// Background Color
[83] Fix | Delete
if ( 'background_color' === $field_name ) {
[84] Fix | Delete
if ( in_array( $module_slug, $this->get_modules( 'slide' ) ) ) {
[85] Fix | Delete
$current_value = '#ffffff';
[86] Fix | Delete
[87] Fix | Delete
if ( et_builder_accent_color() === $saved_value ) {
[88] Fix | Delete
$current_value = '#ffffff';
[89] Fix | Delete
} else {
[90] Fix | Delete
$current_value = $saved_value;
[91] Fix | Delete
}
[92] Fix | Delete
}
[93] Fix | Delete
[94] Fix | Delete
if ( in_array( $module_slug, $this->get_modules( 'post_slider' ) ) ) {
[95] Fix | Delete
if ( isset( $attrs['background_layout'] ) && 'light' === $attrs['background_layout'] ) {
[96] Fix | Delete
$current_value = '#f5f5f5';
[97] Fix | Delete
} else {
[98] Fix | Delete
$current_value = '#2ea3f2';
[99] Fix | Delete
}
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
// Migrated value cannot be empty string because it'll be filled by default on visual builder.
[103] Fix | Delete
// Thus for empty value, use rgba-based transparent white color
[104] Fix | Delete
if ( in_array( $module_slug, $this->get_modules( 'fullwidth_header' ) ) ) {
[105] Fix | Delete
$current_value = 'rgba(255, 255, 255, 0)';
[106] Fix | Delete
}
[107] Fix | Delete
}
[108] Fix | Delete
[109] Fix | Delete
// Divider
[110] Fix | Delete
if ( in_array( $module_slug, $this->get_modules( 'divider' ) ) ) {
[111] Fix | Delete
if ( 'color' === $field_name ) {
[112] Fix | Delete
$current_value = '#ffffff';
[113] Fix | Delete
}
[114] Fix | Delete
[115] Fix | Delete
// Divider visibility was automatically set to visible when module customizer for divider visibility is turned on in theme
[116] Fix | Delete
// Thus the migration only took effect on theme when module customizer for divider visibility isn't turn on
[117] Fix | Delete
$is_theme_module_customizer_unmodified = ! et_is_builder_plugin_active() && true === et_get_option( 'et_pb_divider-show_divider', false );
[118] Fix | Delete
[119] Fix | Delete
if ( 'show_divider' === $field_name && ! $is_theme_module_customizer_unmodified ) {
[120] Fix | Delete
$current_value = 'off';
[121] Fix | Delete
}
[122] Fix | Delete
}
[123] Fix | Delete
}
[124] Fix | Delete
[125] Fix | Delete
// Bump _builder_version if migrate() is called for visual builder data retrieval. This needs to be done
[126] Fix | Delete
// due to shortcode trimming. Migration originally added with migrating attribute value from a field_name to
[127] Fix | Delete
// different field_name in mind. When data is migrated to the same field_name and the value gets trimmed
[128] Fix | Delete
// due to it being identical to default value, what ends up happening is unexpected layout change when
[129] Fix | Delete
// layout is saved in VB because the builder version remains but the data changed and gets trimmed
[130] Fix | Delete
// because it is migrated to default value and it gets migrated again on the next round (due to builder
[131] Fix | Delete
// version remains to its original value)
[132] Fix | Delete
if ( $field_name === '_builder_version' && is_admin() && defined( 'DOING_AJAX' ) && DOING_AJAX ) {
[133] Fix | Delete
$current_value = $this->version;
[134] Fix | Delete
}
[135] Fix | Delete
[136] Fix | Delete
return $current_value;
[137] Fix | Delete
}
[138] Fix | Delete
}
[139] Fix | Delete
[140] Fix | Delete
return new ET_Builder_Module_Settings_Migration_UIImprovement();
[141] Fix | Delete
[142] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function