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/field
File: MaxWidth.php
<?php
[0] Fix | Delete
[1] Fix | Delete
class ET_Builder_Module_Field_MaxWidth extends ET_Builder_Module_Field_Base {
[2] Fix | Delete
[3] Fix | Delete
/**
[4] Fix | Delete
* Translations.
[5] Fix | Delete
*
[6] Fix | Delete
* @var array
[7] Fix | Delete
*/
[8] Fix | Delete
protected $i18n = array();
[9] Fix | Delete
[10] Fix | Delete
public function get_defaults() {
[11] Fix | Delete
return array(
[12] Fix | Delete
'prefix' => '',
[13] Fix | Delete
'use_width' => true,
[14] Fix | Delete
'use_max_width' => true,
[15] Fix | Delete
'use_module_alignment' => true,
[16] Fix | Delete
);
[17] Fix | Delete
}
[18] Fix | Delete
[19] Fix | Delete
public function get_fields( array $args = array() ) {
[20] Fix | Delete
$settings = array_merge( $this->get_defaults(), $args );
[21] Fix | Delete
[22] Fix | Delete
return array_merge(
[23] Fix | Delete
$this->width_fields( $settings ),
[24] Fix | Delete
$this->max_width_fields( $settings ),
[25] Fix | Delete
$this->alignment_fields( $settings )
[26] Fix | Delete
);
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
private function width_fields( $settings ) {
[30] Fix | Delete
if ( ! $settings['use_width'] ) {
[31] Fix | Delete
return array();
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
$i18n =& $this->i18n;
[35] Fix | Delete
[36] Fix | Delete
if ( ! isset( $i18n['width'] ) ) {
[37] Fix | Delete
// phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
[38] Fix | Delete
$i18n['width'] = array(
[39] Fix | Delete
'label' => __( 'Width', 'et_builder' ),
[40] Fix | Delete
'description' => __( 'By default, elements will extend the full width of their parent element. If you would like to set a custom static width, you can do so using this option.', 'et_builder' ),
[41] Fix | Delete
);
[42] Fix | Delete
// phpcs:enable
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
$alignment = new ET_Builder_Module_Helper_Alignment( $settings['prefix'] );
[46] Fix | Delete
$width = new ET_Builder_Module_Helper_Width( $settings['prefix'] );
[47] Fix | Delete
$field_name = $width->get_field();
[48] Fix | Delete
$field = array_merge(
[49] Fix | Delete
array(
[50] Fix | Delete
$field_name => array_merge(
[51] Fix | Delete
array(
[52] Fix | Delete
'label' => $i18n['width']['label'],
[53] Fix | Delete
'description' => $i18n['width']['description'],
[54] Fix | Delete
'default' => 'auto',
[55] Fix | Delete
'default_tablet' => 'auto',
[56] Fix | Delete
'allowed_values' => et_builder_get_acceptable_css_string_values( 'width' ),
[57] Fix | Delete
),
[58] Fix | Delete
$this->get_base_field()
[59] Fix | Delete
),
[60] Fix | Delete
),
[61] Fix | Delete
$this->responsive_fields( $field_name )
[62] Fix | Delete
);
[63] Fix | Delete
[64] Fix | Delete
if ( $settings['use_module_alignment'] ) {
[65] Fix | Delete
$field[ $field_name ]['responsive_affects'] = array( $alignment->get_field() );
[66] Fix | Delete
}
[67] Fix | Delete
[68] Fix | Delete
return $field;
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
private function max_width_fields( $settings ) {
[72] Fix | Delete
if ( ! $settings['use_max_width'] ) {
[73] Fix | Delete
return array();
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
$i18n =& $this->i18n;
[77] Fix | Delete
[78] Fix | Delete
if ( ! isset( $i18n['maxwidth'] ) ) {
[79] Fix | Delete
// phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
[80] Fix | Delete
$i18n['maxwidth'] = array(
[81] Fix | Delete
'label' => __( 'Max Width', 'et_builder' ),
[82] Fix | Delete
'description' => __( 'Setting a maximum width will prevent your element from ever surpassing the defined width value. Maximum width can be used in combination with the standard width setting. Maximum width supersedes the normal width value.', 'et_builder' ),
[83] Fix | Delete
);
[84] Fix | Delete
// phpcs:enable
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
$alignment = new ET_Builder_Module_Helper_Alignment( $settings['prefix'] );
[88] Fix | Delete
$max_width = new ET_Builder_Module_Helper_Max_Width( $settings['prefix'] );
[89] Fix | Delete
$field_name = $max_width->get_field();
[90] Fix | Delete
$field = array_merge(
[91] Fix | Delete
array(
[92] Fix | Delete
$field_name => array_merge(
[93] Fix | Delete
array(
[94] Fix | Delete
'label' => $i18n['maxwidth']['label'],
[95] Fix | Delete
'description' => $i18n['maxwidth']['description'],
[96] Fix | Delete
'default' => 'none',
[97] Fix | Delete
'default_tablet' => 'none',
[98] Fix | Delete
'allowed_values' => et_builder_get_acceptable_css_string_values( 'max-width' ),
[99] Fix | Delete
),
[100] Fix | Delete
$this->get_base_field()
[101] Fix | Delete
),
[102] Fix | Delete
),
[103] Fix | Delete
$this->responsive_fields( $field_name )
[104] Fix | Delete
);
[105] Fix | Delete
[106] Fix | Delete
if ( $settings['use_module_alignment'] ) {
[107] Fix | Delete
$field[ $field_name ]['responsive_affects'] = array( $alignment->get_field() );
[108] Fix | Delete
}
[109] Fix | Delete
[110] Fix | Delete
return $field;
[111] Fix | Delete
}
[112] Fix | Delete
[113] Fix | Delete
private function alignment_fields( $settings ) {
[114] Fix | Delete
if ( ! $settings['use_module_alignment'] ) {
[115] Fix | Delete
return array();
[116] Fix | Delete
}
[117] Fix | Delete
[118] Fix | Delete
$i18n =& $this->i18n;
[119] Fix | Delete
[120] Fix | Delete
if ( ! isset( $i18n['alignment'] ) ) {
[121] Fix | Delete
// phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
[122] Fix | Delete
$i18n['alignment'] = array(
[123] Fix | Delete
'label' => esc_html__( 'Module Alignment', 'et_builder' ),
[124] Fix | Delete
'description' => esc_html__( 'Align the module to the left, right or center.', 'et_builder' ),
[125] Fix | Delete
);
[126] Fix | Delete
// phpcs:enable
[127] Fix | Delete
}
[128] Fix | Delete
[129] Fix | Delete
$width = new ET_Builder_Module_Helper_Width( $settings['prefix'] );
[130] Fix | Delete
$max_width = new ET_Builder_Module_Helper_Max_Width( $settings['prefix'] );
[131] Fix | Delete
$alignment = new ET_Builder_Module_Helper_Alignment( $settings['prefix'] );
[132] Fix | Delete
$field_name = $alignment->get_field();
[133] Fix | Delete
$depends = array();
[134] Fix | Delete
$depends_responsive = array();
[135] Fix | Delete
$field = array(
[136] Fix | Delete
'label' => $i18n['alignment']['label'],
[137] Fix | Delete
'description' => $i18n['alignment']['description'],
[138] Fix | Delete
'type' => 'align',
[139] Fix | Delete
'option_category' => 'layout',
[140] Fix | Delete
'options' => et_builder_get_text_orientation_options( array( 'justified' ) ),
[141] Fix | Delete
'tab_slug' => 'advanced',
[142] Fix | Delete
'toggle_slug' => 'width',
[143] Fix | Delete
'mobile_options' => true,
[144] Fix | Delete
'show_if_not' => array(
[145] Fix | Delete
'positioning' => array( 'absolute', 'fixed' ),
[146] Fix | Delete
),
[147] Fix | Delete
);
[148] Fix | Delete
[149] Fix | Delete
if ( $settings['use_width'] ) {
[150] Fix | Delete
array_push( $depends, $width->get_field() );
[151] Fix | Delete
array_push( $depends_responsive, $width->get_field() );
[152] Fix | Delete
}
[153] Fix | Delete
[154] Fix | Delete
if ( $settings['use_max_width'] ) {
[155] Fix | Delete
array_push( $depends, $max_width->get_field() );
[156] Fix | Delete
array_push( $depends_responsive, $max_width->get_field() );
[157] Fix | Delete
}
[158] Fix | Delete
[159] Fix | Delete
if ( $settings['use_width'] || $settings['use_max_width'] ) {
[160] Fix | Delete
$field['depends_show_if_not'] = array( '', '100%', 'auto', 'none' );
[161] Fix | Delete
}
[162] Fix | Delete
[163] Fix | Delete
if ( ! empty( $depends ) ) {
[164] Fix | Delete
$field['depends_on'] = $depends;
[165] Fix | Delete
$field['depends_on_responsive'] = $depends_responsive;
[166] Fix | Delete
}
[167] Fix | Delete
[168] Fix | Delete
return array( $field_name => $field );
[169] Fix | Delete
}
[170] Fix | Delete
[171] Fix | Delete
private function get_base_field() {
[172] Fix | Delete
return array(
[173] Fix | Delete
'type' => 'range',
[174] Fix | Delete
'hover' => 'tabs',
[175] Fix | Delete
'default_on_child' => true,
[176] Fix | Delete
'mobile_options' => true,
[177] Fix | Delete
'validate_unit' => true,
[178] Fix | Delete
'default_unit' => '%',
[179] Fix | Delete
'allow_empty' => true,
[180] Fix | Delete
'tab_slug' => 'advanced',
[181] Fix | Delete
'toggle_slug' => 'width',
[182] Fix | Delete
'range_settings' => array(
[183] Fix | Delete
'min' => 0,
[184] Fix | Delete
'max' => 100,
[185] Fix | Delete
'step' => 1,
[186] Fix | Delete
),
[187] Fix | Delete
);
[188] Fix | Delete
}
[189] Fix | Delete
[190] Fix | Delete
private function responsive_fields( $field ) {
[191] Fix | Delete
return array(
[192] Fix | Delete
"{$field}_tablet" => array(
[193] Fix | Delete
'type' => 'skip',
[194] Fix | Delete
'tab_slug' => 'advanced',
[195] Fix | Delete
'toggle_slug' => 'width',
[196] Fix | Delete
),
[197] Fix | Delete
"{$field}_phone" => array(
[198] Fix | Delete
'type' => 'skip',
[199] Fix | Delete
'tab_slug' => 'advanced',
[200] Fix | Delete
'toggle_slug' => 'width',
[201] Fix | Delete
),
[202] Fix | Delete
"{$field}_last_edited" => array(
[203] Fix | Delete
'type' => 'skip',
[204] Fix | Delete
'tab_slug' => 'advanced',
[205] Fix | Delete
'toggle_slug' => 'width',
[206] Fix | Delete
),
[207] Fix | Delete
);
[208] Fix | Delete
}
[209] Fix | Delete
}
[210] Fix | Delete
[211] Fix | Delete
return new ET_Builder_Module_Field_MaxWidth();
[212] Fix | Delete
[213] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function