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/wp-conte.../plugins/wp-bulk-.../includes
File: delele-comments-form-functions.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Delete Comments Form Funcitons
[2] Fix | Delete
*
[3] Fix | Delete
* @package WP_Bulk_Delete
[4] Fix | Delete
* @subpackage Delete Comments Form Funcitons
[5] Fix | Delete
* @copyright Copyright (c) 2016, Dharmesh Patel
[6] Fix | Delete
* @since 1.1.0
[7] Fix | Delete
*/
[8] Fix | Delete
[9] Fix | Delete
// Exit if accessed directly
[10] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) exit;
[11] Fix | Delete
[12] Fix | Delete
/** Actions *************************************************************/
[13] Fix | Delete
add_action( 'wpbd_delete_comments_form', 'wpdb_render_delete_comments_status' );
[14] Fix | Delete
add_action( 'wpbd_delete_comments_form', 'wpdb_render_delete_comments_users' );
[15] Fix | Delete
add_action( 'wpbd_delete_comments_form', 'wpdb_render_delete_comments_posts' );
[16] Fix | Delete
add_action( 'wpbd_delete_comments_form', 'wpdb_render_delete_comments_date_interval' );
[17] Fix | Delete
[18] Fix | Delete
/**
[19] Fix | Delete
* Process Delete Comments form
[20] Fix | Delete
*
[21] Fix | Delete
*
[22] Fix | Delete
* @since 1.1.0
[23] Fix | Delete
* @param array $data Form post Data.
[24] Fix | Delete
* @return array | posts ID to be delete.
[25] Fix | Delete
*/
[26] Fix | Delete
function xt_delete_comments_form_process( $data ) {
[27] Fix | Delete
$error = array();
[28] Fix | Delete
if ( ! current_user_can( 'manage_options' ) ) {
[29] Fix | Delete
$error[] = esc_html__('You don\'t have enough permission for this operation.', 'wp-bulk-delete' );
[30] Fix | Delete
}
[31] Fix | Delete
if( empty( $data['delete_comment_status'] ) ){
[32] Fix | Delete
$error[] = esc_html__('Please select Comment status for proceed delete operation.', 'wp-bulk-delete' );
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
if ( isset( $data['_delete_comments_wpnonce'] ) && wp_verify_nonce( $data['_delete_comments_wpnonce'], 'delete_comments_nonce' ) ) {
[36] Fix | Delete
[37] Fix | Delete
if( empty( $error ) ){
[38] Fix | Delete
$delete_time = ( $data['delete_time'] ) ? $data['delete_time'] : 'now';
[39] Fix | Delete
$delete_datetime = isset( $data['delete_datetime'] ) ? $data['delete_datetime'] : '';
[40] Fix | Delete
if( $delete_time === 'scheduled' && !empty($delete_datetime) && wpbd_is_pro() ) {
[41] Fix | Delete
$data['delete_entity'] = 'comment';
[42] Fix | Delete
return wpbd_save_scheduled_delete($data);
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
$comment_count = wpbulkdelete()->api->do_delete_comments( $data );
[46] Fix | Delete
if( false === $comment_count ){
[47] Fix | Delete
return array(
[48] Fix | Delete
'status' => 0,
[49] Fix | Delete
'messages' => array( esc_html__( 'Something went wrong please try again!!', 'wp-bulk-delete' ) ),
[50] Fix | Delete
);
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
if ( ! empty( $comment_count ) && $comment_count > 0 ) {
[54] Fix | Delete
return array(
[55] Fix | Delete
'status' => 1,
[56] Fix | Delete
'messages' => array( sprintf( esc_html__( '%d comment(s) deleted successfully.', 'wp-bulk-delete' ), $comment_count )
[57] Fix | Delete
) );
[58] Fix | Delete
} else {
[59] Fix | Delete
return array(
[60] Fix | Delete
'status' => 1,
[61] Fix | Delete
'messages' => array( esc_html__( 'Nothing to delete!!', 'wp-bulk-delete' ) ),
[62] Fix | Delete
);
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
} else {
[66] Fix | Delete
return array(
[67] Fix | Delete
'status' => 0,
[68] Fix | Delete
'messages' => $error,
[69] Fix | Delete
);
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
} else {
[73] Fix | Delete
wp_die( esc_html__( 'Sorry, Your nonce did not verify.', 'wp-bulk-delete' ) );
[74] Fix | Delete
}
[75] Fix | Delete
}
[76] Fix | Delete
[77] Fix | Delete
/**
[78] Fix | Delete
* Render Userroles checkboxes.
[79] Fix | Delete
*
[80] Fix | Delete
* @since 1.1.0
[81] Fix | Delete
* @return void
[82] Fix | Delete
*/
[83] Fix | Delete
function wpdb_render_delete_comments_status(){
[84] Fix | Delete
$comment_status = array(
[85] Fix | Delete
'pending' => __( 'Pending Comments', 'wp-bulk-delete'),
[86] Fix | Delete
'spam' => __( 'Spam Comments', 'wp-bulk-delete'),
[87] Fix | Delete
'trash' => __( 'Trash Comments', 'wp-bulk-delete'),
[88] Fix | Delete
'approved' => __( 'Approved Comments', 'wp-bulk-delete'),
[89] Fix | Delete
);
[90] Fix | Delete
[91] Fix | Delete
?>
[92] Fix | Delete
<tr>
[93] Fix | Delete
<th scope="row">
[94] Fix | Delete
<?php _e( 'Comment Status', 'wp-bulk-delete' ); ?> :
[95] Fix | Delete
</th>
[96] Fix | Delete
[97] Fix | Delete
<td>
[98] Fix | Delete
<?php
[99] Fix | Delete
if( ! empty( $comment_status ) ){
[100] Fix | Delete
foreach ($comment_status as $comment_status_value => $comment_status_name ) {
[101] Fix | Delete
?>
[102] Fix | Delete
<input name="delete_comment_status[]" class="delete_comment_status" id="comment_status_<?php echo $comment_status_value; ?>" type="checkbox" value="<?php echo $comment_status_value; ?>" >
[103] Fix | Delete
<label for="comment_status_<?php echo $comment_status_value; ?>">
[104] Fix | Delete
<?php echo $comment_status_name . ' ' . sprintf( __( '( %s Comment(s) )', 'wp-bulk-delete' ), wpbulkdelete()->api->get_comment_count( $comment_status_value ) ); ?>
[105] Fix | Delete
</label>
[106] Fix | Delete
<br/>
[107] Fix | Delete
<?php
[108] Fix | Delete
}
[109] Fix | Delete
}
[110] Fix | Delete
?>
[111] Fix | Delete
<p class="description">
[112] Fix | Delete
<?php _e('Select the comment statuses which you want to delete.','wp-bulk-delete'); ?>
[113] Fix | Delete
</p>
[114] Fix | Delete
</td>
[115] Fix | Delete
</tr>
[116] Fix | Delete
<?php
[117] Fix | Delete
}
[118] Fix | Delete
[119] Fix | Delete
[120] Fix | Delete
/**
[121] Fix | Delete
* Render User registration date interval.
[122] Fix | Delete
*
[123] Fix | Delete
* @since 1.0
[124] Fix | Delete
* @return void
[125] Fix | Delete
*/
[126] Fix | Delete
function wpdb_render_delete_comments_date_interval(){
[127] Fix | Delete
?>
[128] Fix | Delete
<tr>
[129] Fix | Delete
<th scope="row">
[130] Fix | Delete
<?php _e('Comment Date :','wp-bulk-delete'); ?>
[131] Fix | Delete
</th>
[132] Fix | Delete
<td>
[133] Fix | Delete
<?php _e('Delete Comments which are','wp-bulk-delete'); ?>
[134] Fix | Delete
<select name="date_type" class="date_type">
[135] Fix | Delete
<option value="older_than"><?php _e('older than','wp-bulk-delete'); ?></option>
[136] Fix | Delete
<option value="within_last"><?php _e('submitted within last','wp-bulk-delete'); ?></option>
[137] Fix | Delete
<?php if( wpbd_is_pro() ) { ?>
[138] Fix | Delete
<option value="onemonth"><?php _e('1 Month','wp-bulk-delete'); ?></option>
[139] Fix | Delete
<option value="sixmonths"><?php _e('6 Months','wp-bulk-delete'); ?></option>
[140] Fix | Delete
<option value="oneyear"><?php _e('1 Year','wp-bulk-delete'); ?></option>
[141] Fix | Delete
<option value="twoyear"><?php _e('2 Years','wp-bulk-delete'); ?></option>
[142] Fix | Delete
<?php } ?>
[143] Fix | Delete
<option value="custom_date"><?php _e('submitted between custom','wp-bulk-delete'); ?></option>
[144] Fix | Delete
</select>
[145] Fix | Delete
<div class="wpbd_date_days wpbd_inline">
[146] Fix | Delete
<input type="number" id="input_days" name="input_days" class="wpbd_input_days" placeholder="0" min="0" /> <?php _e('days','wp-bulk-delete'); ?>
[147] Fix | Delete
</div>
[148] Fix | Delete
<div class="wpbd_custom_interval wpbd_inline" style="display:none;">
[149] Fix | Delete
<input type="text" id="delete_start_date" name="delete_start_date" class="delete_all_datepicker" placeholder="<?php _e('Start Date','wp-bulk-delete'); ?>" />
[150] Fix | Delete
-
[151] Fix | Delete
<input type="text" id="delete_end_date" name="delete_end_date" class="delete_all_datepicker" placeholder="<?php _e('End Date','wp-bulk-delete'); ?>" />
[152] Fix | Delete
<p class="description">
[153] Fix | Delete
<?php _e('Set the date interval for comments to delete ( only delete comments between these dates ) or leave these fields blank to select all comments. The dates must be specified in the following format: <strong>YYYY-MM-DD</strong>','wp-bulk-delete'); ?>
[154] Fix | Delete
</p>
[155] Fix | Delete
</div>
[156] Fix | Delete
<div class="wpbd_date_range wpbd_inline" style="display:none;">
[157] Fix | Delete
<p class="description">
[158] Fix | Delete
<?php _e('This option will work well with Scheduled Delete, which will help to delete comments of the selected option from the scheduled run date.','wp-bulk-delete'); ?>
[159] Fix | Delete
</p>
[160] Fix | Delete
</div>
[161] Fix | Delete
</td>
[162] Fix | Delete
</tr>
[163] Fix | Delete
<?php
[164] Fix | Delete
}
[165] Fix | Delete
[166] Fix | Delete
/**
[167] Fix | Delete
* Render Users Dropdown for comment authors.
[168] Fix | Delete
*
[169] Fix | Delete
* @since 1.1
[170] Fix | Delete
* @return void
[171] Fix | Delete
*/
[172] Fix | Delete
function wpdb_render_delete_comments_users(){
[173] Fix | Delete
global $wpdb;
[174] Fix | Delete
?>
[175] Fix | Delete
<tr>
[176] Fix | Delete
<th scope="row">
[177] Fix | Delete
<?php _e('Comment Author','wp-bulk-delete'); ?> :
[178] Fix | Delete
</th>
[179] Fix | Delete
<td>
[180] Fix | Delete
<?php
[181] Fix | Delete
if( ! wpbd_is_pro() ) { ?>
[182] Fix | Delete
<select name="sample1" class="sample1" disabled="disabled" >
[183] Fix | Delete
<option value=""><?php esc_attr_e( 'Select author', 'wp-bulk-delete' ); ?></option>
[184] Fix | Delete
</select>
[185] Fix | Delete
<?php
[186] Fix | Delete
} else {
[187] Fix | Delete
$comment_query = "SELECT DISTINCT `comment_author` FROM {$wpdb->comments}";
[188] Fix | Delete
$comment_authors = $wpdb->get_col( $comment_query );
[189] Fix | Delete
if( !empty( $comment_authors ) ){
[190] Fix | Delete
?>
[191] Fix | Delete
<select name="comment_author" class="chosen_select">
[192] Fix | Delete
<option value=""><?php esc_attr_e( 'Select author', 'wp-bulk-delete' ); ?></option>
[193] Fix | Delete
<?php
[194] Fix | Delete
foreach ($comment_authors as $comment_author ) {
[195] Fix | Delete
echo '<option value="' . $comment_author . '">' . $comment_author . '</option>';
[196] Fix | Delete
}
[197] Fix | Delete
?>
[198] Fix | Delete
</select>
[199] Fix | Delete
<?php
[200] Fix | Delete
}
[201] Fix | Delete
} ?>
[202] Fix | Delete
<p class="description">
[203] Fix | Delete
<?php _e('Select comment author whose comment you want to delete.','wp-bulk-delete'); ?>
[204] Fix | Delete
</p>
[205] Fix | Delete
<?php do_action( 'wpbd_display_available_in_pro'); ?>
[206] Fix | Delete
</td>
[207] Fix | Delete
</tr>
[208] Fix | Delete
<?php
[209] Fix | Delete
}
[210] Fix | Delete
[211] Fix | Delete
/**
[212] Fix | Delete
* Render Posts Dropdown for comment posts.
[213] Fix | Delete
*
[214] Fix | Delete
* @since 1.1
[215] Fix | Delete
* @return void
[216] Fix | Delete
*/
[217] Fix | Delete
function wpdb_render_delete_comments_posts(){
[218] Fix | Delete
global $wpdb;
[219] Fix | Delete
?>
[220] Fix | Delete
<tr>
[221] Fix | Delete
<th scope="row">
[222] Fix | Delete
<?php _e('Comment Post','wp-bulk-delete'); ?> :
[223] Fix | Delete
</th>
[224] Fix | Delete
<td>
[225] Fix | Delete
<?php
[226] Fix | Delete
if( ! wpbd_is_pro() ) { ?>
[227] Fix | Delete
<select name="sample2" class="sample2" disabled="disabled" >
[228] Fix | Delete
<option value=""><?php esc_attr_e( 'Select post', 'wp-bulk-delete' ); ?></option>
[229] Fix | Delete
</select>
[230] Fix | Delete
<?php
[231] Fix | Delete
} else {
[232] Fix | Delete
$comment_query = "SELECT DISTINCT `comment_post_ID` FROM {$wpdb->comments}";
[233] Fix | Delete
$comment_posts = $wpdb->get_col( $comment_query );
[234] Fix | Delete
if( !empty( $comment_posts ) ){
[235] Fix | Delete
?>
[236] Fix | Delete
<select name="comment_post" class="chosen_select">
[237] Fix | Delete
<option value=""><?php esc_attr_e( 'Select post', 'wp-bulk-delete' ); ?></option>
[238] Fix | Delete
<?php
[239] Fix | Delete
foreach ($comment_posts as $comment_post ) {
[240] Fix | Delete
echo '<option value="' . $comment_post . '">' . get_the_title( $comment_post ) . '</option>';
[241] Fix | Delete
}
[242] Fix | Delete
?>
[243] Fix | Delete
</select>
[244] Fix | Delete
<?php
[245] Fix | Delete
}
[246] Fix | Delete
} ?>
[247] Fix | Delete
<p class="description">
[248] Fix | Delete
<?php _e('Select comment post whose comment you want to delete.','wp-bulk-delete'); ?>
[249] Fix | Delete
</p>
[250] Fix | Delete
<?php do_action( 'wpbd_display_available_in_pro'); ?>
[251] Fix | Delete
</td>
[252] Fix | Delete
</tr>
[253] Fix | Delete
<?php
[254] Fix | Delete
}
[255] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function