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: OptionsHarmony2.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Migration process to handle all the changes done in Options Harmony v2's QF.
[2] Fix | Delete
*
[3] Fix | Delete
* @since 3.23
[4] Fix | Delete
*/
[5] Fix | Delete
class ET_Builder_Module_Settings_Migration_OptionsHarmony2 extends ET_Builder_Module_Settings_Migration {
[6] Fix | Delete
[7] Fix | Delete
/**
[8] Fix | Delete
* Migration Version
[9] Fix | Delete
*
[10] Fix | Delete
* @since 3.23
[11] Fix | Delete
* @todo Should be replaced with the correct release version.
[12] Fix | Delete
*
[13] Fix | Delete
* @var string
[14] Fix | Delete
*/
[15] Fix | Delete
public $version = '3.23';
[16] Fix | Delete
[17] Fix | Delete
/**
[18] Fix | Delete
* Get all fields need to be migrated.
[19] Fix | Delete
*
[20] Fix | Delete
* Contains array with:
[21] Fix | Delete
* - key as new field
[22] Fix | Delete
* - value consists affected fields as old field and module location
[23] Fix | Delete
*
[24] Fix | Delete
* @since 3.23
[25] Fix | Delete
*
[26] Fix | Delete
* @return array New and old fields need to be migrated.
[27] Fix | Delete
*/
[28] Fix | Delete
public function get_fields() {
[29] Fix | Delete
return array(
[30] Fix | Delete
// Form Field BG Color.
[31] Fix | Delete
'form_field_background_color' => array(
[32] Fix | Delete
'affected_fields' => array(
[33] Fix | Delete
'form_background_color' => $this->get_modules( 'form_bg_color' ),
[34] Fix | Delete
'field_background_color' => $this->get_modules( 'field_bg_color' ),
[35] Fix | Delete
),
[36] Fix | Delete
),
[37] Fix | Delete
'form_field_background_color__hover_enabled' => array(
[38] Fix | Delete
'affected_fields' => array(
[39] Fix | Delete
'form_background_color__hover_enabled' => $this->get_modules( 'contact_form' ),
[40] Fix | Delete
'field_background_color__hover_enabled' => $this->get_modules( 'contact_form_field' ),
[41] Fix | Delete
),
[42] Fix | Delete
),
[43] Fix | Delete
'form_field_background_color__hover' => array(
[44] Fix | Delete
'affected_fields' => array(
[45] Fix | Delete
'form_background_color__hover' => $this->get_modules( 'contact_form' ),
[46] Fix | Delete
'field_background_color__hover' => $this->get_modules( 'contact_form_field' ),
[47] Fix | Delete
),
[48] Fix | Delete
),
[49] Fix | Delete
// Form Field Focus BG Color.
[50] Fix | Delete
'form_field_focus_background_color' => array(
[51] Fix | Delete
'affected_fields' => array(
[52] Fix | Delete
'focus_background_color' => $this->get_modules( 'focus_bg_color' ),
[53] Fix | Delete
),
[54] Fix | Delete
),
[55] Fix | Delete
'form_field_focus_background_color__hover_enabled' => array(
[56] Fix | Delete
'affected_fields' => array(
[57] Fix | Delete
'focus_background_color__hover_enabled' => $this->get_modules( 'login' ),
[58] Fix | Delete
),
[59] Fix | Delete
),
[60] Fix | Delete
'form_field_focus_background_color__hover' => array(
[61] Fix | Delete
'affected_fields' => array(
[62] Fix | Delete
'focus_background_color__hover' => $this->get_modules( 'login' ),
[63] Fix | Delete
),
[64] Fix | Delete
),
[65] Fix | Delete
// Form Field Focus Text Color.
[66] Fix | Delete
'form_field_focus_text_color' => array(
[67] Fix | Delete
'affected_fields' => array(
[68] Fix | Delete
'focus_text_color' => $this->get_modules( 'focus_bg_color' ),
[69] Fix | Delete
),
[70] Fix | Delete
),
[71] Fix | Delete
'form_field_focus_text_color__hover_enabled' => array(
[72] Fix | Delete
'affected_fields' => array(
[73] Fix | Delete
'focus_text_color__hover_enabled' => $this->get_modules( 'login' ),
[74] Fix | Delete
),
[75] Fix | Delete
),
[76] Fix | Delete
'form_field_focus_text_color__hover' => array(
[77] Fix | Delete
'affected_fields' => array(
[78] Fix | Delete
'focus_text_color__hover' => $this->get_modules( 'login' ),
[79] Fix | Delete
),
[80] Fix | Delete
),
[81] Fix | Delete
// Form Field Font.
[82] Fix | Delete
'form_field_text_color' => array(
[83] Fix | Delete
'affected_fields' => array(
[84] Fix | Delete
'input_text_color' => $this->get_modules( 'search' ),
[85] Fix | Delete
),
[86] Fix | Delete
),
[87] Fix | Delete
'form_field_text_color__hover_enabled' => array(
[88] Fix | Delete
'affected_fields' => array(
[89] Fix | Delete
'input_text_color__hover_enabled' => $this->get_modules( 'search' ),
[90] Fix | Delete
),
[91] Fix | Delete
),
[92] Fix | Delete
'form_field_text_color__hover' => array(
[93] Fix | Delete
'affected_fields' => array(
[94] Fix | Delete
'input_text_color__hover' => $this->get_modules( 'search' ),
[95] Fix | Delete
),
[96] Fix | Delete
),
[97] Fix | Delete
'form_field_font' => array(
[98] Fix | Delete
'affected_fields' => array(
[99] Fix | Delete
'input_font' => $this->get_modules( 'search' ),
[100] Fix | Delete
),
[101] Fix | Delete
),
[102] Fix | Delete
'form_field_text_align' => array(
[103] Fix | Delete
'affected_fields' => array(
[104] Fix | Delete
'input_text_align' => $this->get_modules( 'search' ),
[105] Fix | Delete
),
[106] Fix | Delete
),
[107] Fix | Delete
'form_field_font_size' => array(
[108] Fix | Delete
'affected_fields' => array(
[109] Fix | Delete
'input_font_size' => $this->get_modules( 'search' ),
[110] Fix | Delete
),
[111] Fix | Delete
),
[112] Fix | Delete
'form_field_font_size_last_edited' => array(
[113] Fix | Delete
'affected_fields' => array(
[114] Fix | Delete
'input_font_size_last_edited' => $this->get_modules( 'search' ),
[115] Fix | Delete
),
[116] Fix | Delete
),
[117] Fix | Delete
'form_field_font_size_tablet' => array(
[118] Fix | Delete
'affected_fields' => array(
[119] Fix | Delete
'input_font_size_tablet' => $this->get_modules( 'search' ),
[120] Fix | Delete
),
[121] Fix | Delete
),
[122] Fix | Delete
'form_field_font_size_phone' => array(
[123] Fix | Delete
'affected_fields' => array(
[124] Fix | Delete
'input_font_size_phone' => $this->get_modules( 'search' ),
[125] Fix | Delete
),
[126] Fix | Delete
),
[127] Fix | Delete
'form_field_font_size__hover_enabled' => array(
[128] Fix | Delete
'affected_fields' => array(
[129] Fix | Delete
'input_font_size__hover_enabled' => $this->get_modules( 'search' ),
[130] Fix | Delete
),
[131] Fix | Delete
),
[132] Fix | Delete
'form_field_font_size__hover' => array(
[133] Fix | Delete
'affected_fields' => array(
[134] Fix | Delete
'input_font_size__hover' => $this->get_modules( 'search' ),
[135] Fix | Delete
),
[136] Fix | Delete
),
[137] Fix | Delete
'form_field_letter_spacing' => array(
[138] Fix | Delete
'affected_fields' => array(
[139] Fix | Delete
'input_letter_spacing' => $this->get_modules( 'search' ),
[140] Fix | Delete
),
[141] Fix | Delete
),
[142] Fix | Delete
'form_field_letter_spacing_last_edited' => array(
[143] Fix | Delete
'affected_fields' => array(
[144] Fix | Delete
'input_letter_spacing_last_edited' => $this->get_modules( 'search' ),
[145] Fix | Delete
),
[146] Fix | Delete
),
[147] Fix | Delete
'form_field_letter_spacing_tablet' => array(
[148] Fix | Delete
'affected_fields' => array(
[149] Fix | Delete
'input_letter_spacing_tablet' => $this->get_modules( 'search' ),
[150] Fix | Delete
),
[151] Fix | Delete
),
[152] Fix | Delete
'form_field_letter_spacing_phone' => array(
[153] Fix | Delete
'affected_fields' => array(
[154] Fix | Delete
'input_letter_spacing_phone' => $this->get_modules( 'search' ),
[155] Fix | Delete
),
[156] Fix | Delete
),
[157] Fix | Delete
'form_field_letter_spacing__hover_enabled' => array(
[158] Fix | Delete
'affected_fields' => array(
[159] Fix | Delete
'input_letter_spacing__hover_enabled' => $this->get_modules( 'search' ),
[160] Fix | Delete
),
[161] Fix | Delete
),
[162] Fix | Delete
'form_field_letter_spacing__hover' => array(
[163] Fix | Delete
'affected_fields' => array(
[164] Fix | Delete
'input_letter_spacing__hover' => $this->get_modules( 'search' ),
[165] Fix | Delete
),
[166] Fix | Delete
),
[167] Fix | Delete
'form_field_line_height' => array(
[168] Fix | Delete
'affected_fields' => array(
[169] Fix | Delete
'input_line_height' => $this->get_modules( 'search' ),
[170] Fix | Delete
),
[171] Fix | Delete
),
[172] Fix | Delete
'form_field_line_height_last_edited' => array(
[173] Fix | Delete
'affected_fields' => array(
[174] Fix | Delete
'input_line_height_last_edited' => $this->get_modules( 'search' ),
[175] Fix | Delete
),
[176] Fix | Delete
),
[177] Fix | Delete
'form_field_line_height_tablet' => array(
[178] Fix | Delete
'affected_fields' => array(
[179] Fix | Delete
'input_line_height_tablet' => $this->get_modules( 'search' ),
[180] Fix | Delete
),
[181] Fix | Delete
),
[182] Fix | Delete
'form_field_line_height_phone' => array(
[183] Fix | Delete
'affected_fields' => array(
[184] Fix | Delete
'input_line_height_phone' => $this->get_modules( 'search' ),
[185] Fix | Delete
),
[186] Fix | Delete
),
[187] Fix | Delete
'form_field_line_height__hover_enabled' => array(
[188] Fix | Delete
'affected_fields' => array(
[189] Fix | Delete
'input_line_height__hover_enabled' => $this->get_modules( 'search' ),
[190] Fix | Delete
),
[191] Fix | Delete
),
[192] Fix | Delete
'form_field_line_height__hover' => array(
[193] Fix | Delete
'affected_fields' => array(
[194] Fix | Delete
'input_line_height__hover' => $this->get_modules( 'search' ),
[195] Fix | Delete
),
[196] Fix | Delete
),
[197] Fix | Delete
// Form Field Text Shadow.
[198] Fix | Delete
'form_field_text_shadow_horizontal_length' => array(
[199] Fix | Delete
'affected_fields' => array(
[200] Fix | Delete
'fields_text_shadow_horizontal_length' => $this->get_modules( 'text_shadow' ),
[201] Fix | Delete
'input_text_shadow_horizontal_length' => $this->get_modules( 'search' ),
[202] Fix | Delete
),
[203] Fix | Delete
),
[204] Fix | Delete
'form_field_text_shadow_horizontal_length__hover_enabled' => array(
[205] Fix | Delete
'affected_fields' => array(
[206] Fix | Delete
'fields_text_shadow_horizontal_length__hover_enabled' => $this->get_modules( 'text_shadow' ),
[207] Fix | Delete
'input_text_shadow_horizontal_length__hover_enabled' => $this->get_modules( 'search' ),
[208] Fix | Delete
),
[209] Fix | Delete
),
[210] Fix | Delete
'form_field_text_shadow_horizontal_length__hover' => array(
[211] Fix | Delete
'affected_fields' => array(
[212] Fix | Delete
'fields_text_shadow_horizontal_length__hover' => $this->get_modules( 'text_shadow' ),
[213] Fix | Delete
'input_text_shadow_horizontal_length__hover' => $this->get_modules( 'search' ),
[214] Fix | Delete
),
[215] Fix | Delete
),
[216] Fix | Delete
'form_field_text_shadow_vertical_length' => array(
[217] Fix | Delete
'affected_fields' => array(
[218] Fix | Delete
'fields_text_shadow_vertical_length' => $this->get_modules( 'text_shadow' ),
[219] Fix | Delete
'input_text_shadow_vertical_length' => $this->get_modules( 'search' ),
[220] Fix | Delete
),
[221] Fix | Delete
),
[222] Fix | Delete
'form_field_text_shadow_vertical_length__hover_enabled' => array(
[223] Fix | Delete
'affected_fields' => array(
[224] Fix | Delete
'fields_text_shadow_vertical_length__hover_enabled' => $this->get_modules( 'text_shadow' ),
[225] Fix | Delete
'input_text_shadow_vertical_length__hover_enabled' => $this->get_modules( 'search' ),
[226] Fix | Delete
),
[227] Fix | Delete
),
[228] Fix | Delete
'form_field_text_shadow_vertical_length__hover' => array(
[229] Fix | Delete
'affected_fields' => array(
[230] Fix | Delete
'fields_text_shadow_vertical_length__hover' => $this->get_modules( 'text_shadow' ),
[231] Fix | Delete
'input_text_shadow_vertical_length__hover' => $this->get_modules( 'search' ),
[232] Fix | Delete
),
[233] Fix | Delete
),
[234] Fix | Delete
'form_field_text_shadow_blur_strength' => array(
[235] Fix | Delete
'affected_fields' => array(
[236] Fix | Delete
'fields_text_shadow_blur_strength' => $this->get_modules( 'text_shadow' ),
[237] Fix | Delete
'input_text_shadow_blur_strength' => $this->get_modules( 'search' ),
[238] Fix | Delete
),
[239] Fix | Delete
),
[240] Fix | Delete
'form_field_text_shadow_blur_strength__hover_enabled' => array(
[241] Fix | Delete
'affected_fields' => array(
[242] Fix | Delete
'fields_text_shadow_blur_strength__hover_enabled' => $this->get_modules( 'text_shadow' ),
[243] Fix | Delete
'input_text_shadow_blur_strength__hover_enabled' => $this->get_modules( 'search' ),
[244] Fix | Delete
),
[245] Fix | Delete
),
[246] Fix | Delete
'form_field_text_shadow_blur_strength__hover' => array(
[247] Fix | Delete
'affected_fields' => array(
[248] Fix | Delete
'fields_text_shadow_blur_strength__hover' => $this->get_modules( 'text_shadow' ),
[249] Fix | Delete
'input_text_shadow_blur_strength__hover' => $this->get_modules( 'search' ),
[250] Fix | Delete
),
[251] Fix | Delete
),
[252] Fix | Delete
'form_field_text_shadow_color' => array(
[253] Fix | Delete
'affected_fields' => array(
[254] Fix | Delete
'fields_text_shadow_color' => $this->get_modules( 'text_shadow' ),
[255] Fix | Delete
'input_text_shadow_color' => $this->get_modules( 'search' ),
[256] Fix | Delete
),
[257] Fix | Delete
),
[258] Fix | Delete
'form_field_text_shadow_color__hover_enabled' => array(
[259] Fix | Delete
'affected_fields' => array(
[260] Fix | Delete
'fields_text_shadow_color__hover_enabled' => $this->get_modules( 'text_shadow' ),
[261] Fix | Delete
'input_text_shadow_color__hover_enabled' => $this->get_modules( 'search' ),
[262] Fix | Delete
),
[263] Fix | Delete
),
[264] Fix | Delete
'form_field_text_shadow_color__hover' => array(
[265] Fix | Delete
'affected_fields' => array(
[266] Fix | Delete
'fields_text_shadow_color__hover' => $this->get_modules( 'text_shadow' ),
[267] Fix | Delete
'input_text_shadow_color__hover' => $this->get_modules( 'search' ),
[268] Fix | Delete
),
[269] Fix | Delete
),
[270] Fix | Delete
'form_field_text_shadow_style' => array(
[271] Fix | Delete
'affected_fields' => array(
[272] Fix | Delete
'fields_text_shadow_style' => $this->get_modules( 'text_shadow' ),
[273] Fix | Delete
'input_text_shadow_style' => $this->get_modules( 'search' ),
[274] Fix | Delete
),
[275] Fix | Delete
),
[276] Fix | Delete
// Image.
[277] Fix | Delete
'align_last_edited' => array(
[278] Fix | Delete
'affected_fields' => array(
[279] Fix | Delete
'always_center_on_mobile' => $this->get_modules( 'image' ),
[280] Fix | Delete
),
[281] Fix | Delete
),
[282] Fix | Delete
'align_tablet' => array(
[283] Fix | Delete
'affected_fields' => array(
[284] Fix | Delete
'always_center_on_mobile' => $this->get_modules( 'image' ),
[285] Fix | Delete
),
[286] Fix | Delete
),
[287] Fix | Delete
// Price Excluded Color.
[288] Fix | Delete
'excluded_text_color' => array(
[289] Fix | Delete
'affected_fields' => array(
[290] Fix | Delete
'pricing_item_excluded_color' => $this->get_modules( 'pricing_table' ),
[291] Fix | Delete
),
[292] Fix | Delete
),
[293] Fix | Delete
'excluded_text_color__hover_enabled' => array(
[294] Fix | Delete
'affected_fields' => array(
[295] Fix | Delete
'pricing_item_excluded_color__hover_enabled' => $this->get_modules( 'pricing_table' ),
[296] Fix | Delete
),
[297] Fix | Delete
),
[298] Fix | Delete
'excluded_text_color__hover' => array(
[299] Fix | Delete
'affected_fields' => array(
[300] Fix | Delete
'pricing_item_excluded_color__hover' => $this->get_modules( 'pricing_table' ),
[301] Fix | Delete
),
[302] Fix | Delete
),
[303] Fix | Delete
// Price Excluded Color.
[304] Fix | Delete
'body_text_align' => array(
[305] Fix | Delete
'affected_fields' => array(
[306] Fix | Delete
'center_list_items' => $this->get_modules( 'pricing_tables' ),
[307] Fix | Delete
),
[308] Fix | Delete
),
[309] Fix | Delete
);
[310] Fix | Delete
}
[311] Fix | Delete
[312] Fix | Delete
/**
[313] Fix | Delete
* Get all modules affected.
[314] Fix | Delete
*
[315] Fix | Delete
* Pass attribute and it will return selected modules only. Default return all affected modules.
[316] Fix | Delete
*
[317] Fix | Delete
* @since 3.23
[318] Fix | Delete
*
[319] Fix | Delete
* @param string $attr Attribute name.
[320] Fix | Delete
*
[321] Fix | Delete
* @return [type] [description]
[322] Fix | Delete
*/
[323] Fix | Delete
public function get_modules( $attr = '' ) {
[324] Fix | Delete
$modules = array();
[325] Fix | Delete
[326] Fix | Delete
// Comments.
[327] Fix | Delete
if ( in_array( $attr, array( '', 'comments' ) ) ) {
[328] Fix | Delete
$modules[] = 'et_pb_comments';
[329] Fix | Delete
}
[330] Fix | Delete
[331] Fix | Delete
// Contact Form.
[332] Fix | Delete
if ( in_array( $attr, array( '', 'contact_form' ) ) ) {
[333] Fix | Delete
$modules[] = 'et_pb_contact_form';
[334] Fix | Delete
}
[335] Fix | Delete
[336] Fix | Delete
// Contact Form Field.
[337] Fix | Delete
if ( in_array( $attr, array( '', 'contact_form_field' ) ) ) {
[338] Fix | Delete
$modules[] = 'et_pb_contact_field';
[339] Fix | Delete
}
[340] Fix | Delete
[341] Fix | Delete
// Email Optin.
[342] Fix | Delete
if ( in_array( $attr, array( '', 'email_optin' ) ) ) {
[343] Fix | Delete
$modules[] = 'et_pb_signup';
[344] Fix | Delete
}
[345] Fix | Delete
[346] Fix | Delete
// Email Optin Custom Field.
[347] Fix | Delete
if ( in_array( $attr, array( '', 'email_optin_field' ) ) ) {
[348] Fix | Delete
$modules[] = 'et_pb_signup_custom_field';
[349] Fix | Delete
}
[350] Fix | Delete
[351] Fix | Delete
// Image.
[352] Fix | Delete
if ( in_array( $attr, array( '', 'image' ) ) ) {
[353] Fix | Delete
$modules[] = 'et_pb_image';
[354] Fix | Delete
}
[355] Fix | Delete
[356] Fix | Delete
// Login.
[357] Fix | Delete
if ( in_array( $attr, array( '', 'login' ) ) ) {
[358] Fix | Delete
$modules[] = 'et_pb_login';
[359] Fix | Delete
}
[360] Fix | Delete
[361] Fix | Delete
// Search.
[362] Fix | Delete
if ( in_array( $attr, array( '', 'search' ) ) ) {
[363] Fix | Delete
$modules[] = 'et_pb_search';
[364] Fix | Delete
}
[365] Fix | Delete
[366] Fix | Delete
// Pricing Table.
[367] Fix | Delete
if ( in_array( $attr, array( '', 'pricing_tables' ) ) ) {
[368] Fix | Delete
$modules[] = 'et_pb_pricing_tables';
[369] Fix | Delete
}
[370] Fix | Delete
[371] Fix | Delete
if ( in_array( $attr, array( '', 'pricing_table' ) ) ) {
[372] Fix | Delete
$modules[] = 'et_pb_pricing_table';
[373] Fix | Delete
}
[374] Fix | Delete
[375] Fix | Delete
// Form BG Color options group.
[376] Fix | Delete
if ( 'form_bg_color' === $attr ) {
[377] Fix | Delete
$modules[] = 'et_pb_comments';
[378] Fix | Delete
$modules[] = 'et_pb_contact_form';
[379] Fix | Delete
}
[380] Fix | Delete
[381] Fix | Delete
// Form BG Color options group.
[382] Fix | Delete
if ( 'field_bg_color' === $attr ) {
[383] Fix | Delete
$modules[] = 'et_pb_signup_custom_field';
[384] Fix | Delete
$modules[] = 'et_pb_contact_field';
[385] Fix | Delete
}
[386] Fix | Delete
[387] Fix | Delete
// Form BG Color options group.
[388] Fix | Delete
if ( in_array( $attr, array( 'focus_bg_color', 'text_shadow' ) ) ) {
[389] Fix | Delete
$modules[] = 'et_pb_signup';
[390] Fix | Delete
$modules[] = 'et_pb_login';
[391] Fix | Delete
}
[392] Fix | Delete
[393] Fix | Delete
return $modules;
[394] Fix | Delete
}
[395] Fix | Delete
[396] Fix | Delete
public function migrate( $field_name, $current_value, $module_slug, $saved_value, $saved_field_name, $attrs, $content, $module_address ) {
[397] Fix | Delete
[398] Fix | Delete
// Migrate Email Optin fields text shadow. There is a conflict on Fields & Email Optin. There
[399] Fix | Delete
// are two different Text Shadow settings. The first one under Fields settings, the second one
[400] Fix | Delete
// under Field Text. In the process, the second one has higher priority than the first one. And
[401] Fix | Delete
// it has the same prefix with current form field. So, we need to check if saved value (2nd) is
[402] Fix | Delete
// exist and not empty, return it and no need to migrate.
[403] Fix | Delete
if ( 'et_pb_signup' === $module_slug ) {
[404] Fix | Delete
$text_shadow_property_name = $this->get_form_field_text_shadow( $field_name );
[405] Fix | Delete
if ( '' !== $text_shadow_property_name ) {
[406] Fix | Delete
// If form_field_text_shadow_style value is not 'none', we need to return current saved
[407] Fix | Delete
// value or 2nd text shadow settings value (Field Text).
[408] Fix | Delete
$form_field_text_shadow_style = isset( $attrs['form_field_text_shadow_style'] ) ? $attrs['form_field_text_shadow_style'] : '';
[409] Fix | Delete
if ( '' !== $form_field_text_shadow_style && 'none' !== $form_field_text_shadow_style ) {
[410] Fix | Delete
return $saved_value;
[411] Fix | Delete
}
[412] Fix | Delete
[413] Fix | Delete
return $current_value;
[414] Fix | Delete
}
[415] Fix | Delete
}
[416] Fix | Delete
[417] Fix | Delete
// Migrate Always Center Image on Mobile field as Image Alignment. If current value is
[418] Fix | Delete
// 'off', there is nothing we need to do here. But, if it's 'on', we need to set value
[419] Fix | Delete
// for align_tablet and align_last_edited.
[420] Fix | Delete
if ( 'et_pb_image' === $module_slug ) {
[421] Fix | Delete
if ( 'align_last_edited' === $field_name && 'off' !== $current_value ) {
[422] Fix | Delete
// If always_center_on_mobile is on (the current value is ''), we need to set last
[423] Fix | Delete
// edited value as 'on|desktop'.
[424] Fix | Delete
return 'on|desktop';
[425] Fix | Delete
} elseif ( 'align_tablet' === $field_name && 'off' !== $current_value ) {
[426] Fix | Delete
// If always_center_on_mobile is on (the current value is ''), we need to set align
[427] Fix | Delete
// tablet value as center.
[428] Fix | Delete
return 'center';
[429] Fix | Delete
}
[430] Fix | Delete
[431] Fix | Delete
return $saved_value;
[432] Fix | Delete
}
[433] Fix | Delete
[434] Fix | Delete
// Migrate Center List Items as Body Tetx Alignment. If current value is 'off', there is
[435] Fix | Delete
// nothing we need to do here. But, if it's 'on', we need to set value for body_text_align
[436] Fix | Delete
// as 'center'.
[437] Fix | Delete
if ( 'et_pb_pricing_tables' === $module_slug ) {
[438] Fix | Delete
if ( 'body_text_align' === $field_name && 'on' === $current_value && empty( $saved_value ) ) {
[439] Fix | Delete
// If center_list_items is on (the current value is 'on'), we need to set body text
[440] Fix | Delete
// align value as 'center'. However, only do this if current $saved_value is empty
[441] Fix | Delete
// because body_text_align has higher priority than center_list_items.
[442] Fix | Delete
return 'center';
[443] Fix | Delete
}
[444] Fix | Delete
[445] Fix | Delete
return $saved_value;
[446] Fix | Delete
}
[447] Fix | Delete
[448] Fix | Delete
// Don't migrate empty value.
[449] Fix | Delete
if ( ! empty( $current_value ) ) {
[450] Fix | Delete
return $current_value;
[451] Fix | Delete
}
[452] Fix | Delete
[453] Fix | Delete
return $saved_value;
[454] Fix | Delete
}
[455] Fix | Delete
[456] Fix | Delete
/**
[457] Fix | Delete
* Text shadow properties need to be migrated.
[458] Fix | Delete
*
[459] Fix | Delete
* It's only used to check if current text shadow property is the correct field to migrate.
[460] Fix | Delete
*
[461] Fix | Delete
* @since 3.23
[462] Fix | Delete
*
[463] Fix | Delete
* @param string $field_name New field name.
[464] Fix | Delete
* @return string Old field name.
[465] Fix | Delete
*/
[466] Fix | Delete
public function get_form_field_text_shadow( $field_name = '' ) {
[467] Fix | Delete
$text_shadow_properties = array(
[468] Fix | Delete
'form_field_text_shadow_style' => 'fields_text_shadow_style',
[469] Fix | Delete
'form_field_text_shadow_horizontal_length' => 'fields_text_shadow_horizontal_length',
[470] Fix | Delete
'form_field_text_shadow_horizontal_length__hover_enabled' => 'fields_text_shadow_horizontal_length__hover_enabled',
[471] Fix | Delete
'form_field_text_shadow_horizontal_length__hover' => 'fields_text_shadow_horizontal_length__hover',
[472] Fix | Delete
'form_field_text_shadow_vertical_length' => 'fields_text_shadow_vertical_length',
[473] Fix | Delete
'form_field_text_shadow_vertical_length__hover_enabled' => 'fields_text_shadow_vertical_length__hover_enabled',
[474] Fix | Delete
'form_field_text_shadow_vertical_length__hover' => 'fields_text_shadow_vertical_length__hover',
[475] Fix | Delete
'form_field_text_shadow_blur_strength' => 'fields_text_shadow_blur_strength',
[476] Fix | Delete
'form_field_text_shadow_blur_strength__hover' => 'fields_text_shadow_blur_strength__hover',
[477] Fix | Delete
'form_field_text_shadow_blur_strength__hover_enabled' => 'fields_text_shadow_blur_strength__hover_enabled',
[478] Fix | Delete
'form_field_text_shadow_color' => 'fields_text_shadow_color',
[479] Fix | Delete
'form_field_text_shadow_color__hover_enabled' => 'fields_text_shadow_color__hover_enabled',
[480] Fix | Delete
'form_field_text_shadow_color__hover' => 'fields_text_shadow_color__hover',
[481] Fix | Delete
);
[482] Fix | Delete
[483] Fix | Delete
return isset( $text_shadow_properties[ $field_name ] ) ? $text_shadow_properties[ $field_name ] : '';
[484] Fix | Delete
}
[485] Fix | Delete
}
[486] Fix | Delete
[487] Fix | Delete
return new ET_Builder_Module_Settings_Migration_OptionsHarmony2();
[488] Fix | Delete
[489] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function