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: OptionsHarmony.php
<?php
[0] Fix | Delete
class ET_Builder_Module_Settings_Migration_OptionsHarmony extends ET_Builder_Module_Settings_Migration {
[1] Fix | Delete
[2] Fix | Delete
public $version = '3.0.74';
[3] Fix | Delete
[4] Fix | Delete
public function __construct() {
[5] Fix | Delete
parent::__construct();
[6] Fix | Delete
[7] Fix | Delete
self::$_bb_excluded_name_changes[] = 'text_orientation';
[8] Fix | Delete
}
[9] Fix | Delete
[10] Fix | Delete
public function get_fields() {
[11] Fix | Delete
return array(
[12] Fix | Delete
'parallax' => array(
[13] Fix | Delete
'affected_fields' => array(
[14] Fix | Delete
'parallax_effect' => $this->get_modules( 'post_title' ),
[15] Fix | Delete
),
[16] Fix | Delete
),
[17] Fix | Delete
'parallax_method' => array(
[18] Fix | Delete
'affected_fields' => array(
[19] Fix | Delete
'parallax_effect' => $this->get_modules( 'post_title' ),
[20] Fix | Delete
'parallax_method' => $this->get_modules( 'slide' ),
[21] Fix | Delete
),
[22] Fix | Delete
'values' => array(
[23] Fix | Delete
'off' => 'on',
[24] Fix | Delete
'on' => 'off',
[25] Fix | Delete
),
[26] Fix | Delete
),
[27] Fix | Delete
'background_color' => array(
[28] Fix | Delete
'affected_fields' => array(
[29] Fix | Delete
'module_bg_color' => $this->get_modules( 'post_title' ),
[30] Fix | Delete
'field_bg' => $this->get_modules( 'search' ),
[31] Fix | Delete
'bg_color' => $this->get_modules( 'social_media_follow_network' ),
[32] Fix | Delete
'transparent_background' => $this->get_modules( 'section' ),
[33] Fix | Delete
'transparent_background_fb' => $this->get_modules( 'section' ),
[34] Fix | Delete
),
[35] Fix | Delete
),
[36] Fix | Delete
'custom_padding' => array(
[37] Fix | Delete
'affected_fields' => array(
[38] Fix | Delete
'bar_top_padding' => $this->get_modules( 'bar_counters' ),
[39] Fix | Delete
'bar_bottom_padding' => $this->get_modules( 'bar_counters' ),
[40] Fix | Delete
'top_padding' => $this->get_modules( 'slider' ),
[41] Fix | Delete
'bottom_padding' => $this->get_modules( 'slider' ),
[42] Fix | Delete
'custom_padding' => $this->get_modules( 'section' ),
[43] Fix | Delete
),
[44] Fix | Delete
),
[45] Fix | Delete
'custom_padding_tablet' => array(
[46] Fix | Delete
'affected_fields' => array(
[47] Fix | Delete
'bar_top_padding_tablet' => $this->get_modules( 'bar_counters' ),
[48] Fix | Delete
'bar_bottom_padding_tablet'=> $this->get_modules( 'bar_counters' ),
[49] Fix | Delete
'top_padding_tablet' => $this->get_modules( 'slider' ),
[50] Fix | Delete
'bottom_padding_tablet' => $this->get_modules( 'slider' ),
[51] Fix | Delete
'padding_mobile' => $this->get_modules( 'section' ),
[52] Fix | Delete
),
[53] Fix | Delete
),
[54] Fix | Delete
'custom_padding_phone' => array(
[55] Fix | Delete
'affected_fields' => array(
[56] Fix | Delete
'bar_top_padding_phone' => $this->get_modules( 'bar_counters' ),
[57] Fix | Delete
'bar_bottom_padding_phone'=> $this->get_modules( 'bar_counters' ),
[58] Fix | Delete
'top_padding_phone' => $this->get_modules( 'slider' ),
[59] Fix | Delete
'bottom_padding_phone' => $this->get_modules( 'slider' ),
[60] Fix | Delete
),
[61] Fix | Delete
),
[62] Fix | Delete
'custom_padding_last_edited' => array(
[63] Fix | Delete
'affected_fields' => array(
[64] Fix | Delete
'bar_top_padding_last_edited' => $this->get_modules( 'bar_counters' ),
[65] Fix | Delete
'bar_bottom_padding_last_edited' => $this->get_modules( 'bar_counters' ),
[66] Fix | Delete
'top_padding_last_edited' => $this->get_modules( 'slider' ),
[67] Fix | Delete
'bottom_padding_last_edited' => $this->get_modules( 'slider' ),
[68] Fix | Delete
'padding_mobile' => $this->get_modules( 'section' ),
[69] Fix | Delete
),
[70] Fix | Delete
),
[71] Fix | Delete
'background_video_mp4' => array(
[72] Fix | Delete
'affected_fields' => array(
[73] Fix | Delete
'video_bg_mp4' => $this->get_modules( 'slide' ),
[74] Fix | Delete
),
[75] Fix | Delete
),
[76] Fix | Delete
'background_video_webm' => array(
[77] Fix | Delete
'affected_fields' => array(
[78] Fix | Delete
'video_bg_webm' => $this->get_modules( 'slide' ),
[79] Fix | Delete
),
[80] Fix | Delete
),
[81] Fix | Delete
'background_video_width' => array(
[82] Fix | Delete
'affected_fields' => array(
[83] Fix | Delete
'video_bg_width' => $this->get_modules( 'slide' ),
[84] Fix | Delete
),
[85] Fix | Delete
),
[86] Fix | Delete
'background_video_height' => array(
[87] Fix | Delete
'affected_fields' => array(
[88] Fix | Delete
'video_bg_height' => $this->get_modules( 'slide' ),
[89] Fix | Delete
),
[90] Fix | Delete
),
[91] Fix | Delete
'disabled_on' => array(
[92] Fix | Delete
'affected_fields' => array(
[93] Fix | Delete
'hide_on_mobile' => $this->get_modules( 'divider' ),
[94] Fix | Delete
),
[95] Fix | Delete
),
[96] Fix | Delete
'show_prev' => array(
[97] Fix | Delete
'affected_fields' => array(
[98] Fix | Delete
'hide_prev' => $this->get_modules( 'post_nav' ),
[99] Fix | Delete
),
[100] Fix | Delete
),
[101] Fix | Delete
'show_next' => array(
[102] Fix | Delete
'affected_fields' => array(
[103] Fix | Delete
'hide_next' => $this->get_modules( 'post_nav' ),
[104] Fix | Delete
),
[105] Fix | Delete
),
[106] Fix | Delete
'show_inner_shadow' => array(
[107] Fix | Delete
'affected_fields' => array(
[108] Fix | Delete
'remove_inner_shadow' => $this->get_modules( 'slider' ),
[109] Fix | Delete
),
[110] Fix | Delete
),
[111] Fix | Delete
'show_featured_drop_shadow' => array(
[112] Fix | Delete
'affected_fields' => array(
[113] Fix | Delete
'remove_featured_drop_shadow' => $this->get_modules( 'pricing_table' ),
[114] Fix | Delete
),
[115] Fix | Delete
),
[116] Fix | Delete
'show_button' => array(
[117] Fix | Delete
'affected_fields' => array(
[118] Fix | Delete
'hide_button' => $this->get_modules( 'search' ),
[119] Fix | Delete
),
[120] Fix | Delete
),
[121] Fix | Delete
'show_border' => array(
[122] Fix | Delete
'affected_fields' => array(
[123] Fix | Delete
'remove_border' => $this->get_modules( 'sidebar' ),
[124] Fix | Delete
),
[125] Fix | Delete
),
[126] Fix | Delete
'show_image_overlay' => array(
[127] Fix | Delete
'affected_fields' => array(
[128] Fix | Delete
'show_image_overlay' => $this->get_modules( 'video_slider' ),
[129] Fix | Delete
),
[130] Fix | Delete
),
[131] Fix | Delete
'show_content_on_mobile' => array(
[132] Fix | Delete
'affected_fields' => array(
[133] Fix | Delete
'hide_content_on_mobile' => $this->get_modules( 'slider' ),
[134] Fix | Delete
),
[135] Fix | Delete
),
[136] Fix | Delete
'show_cta_on_mobile' => array(
[137] Fix | Delete
'affected_fields' => array(
[138] Fix | Delete
'hide_cta_on_mobile' => $this->get_modules( 'slider' ),
[139] Fix | Delete
),
[140] Fix | Delete
),
[141] Fix | Delete
'show_bottom_space' => array(
[142] Fix | Delete
'affected_fields' => array(
[143] Fix | Delete
'sticky' => $this->get_modules( 'image' ),
[144] Fix | Delete
),
[145] Fix | Delete
),
[146] Fix | Delete
'image_max_width' => array(
[147] Fix | Delete
'affected_fields' => array(
[148] Fix | Delete
'max_width' => $this->get_modules( 'blurb' ),
[149] Fix | Delete
),
[150] Fix | Delete
),
[151] Fix | Delete
'content_max_width' => array(
[152] Fix | Delete
'affected_fields' => array(
[153] Fix | Delete
'max_width' => $this->get_modules( 'fullwidth_header' ),
[154] Fix | Delete
),
[155] Fix | Delete
),
[156] Fix | Delete
'max_width' => array(
[157] Fix | Delete
'affected_fields' => array(
[158] Fix | Delete
'max_width' => $this->get_modules( 'reset_max_width' ),
[159] Fix | Delete
),
[160] Fix | Delete
),
[161] Fix | Delete
'title_text_color' => array(
[162] Fix | Delete
'affected_fields' => array(
[163] Fix | Delete
'label_color' => $this->get_modules( 'bar_counter' ),
[164] Fix | Delete
),
[165] Fix | Delete
),
[166] Fix | Delete
'percent_text_color' => array(
[167] Fix | Delete
'affected_fields' => array(
[168] Fix | Delete
'percentage_color' => $this->get_modules( 'bar_counter' ),
[169] Fix | Delete
),
[170] Fix | Delete
),
[171] Fix | Delete
'module_alignment' => array(
[172] Fix | Delete
'affected_fields' => array(
[173] Fix | Delete
'text_orientation' => $this->get_modules( 'text_orientation' ),
[174] Fix | Delete
),
[175] Fix | Delete
),
[176] Fix | Delete
);
[177] Fix | Delete
}
[178] Fix | Delete
[179] Fix | Delete
public function get_modules( $attr = '' ) {
[180] Fix | Delete
$modules = array();
[181] Fix | Delete
// Section
[182] Fix | Delete
if ( in_array( $attr, array( '', 'section' ) ) ) {
[183] Fix | Delete
$modules[] = 'et_pb_section';
[184] Fix | Delete
}
[185] Fix | Delete
[186] Fix | Delete
// Post title & Fullwidth post title migration settings
[187] Fix | Delete
if ( in_array( $attr, array( '', 'post_title' ) ) ) {
[188] Fix | Delete
$modules[] = 'et_pb_post_title';
[189] Fix | Delete
$modules[] = 'et_pb_fullwidth_post_title';
[190] Fix | Delete
}
[191] Fix | Delete
[192] Fix | Delete
// Blurb migration setting
[193] Fix | Delete
if ( in_array( $attr, array( '', 'blurb' ) ) ) {
[194] Fix | Delete
$modules[] = 'et_pb_blurb';
[195] Fix | Delete
}
[196] Fix | Delete
[197] Fix | Delete
// Fullwidth Header
[198] Fix | Delete
if ( in_array( $attr, array( '', 'fullwidth_header' ) ) ) {
[199] Fix | Delete
$modules[] = 'et_pb_fullwidth_header';
[200] Fix | Delete
}
[201] Fix | Delete
[202] Fix | Delete
if ( 'reset_max_width' === $attr ) {
[203] Fix | Delete
$modules[] = 'et_pb_blurb';
[204] Fix | Delete
$modules[] = 'et_pb_fullwidth_header';
[205] Fix | Delete
}
[206] Fix | Delete
[207] Fix | Delete
if ( in_array( $attr, array( '', 'text_orientation') ) ) {
[208] Fix | Delete
$modules[] = 'et_pb_text';
[209] Fix | Delete
$modules[] = 'et_pb_search';
[210] Fix | Delete
}
[211] Fix | Delete
[212] Fix | Delete
// Social media follow item migration settings
[213] Fix | Delete
if ( in_array( $attr, array( '', 'social_media_follow_network' ) ) ) {
[214] Fix | Delete
$modules[] = 'et_pb_social_media_follow_network';
[215] Fix | Delete
}
[216] Fix | Delete
[217] Fix | Delete
// Bar Counters
[218] Fix | Delete
if ( in_array( $attr, array( '', 'bar_counters' ) ) ) {
[219] Fix | Delete
$modules[] = 'et_pb_counters';
[220] Fix | Delete
}
[221] Fix | Delete
[222] Fix | Delete
// Bar Counter Item
[223] Fix | Delete
if ( in_array( $attr, array( '', 'bar_counter' ) ) ) {
[224] Fix | Delete
$modules[] = 'et_pb_counter';
[225] Fix | Delete
}
[226] Fix | Delete
[227] Fix | Delete
// Slider
[228] Fix | Delete
if ( in_array( $attr, array( '', 'slider' ) ) ) {
[229] Fix | Delete
$modules[] = 'et_pb_post_slider';
[230] Fix | Delete
$modules[] = 'et_pb_fullwidth_post_slider';
[231] Fix | Delete
$modules[] = 'et_pb_slider';
[232] Fix | Delete
$modules[] = 'et_pb_fullwidth_slider';
[233] Fix | Delete
}
[234] Fix | Delete
[235] Fix | Delete
// Slide Item
[236] Fix | Delete
if ( in_array( $attr, array( '', 'slide' ) ) ) {
[237] Fix | Delete
$modules[] = 'et_pb_slide';
[238] Fix | Delete
}
[239] Fix | Delete
[240] Fix | Delete
// Divider
[241] Fix | Delete
if ( in_array( $attr, array( '', 'divider' ) ) ) {
[242] Fix | Delete
$modules[] = 'et_pb_divider';
[243] Fix | Delete
}
[244] Fix | Delete
[245] Fix | Delete
// Post Nav
[246] Fix | Delete
if ( in_array( $attr, array( '', 'post_nav' ) ) ) {
[247] Fix | Delete
$modules[] = 'et_pb_post_nav';
[248] Fix | Delete
}
[249] Fix | Delete
[250] Fix | Delete
// Pricing Tables
[251] Fix | Delete
if ( in_array( $attr, array( '', 'pricing_table' ) ) ) {
[252] Fix | Delete
$modules[] = 'et_pb_pricing_tables';
[253] Fix | Delete
}
[254] Fix | Delete
[255] Fix | Delete
// Search
[256] Fix | Delete
if ( in_array( $attr, array( '', 'search' ) ) ) {
[257] Fix | Delete
$modules[] = 'et_pb_search';
[258] Fix | Delete
}
[259] Fix | Delete
[260] Fix | Delete
// Sidebar
[261] Fix | Delete
if ( in_array( $attr, array( '', 'sidebar' ) ) ) {
[262] Fix | Delete
$modules[] = 'et_pb_sidebar';
[263] Fix | Delete
}
[264] Fix | Delete
[265] Fix | Delete
// Video Slider
[266] Fix | Delete
if ( in_array( $attr, array( '', 'video_slider' ) ) ) {
[267] Fix | Delete
$modules[] = 'et_pb_video_slider';
[268] Fix | Delete
}
[269] Fix | Delete
[270] Fix | Delete
// Image
[271] Fix | Delete
if ( in_array( $attr, array( '', 'image' ) ) ) {
[272] Fix | Delete
$modules[] = 'et_pb_image';
[273] Fix | Delete
}
[274] Fix | Delete
[275] Fix | Delete
return $modules;
[276] Fix | Delete
}
[277] Fix | Delete
[278] Fix | Delete
public function migrate_spacing( $current_value, $saved_value, $location, $saved_field_name = '', $module_slug = '' ) {
[279] Fix | Delete
$locations = array( 'top', 'right', 'bottom', 'left' );
[280] Fix | Delete
$location_index = array_search( $location, $locations );
[281] Fix | Delete
$spacings = array( '', '', '', '' );
[282] Fix | Delete
[283] Fix | Delete
if ( -1 === $location_index ) {
[284] Fix | Delete
return $current_value;
[285] Fix | Delete
}
[286] Fix | Delete
[287] Fix | Delete
if ( '' !== $saved_value ) {
[288] Fix | Delete
$spacings = explode( '|', $saved_value );
[289] Fix | Delete
$spacings[ $location_index ] = $saved_value;
[290] Fix | Delete
}
[291] Fix | Delete
[292] Fix | Delete
$spacings[ $location_index ] = $current_value;
[293] Fix | Delete
[294] Fix | Delete
// Automatically add zero pixel to padding-right & padding-left of slider & post slider if custom top/bottom padding exist
[295] Fix | Delete
if ( '' !== $current_value && in_array( $saved_field_name, array( 'top_padding', 'bottom_padding' ) ) && in_array( $module_slug, array( 'et_pb_slider', 'et_pb_post_slider' ) ) ) {
[296] Fix | Delete
$spacings[1] = '0px';
[297] Fix | Delete
$spacings[3] = '0px';
[298] Fix | Delete
}
[299] Fix | Delete
[300] Fix | Delete
return implode( '|', $spacings );
[301] Fix | Delete
}
[302] Fix | Delete
[303] Fix | Delete
/**
[304] Fix | Delete
* Re-map value to new value. Originally add to reverse yes/no button value due to option migration
[305] Fix | Delete
* @param string saved value
[306] Fix | Delete
* @param array map of value, expected mapped value in key-value relationship
[307] Fix | Delete
* @param string default value
[308] Fix | Delete
* @return string mapped value
[309] Fix | Delete
*/
[310] Fix | Delete
public function migrate_remap_value( $value, $map = array(), $default = 'on' ) {
[311] Fix | Delete
$map = wp_parse_args( $map, array(
[312] Fix | Delete
'' => 'on',
[313] Fix | Delete
'off' => 'on',
[314] Fix | Delete
'on' => 'off',
[315] Fix | Delete
) );
[316] Fix | Delete
[317] Fix | Delete
return isset( $map[ $value ] ) ? $map[ $value ] : $default;
[318] Fix | Delete
}
[319] Fix | Delete
[320] Fix | Delete
public function migrate( $field_name, $current_value, $module_slug, $saved_value, $saved_field_name, $attrs, $content, $module_address ) {
[321] Fix | Delete
// Padding top & bottom migration to full paddings
[322] Fix | Delete
if ( in_array( $module_slug, array( 'et_pb_counters', 'et_pb_post_slider', 'et_pb_fullwidth_post_slider', 'et_pb_slider', 'et_pb_fullwidth_slider' ) ) ) {
[323] Fix | Delete
[324] Fix | Delete
$top_padding_selectors = array(
[325] Fix | Delete
'bar_top_padding',
[326] Fix | Delete
'bar_top_padding_tablet',
[327] Fix | Delete
'bar_top_padding_phone',
[328] Fix | Delete
'top_padding',
[329] Fix | Delete
'top_padding_tablet',
[330] Fix | Delete
'top_padding_phone',
[331] Fix | Delete
);
[332] Fix | Delete
[333] Fix | Delete
if ( in_array( $saved_field_name, $top_padding_selectors ) ) {
[334] Fix | Delete
return $this->migrate_spacing( $current_value, $saved_value, 'top', $saved_field_name, $module_slug );
[335] Fix | Delete
}
[336] Fix | Delete
[337] Fix | Delete
$bottom_padding_selectors = array(
[338] Fix | Delete
'bar_bottom_padding',
[339] Fix | Delete
'bar_bottom_padding_tablet',
[340] Fix | Delete
'bar_bottom_padding_phone',
[341] Fix | Delete
'bottom_padding',
[342] Fix | Delete
'bottom_padding_tablet',
[343] Fix | Delete
'bottom_padding_phone'
[344] Fix | Delete
);
[345] Fix | Delete
[346] Fix | Delete
if ( in_array( $saved_field_name, $bottom_padding_selectors ) ) {
[347] Fix | Delete
return $this->migrate_spacing( $current_value, $saved_value, 'bottom', $saved_field_name, $module_slug );
[348] Fix | Delete
}
[349] Fix | Delete
[350] Fix | Delete
if ( in_array( $saved_field_name, array( 'bar_top_padding_last_edited', 'bar_bottom_padding_last_edited' ) ) ) {
[351] Fix | Delete
$last_edited_current_value = '' === $current_value ? array( '', '' ) : explode( '|', $current_value );
[352] Fix | Delete
$last_edited_saved_value = '' === $saved_value ? array( '', '' ) : explode( '|', $saved_value);
[353] Fix | Delete
$last_edited_responsive = in_array( 'on', array( $last_edited_current_value[0], $last_edited_saved_value[0] ) ) ? 'on' : 'off';
[354] Fix | Delete
$last_edited_tabs = array_filter( array( $last_edited_current_value[1], $last_edited_saved_value[1] ) );
[355] Fix | Delete
$last_edited_tab = empty( $last_edited_tabs ) ? 'desktop' : end( $last_edited_tabs );
[356] Fix | Delete
[357] Fix | Delete
return "{$last_edited_responsive}|{$last_edited_tab}";
[358] Fix | Delete
}
[359] Fix | Delete
}
[360] Fix | Delete
[361] Fix | Delete
// Section's padding related migration
[362] Fix | Delete
if ( 'et_pb_section' === $module_slug ) {
[363] Fix | Delete
[364] Fix | Delete
// Migrating two side paddings (prior to Divi v2.4) into full paddings
[365] Fix | Delete
if ( 'custom_padding' === $field_name && 'custom_padding' === $saved_field_name ) {
[366] Fix | Delete
$padding_sides = explode( '|', $current_value );
[367] Fix | Delete
[368] Fix | Delete
if ( 2 === count( $padding_sides ) ) {
[369] Fix | Delete
$full_padding_sides = array(
[370] Fix | Delete
$padding_sides[0],
[371] Fix | Delete
'',
[372] Fix | Delete
$padding_sides[1],
[373] Fix | Delete
''
[374] Fix | Delete
);
[375] Fix | Delete
[376] Fix | Delete
return implode( '|', $full_padding_sides );
[377] Fix | Delete
}
[378] Fix | Delete
}
[379] Fix | Delete
[380] Fix | Delete
// Translating "Keep padding on mobile" options into *_last_edited value
[381] Fix | Delete
if ( 'custom_padding_last_edited' === $field_name && 'padding_mobile' === $saved_field_name ) {
[382] Fix | Delete
[383] Fix | Delete
if ( 'off' === $current_value && '' === $saved_value ) {
[384] Fix | Delete
return 'on|desktop';
[385] Fix | Delete
}
[386] Fix | Delete
[387] Fix | Delete
return $saved_value;
[388] Fix | Delete
}
[389] Fix | Delete
[390] Fix | Delete
// Translating "Keep padding on mobile" options into custom_padding_tablet value
[391] Fix | Delete
if ( 'custom_padding_tablet' === $field_name && 'padding_mobile' === $saved_field_name ) {
[392] Fix | Delete
// Keep padding on mobile is disabled
[393] Fix | Delete
if ( '' === $saved_value && 'off' === $current_value ) {
[394] Fix | Delete
return '50px|0|50px|0';
[395] Fix | Delete
}
[396] Fix | Delete
[397] Fix | Delete
// Keep padding on mobile is enabled and custom padding is defined. If no custom_padding value is defined,
[398] Fix | Delete
// the value is expected to be empty string, which makes letting $saved_value to be returned is ok
[399] Fix | Delete
if ( '' === $saved_value && 'on' === $current_value && isset( $attrs['custom_padding'] ) ) {
[400] Fix | Delete
return $attrs['custom_padding'];
[401] Fix | Delete
}
[402] Fix | Delete
[403] Fix | Delete
return $saved_value;
[404] Fix | Delete
}
[405] Fix | Delete
[406] Fix | Delete
// Translating transparent_background into background_color
[407] Fix | Delete
if ( 'background_color' === $field_name && in_array( $saved_field_name, array( 'transparent_background', 'transparent_background_fb' ) ) ) {
[408] Fix | Delete
// Transparent is default for Builder Plugin, but not for theme
[409] Fix | Delete
if ( 'on' === $current_value || ( et_is_builder_plugin_active() && 'default' === $current_value ) ) {
[410] Fix | Delete
return 'rgba(255,255,255,0)';
[411] Fix | Delete
} else {
[412] Fix | Delete
return $saved_value;
[413] Fix | Delete
}
[414] Fix | Delete
}
[415] Fix | Delete
}
[416] Fix | Delete
[417] Fix | Delete
// Divider's hide_on_mobile migration
[418] Fix | Delete
if ( 'et_pb_divider' === $module_slug && 'disabled_on' === $field_name ) {
[419] Fix | Delete
// Set disabled_on if it is previously empty and hide_on_mobile is empty / on (its default value is on)
[420] Fix | Delete
if ( in_array( $current_value, array( '', 'on' ) ) && '' === $saved_value ) {
[421] Fix | Delete
return 'on|on|off';
[422] Fix | Delete
}
[423] Fix | Delete
[424] Fix | Delete
// Translate hide_on_mobile into disabled_on if hide_on_mobile is empty / on and saved_value isn't empty
[425] Fix | Delete
if ( in_array( $current_value, array( '', 'on' ) ) && '' !== $saved_value ) {
[426] Fix | Delete
$disabled_on_array = explode( '|', $saved_value );
[427] Fix | Delete
$disabled_on_array[0] = 'on';
[428] Fix | Delete
$disabled_on_array[1] = 'on';
[429] Fix | Delete
[430] Fix | Delete
return implode( '|', $disabled_on_array );
[431] Fix | Delete
}
[432] Fix | Delete
[433] Fix | Delete
// Otherwise, return saved value
[434] Fix | Delete
return $saved_value;
[435] Fix | Delete
}
[436] Fix | Delete
[437] Fix | Delete
if ( 'parallax_method' === $field_name ) {
[438] Fix | Delete
// Reverse post title and fullwidth post title's parallax_method value because its previous select option values (on = CSS, off = True)
[439] Fix | Delete
// were reversed compared to background UI's parallax_method select options values (on = True, off = CSS)
[440] Fix | Delete
if ( in_array( $module_slug, $this->get_modules( 'post_title' ) ) && isset( $this->fields[ $field_name ] ) && isset( $this->fields[ $field_name ]['values'][ $saved_value ] ) ) {
[441] Fix | Delete
return $this->fields[ $field_name ]['values'][ $saved_value ];
[442] Fix | Delete
}
[443] Fix | Delete
[444] Fix | Delete
// Previous version of slide item has parallax_method options order reversed which causing CSS Parallax can't be rendered.
[445] Fix | Delete
// If the attribute has been saved, it will be rendered just fine
[446] Fix | Delete
// $saved_value reflects the correct value, now it inherits value from Slider / Fullwidth Slider module
[447] Fix | Delete
if ( in_array( $module_slug, $this->get_modules( 'slide' ) ) && '' === $current_value ) {
[448] Fix | Delete
return $saved_value;
[449] Fix | Delete
}
[450] Fix | Delete
}
[451] Fix | Delete
[452] Fix | Delete
// Normalizing video slider's display image overlay's hide/show & select-based field into yes_no_button + on/off-based option
[453] Fix | Delete
if ( 'et_pb_video_slider' === $module_slug && 'show_image_overlay' === $field_name ) {
[454] Fix | Delete
return $this->migrate_remap_value( $current_value, array(
[455] Fix | Delete
'hide' => 'off',
[456] Fix | Delete
'show' => 'on',
[457] Fix | Delete
'' => 'off',
[458] Fix | Delete
), 'off' );
[459] Fix | Delete
}
[460] Fix | Delete
[461] Fix | Delete
// Search's input background migration
[462] Fix | Delete
if ( 'et_pb_search' === $module_slug && 'background_color' === $field_name ) {
[463] Fix | Delete
if ( '' !== $saved_value && '' === $current_value ) {
[464] Fix | Delete
return $saved_value;
[465] Fix | Delete
}
[466] Fix | Delete
}
[467] Fix | Delete
[468] Fix | Delete
// Only Text & Search module's text_orientation = center that is being migrated to each module's module_alignment attribute
[469] Fix | Delete
// If module's text_orientation has different value, let it be. This is needed because on previous version, .et_pb_text_align_center class
[470] Fix | Delete
// set text-align: center; AND margin: 0 auto; margin: 0 auto; belongs to module alignment now, hence the migration
[471] Fix | Delete
if ( in_array( $module_slug, $this->get_modules( 'text_orientation' ) ) && 'text_orientation' === $saved_field_name && 'module_alignment' === $field_name ) {
[472] Fix | Delete
if ( 'center' === $current_value && '' === $saved_value ) {
[473] Fix | Delete
return $current_value;
[474] Fix | Delete
}
[475] Fix | Delete
[476] Fix | Delete
return $saved_value;
[477] Fix | Delete
}
[478] Fix | Delete
[479] Fix | Delete
// Normalizing "remove_*" & "hide_*" option, to ensure that "Yes" === "Show".
[480] Fix | Delete
// saved value needs to be reversed / remapped, off == on, vice versa
[481] Fix | Delete
$is_slider_remove = in_array( $module_slug, $this->get_modules( 'slider' ) ) && in_array( $saved_field_name, array( 'remove_inner_shadow', 'hide_content_on_mobile', 'hide_cta_on_mobile' ) );
[482] Fix | Delete
$is_post_nav_hides = 'et_pb_post_nav' === $module_slug && in_array( $saved_field_name, array( 'hide_prev', 'hide_next' ) );
[483] Fix | Delete
$is_pricing_tables_remove = 'et_pb_pricing_tables' === $module_slug && in_array( $saved_field_name, array( 'remove_featured_drop_shadow' ) );
[484] Fix | Delete
$is_search_hide = 'et_pb_search' === $module_slug && in_array( $saved_field_name, array( 'hide_button' ) );
[485] Fix | Delete
$is_sidebar_remove = 'et_pb_sidebar' === $module_slug && in_array( $saved_field_name, array( 'remove_border' ) );
[486] Fix | Delete
$is_image_sticky = 'et_pb_image' === $module_slug && in_array( $saved_field_name, array( 'sticky' ) );
[487] Fix | Delete
[488] Fix | Delete
if ( $is_slider_remove || $is_post_nav_hides || $is_pricing_tables_remove || $is_search_hide || $is_sidebar_remove || $is_image_sticky ) {
[489] Fix | Delete
return $this->migrate_remap_value( $current_value );
[490] Fix | Delete
}
[491] Fix | Delete
[492] Fix | Delete
// Blurb's max_width needs to be removed, since older max_width is new image_max_width
[493] Fix | Delete
if ( in_array( $module_slug, $this->get_modules( 'reset_max_width' ) ) && 'max_width' === $field_name && 'max_width' === $saved_field_name ) {
[494] Fix | Delete
return '';
[495] Fix | Delete
}
[496] Fix | Delete
[497] Fix | Delete
return $current_value;
[498] Fix | Delete
}
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function