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: RowCustomWidthToSizing.php
<?php
[0] Fix | Delete
[1] Fix | Delete
class ET_Builder_Module_Settings_Migration_RowCustomWidthToSizing extends ET_Builder_Module_Settings_Migration {
[2] Fix | Delete
[3] Fix | Delete
public $version = '3.22';
[4] Fix | Delete
[5] Fix | Delete
public function get_modules() {
[6] Fix | Delete
return array( 'et_pb_row', 'et_pb_section', );
[7] Fix | Delete
}
[8] Fix | Delete
[9] Fix | Delete
public function get_fields() {
[10] Fix | Delete
$fields = array(
[11] Fix | Delete
'module_class' => array(
[12] Fix | Delete
'affected_fields' => array(
[13] Fix | Delete
'make_fullwidth' => $this->get_modules(),
[14] Fix | Delete
),
[15] Fix | Delete
)
[16] Fix | Delete
);
[17] Fix | Delete
[18] Fix | Delete
foreach ( $this->get_modules() as $module ) {
[19] Fix | Delete
foreach ( $this->get_keys() as $key ) {
[20] Fix | Delete
$field = $module === 'et_pb_section' ? "inner_$key" : $key;
[21] Fix | Delete
$fields[ $field ] = array(
[22] Fix | Delete
'affected_fields' => array(
[23] Fix | Delete
'make_fullwidth' => array( $module ),
[24] Fix | Delete
'use_custom_width' => array( $module ),
[25] Fix | Delete
'width_unit' => array( $module ),
[26] Fix | Delete
'custom_width_px' => array( $module ),
[27] Fix | Delete
'custom_width_px__hover' => array( $module ),
[28] Fix | Delete
'custom_width_px__hover_enabled' => array( $module ),
[29] Fix | Delete
'custom_width_percent' => array( $module ),
[30] Fix | Delete
'custom_width_percent__hover' => array( $module ),
[31] Fix | Delete
'custom_width_percent__hover_enabled' => array( $module ),
[32] Fix | Delete
),
[33] Fix | Delete
);
[34] Fix | Delete
}
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
return $fields;
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
public function migrate(
[41] Fix | Delete
$field_name,
[42] Fix | Delete
$current_value,
[43] Fix | Delete
$module_slug,
[44] Fix | Delete
$saved_value,
[45] Fix | Delete
$saved_field_name,
[46] Fix | Delete
$attrs,
[47] Fix | Delete
$content,
[48] Fix | Delete
$module_address
[49] Fix | Delete
) {
[50] Fix | Delete
$raw_field = str_replace( 'inner_', '', $field_name );
[51] Fix | Delete
[52] Fix | Delete
if ( et_builder_module_prop( 'use_custom_width', $attrs, '' ) === 'on' ) {
[53] Fix | Delete
$percent = et_builder_module_prop( 'width_unit', $attrs, '' ) === 'off';
[54] Fix | Delete
$field = $percent ? 'custom_width_percent' : 'custom_width_px';
[55] Fix | Delete
[56] Fix | Delete
switch ( $raw_field ) {
[57] Fix | Delete
// If the field is set to % only the max-width is defined
[58] Fix | Delete
case 'width':
[59] Fix | Delete
return ! $percent ? $saved_value : et_builder_module_prop( $field, $attrs, '' );
[60] Fix | Delete
case 'width__hover':
[61] Fix | Delete
return ! $percent ? $saved_value : et_builder_module_prop( "{$field}__hover", $attrs, '' );
[62] Fix | Delete
case 'width__hover_enabled':
[63] Fix | Delete
return ! $percent ? $saved_value : et_builder_module_prop( "{$field}__hover_enabled", $attrs, '' );
[64] Fix | Delete
[65] Fix | Delete
case 'max_width':
[66] Fix | Delete
return et_builder_module_prop( $field, $attrs, $percent ? '80%' : '' );
[67] Fix | Delete
case 'max_width__hover':
[68] Fix | Delete
return et_builder_module_prop( "{$field}__hover", $attrs, '' );
[69] Fix | Delete
case 'max_width__hover_enabled':
[70] Fix | Delete
return et_builder_module_prop( "{$field}__hover_enabled", $attrs, '' );
[71] Fix | Delete
default:
[72] Fix | Delete
return $saved_value;
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
}
[76] Fix | Delete
[77] Fix | Delete
if ( et_builder_module_prop( 'make_fullwidth', $attrs, '' ) === 'on' ) {
[78] Fix | Delete
$gutter = (int) et_builder_module_prop( 'gutter_width', $attrs, '' );
[79] Fix | Delete
[80] Fix | Delete
switch ( $raw_field ) {
[81] Fix | Delete
case 'module_class':
[82] Fix | Delete
return $saved_value . ' ' . $this->class_name( $module_slug );
[83] Fix | Delete
case 'width_last_edited':
[84] Fix | Delete
case 'max_width_last_edited':
[85] Fix | Delete
return 'on|desktop';
[86] Fix | Delete
case 'width_tablet':
[87] Fix | Delete
case 'max_width_tablet':
[88] Fix | Delete
return 1 === $gutter ? '100%' : '80%';
[89] Fix | Delete
case 'width':
[90] Fix | Delete
case 'max_width':
[91] Fix | Delete
return $this->get_width( $gutter );
[92] Fix | Delete
}
[93] Fix | Delete
[94] Fix | Delete
if ( et_builder_module_prop( 'gutter_width__hover_enabled', $attrs, '' ) === 'on' ) {
[95] Fix | Delete
$gutter = (int) et_builder_module_prop( 'gutter_width__hover', $attrs, '' );
[96] Fix | Delete
[97] Fix | Delete
switch ( $raw_field ) {
[98] Fix | Delete
case 'width__hover_enabled':
[99] Fix | Delete
case 'max_width__hover_enabled':
[100] Fix | Delete
return 'on';
[101] Fix | Delete
case 'width__hover':
[102] Fix | Delete
case 'max_width__hover':
[103] Fix | Delete
return $this->get_width( $gutter );
[104] Fix | Delete
}
[105] Fix | Delete
}
[106] Fix | Delete
}
[107] Fix | Delete
[108] Fix | Delete
return $saved_value;
[109] Fix | Delete
}
[110] Fix | Delete
[111] Fix | Delete
private function get_keys() {
[112] Fix | Delete
return array_merge( $this->to_fields( 'width' ), $this->to_fields( 'max_width' ) );
[113] Fix | Delete
}
[114] Fix | Delete
[115] Fix | Delete
private function to_fields( $field ) {
[116] Fix | Delete
return array(
[117] Fix | Delete
$field,
[118] Fix | Delete
"{$field}_tablet",
[119] Fix | Delete
"{$field}_phone",
[120] Fix | Delete
"{$field}_last_edited",
[121] Fix | Delete
"{$field}__hover",
[122] Fix | Delete
"{$field}__hover_enabled",
[123] Fix | Delete
);
[124] Fix | Delete
}
[125] Fix | Delete
[126] Fix | Delete
private function get_width( $gutter ) {
[127] Fix | Delete
switch ( $gutter ) {
[128] Fix | Delete
case 1:
[129] Fix | Delete
return '100%';
[130] Fix | Delete
case 2:
[131] Fix | Delete
return '94%';
[132] Fix | Delete
case 3:
[133] Fix | Delete
return '89%';
[134] Fix | Delete
case 4:
[135] Fix | Delete
return '86%';
[136] Fix | Delete
default:
[137] Fix | Delete
return '89%';
[138] Fix | Delete
}
[139] Fix | Delete
}
[140] Fix | Delete
[141] Fix | Delete
private function class_name( $module ) {
[142] Fix | Delete
switch ( $module ) {
[143] Fix | Delete
case 'et_pb_row' :
[144] Fix | Delete
return 'et_pb_row_fullwidth';
[145] Fix | Delete
case 'et_pb_section' :
[146] Fix | Delete
return 'et_pb_specialty_fullwidth';
[147] Fix | Delete
default :
[148] Fix | Delete
return '';
[149] Fix | Delete
}
[150] Fix | Delete
}
[151] Fix | Delete
}
[152] Fix | Delete
[153] Fix | Delete
return new ET_Builder_Module_Settings_Migration_RowCustomWidthToSizing();
[154] Fix | Delete
[155] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function