CustomizerTrait.php
5 years ago
DefaultTemplateCustomizer.php
3 years ago
EmailSettingsPage.php
1 year ago
WPListTable.php
4 years ago
email-template-preview.php
5 years ago
WPListTable.php
82 lines
| 1 | <?php |
| 2 | |
| 3 | namespace ProfilePress\Core\Admin\SettingsPages\EmailSettings; |
| 4 | |
| 5 | class WPListTable extends \WP_List_Table |
| 6 | { |
| 7 | public $items; |
| 8 | |
| 9 | public function __construct($data) |
| 10 | { |
| 11 | $this->items = $data; |
| 12 | |
| 13 | parent::__construct(array( |
| 14 | 'singular' => 'pp-email-notification', |
| 15 | 'plural' => 'pp-email-notifications', |
| 16 | 'ajax' => false |
| 17 | )); |
| 18 | |
| 19 | } |
| 20 | |
| 21 | public function no_items() |
| 22 | { |
| 23 | _e('No email available.', 'wp-user-avatar'); |
| 24 | } |
| 25 | |
| 26 | public function get_columns() |
| 27 | { |
| 28 | $columns = [ |
| 29 | 'title' => esc_html__('Email', 'wp-user-avatar'), |
| 30 | 'recipient' => esc_html__('Recipient', 'wp-user-avatar'), |
| 31 | 'configure' => '' |
| 32 | ]; |
| 33 | |
| 34 | return $columns; |
| 35 | } |
| 36 | |
| 37 | public function display_tablenav($which) |
| 38 | { |
| 39 | return ''; |
| 40 | } |
| 41 | |
| 42 | public function column_default($item, $column_name) |
| 43 | { |
| 44 | $url = esc_url(remove_query_arg(wp_removable_query_args(),add_query_arg('type', sanitize_text_field($item['key'])))); |
| 45 | |
| 46 | if ($column_name == 'configure') { |
| 47 | return '<a class="button pp-email-configure" href="' . $url . '"><span class="dashicons dashicons-admin-generic"></span></a>'; |
| 48 | } |
| 49 | |
| 50 | return isset($item[$column_name]) ? $item[$column_name] : ''; |
| 51 | } |
| 52 | |
| 53 | public function column_title($item) |
| 54 | { |
| 55 | $key = sanitize_text_field($item['key']); |
| 56 | $class = 'dashicons pp-email-notification-status dashicons-no-alt'; |
| 57 | |
| 58 | if (ppress_get_setting($key . '_email_enabled', 'on') == 'on') { |
| 59 | $class = 'dashicons pp-email-notification-status dashicons-yes'; |
| 60 | $class .= ' pp-is-active '; |
| 61 | } |
| 62 | |
| 63 | $url = esc_url_raw(remove_query_arg(wp_removable_query_args(),add_query_arg('type', $key))); |
| 64 | $flag = '<span class="' . $class . '"></span>'; |
| 65 | |
| 66 | $hint = ''; |
| 67 | if ( ! empty($item['description'])) { |
| 68 | $hint = sprintf( |
| 69 | ' <span class="ppress-hint-tooltip ppress-hint-wrap hint--top hint--medium hint--bounce" aria-label="%s"><span class="dashicons dashicons-editor-help"></span></span>', |
| 70 | esc_attr($item['description']) |
| 71 | ); |
| 72 | } |
| 73 | |
| 74 | return sprintf('%s<strong><a href="%s">%s</a>%s</strong>', $flag, $url, esc_html($item['title']), $hint); |
| 75 | } |
| 76 | |
| 77 | public function prepare_items() |
| 78 | { |
| 79 | $this->_column_headers = $this->get_column_info(); |
| 80 | } |
| 81 | } |
| 82 |