Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/includes/builder/module
File: Comments.php
<?php
[0] Fix | Delete
[1] Fix | Delete
class ET_Builder_Module_Comments extends ET_Builder_Module {
[2] Fix | Delete
function init() {
[3] Fix | Delete
$this->name = esc_html__( 'Comments', 'et_builder' );
[4] Fix | Delete
$this->plural = esc_html__( 'Comments', 'et_builder' );
[5] Fix | Delete
$this->slug = 'et_pb_comments';
[6] Fix | Delete
$this->vb_support = 'on';
[7] Fix | Delete
[8] Fix | Delete
$this->main_css_element = '%%order_class%%';
[9] Fix | Delete
[10] Fix | Delete
$this->settings_modal_toggles = array(
[11] Fix | Delete
'general' => array(
[12] Fix | Delete
'toggles' => array(
[13] Fix | Delete
'elements' => et_builder_i18n( 'Elements' ),
[14] Fix | Delete
),
[15] Fix | Delete
),
[16] Fix | Delete
'advanced' => array(
[17] Fix | Delete
'toggles' => array(
[18] Fix | Delete
'image' => array(
[19] Fix | Delete
'title' => et_builder_i18n( 'Image' ),
[20] Fix | Delete
'priority' => 30,
[21] Fix | Delete
),
[22] Fix | Delete
'text' => array(
[23] Fix | Delete
'title' => et_builder_i18n( 'Text' ),
[24] Fix | Delete
'priority' => 49,
[25] Fix | Delete
),
[26] Fix | Delete
),
[27] Fix | Delete
),
[28] Fix | Delete
);
[29] Fix | Delete
[30] Fix | Delete
$this->advanced_fields = array(
[31] Fix | Delete
'box_shadow' => array(
[32] Fix | Delete
'default' => array(),
[33] Fix | Delete
'image' => array(
[34] Fix | Delete
'label' => esc_html__( 'Image Box Shadow', 'et_builder' ),
[35] Fix | Delete
'option_category' => 'layout',
[36] Fix | Delete
'tab_slug' => 'advanced',
[37] Fix | Delete
'toggle_slug' => 'image',
[38] Fix | Delete
'css' => array(
[39] Fix | Delete
'main' => "{$this->main_css_element} .commentlist img.avatar",
[40] Fix | Delete
),
[41] Fix | Delete
),
[42] Fix | Delete
),
[43] Fix | Delete
'borders' => array(
[44] Fix | Delete
'default' => array(
[45] Fix | Delete
'css' => array(
[46] Fix | Delete
'main' => array(
[47] Fix | Delete
'border_radii' => "{$this->main_css_element}",
[48] Fix | Delete
'border_styles' => "{$this->main_css_element}",
[49] Fix | Delete
),
[50] Fix | Delete
'important' => 'all',
[51] Fix | Delete
),
[52] Fix | Delete
),
[53] Fix | Delete
'image' => array(
[54] Fix | Delete
'css' => array(
[55] Fix | Delete
'main' => array(
[56] Fix | Delete
'border_radii' => '%%order_class%%.et_pb_comments_module .commentlist li img.avatar',
[57] Fix | Delete
'border_styles' => '%%order_class%%.et_pb_comments_module .commentlist li img.avatar',
[58] Fix | Delete
),
[59] Fix | Delete
),
[60] Fix | Delete
'label_prefix' => et_builder_i18n( 'Image' ),
[61] Fix | Delete
'tab_slug' => 'advanced',
[62] Fix | Delete
'toggle_slug' => 'image',
[63] Fix | Delete
),
[64] Fix | Delete
),
[65] Fix | Delete
'margin_padding' => array(
[66] Fix | Delete
'css' => array(
[67] Fix | Delete
'important' => 'all',
[68] Fix | Delete
),
[69] Fix | Delete
),
[70] Fix | Delete
'fonts' => array(
[71] Fix | Delete
'header' => array(
[72] Fix | Delete
'label' => esc_html__( 'Comment Count', 'et_builder' ),
[73] Fix | Delete
'css' => array(
[74] Fix | Delete
'main' => "{$this->main_css_element} h1.page_title, {$this->main_css_element} h2.page_title, {$this->main_css_element} h3.page_title, {$this->main_css_element} h4.page_title, {$this->main_css_element} h5.page_title, {$this->main_css_element} h6.page_title",
[75] Fix | Delete
),
[76] Fix | Delete
'header_level' => array(
[77] Fix | Delete
'default' => 'h1',
[78] Fix | Delete
),
[79] Fix | Delete
),
[80] Fix | Delete
'title' => array(
[81] Fix | Delete
'label' => esc_html__( 'Form Title', 'et_builder' ),
[82] Fix | Delete
'css' => array(
[83] Fix | Delete
'main' => "{$this->main_css_element} .comment-reply-title",
[84] Fix | Delete
),
[85] Fix | Delete
'line_height' => array(
[86] Fix | Delete
'default' => '1em',
[87] Fix | Delete
),
[88] Fix | Delete
'font_size' => array(
[89] Fix | Delete
'default' => '22px',
[90] Fix | Delete
),
[91] Fix | Delete
'letter_spacing' => array(
[92] Fix | Delete
'default' => '0px',
[93] Fix | Delete
),
[94] Fix | Delete
'header_level' => array(
[95] Fix | Delete
'default' => 'h3',
[96] Fix | Delete
),
[97] Fix | Delete
),
[98] Fix | Delete
'meta' => array(
[99] Fix | Delete
'label' => esc_html__( 'Meta', 'et_builder' ),
[100] Fix | Delete
'css' => array(
[101] Fix | Delete
'main' => "{$this->main_css_element} .comment_postinfo span",
[102] Fix | Delete
'important' => 'all',
[103] Fix | Delete
'text_align' => "{$this->main_css_element} .comment_postinfo",
[104] Fix | Delete
),
[105] Fix | Delete
'line_height' => array(
[106] Fix | Delete
'default' => '1em',
[107] Fix | Delete
),
[108] Fix | Delete
'font_size' => array(
[109] Fix | Delete
'default' => '14px',
[110] Fix | Delete
),
[111] Fix | Delete
'letter_spacing' => array(
[112] Fix | Delete
'default' => '0px',
[113] Fix | Delete
),
[114] Fix | Delete
),
[115] Fix | Delete
'body' => array(
[116] Fix | Delete
'label' => esc_html__( 'Comment', 'et_builder' ),
[117] Fix | Delete
'css' => array(
[118] Fix | Delete
'main' => "{$this->main_css_element} .comment-content p",
[119] Fix | Delete
),
[120] Fix | Delete
'line_height' => array(
[121] Fix | Delete
'default' => '1em',
[122] Fix | Delete
),
[123] Fix | Delete
'font_size' => array(
[124] Fix | Delete
'default' => '14px',
[125] Fix | Delete
),
[126] Fix | Delete
'letter_spacing' => array(
[127] Fix | Delete
'default' => '0px',
[128] Fix | Delete
),
[129] Fix | Delete
),
[130] Fix | Delete
),
[131] Fix | Delete
'button' => array(
[132] Fix | Delete
'button' => array(
[133] Fix | Delete
'label' => et_builder_i18n( 'Button' ),
[134] Fix | Delete
'css' => array(
[135] Fix | Delete
'main' => "{$this->main_css_element}.et_pb_comments_module .et_pb_button",
[136] Fix | Delete
'limited_main' => "{$this->main_css_element}.et_pb_comments_module .et_pb_button",
[137] Fix | Delete
'alignment' => "{$this->main_css_element} .form-submit",
[138] Fix | Delete
),
[139] Fix | Delete
'no_rel_attr' => true,
[140] Fix | Delete
'use_alignment' => true,
[141] Fix | Delete
'box_shadow' => array(
[142] Fix | Delete
'css' => array(
[143] Fix | Delete
'main' => "{$this->main_css_element} .et_pb_button",
[144] Fix | Delete
),
[145] Fix | Delete
),
[146] Fix | Delete
'margin_padding' => array(
[147] Fix | Delete
'css' => array(
[148] Fix | Delete
'important' => 'all',
[149] Fix | Delete
),
[150] Fix | Delete
),
[151] Fix | Delete
),
[152] Fix | Delete
),
[153] Fix | Delete
'text' => array(
[154] Fix | Delete
'use_background_layout' => true,
[155] Fix | Delete
'css' => array(
[156] Fix | Delete
'main' => '%%order_class%% p, %%order_class%% .comment_postinfo *, %%order_class%% .page_title, %%order_class%% .comment-reply-title',
[157] Fix | Delete
'text_shadow' => '%%order_class%% p, %%order_class%% .comment_postinfo, %%order_class%% .page_title, %%order_class%% .comment-reply-title',
[158] Fix | Delete
),
[159] Fix | Delete
'options' => array(
[160] Fix | Delete
'background_layout' => array(
[161] Fix | Delete
'default_on_front' => 'light',
[162] Fix | Delete
'hover' => 'tabs',
[163] Fix | Delete
),
[164] Fix | Delete
),
[165] Fix | Delete
),
[166] Fix | Delete
'form_field' => array(
[167] Fix | Delete
'form_field' => array(
[168] Fix | Delete
'label' => esc_html__( 'Fields', 'et_builder' ),
[169] Fix | Delete
'css' => array(
[170] Fix | Delete
'main' => "{$this->main_css_element} #commentform textarea, {$this->main_css_element} #commentform input[type='text'], {$this->main_css_element} #commentform input[type='email'], {$this->main_css_element} #commentform input[type='url']",
[171] Fix | Delete
'hover' => "{$this->main_css_element} #commentform textarea:hover, {$this->main_css_element} #commentform input[type='text']:hover, {$this->main_css_element} #commentform input[type='email']:hover, {$this->main_css_element} #commentform input[type='url']:hover",
[172] Fix | Delete
'focus' => "{$this->main_css_element} #commentform textarea:focus, {$this->main_css_element} #commentform input[type='text']:focus, {$this->main_css_element} #commentform input[type='email']:focus, {$this->main_css_element} #commentform input[type='url']:focus",
[173] Fix | Delete
'focus_hover' => "{$this->main_css_element} #commentform textarea:focus:hover, {$this->main_css_element} #commentform input[type='text']:focus:hover, {$this->main_css_element} #commentform input[type='email']:focus:hover, {$this->main_css_element} #commentform input[type='url']:focus:hover",
[174] Fix | Delete
'placeholder' => "{$this->main_css_element} #commentform textarea::-webkit-input-placeholder, {$this->main_css_element} #commentform textarea::-moz-placeholder, {$this->main_css_element} #commentform textarea:-ms-input-placeholder, {$this->main_css_element} #commentform input::-webkit-input-placeholder, {$this->main_css_element} #commentform input::-moz-placeholder, {$this->main_css_element} #commentform input:-ms-input-placeholder",
[175] Fix | Delete
'placeholder_focus' => "{$this->main_css_element} #commentform textarea:focus::-webkit-input-placeholder, {$this->main_css_element} #commentform textarea:focus::-moz-placeholder, {$this->main_css_element} #commentform textarea:focus:-ms-input-placeholder, {$this->main_css_element} #commentform input:focus::-webkit-input-placeholder, {$this->main_css_element} #commentform input:focus::-moz-placeholder, {$this->main_css_element} #commentform input:focus:-ms-input-placeholder",
[176] Fix | Delete
'margin' => "{$this->main_css_element} #commentform .comment-form-comment, {$this->main_css_element} #commentform .comment-form-author, {$this->main_css_element} #commentform .comment-form-email, {$this->main_css_element} #commentform .comment-form-url",
[177] Fix | Delete
),
[178] Fix | Delete
'box_shadow' => array(
[179] Fix | Delete
'name' => 'fields',
[180] Fix | Delete
'css' => array(
[181] Fix | Delete
'main' => "{$this->main_css_element} #commentform textarea, {$this->main_css_element} #commentform input[type='text'], {$this->main_css_element} #commentform input[type='email'], {$this->main_css_element} #commentform input[type='url']",
[182] Fix | Delete
),
[183] Fix | Delete
),
[184] Fix | Delete
'border_styles' => array(
[185] Fix | Delete
'form_field' => array(
[186] Fix | Delete
'name' => 'fields',
[187] Fix | Delete
'css' => array(
[188] Fix | Delete
'main' => array(
[189] Fix | Delete
'border_radii' => "{$this->main_css_element} #commentform textarea, {$this->main_css_element} #commentform input[type='text'], {$this->main_css_element} #commentform input[type='email'], {$this->main_css_element} #commentform input[type='url']",
[190] Fix | Delete
'border_styles' => "{$this->main_css_element} #commentform textarea, {$this->main_css_element} #commentform input[type='text'], {$this->main_css_element} #commentform input[type='email'], {$this->main_css_element} #commentform input[type='url']",
[191] Fix | Delete
),
[192] Fix | Delete
'important' => 'all',
[193] Fix | Delete
),
[194] Fix | Delete
'label_prefix' => esc_html__( 'Fields', 'et_builder' ),
[195] Fix | Delete
),
[196] Fix | Delete
'form_field_focus' => array(
[197] Fix | Delete
'name' => 'fields_focus',
[198] Fix | Delete
'css' => array(
[199] Fix | Delete
'main' => array(
[200] Fix | Delete
'border_radii' => "{$this->main_css_element} #commentform textarea:focus, {$this->main_css_element} #commentform input[type='text']:focus, {$this->main_css_element} #commentform input[type='email']:focus, {$this->main_css_element} #commentform input[type='url']:focus",
[201] Fix | Delete
'border_styles' => "{$this->main_css_element} #commentform textarea:focus, {$this->main_css_element} #commentform input[type='text']:focus, {$this->main_css_element} #commentform input[type='email']:focus, {$this->main_css_element} #commentform input[type='url']:focus",
[202] Fix | Delete
),
[203] Fix | Delete
),
[204] Fix | Delete
'label_prefix' => esc_html__( 'Fields Focus', 'et_builder' ),
[205] Fix | Delete
),
[206] Fix | Delete
),
[207] Fix | Delete
'font_field' => array(
[208] Fix | Delete
'css' => array(
[209] Fix | Delete
'main' => "{$this->main_css_element} #commentform textarea, {$this->main_css_element} #commentform input[type='text'], {$this->main_css_element} #commentform input[type='email'], {$this->main_css_element} #commentform input[type='url'], {$this->main_css_element} #commentform label",
[210] Fix | Delete
'important' => 'all',
[211] Fix | Delete
),
[212] Fix | Delete
'line_height' => array(
[213] Fix | Delete
'default' => '1em',
[214] Fix | Delete
),
[215] Fix | Delete
'font_size' => array(
[216] Fix | Delete
'default' => '18px',
[217] Fix | Delete
),
[218] Fix | Delete
'letter_spacing' => array(
[219] Fix | Delete
'default' => '0px',
[220] Fix | Delete
),
[221] Fix | Delete
),
[222] Fix | Delete
),
[223] Fix | Delete
),
[224] Fix | Delete
'filters' => array(
[225] Fix | Delete
'child_filters_target' => array(
[226] Fix | Delete
'tab_slug' => 'advanced',
[227] Fix | Delete
'toggle_slug' => 'image',
[228] Fix | Delete
),
[229] Fix | Delete
),
[230] Fix | Delete
'image' => array(
[231] Fix | Delete
'css' => array(
[232] Fix | Delete
'main' => "{$this->main_css_element} .commentlist img.avatar",
[233] Fix | Delete
),
[234] Fix | Delete
),
[235] Fix | Delete
);
[236] Fix | Delete
[237] Fix | Delete
$this->custom_css_fields = array(
[238] Fix | Delete
'main_header' => array(
[239] Fix | Delete
'label' => esc_html__( 'Comments Count', 'et_builder' ),
[240] Fix | Delete
'selector' => 'h1#comments',
[241] Fix | Delete
),
[242] Fix | Delete
'comment_body' => array(
[243] Fix | Delete
'label' => esc_html__( 'Comment Body', 'et_builder' ),
[244] Fix | Delete
'selector' => '.comment-body',
[245] Fix | Delete
),
[246] Fix | Delete
'comment_meta' => array(
[247] Fix | Delete
'label' => esc_html__( 'Comment Meta', 'et_builder' ),
[248] Fix | Delete
'selector' => '.comment_postinfo',
[249] Fix | Delete
),
[250] Fix | Delete
'comment_content' => array(
[251] Fix | Delete
'label' => esc_html__( 'Comment Content', 'et_builder' ),
[252] Fix | Delete
'selector' => '.comment_area .comment-content',
[253] Fix | Delete
),
[254] Fix | Delete
'comment_avatar' => array(
[255] Fix | Delete
'label' => esc_html__( 'Comment Avatar', 'et_builder' ),
[256] Fix | Delete
'selector' => '.comment_avatar',
[257] Fix | Delete
),
[258] Fix | Delete
'reply_button' => array(
[259] Fix | Delete
'label' => esc_html__( 'Reply Button', 'et_builder' ),
[260] Fix | Delete
'selector' => '.comment-reply-link.et_pb_button',
[261] Fix | Delete
),
[262] Fix | Delete
'new_title' => array(
[263] Fix | Delete
'label' => esc_html__( 'New Comment Title', 'et_builder' ),
[264] Fix | Delete
'selector' => 'h3#reply-title',
[265] Fix | Delete
),
[266] Fix | Delete
'message_field' => array(
[267] Fix | Delete
'label' => esc_html__( 'Message Field', 'et_builder' ),
[268] Fix | Delete
'selector' => '.comment-form-comment textarea#comment',
[269] Fix | Delete
),
[270] Fix | Delete
'name_field' => array(
[271] Fix | Delete
'label' => esc_html__( 'Name Field', 'et_builder' ),
[272] Fix | Delete
'selector' => '.comment-form-author input',
[273] Fix | Delete
),
[274] Fix | Delete
'email_field' => array(
[275] Fix | Delete
'label' => esc_html__( 'Email Field', 'et_builder' ),
[276] Fix | Delete
'selector' => '.comment-form-email input',
[277] Fix | Delete
),
[278] Fix | Delete
'website_field' => array(
[279] Fix | Delete
'label' => esc_html__( 'Website Field', 'et_builder' ),
[280] Fix | Delete
'selector' => '.comment-form-url input',
[281] Fix | Delete
),
[282] Fix | Delete
'submit_button' => array(
[283] Fix | Delete
'label' => esc_html__( 'Submit Button', 'et_builder' ),
[284] Fix | Delete
'selector' => '.form-submit .et_pb_button#et_pb_submit',
[285] Fix | Delete
),
[286] Fix | Delete
);
[287] Fix | Delete
[288] Fix | Delete
$this->help_videos = array(
[289] Fix | Delete
array(
[290] Fix | Delete
'id' => 'k6vskmOxM4U',
[291] Fix | Delete
'name' => esc_html__( 'An introduction to the Comments module', 'et_builder' ),
[292] Fix | Delete
),
[293] Fix | Delete
);
[294] Fix | Delete
}
[295] Fix | Delete
[296] Fix | Delete
function get_fields() {
[297] Fix | Delete
[298] Fix | Delete
$fields = array(
[299] Fix | Delete
'show_avatar' => array(
[300] Fix | Delete
'label' => esc_html__( 'Show Author Avatar', 'et_builder' ),
[301] Fix | Delete
'description' => esc_html__( 'Disabling the author avatar will remove the profile picture from the module.', 'et_builder' ),
[302] Fix | Delete
'type' => 'yes_no_button',
[303] Fix | Delete
'option_category' => 'configuration',
[304] Fix | Delete
'options' => array(
[305] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[306] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[307] Fix | Delete
),
[308] Fix | Delete
'toggle_slug' => 'elements',
[309] Fix | Delete
'default_on_front' => 'on',
[310] Fix | Delete
'mobile_options' => true,
[311] Fix | Delete
'hover' => 'tabs',
[312] Fix | Delete
),
[313] Fix | Delete
'show_reply' => array(
[314] Fix | Delete
'label' => esc_html__( 'Show Reply Button', 'et_builder' ),
[315] Fix | Delete
'description' => esc_html__( 'Disabling the reply button will prevent visitors from creating threaded comments.', 'et_builder' ),
[316] Fix | Delete
'type' => 'yes_no_button',
[317] Fix | Delete
'option_category' => 'configuration',
[318] Fix | Delete
'options' => array(
[319] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[320] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[321] Fix | Delete
),
[322] Fix | Delete
'toggle_slug' => 'elements',
[323] Fix | Delete
'default_on_front' => 'on',
[324] Fix | Delete
'mobile_options' => true,
[325] Fix | Delete
'hover' => 'tabs',
[326] Fix | Delete
),
[327] Fix | Delete
'show_count' => array(
[328] Fix | Delete
'label' => esc_html__( 'Show Comment Count', 'et_builder' ),
[329] Fix | Delete
'description' => esc_html__( 'Disabling the comment count will remove the number of comments from the top of the module.', 'et_builder' ),
[330] Fix | Delete
'type' => 'yes_no_button',
[331] Fix | Delete
'option_category' => 'configuration',
[332] Fix | Delete
'options' => array(
[333] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[334] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[335] Fix | Delete
),
[336] Fix | Delete
'toggle_slug' => 'elements',
[337] Fix | Delete
'default_on_front' => 'on',
[338] Fix | Delete
'mobile_options' => true,
[339] Fix | Delete
'hover' => 'tabs',
[340] Fix | Delete
),
[341] Fix | Delete
);
[342] Fix | Delete
[343] Fix | Delete
return $fields;
[344] Fix | Delete
}
[345] Fix | Delete
[346] Fix | Delete
/**
[347] Fix | Delete
* Get comments markup for comments module
[348] Fix | Delete
*
[349] Fix | Delete
* @since 4.0.9 Add custom form title heading level.
[350] Fix | Delete
*
[351] Fix | Delete
* @param {string} $header_level
[352] Fix | Delete
* @param {string} $form_title_level
[353] Fix | Delete
*
[354] Fix | Delete
* @return string of comment section markup
[355] Fix | Delete
*/
[356] Fix | Delete
static function get_comments( $header_level, $form_title_level ) {
[357] Fix | Delete
global $et_pb_comments_print, $et_comments_header_level, $et_comments_form_title_level;
[358] Fix | Delete
[359] Fix | Delete
// Globally flag that comment module is being printed
[360] Fix | Delete
$et_pb_comments_print = true;
[361] Fix | Delete
[362] Fix | Delete
// set custom header level for comments form
[363] Fix | Delete
$et_comments_header_level = $header_level;
[364] Fix | Delete
$et_comments_form_title_level = $form_title_level;
[365] Fix | Delete
[366] Fix | Delete
// remove filters to make sure comments module rendered correctly if the below filters were applied earlier.
[367] Fix | Delete
remove_filter( 'get_comments_number', '__return_zero' );
[368] Fix | Delete
remove_filter( 'comments_open', '__return_false' );
[369] Fix | Delete
remove_filter( 'comments_array', '__return_empty_array' );
[370] Fix | Delete
[371] Fix | Delete
// Custom action before calling comments_template.
[372] Fix | Delete
do_action( 'et_fb_before_comments_template' );
[373] Fix | Delete
[374] Fix | Delete
ob_start();
[375] Fix | Delete
comments_template( '', true );
[376] Fix | Delete
$comments_content = ob_get_contents();
[377] Fix | Delete
ob_end_clean();
[378] Fix | Delete
[379] Fix | Delete
// Custom action after calling comments_template.
[380] Fix | Delete
do_action( 'et_fb_after_comments_template' );
[381] Fix | Delete
[382] Fix | Delete
// Globally flag that comment module has been printed
[383] Fix | Delete
$et_pb_comments_print = false;
[384] Fix | Delete
$et_comments_header_level = '';
[385] Fix | Delete
[386] Fix | Delete
return $comments_content;
[387] Fix | Delete
}
[388] Fix | Delete
[389] Fix | Delete
/**
[390] Fix | Delete
* Action and filter hooks that are called before comment content rendering. These are
[391] Fix | Delete
* abstracted into method so module which extends comment module can modify these
[392] Fix | Delete
*
[393] Fix | Delete
* @since 3.29
[394] Fix | Delete
*/
[395] Fix | Delete
function before_comments_content() {
[396] Fix | Delete
// Modify the comments request to make sure it's unique.
[397] Fix | Delete
// Otherwise WP generates SQL error and doesn't allow multiple comments sections on single page
[398] Fix | Delete
add_action( 'pre_get_comments', array( $this, 'et_pb_modify_comments_request' ), 1 );
[399] Fix | Delete
[400] Fix | Delete
// include custom comments_template to display the comment section with Divi style
[401] Fix | Delete
add_filter( 'comments_template', array( $this, 'et_pb_comments_template' ) );
[402] Fix | Delete
[403] Fix | Delete
// Modify submit button to be advanced button style ready
[404] Fix | Delete
add_filter( 'comment_form_submit_button', array( $this, 'et_pb_comments_submit_button' ) );
[405] Fix | Delete
}
[406] Fix | Delete
[407] Fix | Delete
/**
[408] Fix | Delete
* Comment content rendering. These are abstracted into method so module which extends comment
[409] Fix | Delete
* module can modify these
[410] Fix | Delete
*
[411] Fix | Delete
* @since 3.29
[412] Fix | Delete
* @since 4.0.9 Add form title heading level.
[413] Fix | Delete
*/
[414] Fix | Delete
function get_comments_content() {
[415] Fix | Delete
$header_level = et_()->array_get( $this->props, 'header_level' );
[416] Fix | Delete
$form_title_level = et_()->array_get( $this->props, 'title_level' );
[417] Fix | Delete
$header_level_processed = et_pb_process_header_level( $header_level, 'h1' );
[418] Fix | Delete
$form_title_level_processed = et_pb_process_header_level( $form_title_level, 'h3' );
[419] Fix | Delete
[420] Fix | Delete
return self::get_comments( $header_level_processed, $form_title_level_processed );
[421] Fix | Delete
}
[422] Fix | Delete
[423] Fix | Delete
/**
[424] Fix | Delete
* Action and filter hooks that are called after comment content rendering. These are
[425] Fix | Delete
* abstracted into method so module which extends comment module can modify these
[426] Fix | Delete
*/
[427] Fix | Delete
function after_comments_content() {
[428] Fix | Delete
// remove all the actions and filters to not break the default comments section from theme
[429] Fix | Delete
remove_filter( 'comments_template', array( $this, 'et_pb_comments_template' ) );
[430] Fix | Delete
remove_action( 'pre_get_comments', array( $this, 'et_pb_modify_comments_request' ), 1 );
[431] Fix | Delete
}
[432] Fix | Delete
[433] Fix | Delete
function et_pb_comments_template() {
[434] Fix | Delete
return realpath( dirname( __FILE__ ) . '/..' ) . '/comments_template.php';
[435] Fix | Delete
}
[436] Fix | Delete
[437] Fix | Delete
function et_pb_comments_submit_button( $submit_button ) {
[438] Fix | Delete
return sprintf(
[439] Fix | Delete
'<button name="%1$s" type="submit" id="%2$s" class="%3$s">%4$s</button>',
[440] Fix | Delete
esc_attr( 'submit' ),
[441] Fix | Delete
esc_attr( 'et_pb_submit' ),
[442] Fix | Delete
esc_attr( 'submit' ),
[443] Fix | Delete
esc_html__( 'Submit Comment', 'et_builder' )
[444] Fix | Delete
);
[445] Fix | Delete
}
[446] Fix | Delete
[447] Fix | Delete
function et_pb_modify_comments_request( $params ) {
[448] Fix | Delete
// modify the request parameters the way it doesn't change the result just to make request with unique parameters
[449] Fix | Delete
$params->query_vars['type__not_in'] = 'et_pb_comments_random_type_' . $this->et_pb_unique_comments_module_class;
[450] Fix | Delete
}
[451] Fix | Delete
[452] Fix | Delete
/**
[453] Fix | Delete
* Renders the module output.
[454] Fix | Delete
*
[455] Fix | Delete
* @param array $attrs List of attributes.
[456] Fix | Delete
* @param string $content Content being processed.
[457] Fix | Delete
* @param string $render_slug Slug of module that is used for rendering output.
[458] Fix | Delete
*
[459] Fix | Delete
* @return string
[460] Fix | Delete
*/
[461] Fix | Delete
public function render( $attrs, $content, $render_slug ) {
[462] Fix | Delete
$multi_view = et_pb_multi_view_options( $this );
[463] Fix | Delete
$button_custom = $this->props['custom_button'];
[464] Fix | Delete
$show_avatar = $this->props['show_avatar'];
[465] Fix | Delete
$show_reply = $this->props['show_reply'];
[466] Fix | Delete
$show_count = $this->props['show_count'];
[467] Fix | Delete
$header_level = $this->props['header_level'];
[468] Fix | Delete
$video_background = $this->video_background();
[469] Fix | Delete
$parallax_image_background = $this->get_parallax_image_background();
[470] Fix | Delete
[471] Fix | Delete
$custom_icon_values = et_pb_responsive_options()->get_property_values( $this->props, 'button_icon' );
[472] Fix | Delete
$custom_icon = isset( $custom_icon_values['desktop'] ) ? $custom_icon_values['desktop'] : '';
[473] Fix | Delete
$custom_icon_tablet = isset( $custom_icon_values['tablet'] ) ? $custom_icon_values['tablet'] : '';
[474] Fix | Delete
$custom_icon_phone = isset( $custom_icon_values['phone'] ) ? $custom_icon_values['phone'] : '';
[475] Fix | Delete
[476] Fix | Delete
$this->et_pb_unique_comments_module_class = ET_Builder_Element::get_module_order_class( $render_slug ); // use this variable to make the comments request unique for each module instance
[477] Fix | Delete
[478] Fix | Delete
// Action & filter hooks before comment content rendering
[479] Fix | Delete
$this->before_comments_content();
[480] Fix | Delete
[481] Fix | Delete
// Comment content rendering
[482] Fix | Delete
$comments_content = $this->get_comments_content();
[483] Fix | Delete
[484] Fix | Delete
// Action & filter hooks after comment content rendering
[485] Fix | Delete
$this->after_comments_content();
[486] Fix | Delete
[487] Fix | Delete
// Image - CSS Filters.
[488] Fix | Delete
if ( et_()->array_get( $this->advanced_fields, 'image.css', false ) ) {
[489] Fix | Delete
$this->add_classname(
[490] Fix | Delete
$this->generate_css_filters(
[491] Fix | Delete
$this->slug,
[492] Fix | Delete
'child_',
[493] Fix | Delete
et_()->array_get( $this->advanced_fields['image']['css'], 'main', '%%order_class%%' )
[494] Fix | Delete
)
[495] Fix | Delete
);
[496] Fix | Delete
}
[497] Fix | Delete
[498] Fix | Delete
$comments_custom_icon = 'on' === $button_custom ? $custom_icon : '';
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function