PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.7.4
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.7.4
8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 8.5.5 8.5.4 8.5.3 8.5.2 All 533 releases
chatbot / includes / admin / templates / email_subscription.php

email_subscription.php in WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services 8.7.4, at includes/admin/templates/email_subscription.php

166 lines 6.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Email Subscription Template
4 *
5 * @package Botmaster
6 * @since 14.8.2
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 wp_register_style( 'qlcd-wp-chatbot-admin-style-email', QCLD_wpCHATBOT_PLUGIN_URL . '/css/email_subscription.css', '', QCLD_wpCHATBOT_VERSION, 'screen' );
14 wp_enqueue_style( 'qlcd-wp-chatbot-admin-style-email' );
15
16 wp_register_script( 'qcld-wp-chatbot-email-subscription-js', QCLD_wpCHATBOT_PLUGIN_URL . '/js/email_subscription.js', array( 'jquery' ), true );
17 wp_enqueue_script( 'qcld-wp-chatbot-email-subscription-js' );
18
19 global $wpdb;
20 if ( ! function_exists( 'wp_get_current_user' ) ) {
21 include ABSPATH . 'wp-includes/pluggable.php';
22 }
23
24 $table = $wpdb->prefix . 'wpbot_subscription';
25 $table_sql = esc_sql( $table );
26
27 if ( isset( $_POST['wpbot_email_subscription_remove'] ) && '1' === $_POST['wpbot_email_subscription_remove'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
28 check_admin_referer( 'wpbot_email_subscription_delete', 'wpbot_email_subscription_nonce' );
29 if ( current_user_can( 'manage_options' ) && isset( $_POST['emails'] ) && is_array( $_POST['emails'] ) ) {
30 $email_ids = array_map( 'absint', wp_unslash( $_POST['emails'] ) );
31 foreach ( $email_ids as $email_id ) {
32 $wpdb->delete( $table, array( 'id' => $email_id ), array( '%d' ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
33 }
34 echo '<script>window.location.href="' . esc_url_raw( admin_url( 'admin.php?page=email-subscription&msg=success' ) ) . '";</script>';
35 exit;
36 }
37 }
38
39 $current_user = wp_get_current_user();
40 $url = admin_url( 'edit.php?post_type=sld&page=qcsld_click_list' );
41 $customPagHTML = '';
42 // Main Report Area
43 $total = $wpdb->get_var(
44 'SELECT COUNT(*) FROM `' . $table_sql . '`' // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
45 ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
46 $items_per_page = 50;
47
48 $page = isset( $_GET['cpage'] ) ? abs( (int) $_GET['cpage'] ) : 1;// phpcs:ignore WordPress.Security.NonceVerification.Missing
49 $offset = ( $page * $items_per_page ) - $items_per_page;
50
51 $rows = $wpdb->get_results(
52 $wpdb->prepare(
53 'SELECT * FROM `' . $table_sql . '` ORDER BY id DESC LIMIT %d, %d', // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
54 $offset,
55 $items_per_page
56 )
57 ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
58 $totalPage = ceil( $total / $items_per_page );
59
60 if ( $totalPage > 1 ) {
61 $customPagHTML = '<div><span class="wpbot_pagination">Page ' . esc_html( $page ) . ' of ' . esc_html( $totalPage ) . '</span>' . paginate_links(
62 array(
63 'base' => add_query_arg( 'cpage', '%#%' ),
64 'format' => '',
65 'prev_text' => esc_html__( '&laquo;', 'chatbot' ),
66 'next_text' => esc_html__( '&raquo;', 'chatbot' ),
67 'total' => esc_html( $totalPage ),
68 'current' => esc_html( $page ),
69 )
70 ) . '</div>';
71 }
72 $mainurl = admin_url( 'admin.php?page=email-subscription' );
73
74 ?>
75 <div class="qchero_sliders_list_wrapper wpbot-userdata-page">
76 <div class="sld_menu_title">
77 <h2><?php echo esc_html__( 'User Data', 'chatbot' ); ?></h2>
78 </div>
79
80 <?php if ( $customPagHTML != '' ) : ?>
81 <div class="sld_menu_title sld_menu_title_align wpbot-userdata-toolbar">
82 <div class="qcld-session-pagination"><?php echo wp_kses_post( $customPagHTML ); ?></div>
83 </div>
84 <?php endif; ?>
85
86 <?php
87 if ( isset( $_GET['msg'] ) && $_GET['msg'] == 'success' ) {// phpcs:ignore WordPress.Security.NonceVerification.Missing
88 echo '<div class="notice notice-success"><p>Record has beed Deleted Successfully!</p></div>';
89 }
90 ?>
91
92 <form id="wpcs_form_sessions" class="wpbot-userdata-form" action="<?php echo esc_url( $mainurl ); ?>" method="POST">
93 <?php wp_nonce_field( 'wpbot_email_subscription_delete', 'wpbot_email_subscription_nonce' ); ?>
94 <input type="hidden" name="wpbot_email_subscription_remove" value="1" />
95
96 <div class="wpbot-userdata-actions">
97 <button type="button" class="button-primary" id="wpbot_submit_email_form"><?php echo esc_html__( 'Delete', 'chatbot' ); ?></button>
98 <a class="button-primary wpbot-userdata-export" href="<?php echo esc_url( admin_url( 'admin-post.php?action=wpbprint.csv' ) ); ?>"><?php echo esc_html__( 'Export All Contacts', 'chatbot' ); ?></a>
99 <span class="wpbot-userdata-total"><?php echo esc_html__( 'Total', 'chatbot' ); ?> <strong><?php echo esc_html( $total ); ?></strong></span>
100 </div>
101
102 <div class="qchero_slider_table_area">
103 <div class="sld_payment_table">
104 <div class="sld_payment_row header">
105
106 <div class="sld_payment_cell">
107 <input type="checkbox" id="wpbot_checked_all" />
108 </div>
109
110 <div class="sld_payment_cell">
111 <?php echo esc_html__( 'Date', 'chatbot' ); ?>
112 </div>
113 <div class="sld_payment_cell">
114 <?php echo esc_html__( 'Name', 'chatbot' ); ?>
115 </div>
116 <div class="sld_payment_cell">
117 <?php echo esc_html__( 'Email', 'chatbot' ); ?>
118 </div>
119 <div class="sld_payment_cell">
120 <?php echo esc_html__( 'Phone', 'chatbot' ); ?>
121 </div>
122
123 </div>
124
125 <?php
126 foreach ( $rows as $row ) {
127 ?>
128 <div class="sld_payment_row">
129
130 <div class="sld_payment_cell">
131
132 <input type="checkbox" name="emails[]" class="wpbot_email_checkbox" value="<?php echo absint( $row->id ); ?>" />
133 </div>
134
135 <div class="sld_payment_cell">
136 <div class="sld_responsive_head"><?php echo esc_html__( 'Date', 'chatbot' ); ?></div>
137 <?php echo esc_html( gmdate( 'm/d/Y', strtotime( $row->date ) ) ); ?>
138 </div>
139 <div class="sld_payment_cell">
140 <div class="sld_responsive_head"><?php echo esc_html__( 'Name', 'chatbot' ); ?></div>
141 <?php echo esc_html( $row->name ); ?>
142 </div>
143 <div class="sld_payment_cell">
144 <div class="sld_responsive_head"><?php echo esc_html__( 'Email', 'chatbot' ); ?></div>
145 <?php
146 echo esc_html( $row->email );
147 ?>
148 </div>
149 <div class="sld_payment_cell">
150 <div class="sld_responsive_head"><?php echo esc_html__( 'Phone', 'chatbot' ); ?></div>
151 <?php
152 echo esc_html( $row->phone );
153
154 ?>
155 </div>
156
157 </div>
158 <?php
159 }
160 ?>
161
162 </div>
163 </div>
164 </form>
165 </div>
166