PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.18.0
GiveWP – Donation Plugin and Fundraising Platform v4.18.0
4.18.0 4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 All 257 releases
← All changes | includes/admin/emails/class-email-notification-table.php +61 -31 2.3.0 → 4.18.0 View file →
@@ -6,9 +6,9 @@
6 6 * This class handles table html for email notifications listing.
7 7 *
8 8 * @package Give
9 9 * @subpackage Classes/Emails
10 - * @copyright Copyright (c) 2016, WordImpress
10 + * @copyright Copyright (c) 2016, GiveWP
11 11 * @license https://opensource.org/licenses/gpl-license GNU Public License
12 12 * @since 2.0
13 13 */
14 14 class Give_Email_Notification_Table extends WP_List_Table {
@@ -35,12 +35,14 @@
35 35 * @since 2.0
36 36 * @access public
37 37 */
38 38 public function __construct() {
39 - parent::__construct( array(
40 - 'singular' => __( 'Give Email Notification', 'give' ),
41 - 'plural' => __( 'Give Email Notifications', 'give' ),
42 - ) );
39 + parent::__construct(
40 + array(
41 + 'singular' => 'giveemailnotification',
42 + 'plural' => 'giveemailnotifications',
43 + )
44 + );
43 45
44 46 $this->email_notifications = Give_Email_Notifications::get_instance();
45 47 }
46 48
@@ -58,15 +60,18 @@
58 60 * Filter the table columns
59 61 *
60 62 * @since 2.0
61 63 */
62 - return apply_filters( 'give_email_notification_setting_columns', array(
63 - 'cb' => __( 'Email Status', 'give' ),
64 - 'name' => __( 'Email', 'give' ),
65 - 'email_type' => __( 'Content Type', 'give' ),
66 - 'recipient' => __( 'Recipient(s)', 'give' ),
67 - 'setting' => __( 'Edit Email', 'give' ),
68 - ) );
64 + return apply_filters(
65 + 'give_email_notification_setting_columns',
66 + array(
67 + 'cb' => __( 'Email Status', 'give' ),
68 + 'name' => __( 'Email', 'give' ),
69 + 'email_type' => __( 'Content Type', 'give' ),
70 + 'recipient' => __( 'Recipient(s)', 'give' ),
71 + 'setting' => __( 'Edit Email', 'give' ),
72 + )
73 + );
69 74 }
70 75
71 76 /**
72 77 * Get name column.
@@ -107,9 +112,9 @@
107 112 */
108 113 public function column_recipient( $email ) {
109 114 ob_start();
110 115
111 - if( Give_Email_Notification_Util::has_recipient_field( $email ) ) {
116 + if ( Give_Email_Notification_Util::has_recipient_field( $email ) ) {
112 117 $recipients = $email->get_recipient();
113 118 if ( is_array( $recipients ) ) {
114 119 $recipients = implode( '<br>', $recipients );
115 120 }
@@ -146,9 +151,9 @@
146 151 'data-edit' => $user_can_edit_status,
147 152 );
148 153
149 154 if ( ! $user_can_edit_status ) {
150 - $icon_classes = 'dashicons dashicons-lock';
155 + $icon_classes = 'dashicons dashicons-lock';
151 156
152 157 $attributes['data-notice'] = esc_attr( $email->config['notices']['non-notification-status-editable'] );
153 158 }
154 159
@@ -192,16 +197,18 @@
192 197 *
193 198 * @return string
194 199 */
195 200 public function column_setting( Give_Email_Notification $email ) {
196 - return Give()->tooltips->render_link( array(
197 - 'label' => __( 'Edit', 'give' ) . " {$email->config['label']}",
198 - 'tag_content' => '<span class="dashicons dashicons-admin-generic"></span>',
199 - 'link' => esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails&section=' . $email->config['id'] ) ),
200 - 'attributes' => array(
201 - 'class' => 'button button-small',
202 - ),
203 - ) );
201 + return Give()->tooltips->render_link(
202 + array(
203 + 'label' => __( 'Edit', 'give' ) . " {$email->config['label']}",
204 + 'tag_content' => '<span class="dashicons dashicons-admin-generic"></span>',
205 + 'link' => esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails&section=' . $email->config['id'] ) ),
206 + 'attributes' => array(
207 + 'class' => 'button button-small',
208 + ),
209 + )
210 + );
204 211 }
205 212
206 213
207 214 /**
@@ -249,22 +256,45 @@
249 256 $email_notifications = array();
250 257 $sortable = $this->get_sortable_columns();
251 258 $this->_column_headers = array( $columns, $hidden, $sortable, $this->get_primary_column_name() );
252 259
260 + // Get email section
261 + $current_section = give_get_current_setting_section();
262 +
253 263 // Set email notifications.
254 264 /* @var Give_Email_Notification $email_notification */
255 265 foreach ( $this->email_notifications->get_email_notifications() as $email_notification ) {
256 - if ( Give_Email_Notification_Util::is_show_on_emails_setting_page( $email_notification ) ) {
257 - $email_notifications[] = $email_notification;
258 - }
259 - }
266 + if ( ! Give_Email_Notification_Util::is_show_on_emails_setting_page($email_notification)) {
267 + continue;
268 + }
260 269
261 - $totalItems = count( $email_notifications );
270 + if ('donor-email' === $current_section) {
271 + // Add donor emails to email array list.
272 + if (empty($email_notification->config['has_recipient_field'])) {
273 + $email_notifications[] = $email_notification;
274 + }
275 + } elseif ('admin-email' === $current_section) {
276 + // Add admin emails to email array list.
277 + if ( ! empty($email_notification->config['has_recipient_field'])) {
278 + $email_notifications[] = $email_notification;
279 + }
280 + }
281 +
282 + /**
283 + * @since 2.23.0
284 + */
285 + $email_notifications = apply_filters('give_email_notification_table_items', $email_notifications,
286 + $email_notification, $current_section);
287 + }
288 +
289 + $total_items = count( $email_notifications );
262 290 $this->items = $email_notifications;
263 - $this->set_pagination_args( array(
264 - 'total_items' => $totalItems,
265 - 'per_page' => $this->per_page,
266 - ) );
291 + $this->set_pagination_args(
292 + array(
293 + 'total_items' => $total_items,
294 + 'per_page' => $this->per_page,
295 + )
296 + );
267 297 }
268 298
269 299 /**
270 300 * Message to be displayed when there are no items