Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/includes/builder/module
File: Code.php
<?php
[0] Fix | Delete
[1] Fix | Delete
class ET_Builder_Module_Code extends ET_Builder_Module {
[2] Fix | Delete
function init() {
[3] Fix | Delete
$this->name = esc_html__( 'Code', 'et_builder' );
[4] Fix | Delete
$this->plural = esc_html__( 'Codes', 'et_builder' );
[5] Fix | Delete
$this->slug = 'et_pb_code';
[6] Fix | Delete
$this->vb_support = 'on';
[7] Fix | Delete
$this->use_raw_content = true;
[8] Fix | Delete
[9] Fix | Delete
$this->settings_modal_toggles = array(
[10] Fix | Delete
'general' => array(
[11] Fix | Delete
'toggles' => array(
[12] Fix | Delete
'main_content' => et_builder_i18n( 'Text' ),
[13] Fix | Delete
),
[14] Fix | Delete
),
[15] Fix | Delete
'advanced' => array(
[16] Fix | Delete
'toggles' => array(
[17] Fix | Delete
'width' => array(
[18] Fix | Delete
'title' => et_builder_i18n( 'Sizing' ),
[19] Fix | Delete
'priority' => 65,
[20] Fix | Delete
),
[21] Fix | Delete
),
[22] Fix | Delete
),
[23] Fix | Delete
);
[24] Fix | Delete
[25] Fix | Delete
$this->advanced_fields = array(
[26] Fix | Delete
'margin_padding' => array(
[27] Fix | Delete
'css' => array(
[28] Fix | Delete
'important' => array( 'custom_margin' ), // needed to overwrite last module margin-bottom styling
[29] Fix | Delete
),
[30] Fix | Delete
),
[31] Fix | Delete
'text_shadow' => array(
[32] Fix | Delete
// Don't add text-shadow fields since they already are via font-options
[33] Fix | Delete
'default' => false,
[34] Fix | Delete
),
[35] Fix | Delete
'fonts' => false,
[36] Fix | Delete
'button' => false,
[37] Fix | Delete
);
[38] Fix | Delete
[39] Fix | Delete
$this->help_videos = array(
[40] Fix | Delete
array(
[41] Fix | Delete
'id' => 'dTY6-Cbr00A',
[42] Fix | Delete
'name' => esc_html__( 'An introduction to the Code module', 'et_builder' ),
[43] Fix | Delete
),
[44] Fix | Delete
);
[45] Fix | Delete
[46] Fix | Delete
// wptexturize is often incorrectly parsed single and double quotes
[47] Fix | Delete
// This disables wptexturize on this module
[48] Fix | Delete
add_filter( 'no_texturize_shortcodes', array( $this, 'disable_wptexturize' ) );
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
function get_fields() {
[52] Fix | Delete
$fields = array(
[53] Fix | Delete
'raw_content' => array(
[54] Fix | Delete
'label' => esc_html__( 'Code', 'et_builder' ),
[55] Fix | Delete
'type' => 'codemirror',
[56] Fix | Delete
'mode' => 'html',
[57] Fix | Delete
'option_category' => 'basic_option',
[58] Fix | Delete
'description' => esc_html__( 'Here you can create the content that will be used within the module.', 'et_builder' ),
[59] Fix | Delete
'is_fb_content' => true,
[60] Fix | Delete
'toggle_slug' => 'main_content',
[61] Fix | Delete
'mobile_options' => true,
[62] Fix | Delete
'hover' => 'tabs',
[63] Fix | Delete
),
[64] Fix | Delete
);
[65] Fix | Delete
[66] Fix | Delete
return $fields;
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
/**
[70] Fix | Delete
* Renders the module output.
[71] Fix | Delete
*
[72] Fix | Delete
* @param array $attrs List of attributes.
[73] Fix | Delete
* @param string $content Content being processed.
[74] Fix | Delete
* @param string $render_slug Slug of module that is used for rendering output.
[75] Fix | Delete
*
[76] Fix | Delete
* @return string
[77] Fix | Delete
*/
[78] Fix | Delete
public function render( $attrs, $content, $render_slug ) {
[79] Fix | Delete
$multi_view = et_pb_multi_view_options( $this );
[80] Fix | Delete
$video_background = $this->video_background();
[81] Fix | Delete
$parallax_image_background = $this->get_parallax_image_background();
[82] Fix | Delete
[83] Fix | Delete
// Module classnames
[84] Fix | Delete
$this->add_classname( $this->get_text_orientation_classname() );
[85] Fix | Delete
[86] Fix | Delete
$raw_content = $multi_view->render_element(
[87] Fix | Delete
array(
[88] Fix | Delete
'tag' => 'div',
[89] Fix | Delete
'content' => '{{raw_content}}',
[90] Fix | Delete
'attrs' => array(
[91] Fix | Delete
'class' => 'et_pb_code_inner',
[92] Fix | Delete
),
[93] Fix | Delete
)
[94] Fix | Delete
);
[95] Fix | Delete
[96] Fix | Delete
$output = sprintf(
[97] Fix | Delete
'<div%2$s class="%3$s">
[98] Fix | Delete
%5$s
[99] Fix | Delete
%4$s
[100] Fix | Delete
%1$s
[101] Fix | Delete
</div> <!-- .et_pb_code -->',
[102] Fix | Delete
$raw_content,
[103] Fix | Delete
$this->module_id(),
[104] Fix | Delete
$this->module_classname( $render_slug ),
[105] Fix | Delete
$video_background,
[106] Fix | Delete
$parallax_image_background
[107] Fix | Delete
);
[108] Fix | Delete
[109] Fix | Delete
return $output;
[110] Fix | Delete
}
[111] Fix | Delete
[112] Fix | Delete
/**
[113] Fix | Delete
* Filter multi view value.
[114] Fix | Delete
*
[115] Fix | Delete
* @since 3.27.1
[116] Fix | Delete
*
[117] Fix | Delete
* @see ET_Builder_Module_Helper_MultiViewOptions::filter_value
[118] Fix | Delete
*
[119] Fix | Delete
* @param mixed $raw_value Props raw value.
[120] Fix | Delete
* @param array $args {
[121] Fix | Delete
* Context data.
[122] Fix | Delete
*
[123] Fix | Delete
* @type string $context Context param: content, attrs, visibility, classes.
[124] Fix | Delete
* @type string $name Module options props name.
[125] Fix | Delete
* @type string $mode Current data mode: desktop, hover, tablet, phone.
[126] Fix | Delete
* @type string $attr_key Attribute key for attrs context data. Example: src, class, etc.
[127] Fix | Delete
* @type string $attr_sub_key Attribute sub key that availabe when passing attrs value as array such as styes. Example: padding-top, margin-botton, etc.
[128] Fix | Delete
* }
[129] Fix | Delete
*
[130] Fix | Delete
* @return mixed
[131] Fix | Delete
*/
[132] Fix | Delete
public function multi_view_filter_value( $raw_value, $args ) {
[133] Fix | Delete
$name = isset( $args['name'] ) ? $args['name'] : '';
[134] Fix | Delete
$mode = isset( $args['mode'] ) ? $args['mode'] : 'desktop';
[135] Fix | Delete
[136] Fix | Delete
if ( $raw_value && 'raw_content' === $name ) {
[137] Fix | Delete
if ( 'desktop' !== $mode ) {
[138] Fix | Delete
$raw_value = et_builder_convert_line_breaks( et_builder_replace_code_content_entities( $raw_value ) );
[139] Fix | Delete
}
[140] Fix | Delete
[141] Fix | Delete
$raw_value = $this->fix_wptexturized_scripts( $raw_value );
[142] Fix | Delete
}
[143] Fix | Delete
[144] Fix | Delete
return $raw_value;
[145] Fix | Delete
}
[146] Fix | Delete
}
[147] Fix | Delete
[148] Fix | Delete
new ET_Builder_Module_Code();
[149] Fix | Delete
[150] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function