Completed
Branch fix-dummy-related-question-qst... (e5efcf)
by
unknown
07:49 queued 03:45
created
Paypal_Standard/templates/paypal_standard_intro.template.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@
 block discarded – undo
3 3
 // if this is decaf, which is put on WordPress.org, we need to inform users that
4 4
 // we just put an affiliate link there. See https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/ section 12
5 5
 if (apply_filters('FHEE__ee_show_affiliate_links', true)) {
6
-    $closing_tag .= esc_html__(' (affiliate link)', 'event_espresso');
6
+	$closing_tag .= esc_html__(' (affiliate link)', 'event_espresso');
7 7
 }
8 8
 printf(
9
-    esc_html__(
10
-        'PayPal Standard (PayPal Payments Standard) is an off-site payment method and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.',
11
-        'event_espresso'
12
-    ),
13
-    '<a href="https://eventespresso.com/go/paypalstandard/" target="_blank">',
14
-    $closing_tag
9
+	esc_html__(
10
+		'PayPal Standard (PayPal Payments Standard) is an off-site payment method and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.',
11
+		'event_espresso'
12
+	),
13
+	'<a href="https://eventespresso.com/go/paypalstandard/" target="_blank">',
14
+	$closing_tag
15 15
 );
Please login to merge, or discard this patch.
caffeinated/admin/new/tickets/Tickets_Admin_Page.core.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
         $limit = array($offset, $per_page);
217 217
 
218 218
         if (isset($this->_req_data['s'])) {
219
-            $sstr = '%' . $this->_req_data['s'] . '%';
219
+            $sstr = '%'.$this->_req_data['s'].'%';
220 220
             $_where['OR'] = array(
221 221
                 'TKT_name'        => array('LIKE', $sstr),
222 222
                 'TKT_description' => array('LIKE', $sstr),
@@ -245,18 +245,18 @@  discard block
 block discarded – undo
245 245
         $TKT = EEM_Ticket::instance();
246 246
 
247 247
         // checkboxes?
248
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
248
+        if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
249 249
             // if array has more than one element then success message should be plural
250 250
             $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
251 251
 
252 252
             // cycle thru the boxes
253 253
             while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
254 254
                 if ($trash) {
255
-                    if (! $TKT->delete_by_ID($TKT_ID)) {
255
+                    if ( ! $TKT->delete_by_ID($TKT_ID)) {
256 256
                         $success = 0;
257 257
                     }
258 258
                 } else {
259
-                    if (! $TKT->restore_by_ID($TKT_ID)) {
259
+                    if ( ! $TKT->restore_by_ID($TKT_ID)) {
260 260
                         $success = 0;
261 261
                     }
262 262
                 }
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
             $TKT_ID = absint($this->_req_data['TKT_ID']);
267 267
 
268 268
             if ($trash) {
269
-                if (! $TKT->delete_by_ID($TKT_ID)) {
269
+                if ( ! $TKT->delete_by_ID($TKT_ID)) {
270 270
                     $success = 0;
271 271
                 }
272 272
             } else {
273
-                if (! $TKT->restore_by_ID($TKT_ID)) {
273
+                if ( ! $TKT->restore_by_ID($TKT_ID)) {
274 274
                     $success = 0;
275 275
                 }
276 276
             }
@@ -288,21 +288,21 @@  discard block
 block discarded – undo
288 288
         $TKT = EEM_Ticket::instance();
289 289
 
290 290
         // checkboxes?
291
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
291
+        if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
292 292
             // if array has more than one element then success message should be plural
293 293
             $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
294 294
 
295 295
             // cycle thru the boxes
296 296
             while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
297 297
                 // delete
298
-                if (! $this->_delete_the_ticket($TKT_ID)) {
298
+                if ( ! $this->_delete_the_ticket($TKT_ID)) {
299 299
                     $success = 0;
300 300
                 }
301 301
             }
302 302
         } else {
303 303
             // grab single id and trash
304 304
             $TKT_ID = absint($this->_req_data['TKT_ID']);
305
-            if (! $this->_delete_the_ticket($TKT_ID)) {
305
+            if ( ! $this->_delete_the_ticket($TKT_ID)) {
306 306
                 $success = 0;
307 307
             }
308 308
         }
Please login to merge, or discard this patch.
Indentation   +308 added lines, -308 removed lines patch added patch discarded remove patch
@@ -11,312 +11,312 @@
 block discarded – undo
11 11
  */
12 12
 class Tickets_Admin_Page extends EE_Admin_Page
13 13
 {
14
-    protected function _init_page_props()
15
-    {
16
-        $this->page_slug = TICKETS_PG_SLUG;
17
-        $this->page_label = TICKETS_LABEL;
18
-        $this->_admin_base_url = TICKETS_ADMIN_URL;
19
-        $this->_admin_base_path = TICKETS_ADMIN;
20
-    }
21
-
22
-
23
-    protected function _ajax_hooks()
24
-    {
25
-    }
26
-
27
-
28
-    protected function _define_page_props()
29
-    {
30
-        $this->_admin_page_title = TICKETS_LABEL;
31
-        $this->_labels = array(
32
-            'buttons' => array(
33
-                'add'    => esc_html__('Add New Default Ticket', 'event_espresso'),
34
-                'edit'   => esc_html__('Edit Default Ticket', 'event_espresso'),
35
-                'delete' => esc_html__('Delete Default Ticket', 'event_espresso'),
36
-            ),
37
-        );
38
-    }
39
-
40
-
41
-    protected function _set_page_routes()
42
-    {
43
-
44
-        $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID'])
45
-            ? $this->_req_data['TKT_ID'] : 0;
46
-
47
-        $this->_page_routes = array(
48
-            'default'         => array(
49
-                'func'       => '_tickets_overview_list_table',
50
-                'capability' => 'ee_read_default_tickets',
51
-            ),
52
-            'trash_ticket'    => array(
53
-                'func'       => '_trash_or_restore_ticket',
54
-                'noheader'   => true,
55
-                'args'       => array('trash' => true),
56
-                'capability' => 'ee_delete_default_ticket',
57
-                'obj_id'     => $tkt_id,
58
-            ),
59
-            'trash_tickets'   => array(
60
-                'func'       => '_trash_or_restore_ticket',
61
-                'noheader'   => true,
62
-                'args'       => array('trash' => true),
63
-                'capability' => 'ee_delete_default_tickets',
64
-            ),
65
-            'restore_ticket'  => array(
66
-                'func'       => '_trash_or_restore_ticket',
67
-                'noheader'   => true,
68
-                'capability' => 'ee_delete_default_ticket',
69
-                'obj_id'     => $tkt_id,
70
-            ),
71
-            'restore_tickets' => array(
72
-                'func'       => '_trash_or_restore_ticket',
73
-                'noheader'   => true,
74
-                'capability' => 'ee_delete_default_tickets',
75
-            ),
76
-            'delete_ticket'   => array(
77
-                'func'       => '_delete_ticket',
78
-                'noheader'   => true,
79
-                'capability' => 'ee_delete_default_ticket',
80
-                'obj_id'     => $tkt_id,
81
-            ),
82
-            'delete_tickets'  => array(
83
-                'func'       => '_delete_ticket',
84
-                'noheader'   => true,
85
-                'capability' => 'ee_delete_default_tickets',
86
-            ),
87
-        );
88
-    }
89
-
90
-
91
-    protected function _set_page_config()
92
-    {
93
-        $this->_page_config = array(
94
-            'default' => array(
95
-                'nav'           => array(
96
-                    'label' => esc_html__('Default Tickets', 'event_espresso'),
97
-                    'order' => 10,
98
-                ),
99
-                'list_table'    => 'Tickets_List_Table',
100
-                'require_nonce' => false,
101
-            ),
102
-        );
103
-    }
104
-
105
-
106
-    protected function _add_screen_options()
107
-    {
108
-    }
109
-
110
-    protected function _add_screen_options_default()
111
-    {
112
-        $this->_per_page_screen_option();
113
-    }
114
-
115
-
116
-    protected function _add_feature_pointers()
117
-    {
118
-    }
119
-
120
-    public function load_scripts_styles()
121
-    {
122
-    }
123
-
124
-    public function load_scripts_styles_default()
125
-    {
126
-    }
127
-
128
-    public function admin_footer_scripts()
129
-    {
130
-    }
131
-
132
-    public function admin_init()
133
-    {
134
-    }
135
-
136
-    public function admin_notices()
137
-    {
138
-    }
139
-
140
-
141
-    public function _set_list_table_views_default()
142
-    {
143
-        $this->_views = array(
144
-            'all'     => array(
145
-                'slug'        => 'all',
146
-                'label'       => esc_html__('All', 'event_espresso'),
147
-                'count'       => 0,
148
-                'bulk_action' => array(
149
-                    'trash_tickets' => esc_html__('Move to Trash', 'event_espresso'),
150
-                ),
151
-            ),
152
-            'trashed' => array(
153
-                'slug'        => 'trashed',
154
-                'label'       => esc_html__('Trash', 'event_espresso'),
155
-                'count'       => 0,
156
-                'bulk_action' => array(
157
-                    'restore_tickets' => esc_html__('Restore from Trash', 'event_espresso'),
158
-                    'delete_tickets'  => esc_html__('Delete Permanently', 'event_espresso'),
159
-                ),
160
-            ),
161
-        );
162
-    }
163
-
164
-
165
-    public function _tickets_overview_list_table()
166
-    {
167
-        $this->_search_btn_label = esc_html__('Tickets', 'event_espresso');
168
-        $this->display_admin_list_table_page_with_no_sidebar();
169
-    }
170
-
171
-
172
-    public function get_default_tickets($per_page = 10, $count = false, $trashed = false)
173
-    {
174
-
175
-        $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby'];
176
-        $order = empty($this->_req_data['order']) ? 'ASC' : $order;
177
-
178
-        switch ($orderby) {
179
-            case 'TKT_name':
180
-                $orderby = array('TKT_name' => $order);
181
-                break;
182
-
183
-            case 'TKT_price':
184
-                $orderby = array('TKT_price' => $order);
185
-                break;
186
-
187
-            case 'TKT_uses':
188
-                $orderby = array('TKT_uses' => $order);
189
-                break;
190
-
191
-            case 'TKT_min':
192
-                $orderby = array('TKT_min' => $order);
193
-                break;
194
-
195
-            case 'TKT_max':
196
-                $orderby = array('TKT_max' => $order);
197
-                break;
198
-
199
-            case 'TKT_qty':
200
-                $orderby = array('TKT_qty' => $order);
201
-                break;
202
-        }
203
-
204
-        $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged'])
205
-            ? $this->_req_data['paged'] : 1;
206
-        $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage'])
207
-            ? $this->_req_data['perpage'] : $per_page;
208
-
209
-        $_where = array(
210
-            'TKT_is_default' => 1,
211
-            'TKT_deleted'    => $trashed,
212
-        );
213
-
214
-        $offset = ($current_page - 1) * $per_page;
215
-        $limit = array($offset, $per_page);
216
-
217
-        if (isset($this->_req_data['s'])) {
218
-            $sstr = '%' . $this->_req_data['s'] . '%';
219
-            $_where['OR'] = array(
220
-                'TKT_name'        => array('LIKE', $sstr),
221
-                'TKT_description' => array('LIKE', $sstr),
222
-            );
223
-        }
224
-
225
-        $query_params = array(
226
-            $_where,
227
-            'order_by' => $orderby,
228
-            'limit'    => $limit,
229
-            'group_by' => 'TKT_ID',
230
-        );
231
-
232
-        if ($count) {
233
-            return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where));
234
-        } else {
235
-            return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params);
236
-        }
237
-    }
238
-
239
-
240
-    protected function _trash_or_restore_ticket($trash = false)
241
-    {
242
-        $success = 1;
243
-
244
-        $TKT = EEM_Ticket::instance();
245
-
246
-        // checkboxes?
247
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
248
-            // if array has more than one element then success message should be plural
249
-            $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
250
-
251
-            // cycle thru the boxes
252
-            while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
253
-                if ($trash) {
254
-                    if (! $TKT->delete_by_ID($TKT_ID)) {
255
-                        $success = 0;
256
-                    }
257
-                } else {
258
-                    if (! $TKT->restore_by_ID($TKT_ID)) {
259
-                        $success = 0;
260
-                    }
261
-                }
262
-            }
263
-        } else {
264
-            // grab single id and trash
265
-            $TKT_ID = absint($this->_req_data['TKT_ID']);
266
-
267
-            if ($trash) {
268
-                if (! $TKT->delete_by_ID($TKT_ID)) {
269
-                    $success = 0;
270
-                }
271
-            } else {
272
-                if (! $TKT->restore_by_ID($TKT_ID)) {
273
-                    $success = 0;
274
-                }
275
-            }
276
-        }
277
-
278
-        $action_desc = $trash ? 'moved to the trash' : 'restored';
279
-        $this->_redirect_after_action($success, 'Tickets', $action_desc, array());
280
-    }
281
-
282
-
283
-    protected function _delete_ticket()
284
-    {
285
-        $success = 1;
286
-
287
-        $TKT = EEM_Ticket::instance();
288
-
289
-        // checkboxes?
290
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
291
-            // if array has more than one element then success message should be plural
292
-            $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
293
-
294
-            // cycle thru the boxes
295
-            while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
296
-                // delete
297
-                if (! $this->_delete_the_ticket($TKT_ID)) {
298
-                    $success = 0;
299
-                }
300
-            }
301
-        } else {
302
-            // grab single id and trash
303
-            $TKT_ID = absint($this->_req_data['TKT_ID']);
304
-            if (! $this->_delete_the_ticket($TKT_ID)) {
305
-                $success = 0;
306
-            }
307
-        }
308
-
309
-        $action_desc = 'deleted';
310
-        $this->_redirect_after_action($success, 'Tickets', $action_desc, array());
311
-    }
312
-
313
-
314
-    protected function _delete_the_ticket($TKT_ID)
315
-    {
316
-        $tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID);
317
-
318
-        // delete all related prices first
319
-        $tkt->delete_related_permanently('Price');
320
-        return $tkt->delete_permanently();
321
-    }
14
+	protected function _init_page_props()
15
+	{
16
+		$this->page_slug = TICKETS_PG_SLUG;
17
+		$this->page_label = TICKETS_LABEL;
18
+		$this->_admin_base_url = TICKETS_ADMIN_URL;
19
+		$this->_admin_base_path = TICKETS_ADMIN;
20
+	}
21
+
22
+
23
+	protected function _ajax_hooks()
24
+	{
25
+	}
26
+
27
+
28
+	protected function _define_page_props()
29
+	{
30
+		$this->_admin_page_title = TICKETS_LABEL;
31
+		$this->_labels = array(
32
+			'buttons' => array(
33
+				'add'    => esc_html__('Add New Default Ticket', 'event_espresso'),
34
+				'edit'   => esc_html__('Edit Default Ticket', 'event_espresso'),
35
+				'delete' => esc_html__('Delete Default Ticket', 'event_espresso'),
36
+			),
37
+		);
38
+	}
39
+
40
+
41
+	protected function _set_page_routes()
42
+	{
43
+
44
+		$tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID'])
45
+			? $this->_req_data['TKT_ID'] : 0;
46
+
47
+		$this->_page_routes = array(
48
+			'default'         => array(
49
+				'func'       => '_tickets_overview_list_table',
50
+				'capability' => 'ee_read_default_tickets',
51
+			),
52
+			'trash_ticket'    => array(
53
+				'func'       => '_trash_or_restore_ticket',
54
+				'noheader'   => true,
55
+				'args'       => array('trash' => true),
56
+				'capability' => 'ee_delete_default_ticket',
57
+				'obj_id'     => $tkt_id,
58
+			),
59
+			'trash_tickets'   => array(
60
+				'func'       => '_trash_or_restore_ticket',
61
+				'noheader'   => true,
62
+				'args'       => array('trash' => true),
63
+				'capability' => 'ee_delete_default_tickets',
64
+			),
65
+			'restore_ticket'  => array(
66
+				'func'       => '_trash_or_restore_ticket',
67
+				'noheader'   => true,
68
+				'capability' => 'ee_delete_default_ticket',
69
+				'obj_id'     => $tkt_id,
70
+			),
71
+			'restore_tickets' => array(
72
+				'func'       => '_trash_or_restore_ticket',
73
+				'noheader'   => true,
74
+				'capability' => 'ee_delete_default_tickets',
75
+			),
76
+			'delete_ticket'   => array(
77
+				'func'       => '_delete_ticket',
78
+				'noheader'   => true,
79
+				'capability' => 'ee_delete_default_ticket',
80
+				'obj_id'     => $tkt_id,
81
+			),
82
+			'delete_tickets'  => array(
83
+				'func'       => '_delete_ticket',
84
+				'noheader'   => true,
85
+				'capability' => 'ee_delete_default_tickets',
86
+			),
87
+		);
88
+	}
89
+
90
+
91
+	protected function _set_page_config()
92
+	{
93
+		$this->_page_config = array(
94
+			'default' => array(
95
+				'nav'           => array(
96
+					'label' => esc_html__('Default Tickets', 'event_espresso'),
97
+					'order' => 10,
98
+				),
99
+				'list_table'    => 'Tickets_List_Table',
100
+				'require_nonce' => false,
101
+			),
102
+		);
103
+	}
104
+
105
+
106
+	protected function _add_screen_options()
107
+	{
108
+	}
109
+
110
+	protected function _add_screen_options_default()
111
+	{
112
+		$this->_per_page_screen_option();
113
+	}
114
+
115
+
116
+	protected function _add_feature_pointers()
117
+	{
118
+	}
119
+
120
+	public function load_scripts_styles()
121
+	{
122
+	}
123
+
124
+	public function load_scripts_styles_default()
125
+	{
126
+	}
127
+
128
+	public function admin_footer_scripts()
129
+	{
130
+	}
131
+
132
+	public function admin_init()
133
+	{
134
+	}
135
+
136
+	public function admin_notices()
137
+	{
138
+	}
139
+
140
+
141
+	public function _set_list_table_views_default()
142
+	{
143
+		$this->_views = array(
144
+			'all'     => array(
145
+				'slug'        => 'all',
146
+				'label'       => esc_html__('All', 'event_espresso'),
147
+				'count'       => 0,
148
+				'bulk_action' => array(
149
+					'trash_tickets' => esc_html__('Move to Trash', 'event_espresso'),
150
+				),
151
+			),
152
+			'trashed' => array(
153
+				'slug'        => 'trashed',
154
+				'label'       => esc_html__('Trash', 'event_espresso'),
155
+				'count'       => 0,
156
+				'bulk_action' => array(
157
+					'restore_tickets' => esc_html__('Restore from Trash', 'event_espresso'),
158
+					'delete_tickets'  => esc_html__('Delete Permanently', 'event_espresso'),
159
+				),
160
+			),
161
+		);
162
+	}
163
+
164
+
165
+	public function _tickets_overview_list_table()
166
+	{
167
+		$this->_search_btn_label = esc_html__('Tickets', 'event_espresso');
168
+		$this->display_admin_list_table_page_with_no_sidebar();
169
+	}
170
+
171
+
172
+	public function get_default_tickets($per_page = 10, $count = false, $trashed = false)
173
+	{
174
+
175
+		$orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby'];
176
+		$order = empty($this->_req_data['order']) ? 'ASC' : $order;
177
+
178
+		switch ($orderby) {
179
+			case 'TKT_name':
180
+				$orderby = array('TKT_name' => $order);
181
+				break;
182
+
183
+			case 'TKT_price':
184
+				$orderby = array('TKT_price' => $order);
185
+				break;
186
+
187
+			case 'TKT_uses':
188
+				$orderby = array('TKT_uses' => $order);
189
+				break;
190
+
191
+			case 'TKT_min':
192
+				$orderby = array('TKT_min' => $order);
193
+				break;
194
+
195
+			case 'TKT_max':
196
+				$orderby = array('TKT_max' => $order);
197
+				break;
198
+
199
+			case 'TKT_qty':
200
+				$orderby = array('TKT_qty' => $order);
201
+				break;
202
+		}
203
+
204
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged'])
205
+			? $this->_req_data['paged'] : 1;
206
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage'])
207
+			? $this->_req_data['perpage'] : $per_page;
208
+
209
+		$_where = array(
210
+			'TKT_is_default' => 1,
211
+			'TKT_deleted'    => $trashed,
212
+		);
213
+
214
+		$offset = ($current_page - 1) * $per_page;
215
+		$limit = array($offset, $per_page);
216
+
217
+		if (isset($this->_req_data['s'])) {
218
+			$sstr = '%' . $this->_req_data['s'] . '%';
219
+			$_where['OR'] = array(
220
+				'TKT_name'        => array('LIKE', $sstr),
221
+				'TKT_description' => array('LIKE', $sstr),
222
+			);
223
+		}
224
+
225
+		$query_params = array(
226
+			$_where,
227
+			'order_by' => $orderby,
228
+			'limit'    => $limit,
229
+			'group_by' => 'TKT_ID',
230
+		);
231
+
232
+		if ($count) {
233
+			return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where));
234
+		} else {
235
+			return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params);
236
+		}
237
+	}
238
+
239
+
240
+	protected function _trash_or_restore_ticket($trash = false)
241
+	{
242
+		$success = 1;
243
+
244
+		$TKT = EEM_Ticket::instance();
245
+
246
+		// checkboxes?
247
+		if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
248
+			// if array has more than one element then success message should be plural
249
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
250
+
251
+			// cycle thru the boxes
252
+			while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
253
+				if ($trash) {
254
+					if (! $TKT->delete_by_ID($TKT_ID)) {
255
+						$success = 0;
256
+					}
257
+				} else {
258
+					if (! $TKT->restore_by_ID($TKT_ID)) {
259
+						$success = 0;
260
+					}
261
+				}
262
+			}
263
+		} else {
264
+			// grab single id and trash
265
+			$TKT_ID = absint($this->_req_data['TKT_ID']);
266
+
267
+			if ($trash) {
268
+				if (! $TKT->delete_by_ID($TKT_ID)) {
269
+					$success = 0;
270
+				}
271
+			} else {
272
+				if (! $TKT->restore_by_ID($TKT_ID)) {
273
+					$success = 0;
274
+				}
275
+			}
276
+		}
277
+
278
+		$action_desc = $trash ? 'moved to the trash' : 'restored';
279
+		$this->_redirect_after_action($success, 'Tickets', $action_desc, array());
280
+	}
281
+
282
+
283
+	protected function _delete_ticket()
284
+	{
285
+		$success = 1;
286
+
287
+		$TKT = EEM_Ticket::instance();
288
+
289
+		// checkboxes?
290
+		if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
291
+			// if array has more than one element then success message should be plural
292
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
293
+
294
+			// cycle thru the boxes
295
+			while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
296
+				// delete
297
+				if (! $this->_delete_the_ticket($TKT_ID)) {
298
+					$success = 0;
299
+				}
300
+			}
301
+		} else {
302
+			// grab single id and trash
303
+			$TKT_ID = absint($this->_req_data['TKT_ID']);
304
+			if (! $this->_delete_the_ticket($TKT_ID)) {
305
+				$success = 0;
306
+			}
307
+		}
308
+
309
+		$action_desc = 'deleted';
310
+		$this->_redirect_after_action($success, 'Tickets', $action_desc, array());
311
+	}
312
+
313
+
314
+	protected function _delete_the_ticket($TKT_ID)
315
+	{
316
+		$tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID);
317
+
318
+		// delete all related prices first
319
+		$tkt->delete_related_permanently('Price');
320
+		return $tkt->delete_permanently();
321
+	}
322 322
 }
Please login to merge, or discard this patch.
caffeinated/admin/extend/support/Extend_Support_Admin_Page.core.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,13 +15,13 @@  discard block
 block discarded – undo
15 15
     public function __construct($routing = true)
16 16
     {
17 17
         parent::__construct($routing);
18
-        define('EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'support/templates/');
18
+        define('EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'support/templates/');
19 19
     }
20 20
 
21 21
 
22 22
     protected function _extend_page_config()
23 23
     {
24
-        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'support';
24
+        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'support';
25 25
         // new routes and new configs (or overrides )
26 26
         $new_page_routes = array(
27 27
             'faq' => array(
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
     protected function _faq()
49 49
     {
50
-        $template_path = EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH . 'support_admin_details_faq.template.php';
50
+        $template_path = EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH.'support_admin_details_faq.template.php';
51 51
         $this->_template_args['admin_page_content'] = EEH_Template::display_template(
52 52
             $template_path,
53 53
             '',
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         add_meta_box(
67 67
             'espresso_additional_information_support',
68 68
             esc_html__('Additional Information', 'event_espresso'),
69
-            function ($post, $metabox) {
69
+            function($post, $metabox) {
70 70
                 echo EEH_Template::display_template(
71 71
                     $metabox['args']['template_path'],
72 72
                     '',
Please login to merge, or discard this patch.
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -11,71 +11,71 @@
 block discarded – undo
11 11
  */
12 12
 class Extend_Support_Admin_Page extends Support_Admin_Page
13 13
 {
14
-    public function __construct($routing = true)
15
-    {
16
-        parent::__construct($routing);
17
-        define('EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'support/templates/');
18
-    }
14
+	public function __construct($routing = true)
15
+	{
16
+		parent::__construct($routing);
17
+		define('EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'support/templates/');
18
+	}
19 19
 
20 20
 
21
-    protected function _extend_page_config()
22
-    {
23
-        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'support';
24
-        // new routes and new configs (or overrides )
25
-        $new_page_routes = array(
26
-            'faq' => array(
27
-                'func'       => '_faq',
28
-                'capability' => 'ee_read_ee',
29
-            ),
30
-        );
31
-        $this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
32
-        $new_page_config = array(
33
-            'faq' => array(
34
-                'nav'           => array(
35
-                    'label' => esc_html__('FAQ', 'event_espresso'),
36
-                    'order' => 40,
37
-                ),
38
-                'metaboxes'     => array('_espresso_news_post_box', '_espresso_links_post_box'),
39
-                'require_nonce' => false,
40
-            ),
41
-        );
42
-        $this->_page_config = array_merge($this->_page_config, $new_page_config);
43
-        $this->_page_config['default']['metaboxes'][] = '_installation_boxes';
44
-    }
21
+	protected function _extend_page_config()
22
+	{
23
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'support';
24
+		// new routes and new configs (or overrides )
25
+		$new_page_routes = array(
26
+			'faq' => array(
27
+				'func'       => '_faq',
28
+				'capability' => 'ee_read_ee',
29
+			),
30
+		);
31
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
32
+		$new_page_config = array(
33
+			'faq' => array(
34
+				'nav'           => array(
35
+					'label' => esc_html__('FAQ', 'event_espresso'),
36
+					'order' => 40,
37
+				),
38
+				'metaboxes'     => array('_espresso_news_post_box', '_espresso_links_post_box'),
39
+				'require_nonce' => false,
40
+			),
41
+		);
42
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
43
+		$this->_page_config['default']['metaboxes'][] = '_installation_boxes';
44
+	}
45 45
 
46 46
 
47
-    protected function _faq()
48
-    {
49
-        $template_path = EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH . 'support_admin_details_faq.template.php';
50
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
51
-            $template_path,
52
-            '',
53
-            true
54
-        );
55
-        $this->display_admin_page_with_sidebar();
56
-    }
47
+	protected function _faq()
48
+	{
49
+		$template_path = EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH . 'support_admin_details_faq.template.php';
50
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
51
+			$template_path,
52
+			'',
53
+			true
54
+		);
55
+		$this->display_admin_page_with_sidebar();
56
+	}
57 57
 
58 58
 
59
-    protected function _installation_boxes()
60
-    {
61
-        $callback_args = array(
62
-            'template_path' => EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH
63
-                               . 'support_admin_details_additional_information.template.php',
64
-        );
65
-        add_meta_box(
66
-            'espresso_additional_information_support',
67
-            esc_html__('Additional Information', 'event_espresso'),
68
-            function ($post, $metabox) {
69
-                echo EEH_Template::display_template(
70
-                    $metabox['args']['template_path'],
71
-                    '',
72
-                    true
73
-                );
74
-            },
75
-            $this->_current_screen->id,
76
-            'normal',
77
-            'high',
78
-            $callback_args
79
-        );
80
-    }
59
+	protected function _installation_boxes()
60
+	{
61
+		$callback_args = array(
62
+			'template_path' => EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH
63
+							   . 'support_admin_details_additional_information.template.php',
64
+		);
65
+		add_meta_box(
66
+			'espresso_additional_information_support',
67
+			esc_html__('Additional Information', 'event_espresso'),
68
+			function ($post, $metabox) {
69
+				echo EEH_Template::display_template(
70
+					$metabox['args']['template_path'],
71
+					'',
72
+					true
73
+				);
74
+			},
75
+			$this->_current_screen->id,
76
+			'normal',
77
+			'high',
78
+			$callback_args
79
+		);
80
+	}
81 81
 }
Please login to merge, or discard this patch.
admin/extend/support/templates/support_admin_details_faq.template.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@
 block discarded – undo
4 4
     <h4><?php esc_html_e('New to Event Espresso?', 'event_espresso'); ?></h4>
5 5
 
6 6
     <p><?php
7
-        printf(
8
-            esc_html__(
9
-                'Check out the %1$squick start guide for Event Espresso 4%2$s. It has recommendations, tips, and tutorials so you can get your project started %3$squicker%4$s.',
10
-                'event_espresso'
11
-            ),
12
-            '<a href="https://eventespresso.com/wiki/welcome-to-event-espresso/#event-espresso-4" target="_blank">',
13
-            '</a>',
14
-            '<em>',
15
-            '</em>'
16
-        ); ?></p>
7
+		printf(
8
+			esc_html__(
9
+				'Check out the %1$squick start guide for Event Espresso 4%2$s. It has recommendations, tips, and tutorials so you can get your project started %3$squicker%4$s.',
10
+				'event_espresso'
11
+			),
12
+			'<a href="https://eventespresso.com/wiki/welcome-to-event-espresso/#event-espresso-4" target="_blank">',
13
+			'</a>',
14
+			'<em>',
15
+			'</em>'
16
+		); ?></p>
17 17
 </div>
18 18
\ No newline at end of file
Please login to merge, or discard this patch.
caffeinated/admin/extend/messages/Extend_Messages_Admin_Page.core.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -21,17 +21,17 @@  discard block
 block discarded – undo
21 21
     public function __construct($routing = true)
22 22
     {
23 23
         parent::__construct($routing);
24
-        if (! defined('EE_MSG_CAF_ASSETS_PATH')) {
25
-            define('EE_MSG_CAF_ASSETS_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'messages/assets/');
26
-            define('EE_MSG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/');
27
-            define('EE_MSG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/');
28
-            define('EE_MSG_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/templates/');
24
+        if ( ! defined('EE_MSG_CAF_ASSETS_PATH')) {
25
+            define('EE_MSG_CAF_ASSETS_PATH', EE_CORE_CAF_ADMIN_EXTEND.'messages/assets/');
26
+            define('EE_MSG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/assets/');
27
+            define('EE_MSG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/');
28
+            define('EE_MSG_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/templates/');
29 29
         }
30 30
     }
31 31
 
32 32
     protected function _extend_page_config()
33 33
     {
34
-        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'messages';
34
+        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'messages';
35 35
         $this->_page_routes['custom_mtps'] = array(
36 36
             'func'       => '_ee_custom_messages_overview_list_table',
37 37
             'capability' => 'ee_read_messages',
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
     {
77 77
         global $admin_page_hooks;
78 78
 
79
-        if (! empty($admin_page_hooks['espresso_events'])) {
79
+        if ( ! empty($admin_page_hooks['espresso_events'])) {
80 80
             // we're on a EE specific page... good stuff!
81 81
             $hook_prefix = $admin_page_hooks['espresso_events'];
82
-            $filter_ref = $hook_prefix . '_page_' . $this->page_slug;
83
-            add_filter('FHEE_manage_' . $filter_ref . '_columns', array($this, 'add_custom_mtps_columns'), 10, 2);
82
+            $filter_ref = $hook_prefix.'_page_'.$this->page_slug;
83
+            add_filter('FHEE_manage_'.$filter_ref.'_columns', array($this, 'add_custom_mtps_columns'), 10, 2);
84 84
             add_action(
85
-                'AHEE__EE_Admin_List_Table__column_actions__' . $filter_ref,
85
+                'AHEE__EE_Admin_List_Table__column_actions__'.$filter_ref,
86 86
                 array($this, 'custom_mtp_create_button_column'),
87 87
                 10,
88 88
                 2
Please login to merge, or discard this patch.
Indentation   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -16,190 +16,190 @@
 block discarded – undo
16 16
  */
17 17
 class Extend_Messages_Admin_Page extends Messages_Admin_Page
18 18
 {
19
-    public function __construct($routing = true)
20
-    {
21
-        parent::__construct($routing);
22
-        if (! defined('EE_MSG_CAF_ASSETS_PATH')) {
23
-            define('EE_MSG_CAF_ASSETS_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'messages/assets/');
24
-            define('EE_MSG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/');
25
-            define('EE_MSG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/');
26
-            define('EE_MSG_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/templates/');
27
-        }
28
-    }
29
-
30
-    protected function _extend_page_config()
31
-    {
32
-        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'messages';
33
-        $this->_page_routes['custom_mtps'] = array(
34
-            'func'       => '_ee_custom_messages_overview_list_table',
35
-            'capability' => 'ee_read_messages',
36
-        );
37
-        $this->_page_config['custom_mtps'] = array(
38
-            'nav'           => array(
39
-                'label' => esc_html__('Custom Message Templates', 'event_espresso'),
40
-                'order' => 30,
41
-            ),
42
-            'list_table'    => 'Custom_Messages_Template_List_Table',
43
-            'help_tabs'     => array(
44
-                'message_overview_message_types_help_tab' => array(
45
-                    'title'    => esc_html__('Message Types', 'event_espresso'),
46
-                    'filename' => 'messages_overview_types',
47
-                ),
48
-                'messages_overview_messengers_help_tab'   => array(
49
-                    'title'    => esc_html__('Messengers', 'event_espresso'),
50
-                    'filename' => 'messages_overview_messengers',
51
-                ),
52
-                'messages_overview_other_help_tab'        => array(
53
-                    'title'    => esc_html__('Messages Other', 'event_espresso'),
54
-                    'filename' => 'messages_overview_other',
55
-                ),
56
-            ),
57
-            'require_nonce' => false,
58
-        );
59
-
60
-        add_action('current_screen', array($this, 'dynamic_screen_hooks'), 10);
61
-    }
62
-
63
-
64
-    /**
65
-     * Callback for current_screen action
66
-     * This is used for any filters and/or actions that require the dynamic screen hook_prefix to be correct.
67
-     *
68
-     * @since 4.5.0
69
-     *
70
-     * @return void
71
-     */
72
-    public function dynamic_screen_hooks()
73
-    {
74
-        global $admin_page_hooks;
75
-
76
-        if (! empty($admin_page_hooks['espresso_events'])) {
77
-            // we're on a EE specific page... good stuff!
78
-            $hook_prefix = $admin_page_hooks['espresso_events'];
79
-            $filter_ref = $hook_prefix . '_page_' . $this->page_slug;
80
-            add_filter('FHEE_manage_' . $filter_ref . '_columns', array($this, 'add_custom_mtps_columns'), 10, 2);
81
-            add_action(
82
-                'AHEE__EE_Admin_List_Table__column_actions__' . $filter_ref,
83
-                array($this, 'custom_mtp_create_button_column'),
84
-                10,
85
-                2
86
-            );
87
-        }
88
-    }
89
-
90
-
91
-    /**
92
-     * This is the callback for the FHEE__manage_event-espresso_page_espresso_messages_columns to register the
93
-     * caffeinated columns for the global message templates list table.
94
-     *
95
-     * @since 4.3.2
96
-     *
97
-     * @param array  $columns   Original defined list of columns
98
-     * @param string $screen_id The unique screen id for the page.
99
-     */
100
-    public function add_custom_mtps_columns($columns, $screen_id)
101
-    {
102
-        if ($screen_id !== 'espresso_messages_global_mtps') {
103
-            return $columns;
104
-        }
105
-
106
-        $columns['actions'] = '';
107
-        return $columns;
108
-    }
109
-
110
-
111
-    /**
112
-     * Callback for FHEE__EE_Admin_List_Table__column_actions__event-espresso_page_espresso_messages action that allows
113
-     * for adding the content for the registered "action" column.
114
-     *
115
-     * @since 4.3.2
116
-     *
117
-     * @param EE_Base_Class
118
-     * @param string $screen_id Unique screen id for the page
119
-     *
120
-     * @return string html content for the page.
121
-     */
122
-    public function custom_mtp_create_button_column($item, $screen_id)
123
-    {
124
-        if (
125
-            $screen_id !== 'espresso_messages_global_mtps' || ! EE_Registry::instance()->CAP->current_user_can(
126
-                'ee_edit_messages',
127
-                'espresso_messages_add_new_message_template'
128
-            )
129
-        ) {
130
-            return '';
131
-        }
132
-
133
-        // first we consider whether this template has override set.  If it does then that means no custom templates can be created from this template as a base.  So let's just skip the button creation.
134
-        if ($item->get('MTP_is_override')) {
135
-            return '';
136
-        }
137
-
138
-
139
-        $create_args = array(
140
-            'GRP_ID'       => $item->ID(),
141
-            'messenger'    => $item->messenger(),
142
-            'message_type' => $item->message_type(),
143
-            'action'       => 'add_new_message_template',
144
-        );
145
-        $create_link = EE_Admin_Page::add_query_args_and_nonce($create_args, EE_MSG_ADMIN_URL);
146
-        echo sprintf(
147
-            '<a href="%s" class="button button-small">%s</a>',
148
-            $create_link,
149
-            esc_html__('Create Custom', 'event_espresso')
150
-        );
151
-    }
152
-
153
-
154
-    protected function _add_screen_options_custom_mtps()
155
-    {
156
-        $page_title = $this->_admin_page_title;
157
-        $this->_admin_page_title = esc_html__('Custom Message Templates', 'event_espresso');
158
-        $this->_per_page_screen_option();
159
-        $this->_admin_page_title = $page_title;
160
-    }
161
-
162
-
163
-    /**
164
-     * set views array for Custom Templates list table
165
-     *
166
-     * @access public
167
-     * @return void
168
-     */
169
-    public function _set_list_table_views_custom_mtps()
170
-    {
171
-        $this->_views = array(
172
-            'in_use' => array(
173
-                'slug'        => 'in_use',
174
-                'label'       => esc_html__('In Use', 'event_espresso'),
175
-                'count'       => 0,
176
-                'bulk_action' => array(
177
-                    'trash_message_template' => esc_html__('Move to Trash', 'event_espresso'),
178
-                ),
179
-            ),
180
-        );
181
-        if (
182
-            EE_Registry::instance()->CAP->current_user_can(
183
-                'ee_delete_messages',
184
-                'espresso_messages_trash_message_template'
185
-            )
186
-        ) {
187
-            $this->_views['trashed'] = array(
188
-                'slug'        => 'trashed',
189
-                'label'       => esc_html__('Trash', 'event_espresso'),
190
-                'count'       => 0,
191
-                'bulk_action' => array(
192
-                    'restore_message_template' => esc_html__('Restore From Trash', 'event_espresso'),
193
-                    'delete_message_template'  => esc_html__('Delete Permanently', 'event_espresso'),
194
-                ),
195
-            );
196
-        }
197
-    }
198
-
199
-
200
-    protected function _ee_custom_messages_overview_list_table()
201
-    {
202
-        $this->_admin_page_title = esc_html__('Custom Message Templates', 'event_espresso');
203
-        $this->display_admin_list_table_page_with_no_sidebar();
204
-    }
19
+	public function __construct($routing = true)
20
+	{
21
+		parent::__construct($routing);
22
+		if (! defined('EE_MSG_CAF_ASSETS_PATH')) {
23
+			define('EE_MSG_CAF_ASSETS_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'messages/assets/');
24
+			define('EE_MSG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/');
25
+			define('EE_MSG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/');
26
+			define('EE_MSG_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/templates/');
27
+		}
28
+	}
29
+
30
+	protected function _extend_page_config()
31
+	{
32
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'messages';
33
+		$this->_page_routes['custom_mtps'] = array(
34
+			'func'       => '_ee_custom_messages_overview_list_table',
35
+			'capability' => 'ee_read_messages',
36
+		);
37
+		$this->_page_config['custom_mtps'] = array(
38
+			'nav'           => array(
39
+				'label' => esc_html__('Custom Message Templates', 'event_espresso'),
40
+				'order' => 30,
41
+			),
42
+			'list_table'    => 'Custom_Messages_Template_List_Table',
43
+			'help_tabs'     => array(
44
+				'message_overview_message_types_help_tab' => array(
45
+					'title'    => esc_html__('Message Types', 'event_espresso'),
46
+					'filename' => 'messages_overview_types',
47
+				),
48
+				'messages_overview_messengers_help_tab'   => array(
49
+					'title'    => esc_html__('Messengers', 'event_espresso'),
50
+					'filename' => 'messages_overview_messengers',
51
+				),
52
+				'messages_overview_other_help_tab'        => array(
53
+					'title'    => esc_html__('Messages Other', 'event_espresso'),
54
+					'filename' => 'messages_overview_other',
55
+				),
56
+			),
57
+			'require_nonce' => false,
58
+		);
59
+
60
+		add_action('current_screen', array($this, 'dynamic_screen_hooks'), 10);
61
+	}
62
+
63
+
64
+	/**
65
+	 * Callback for current_screen action
66
+	 * This is used for any filters and/or actions that require the dynamic screen hook_prefix to be correct.
67
+	 *
68
+	 * @since 4.5.0
69
+	 *
70
+	 * @return void
71
+	 */
72
+	public function dynamic_screen_hooks()
73
+	{
74
+		global $admin_page_hooks;
75
+
76
+		if (! empty($admin_page_hooks['espresso_events'])) {
77
+			// we're on a EE specific page... good stuff!
78
+			$hook_prefix = $admin_page_hooks['espresso_events'];
79
+			$filter_ref = $hook_prefix . '_page_' . $this->page_slug;
80
+			add_filter('FHEE_manage_' . $filter_ref . '_columns', array($this, 'add_custom_mtps_columns'), 10, 2);
81
+			add_action(
82
+				'AHEE__EE_Admin_List_Table__column_actions__' . $filter_ref,
83
+				array($this, 'custom_mtp_create_button_column'),
84
+				10,
85
+				2
86
+			);
87
+		}
88
+	}
89
+
90
+
91
+	/**
92
+	 * This is the callback for the FHEE__manage_event-espresso_page_espresso_messages_columns to register the
93
+	 * caffeinated columns for the global message templates list table.
94
+	 *
95
+	 * @since 4.3.2
96
+	 *
97
+	 * @param array  $columns   Original defined list of columns
98
+	 * @param string $screen_id The unique screen id for the page.
99
+	 */
100
+	public function add_custom_mtps_columns($columns, $screen_id)
101
+	{
102
+		if ($screen_id !== 'espresso_messages_global_mtps') {
103
+			return $columns;
104
+		}
105
+
106
+		$columns['actions'] = '';
107
+		return $columns;
108
+	}
109
+
110
+
111
+	/**
112
+	 * Callback for FHEE__EE_Admin_List_Table__column_actions__event-espresso_page_espresso_messages action that allows
113
+	 * for adding the content for the registered "action" column.
114
+	 *
115
+	 * @since 4.3.2
116
+	 *
117
+	 * @param EE_Base_Class
118
+	 * @param string $screen_id Unique screen id for the page
119
+	 *
120
+	 * @return string html content for the page.
121
+	 */
122
+	public function custom_mtp_create_button_column($item, $screen_id)
123
+	{
124
+		if (
125
+			$screen_id !== 'espresso_messages_global_mtps' || ! EE_Registry::instance()->CAP->current_user_can(
126
+				'ee_edit_messages',
127
+				'espresso_messages_add_new_message_template'
128
+			)
129
+		) {
130
+			return '';
131
+		}
132
+
133
+		// first we consider whether this template has override set.  If it does then that means no custom templates can be created from this template as a base.  So let's just skip the button creation.
134
+		if ($item->get('MTP_is_override')) {
135
+			return '';
136
+		}
137
+
138
+
139
+		$create_args = array(
140
+			'GRP_ID'       => $item->ID(),
141
+			'messenger'    => $item->messenger(),
142
+			'message_type' => $item->message_type(),
143
+			'action'       => 'add_new_message_template',
144
+		);
145
+		$create_link = EE_Admin_Page::add_query_args_and_nonce($create_args, EE_MSG_ADMIN_URL);
146
+		echo sprintf(
147
+			'<a href="%s" class="button button-small">%s</a>',
148
+			$create_link,
149
+			esc_html__('Create Custom', 'event_espresso')
150
+		);
151
+	}
152
+
153
+
154
+	protected function _add_screen_options_custom_mtps()
155
+	{
156
+		$page_title = $this->_admin_page_title;
157
+		$this->_admin_page_title = esc_html__('Custom Message Templates', 'event_espresso');
158
+		$this->_per_page_screen_option();
159
+		$this->_admin_page_title = $page_title;
160
+	}
161
+
162
+
163
+	/**
164
+	 * set views array for Custom Templates list table
165
+	 *
166
+	 * @access public
167
+	 * @return void
168
+	 */
169
+	public function _set_list_table_views_custom_mtps()
170
+	{
171
+		$this->_views = array(
172
+			'in_use' => array(
173
+				'slug'        => 'in_use',
174
+				'label'       => esc_html__('In Use', 'event_espresso'),
175
+				'count'       => 0,
176
+				'bulk_action' => array(
177
+					'trash_message_template' => esc_html__('Move to Trash', 'event_espresso'),
178
+				),
179
+			),
180
+		);
181
+		if (
182
+			EE_Registry::instance()->CAP->current_user_can(
183
+				'ee_delete_messages',
184
+				'espresso_messages_trash_message_template'
185
+			)
186
+		) {
187
+			$this->_views['trashed'] = array(
188
+				'slug'        => 'trashed',
189
+				'label'       => esc_html__('Trash', 'event_espresso'),
190
+				'count'       => 0,
191
+				'bulk_action' => array(
192
+					'restore_message_template' => esc_html__('Restore From Trash', 'event_espresso'),
193
+					'delete_message_template'  => esc_html__('Delete Permanently', 'event_espresso'),
194
+				),
195
+			);
196
+		}
197
+	}
198
+
199
+
200
+	protected function _ee_custom_messages_overview_list_table()
201
+	{
202
+		$this->_admin_page_title = esc_html__('Custom Message Templates', 'event_espresso');
203
+		$this->display_admin_list_table_page_with_no_sidebar();
204
+	}
205 205
 }
Please login to merge, or discard this patch.
admin/extend/general_settings/Extend_General_Settings_Admin_Page.core.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
     public function __construct($routing = true)
22 22
     {
23 23
         parent::__construct($routing);
24
-        define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/');
24
+        define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'general_settings/templates/');
25 25
     }
26 26
 
27 27
 
28 28
     protected function _extend_page_config()
29 29
     {
30 30
 
31
-        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings';
31
+        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'general_settings';
32 32
 
33 33
         // filters and action hooks here
34 34
         add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9);
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url)
61 61
                                                && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url)
62 62
             ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : '';
63
-        $template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php';
63
+        $template = GEN_SET_CAF_TEMPLATE_PATH.'debug_log_settings.template.php';
64 64
         EEH_Template::display_template($template, $template_args);
65 65
     }
66 66
 
Please login to merge, or discard this patch.
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -16,68 +16,68 @@
 block discarded – undo
16 16
  */
17 17
 class Extend_General_Settings_Admin_Page extends General_Settings_Admin_Page
18 18
 {
19
-    public function __construct($routing = true)
20
-    {
21
-        parent::__construct($routing);
22
-        define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/');
23
-    }
19
+	public function __construct($routing = true)
20
+	{
21
+		parent::__construct($routing);
22
+		define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/');
23
+	}
24 24
 
25 25
 
26
-    protected function _extend_page_config()
27
-    {
26
+	protected function _extend_page_config()
27
+	{
28 28
 
29
-        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings';
29
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings';
30 30
 
31
-        // filters and action hooks here
32
-        add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9);
33
-        add_filter(
34
-            'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin',
35
-            array($this, 'update_debug_logging_options'),
36
-            10,
37
-            1
38
-        );
39
-    }
31
+		// filters and action hooks here
32
+		add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9);
33
+		add_filter(
34
+			'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin',
35
+			array($this, 'update_debug_logging_options'),
36
+			10,
37
+			1
38
+		);
39
+	}
40 40
 
41 41
 
42 42
 
43
-    /*************        Logging Settings        *************/
43
+	/*************        Logging Settings        *************/
44 44
 
45
-    /**
46
-     * debug_logging_options
47
-     *
48
-     * @param array $template_args
49
-     *
50
-     * @return void
51
-     */
52
-    public function debug_logging_options($template_args = array())
53
-    {
54
-        $template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(
55
-            EE_Registry::instance()->CFG->admin->use_remote_logging
56
-        ) : false;
57
-        $template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url)
58
-                                               && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url)
59
-            ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : '';
60
-        $template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php';
61
-        EEH_Template::display_template($template, $template_args);
62
-    }
45
+	/**
46
+	 * debug_logging_options
47
+	 *
48
+	 * @param array $template_args
49
+	 *
50
+	 * @return void
51
+	 */
52
+	public function debug_logging_options($template_args = array())
53
+	{
54
+		$template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(
55
+			EE_Registry::instance()->CFG->admin->use_remote_logging
56
+		) : false;
57
+		$template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url)
58
+											   && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url)
59
+			? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : '';
60
+		$template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php';
61
+		EEH_Template::display_template($template, $template_args);
62
+	}
63 63
 
64 64
 
65
-    /**
66
-     * update_debug_logging_options
67
-     *
68
-     * @param array $admin_options
69
-     *
70
-     * @return array
71
-     */
72
-    public function update_debug_logging_options($admin_options = array())
73
-    {
74
-        $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint(
75
-            $this->_req_data['use_remote_logging']
76
-        ) : $admin_options->use_remote_logging;
77
-        $admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw(
78
-            $this->_req_data['remote_logging_url']
79
-        ) : $admin_options->remote_logging_url;
65
+	/**
66
+	 * update_debug_logging_options
67
+	 *
68
+	 * @param array $admin_options
69
+	 *
70
+	 * @return array
71
+	 */
72
+	public function update_debug_logging_options($admin_options = array())
73
+	{
74
+		$admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint(
75
+			$this->_req_data['use_remote_logging']
76
+		) : $admin_options->use_remote_logging;
77
+		$admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw(
78
+			$this->_req_data['remote_logging_url']
79
+		) : $admin_options->remote_logging_url;
80 80
 
81
-        return $admin_options;
82
-    }
81
+		return $admin_options;
82
+	}
83 83
 }
Please login to merge, or discard this patch.
caffeinated/admin/extend/events/qtips/EE_Event_Editor_Tips.lib.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             ),
72 72
             7  => array(
73 73
                 'content_id' => 'tkt-status-archived',
74
-                'target'     => '.ticket-row .tkt-status-' . EE_Ticket::archived,
74
+                'target'     => '.ticket-row .tkt-status-'.EE_Ticket::archived,
75 75
                 'content'    => $this->_ticket_status_legend(EE_Ticket::archived),
76 76
                 'options'    => array(
77 77
                     'position' => array(
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             ),
85 85
             8  => array(
86 86
                 'content_id' => 'tkt-status-expired',
87
-                'target'     => '.ticket-row .tkt-status-' . EE_Ticket::expired,
87
+                'target'     => '.ticket-row .tkt-status-'.EE_Ticket::expired,
88 88
                 'content'    => $this->_ticket_status_legend(EE_Ticket::expired),
89 89
                 'options'    => array(
90 90
                     'position' => array(
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             ),
98 98
             9  => array(
99 99
                 'content_id' => 'tkt-status-sold_out',
100
-                'target'     => '.ticket-row .tkt-status-' . EE_Ticket::sold_out,
100
+                'target'     => '.ticket-row .tkt-status-'.EE_Ticket::sold_out,
101 101
                 'content'    => $this->_ticket_status_legend(EE_Ticket::sold_out),
102 102
                 'options'    => array(
103 103
                     'position' => array(
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             ),
111 111
             10 => array(
112 112
                 'content_id' => 'tkt-status-pending',
113
-                'target'     => '.ticket-row .tkt-status-' . EE_Ticket::pending,
113
+                'target'     => '.ticket-row .tkt-status-'.EE_Ticket::pending,
114 114
                 'content'    => $this->_ticket_status_legend(EE_Ticket::pending),
115 115
                 'options'    => array(
116 116
                     'position' => array(
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
             ),
124 124
             11 => array(
125 125
                 'content_id' => 'tkt-status-onsale',
126
-                'target'     => '.ticket-row .tkt-status-' . EE_Ticket::onsale,
126
+                'target'     => '.ticket-row .tkt-status-'.EE_Ticket::onsale,
127 127
                 'content'    => $this->_ticket_status_legend(EE_Ticket::onsale),
128 128
                 'options'    => array(
129 129
                     'position' => array(
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
                        'Clicking the taxable ticket toggle checkbox has enabled taxes for this ticket. What this means is that when a person purchases this ticket, the tax will be applied to all prices on this ticket. You can edit the existing tax price modifier that was setup in Event Espresso by going to  %sDefault Pricing Admin Page%s (labelled "Pricing" in the Event Espresso Menu)',
174 174
                        'event_espresso'
175 175
                    ),
176
-                   '<a href="' . $price_admin_link . '" title="' . esc_attr__(
176
+                   '<a href="'.$price_admin_link.'" title="'.esc_attr__(
177 177
                        'Pricing Admin Page',
178 178
                        'event_espresso'
179
-                   ) . '">',
179
+                   ).'">',
180 180
                    '</a>'
181
-               ) . '</p>';
181
+               ).'</p>';
182 182
     }
183 183
 
184 184
     /**
Please login to merge, or discard this patch.
Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -13,189 +13,189 @@
 block discarded – undo
13 13
  */
14 14
 class EE_Event_Editor_Tips extends EE_Qtip_Config
15 15
 {
16
-    protected function _set_tips_array()
17
-    {
18
-        $this->_qtipsa = array(
19
-            0  => array(
20
-                'content_id' => 'about-taxable-toggle',
21
-                'target'     => '.TKT-taxable-checkbox',
22
-                'content'    => $this->_get_taxable_info_content(),
23
-                'options'    => array(
24
-                    'show_only_once' => true,
25
-                    'content'        => array(
26
-                        'title' => esc_html__('Taxable Ticket Toggle', 'event_espresso'),
27
-                        'button' => true,
28
-                    ),
29
-                    'show'           => array(
30
-                        'event' => 'click',
31
-                    ),
32
-                    'hide'           => array(
33
-                        'event' => false,
34
-                    ),
35
-                    'style'          => array(
36
-                        'classes' => '',
37
-                    ),
38
-                )// defaults
39
-            ),
40
-            1  => array(
41
-                'content_id' => 'ticket-icon-help',
42
-                'target'     => '.ticket-icon',
43
-                'content'    => esc_html__('Assigned Tickets', 'event_espresso'),
44
-            ),
45
-            2  => array(
46
-                'content_id' => 'clone-icon-help',
47
-                'target'     => '.clone-icon',
48
-                'content'    => esc_html__('Duplicate this Item', 'event_espresso'),
49
-            ),
50
-            3  => array(
51
-                'content_id' => 'trash-datetime-help',
52
-                'target'     => '.datetime-edit-table .trash-icon',
53
-                'content'    => esc_html__('Trash Datetime', 'event_espresso'),
54
-            ),
55
-            4  => array(
56
-                'content_id' => 'trash-ticket-help',
57
-                'target'     => '.ticket-row .trash-icon',
58
-                'content'    => esc_html__('Trash Ticket', 'event_espresso'),
59
-            ),
60
-            5  => array(
61
-                'content_id' => 'trash-price-modifier-help',
62
-                'target'     => '.ticket-price-rows .trash-icon',
63
-                'content'    => esc_html__('Trash Price Modifier', 'event_espresso'),
64
-            ),
65
-            6  => array(
66
-                'content_id' => 'gear-icon-help',
67
-                'target'     => '.gear-icon',
68
-                'content'    => esc_html__('Advanced Settings', 'event_espresso'),
69
-            ),
70
-            7  => array(
71
-                'content_id' => 'tkt-status-archived',
72
-                'target'     => '.ticket-row .tkt-status-' . EE_Ticket::archived,
73
-                'content'    => $this->_ticket_status_legend(EE_Ticket::archived),
74
-                'options'    => array(
75
-                    'position' => array(
76
-                        'target' => 'mouse',
77
-                        'adjust' => array(
78
-                            'mouse' => false,
79
-                        ),
80
-                    ),
81
-                ),
82
-            ),
83
-            8  => array(
84
-                'content_id' => 'tkt-status-expired',
85
-                'target'     => '.ticket-row .tkt-status-' . EE_Ticket::expired,
86
-                'content'    => $this->_ticket_status_legend(EE_Ticket::expired),
87
-                'options'    => array(
88
-                    'position' => array(
89
-                        'target' => 'mouse',
90
-                        'adjust' => array(
91
-                            'mouse' => false,
92
-                        ),
93
-                    ),
94
-                ),
95
-            ),
96
-            9  => array(
97
-                'content_id' => 'tkt-status-sold_out',
98
-                'target'     => '.ticket-row .tkt-status-' . EE_Ticket::sold_out,
99
-                'content'    => $this->_ticket_status_legend(EE_Ticket::sold_out),
100
-                'options'    => array(
101
-                    'position' => array(
102
-                        'target' => 'mouse',
103
-                        'adjust' => array(
104
-                            'mouse' => false,
105
-                        ),
106
-                    ),
107
-                ),
108
-            ),
109
-            10 => array(
110
-                'content_id' => 'tkt-status-pending',
111
-                'target'     => '.ticket-row .tkt-status-' . EE_Ticket::pending,
112
-                'content'    => $this->_ticket_status_legend(EE_Ticket::pending),
113
-                'options'    => array(
114
-                    'position' => array(
115
-                        'target' => 'mouse',
116
-                        'adjust' => array(
117
-                            'mouse' => false,
118
-                        ),
119
-                    ),
120
-                ),
121
-            ),
122
-            11 => array(
123
-                'content_id' => 'tkt-status-onsale',
124
-                'target'     => '.ticket-row .tkt-status-' . EE_Ticket::onsale,
125
-                'content'    => $this->_ticket_status_legend(EE_Ticket::onsale),
126
-                'options'    => array(
127
-                    'position' => array(
128
-                        'target' => 'mouse',
129
-                        'adjust' => array(
130
-                            'mouse' => false,
131
-                        ),
132
-                    ),
133
-                ),
134
-            ),
135
-            12 => array(
136
-                'content_id' => 'sortable-tkt-drag-handle-tip',
137
-                'target'     => '.ee-ticket-sortable .sortable-drag-handle',
138
-                'content'    => esc_html__('Click and drag-n-drop to reorder tickets.', 'event_espresso'),
139
-                'options'    => array(
140
-                    'position' => array(
141
-                        'adjust' => array(
142
-                            'mouse' => false,
143
-                            'y'     => 5,
144
-                        ),
145
-                    ),
146
-                ),
147
-            ),
148
-            13 => array(
149
-                'content_id' => 'sortable-dtt-drag-handle-tip',
150
-                'target'     => '.ee-dtt-sortable .sortable-drag-handle',
151
-                'content'    => esc_html__('Click and drag-n-drop to reorder datetimes.', 'event_espresso'),
152
-                'options'    => array(
153
-                    'position' => array(
154
-                        'adjust' => array(
155
-                            'mouse' => false,
156
-                            'y'     => 5,
157
-                        ),
158
-                    ),
159
-                ),
160
-            ),
161
-        );
162
-    }
16
+	protected function _set_tips_array()
17
+	{
18
+		$this->_qtipsa = array(
19
+			0  => array(
20
+				'content_id' => 'about-taxable-toggle',
21
+				'target'     => '.TKT-taxable-checkbox',
22
+				'content'    => $this->_get_taxable_info_content(),
23
+				'options'    => array(
24
+					'show_only_once' => true,
25
+					'content'        => array(
26
+						'title' => esc_html__('Taxable Ticket Toggle', 'event_espresso'),
27
+						'button' => true,
28
+					),
29
+					'show'           => array(
30
+						'event' => 'click',
31
+					),
32
+					'hide'           => array(
33
+						'event' => false,
34
+					),
35
+					'style'          => array(
36
+						'classes' => '',
37
+					),
38
+				)// defaults
39
+			),
40
+			1  => array(
41
+				'content_id' => 'ticket-icon-help',
42
+				'target'     => '.ticket-icon',
43
+				'content'    => esc_html__('Assigned Tickets', 'event_espresso'),
44
+			),
45
+			2  => array(
46
+				'content_id' => 'clone-icon-help',
47
+				'target'     => '.clone-icon',
48
+				'content'    => esc_html__('Duplicate this Item', 'event_espresso'),
49
+			),
50
+			3  => array(
51
+				'content_id' => 'trash-datetime-help',
52
+				'target'     => '.datetime-edit-table .trash-icon',
53
+				'content'    => esc_html__('Trash Datetime', 'event_espresso'),
54
+			),
55
+			4  => array(
56
+				'content_id' => 'trash-ticket-help',
57
+				'target'     => '.ticket-row .trash-icon',
58
+				'content'    => esc_html__('Trash Ticket', 'event_espresso'),
59
+			),
60
+			5  => array(
61
+				'content_id' => 'trash-price-modifier-help',
62
+				'target'     => '.ticket-price-rows .trash-icon',
63
+				'content'    => esc_html__('Trash Price Modifier', 'event_espresso'),
64
+			),
65
+			6  => array(
66
+				'content_id' => 'gear-icon-help',
67
+				'target'     => '.gear-icon',
68
+				'content'    => esc_html__('Advanced Settings', 'event_espresso'),
69
+			),
70
+			7  => array(
71
+				'content_id' => 'tkt-status-archived',
72
+				'target'     => '.ticket-row .tkt-status-' . EE_Ticket::archived,
73
+				'content'    => $this->_ticket_status_legend(EE_Ticket::archived),
74
+				'options'    => array(
75
+					'position' => array(
76
+						'target' => 'mouse',
77
+						'adjust' => array(
78
+							'mouse' => false,
79
+						),
80
+					),
81
+				),
82
+			),
83
+			8  => array(
84
+				'content_id' => 'tkt-status-expired',
85
+				'target'     => '.ticket-row .tkt-status-' . EE_Ticket::expired,
86
+				'content'    => $this->_ticket_status_legend(EE_Ticket::expired),
87
+				'options'    => array(
88
+					'position' => array(
89
+						'target' => 'mouse',
90
+						'adjust' => array(
91
+							'mouse' => false,
92
+						),
93
+					),
94
+				),
95
+			),
96
+			9  => array(
97
+				'content_id' => 'tkt-status-sold_out',
98
+				'target'     => '.ticket-row .tkt-status-' . EE_Ticket::sold_out,
99
+				'content'    => $this->_ticket_status_legend(EE_Ticket::sold_out),
100
+				'options'    => array(
101
+					'position' => array(
102
+						'target' => 'mouse',
103
+						'adjust' => array(
104
+							'mouse' => false,
105
+						),
106
+					),
107
+				),
108
+			),
109
+			10 => array(
110
+				'content_id' => 'tkt-status-pending',
111
+				'target'     => '.ticket-row .tkt-status-' . EE_Ticket::pending,
112
+				'content'    => $this->_ticket_status_legend(EE_Ticket::pending),
113
+				'options'    => array(
114
+					'position' => array(
115
+						'target' => 'mouse',
116
+						'adjust' => array(
117
+							'mouse' => false,
118
+						),
119
+					),
120
+				),
121
+			),
122
+			11 => array(
123
+				'content_id' => 'tkt-status-onsale',
124
+				'target'     => '.ticket-row .tkt-status-' . EE_Ticket::onsale,
125
+				'content'    => $this->_ticket_status_legend(EE_Ticket::onsale),
126
+				'options'    => array(
127
+					'position' => array(
128
+						'target' => 'mouse',
129
+						'adjust' => array(
130
+							'mouse' => false,
131
+						),
132
+					),
133
+				),
134
+			),
135
+			12 => array(
136
+				'content_id' => 'sortable-tkt-drag-handle-tip',
137
+				'target'     => '.ee-ticket-sortable .sortable-drag-handle',
138
+				'content'    => esc_html__('Click and drag-n-drop to reorder tickets.', 'event_espresso'),
139
+				'options'    => array(
140
+					'position' => array(
141
+						'adjust' => array(
142
+							'mouse' => false,
143
+							'y'     => 5,
144
+						),
145
+					),
146
+				),
147
+			),
148
+			13 => array(
149
+				'content_id' => 'sortable-dtt-drag-handle-tip',
150
+				'target'     => '.ee-dtt-sortable .sortable-drag-handle',
151
+				'content'    => esc_html__('Click and drag-n-drop to reorder datetimes.', 'event_espresso'),
152
+				'options'    => array(
153
+					'position' => array(
154
+						'adjust' => array(
155
+							'mouse' => false,
156
+							'y'     => 5,
157
+						),
158
+					),
159
+				),
160
+			),
161
+		);
162
+	}
163 163
 
164 164
 
165
-    private function _get_taxable_info_content()
166
-    {
167
-        $price_admin_link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default'), PRICING_ADMIN_URL);
168
-        return '<p>'
169
-               . sprintf(
170
-                   esc_html__(
171
-                       'Clicking the taxable ticket toggle checkbox has enabled taxes for this ticket. What this means is that when a person purchases this ticket, the tax will be applied to all prices on this ticket. You can edit the existing tax price modifier that was setup in Event Espresso by going to  %sDefault Pricing Admin Page%s (labelled "Pricing" in the Event Espresso Menu)',
172
-                       'event_espresso'
173
-                   ),
174
-                   '<a href="' . $price_admin_link . '" title="' . esc_attr__(
175
-                       'Pricing Admin Page',
176
-                       'event_espresso'
177
-                   ) . '">',
178
-                   '</a>'
179
-               ) . '</p>';
180
-    }
165
+	private function _get_taxable_info_content()
166
+	{
167
+		$price_admin_link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default'), PRICING_ADMIN_URL);
168
+		return '<p>'
169
+			   . sprintf(
170
+				   esc_html__(
171
+					   'Clicking the taxable ticket toggle checkbox has enabled taxes for this ticket. What this means is that when a person purchases this ticket, the tax will be applied to all prices on this ticket. You can edit the existing tax price modifier that was setup in Event Espresso by going to  %sDefault Pricing Admin Page%s (labelled "Pricing" in the Event Espresso Menu)',
172
+					   'event_espresso'
173
+				   ),
174
+				   '<a href="' . $price_admin_link . '" title="' . esc_attr__(
175
+					   'Pricing Admin Page',
176
+					   'event_espresso'
177
+				   ) . '">',
178
+				   '</a>'
179
+			   ) . '</p>';
180
+	}
181 181
 
182
-    /**
183
-     * output the relevant ee-status-legend with the designated status highlighted.
184
-     *
185
-     * @param  EE_Ticket constant $status What status is set (by class)
186
-     * @return string         The status legend with the related status highlighted
187
-     */
188
-    private function _ticket_status_legend($status)
189
-    {
182
+	/**
183
+	 * output the relevant ee-status-legend with the designated status highlighted.
184
+	 *
185
+	 * @param  EE_Ticket constant $status What status is set (by class)
186
+	 * @return string         The status legend with the related status highlighted
187
+	 */
188
+	private function _ticket_status_legend($status)
189
+	{
190 190
 
191
-        $status_array = array(
192
-            'archived' => EE_Ticket::archived,
193
-            'expired'  => EE_Ticket::expired,
194
-            'sold_out' => EE_Ticket::sold_out,
195
-            'pending'  => EE_Ticket::pending,
196
-            'onsale'   => EE_Ticket::onsale,
197
-        );
191
+		$status_array = array(
192
+			'archived' => EE_Ticket::archived,
193
+			'expired'  => EE_Ticket::expired,
194
+			'sold_out' => EE_Ticket::sold_out,
195
+			'pending'  => EE_Ticket::pending,
196
+			'onsale'   => EE_Ticket::onsale,
197
+		);
198 198
 
199
-        return EEH_Template::status_legend($status_array, $status);
200
-    }
199
+		return EEH_Template::status_legend($status_array, $status);
200
+	}
201 201
 }
Please login to merge, or discard this patch.
message_type/newsletter/EE_Messages_Email_Newsletter_Validator.class.php 2 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -11,72 +11,72 @@
 block discarded – undo
11 11
  */
12 12
 class EE_Messages_Email_Newsletter_Validator extends EE_Messages_Validator
13 13
 {
14
-    /**
15
-     * EE_Messages_Email_Newsletter_Validator constructor.
16
-     *
17
-     * @param array $fields
18
-     * @param string $context
19
-     * @throws EE_Error
20
-     * @throws ReflectionException
21
-     */
22
-    public function __construct(array $fields, $context)
23
-    {
24
-        $this->_m_name = 'email';
25
-        $this->_mt_name = 'newsletter';
14
+	/**
15
+	 * EE_Messages_Email_Newsletter_Validator constructor.
16
+	 *
17
+	 * @param array $fields
18
+	 * @param string $context
19
+	 * @throws EE_Error
20
+	 * @throws ReflectionException
21
+	 */
22
+	public function __construct(array $fields, $context)
23
+	{
24
+		$this->_m_name = 'email';
25
+		$this->_mt_name = 'newsletter';
26 26
 
27
-        parent::__construct($fields, $context);
28
-    }
27
+		parent::__construct($fields, $context);
28
+	}
29 29
 
30
-    /**
31
-     * custom validator (restricting what was originally set by the messenger)
32
-     */
33
-    protected function _modify_validator()
34
-    {
35
-        if ($this->_context === 'attendee') {
36
-            $this->_valid_shortcodes_modifier[ $this->_context ]['from'] = array(
37
-                'recipient_details',
38
-                'email',
39
-                'organization',
40
-            );
41
-        }
30
+	/**
31
+	 * custom validator (restricting what was originally set by the messenger)
32
+	 */
33
+	protected function _modify_validator()
34
+	{
35
+		if ($this->_context === 'attendee') {
36
+			$this->_valid_shortcodes_modifier[ $this->_context ]['from'] = array(
37
+				'recipient_details',
38
+				'email',
39
+				'organization',
40
+			);
41
+		}
42 42
 
43
-        // excluded shortcodes
44
-        $fields = array('to', 'from', 'subject', 'content', 'newsletter_content');
45
-        foreach ($fields as $field) {
46
-            $this->_specific_shortcode_excludes[ $field ] = array(
47
-                '[RECIPIENT_REGISTRATION_CODE]',
48
-                '[EVENT_AUTHOR_FORMATTED_EMAIL]',
49
-                '[EVENT_AUTHOR_EMAIL]',
50
-            );
51
-        }
52
-        $add_excludes = array(
53
-            '[RECIPIENT_FNAME]',
54
-            '[RECIPIENT_LNAME]',
55
-            '[RECIPIENT_EMAIL]',
56
-            '[COMPANY]',
57
-            '[CO_ADD1]',
58
-            '[CO_ADD2]',
59
-            '[CO_CITY]',
60
-            '[CO_STATE]',
61
-            '[CO_ZIP]',
62
-            '[CO_LOGO]',
63
-            '[CO_PHONE]',
64
-            '[CO_LOGO_URL]',
65
-            '[CO_FACEBOOK_URL]',
66
-            '[CO_TWITTER_URL]',
67
-            '[CO_PINTEREST_URL]',
68
-            '[CO_GOOGLE_URL]',
69
-            '[CO_LINKEDIN_URL]',
70
-            '[CO_INSTAGRAM_URL]',
71
-        );
72
-        $this->_specific_shortcode_excludes['from'] =
73
-            array_merge(
74
-                $this->_specific_shortcode_excludes['from'],
75
-                $add_excludes
76
-            );
77
-        $this->_specific_shortcode_excludes['content'] = array_merge(
78
-            $this->_specific_shortcode_excludes['content'],
79
-            array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]')
80
-        );
81
-    }
43
+		// excluded shortcodes
44
+		$fields = array('to', 'from', 'subject', 'content', 'newsletter_content');
45
+		foreach ($fields as $field) {
46
+			$this->_specific_shortcode_excludes[ $field ] = array(
47
+				'[RECIPIENT_REGISTRATION_CODE]',
48
+				'[EVENT_AUTHOR_FORMATTED_EMAIL]',
49
+				'[EVENT_AUTHOR_EMAIL]',
50
+			);
51
+		}
52
+		$add_excludes = array(
53
+			'[RECIPIENT_FNAME]',
54
+			'[RECIPIENT_LNAME]',
55
+			'[RECIPIENT_EMAIL]',
56
+			'[COMPANY]',
57
+			'[CO_ADD1]',
58
+			'[CO_ADD2]',
59
+			'[CO_CITY]',
60
+			'[CO_STATE]',
61
+			'[CO_ZIP]',
62
+			'[CO_LOGO]',
63
+			'[CO_PHONE]',
64
+			'[CO_LOGO_URL]',
65
+			'[CO_FACEBOOK_URL]',
66
+			'[CO_TWITTER_URL]',
67
+			'[CO_PINTEREST_URL]',
68
+			'[CO_GOOGLE_URL]',
69
+			'[CO_LINKEDIN_URL]',
70
+			'[CO_INSTAGRAM_URL]',
71
+		);
72
+		$this->_specific_shortcode_excludes['from'] =
73
+			array_merge(
74
+				$this->_specific_shortcode_excludes['from'],
75
+				$add_excludes
76
+			);
77
+		$this->_specific_shortcode_excludes['content'] = array_merge(
78
+			$this->_specific_shortcode_excludes['content'],
79
+			array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]')
80
+		);
81
+	}
82 82
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     protected function _modify_validator()
34 34
     {
35 35
         if ($this->_context === 'attendee') {
36
-            $this->_valid_shortcodes_modifier[ $this->_context ]['from'] = array(
36
+            $this->_valid_shortcodes_modifier[$this->_context]['from'] = array(
37 37
                 'recipient_details',
38 38
                 'email',
39 39
                 'organization',
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         // excluded shortcodes
44 44
         $fields = array('to', 'from', 'subject', 'content', 'newsletter_content');
45 45
         foreach ($fields as $field) {
46
-            $this->_specific_shortcode_excludes[ $field ] = array(
46
+            $this->_specific_shortcode_excludes[$field] = array(
47 47
                 '[RECIPIENT_REGISTRATION_CODE]',
48 48
                 '[EVENT_AUTHOR_FORMATTED_EMAIL]',
49 49
                 '[EVENT_AUTHOR_EMAIL]',
Please login to merge, or discard this patch.
messages/message_type/newsletter/EE_Newsletter_message_type.class.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 
115 115
         foreach ($this->_valid_shortcodes as $context => $shortcodes) {
116 116
             foreach ($shortcodes as $key => $shortcode) {
117
-                if (! in_array($shortcode, $included_shortcodes, true)) {
118
-                    unset($this->_valid_shortcodes[ $context ][ $key ]);
117
+                if ( ! in_array($shortcode, $included_shortcodes, true)) {
118
+                    unset($this->_valid_shortcodes[$context][$key]);
119 119
                 }
120 120
             }
121
-            $this->_valid_shortcodes[ $context ][] = 'newsletter';
121
+            $this->_valid_shortcodes[$context][] = 'newsletter';
122 122
         }
123 123
     }
124 124
 
@@ -148,23 +148,23 @@  discard block
 block discarded – undo
148 148
                 ? $details['att_obj']
149 149
                 : null;
150 150
 
151
-            if (! $attendee instanceof EE_Attendee) {
151
+            if ( ! $attendee instanceof EE_Attendee) {
152 152
                 continue;
153 153
             }
154 154
 
155 155
             // set $aee from attendee object
156 156
             $aee['att_obj'] = $attendee;
157
-            $aee['reg_objs'] = isset($this->_data->attendees[ $attendee->ID() ]['reg_objs'])
158
-                ? $this->_data->attendees[ $attendee->ID() ]['reg_objs']
157
+            $aee['reg_objs'] = isset($this->_data->attendees[$attendee->ID()]['reg_objs'])
158
+                ? $this->_data->attendees[$attendee->ID()]['reg_objs']
159 159
                 : array();
160 160
             $aee['attendee_email'] = $attendee->email();
161
-            $aee['tkt_objs'] = isset($this->_data->attendees[ $attendee->ID() ]['tkt_objs'])
162
-                ? $this->_data->attendees[ $attendee->ID() ]['tkt_objs']
161
+            $aee['tkt_objs'] = isset($this->_data->attendees[$attendee->ID()]['tkt_objs'])
162
+                ? $this->_data->attendees[$attendee->ID()]['tkt_objs']
163 163
                 : array();
164 164
 
165
-            if (isset($this->_data->attendees[ $attendee->ID() ]['evt_objs'])) {
166
-                $aee['evt_objs'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs'];
167
-                $aee['events'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs'];
165
+            if (isset($this->_data->attendees[$attendee->ID()]['evt_objs'])) {
166
+                $aee['evt_objs'] = $this->_data->attendees[$attendee->ID()]['evt_objs'];
167
+                $aee['events'] = $this->_data->attendees[$attendee->ID()]['evt_objs'];
168 168
             } else {
169 169
                 $aee['evt_objs'] = $aee['events'] = array();
170 170
             }
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
         $excluded_fields = array(
200 200
             'email' => array('cc')
201 201
         );
202
-        return isset($excluded_fields[ $messenger_name ])
203
-            ? $excluded_fields[ $messenger_name ]
202
+        return isset($excluded_fields[$messenger_name])
203
+            ? $excluded_fields[$messenger_name]
204 204
             : parent::excludedFieldsForMessenger($messenger_name);
205 205
     }
206 206
 }
Please login to merge, or discard this patch.
Indentation   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -12,194 +12,194 @@
 block discarded – undo
12 12
  */
13 13
 class EE_Newsletter_message_type extends EE_message_type
14 14
 {
15
-    public function __construct()
16
-    {
17
-        $this->name = 'newsletter';
18
-        $this->description = esc_html__(
19
-            'Batch message type messages are triggered manually by the admin for sending notifications to a selected group of recipients. This should only be used for more general notification type messages that contain information specific for the recipients. For "newsletter" type messages we recommend using an email list service like MailChimp, because sending non-related mail-outs to contacts increases the risk of your site domain getting added to spam lists, which will prevent messages getting to users.',
20
-            'event_espresso'
21
-        );
22
-        $this->label = array(
23
-            'singular' => esc_html__('batch', 'event_espresso'),
24
-            'plural'   => esc_html__('batches', 'event_espresso'),
25
-        );
26
-        $this->_master_templates = array(
27
-            'email' => 'registration',
28
-        );
29
-
30
-        parent::__construct();
31
-    }
32
-
33
-
34
-    /**
35
-     * Sets admin_registered_pages property
36
-     */
37
-    protected function _set_admin_pages()
38
-    {
39
-        $this->admin_registered_pages = array(); // no admin pages to register this with.
40
-    }
41
-
42
-
43
-    /**
44
-     * Sets property related to data handler.
45
-     */
46
-    protected function _set_data_handler()
47
-    {
48
-        $this->_data_handler = 'Registrations';
49
-        $this->_single_message = $this->_data instanceof EE_Registration;
50
-    }
51
-
52
-
53
-    /**
54
-     * Returns the data for the given context for this message type.
55
-     * @param string          $context
56
-     * @param EE_Registration $registration
57
-     * @param int             $id
58
-     * @return array|mixed
59
-     */
60
-    protected function _get_data_for_context($context, EE_Registration $registration, $id)
61
-    {
62
-        // newsletter message type data handler is 'Registrations' and it expects an array of EE_Registration objects.
63
-        return array($registration);
64
-    }
65
-
66
-
67
-    /**
68
-     * Sets the admin settings fields property for this message type.
69
-     */
70
-    protected function _set_admin_settings_fields()
71
-    {
72
-        $this->_admin_settings_fields = array();
73
-    }
74
-
75
-
76
-    /**
77
-     * Sets the contexts for this message type.
78
-     */
79
-    protected function _set_contexts()
80
-    {
81
-        $this->_context_label = array(
82
-            'label'       => esc_html__('recipient', 'event_espresso'),
83
-            'plural'      => esc_html__('recipients', 'event_espresso'),
84
-            'description' => esc_html__('Recipient\'s are who will receive the message.', 'event_espresso'),
85
-        );
86
-
87
-        $this->_contexts = array(
88
-            'attendee' => array(
89
-                'label'       => esc_html__('Registrant', 'event_espresso'),
90
-                'description' => esc_html__('This template goes to selected registrants.', 'event_espresso'),
91
-            ),
92
-        );
93
-    }
94
-
95
-
96
-    /**
97
-     * used to set the valid shortcodes.
98
-     * For the newsletter message type we only have two valid shortcode libraries in use, recipient details and
99
-     * organization.  That's it!
100
-     *
101
-     * @since   4.3.0
102
-     * @return  void
103
-     */
104
-    protected function _set_valid_shortcodes()
105
-    {
106
-        parent::_set_valid_shortcodes();
107
-
108
-        $included_shortcodes = array(
109
-            'recipient_details',
110
-            'organization',
111
-            'newsletter',
112
-        );
113
-
114
-        foreach ($this->_valid_shortcodes as $context => $shortcodes) {
115
-            foreach ($shortcodes as $key => $shortcode) {
116
-                if (! in_array($shortcode, $included_shortcodes, true)) {
117
-                    unset($this->_valid_shortcodes[ $context ][ $key ]);
118
-                }
119
-            }
120
-            $this->_valid_shortcodes[ $context ][] = 'newsletter';
121
-        }
122
-    }
123
-
124
-
125
-    /**
126
-     * Override default _attendee_addressees in EE_message_type because we want to loop through the registrations
127
-     * for EE_message_type.
128
-     *
129
-     * @return array
130
-     * @throws EE_Error
131
-     * @throws InvalidArgumentException
132
-     * @throws ReflectionException
133
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
134
-     * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
135
-     */
136
-    protected function _attendee_addressees()
137
-    {
138
-        $addressee = array();
139
-
140
-        // looping through registrations
141
-        foreach ($this->_data->registrations as $reg_id => $details) {
142
-            // set $attendee array to blank on each loop
143
-            $aee = array();
144
-
145
-            // need to get the attendee from this registration.
146
-            $attendee = isset($details['att_obj']) && $details['att_obj'] instanceof EE_Attendee
147
-                ? $details['att_obj']
148
-                : null;
149
-
150
-            if (! $attendee instanceof EE_Attendee) {
151
-                continue;
152
-            }
153
-
154
-            // set $aee from attendee object
155
-            $aee['att_obj'] = $attendee;
156
-            $aee['reg_objs'] = isset($this->_data->attendees[ $attendee->ID() ]['reg_objs'])
157
-                ? $this->_data->attendees[ $attendee->ID() ]['reg_objs']
158
-                : array();
159
-            $aee['attendee_email'] = $attendee->email();
160
-            $aee['tkt_objs'] = isset($this->_data->attendees[ $attendee->ID() ]['tkt_objs'])
161
-                ? $this->_data->attendees[ $attendee->ID() ]['tkt_objs']
162
-                : array();
163
-
164
-            if (isset($this->_data->attendees[ $attendee->ID() ]['evt_objs'])) {
165
-                $aee['evt_objs'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs'];
166
-                $aee['events'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs'];
167
-            } else {
168
-                $aee['evt_objs'] = $aee['events'] = array();
169
-            }
170
-
171
-            $aee['reg_obj'] = isset($details['reg_obj'])
172
-                ? $details['reg_obj']
173
-                : null;
174
-            $aee['attendees'] = $this->_data->attendees;
175
-
176
-            // merge in the primary attendee data
177
-            $aee = array_merge($this->_default_addressee_data, $aee);
178
-
179
-            // make sure txn is set
180
-            if (empty($aee['txn']) && $aee['reg_obj'] instanceof EE_Registration) {
181
-                $aee['txn'] = $aee['reg_obj']->transaction();
182
-            }
183
-
184
-            $addressee[] = new EE_Messages_Addressee($aee);
185
-        }
186
-        return $addressee;
187
-    }
188
-
189
-    /**
190
-     * Allows a message type to specifically exclude template fields for the provided messenger.
191
-     * Filtered so this can be programmatically altered as well.
192
-     *
193
-     * @param string $messenger_name name of messenger
194
-     * @return array
195
-     */
196
-    public function excludedFieldsForMessenger($messenger_name)
197
-    {
198
-        $excluded_fields = array(
199
-            'email' => array('cc')
200
-        );
201
-        return isset($excluded_fields[ $messenger_name ])
202
-            ? $excluded_fields[ $messenger_name ]
203
-            : parent::excludedFieldsForMessenger($messenger_name);
204
-    }
15
+	public function __construct()
16
+	{
17
+		$this->name = 'newsletter';
18
+		$this->description = esc_html__(
19
+			'Batch message type messages are triggered manually by the admin for sending notifications to a selected group of recipients. This should only be used for more general notification type messages that contain information specific for the recipients. For "newsletter" type messages we recommend using an email list service like MailChimp, because sending non-related mail-outs to contacts increases the risk of your site domain getting added to spam lists, which will prevent messages getting to users.',
20
+			'event_espresso'
21
+		);
22
+		$this->label = array(
23
+			'singular' => esc_html__('batch', 'event_espresso'),
24
+			'plural'   => esc_html__('batches', 'event_espresso'),
25
+		);
26
+		$this->_master_templates = array(
27
+			'email' => 'registration',
28
+		);
29
+
30
+		parent::__construct();
31
+	}
32
+
33
+
34
+	/**
35
+	 * Sets admin_registered_pages property
36
+	 */
37
+	protected function _set_admin_pages()
38
+	{
39
+		$this->admin_registered_pages = array(); // no admin pages to register this with.
40
+	}
41
+
42
+
43
+	/**
44
+	 * Sets property related to data handler.
45
+	 */
46
+	protected function _set_data_handler()
47
+	{
48
+		$this->_data_handler = 'Registrations';
49
+		$this->_single_message = $this->_data instanceof EE_Registration;
50
+	}
51
+
52
+
53
+	/**
54
+	 * Returns the data for the given context for this message type.
55
+	 * @param string          $context
56
+	 * @param EE_Registration $registration
57
+	 * @param int             $id
58
+	 * @return array|mixed
59
+	 */
60
+	protected function _get_data_for_context($context, EE_Registration $registration, $id)
61
+	{
62
+		// newsletter message type data handler is 'Registrations' and it expects an array of EE_Registration objects.
63
+		return array($registration);
64
+	}
65
+
66
+
67
+	/**
68
+	 * Sets the admin settings fields property for this message type.
69
+	 */
70
+	protected function _set_admin_settings_fields()
71
+	{
72
+		$this->_admin_settings_fields = array();
73
+	}
74
+
75
+
76
+	/**
77
+	 * Sets the contexts for this message type.
78
+	 */
79
+	protected function _set_contexts()
80
+	{
81
+		$this->_context_label = array(
82
+			'label'       => esc_html__('recipient', 'event_espresso'),
83
+			'plural'      => esc_html__('recipients', 'event_espresso'),
84
+			'description' => esc_html__('Recipient\'s are who will receive the message.', 'event_espresso'),
85
+		);
86
+
87
+		$this->_contexts = array(
88
+			'attendee' => array(
89
+				'label'       => esc_html__('Registrant', 'event_espresso'),
90
+				'description' => esc_html__('This template goes to selected registrants.', 'event_espresso'),
91
+			),
92
+		);
93
+	}
94
+
95
+
96
+	/**
97
+	 * used to set the valid shortcodes.
98
+	 * For the newsletter message type we only have two valid shortcode libraries in use, recipient details and
99
+	 * organization.  That's it!
100
+	 *
101
+	 * @since   4.3.0
102
+	 * @return  void
103
+	 */
104
+	protected function _set_valid_shortcodes()
105
+	{
106
+		parent::_set_valid_shortcodes();
107
+
108
+		$included_shortcodes = array(
109
+			'recipient_details',
110
+			'organization',
111
+			'newsletter',
112
+		);
113
+
114
+		foreach ($this->_valid_shortcodes as $context => $shortcodes) {
115
+			foreach ($shortcodes as $key => $shortcode) {
116
+				if (! in_array($shortcode, $included_shortcodes, true)) {
117
+					unset($this->_valid_shortcodes[ $context ][ $key ]);
118
+				}
119
+			}
120
+			$this->_valid_shortcodes[ $context ][] = 'newsletter';
121
+		}
122
+	}
123
+
124
+
125
+	/**
126
+	 * Override default _attendee_addressees in EE_message_type because we want to loop through the registrations
127
+	 * for EE_message_type.
128
+	 *
129
+	 * @return array
130
+	 * @throws EE_Error
131
+	 * @throws InvalidArgumentException
132
+	 * @throws ReflectionException
133
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
134
+	 * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
135
+	 */
136
+	protected function _attendee_addressees()
137
+	{
138
+		$addressee = array();
139
+
140
+		// looping through registrations
141
+		foreach ($this->_data->registrations as $reg_id => $details) {
142
+			// set $attendee array to blank on each loop
143
+			$aee = array();
144
+
145
+			// need to get the attendee from this registration.
146
+			$attendee = isset($details['att_obj']) && $details['att_obj'] instanceof EE_Attendee
147
+				? $details['att_obj']
148
+				: null;
149
+
150
+			if (! $attendee instanceof EE_Attendee) {
151
+				continue;
152
+			}
153
+
154
+			// set $aee from attendee object
155
+			$aee['att_obj'] = $attendee;
156
+			$aee['reg_objs'] = isset($this->_data->attendees[ $attendee->ID() ]['reg_objs'])
157
+				? $this->_data->attendees[ $attendee->ID() ]['reg_objs']
158
+				: array();
159
+			$aee['attendee_email'] = $attendee->email();
160
+			$aee['tkt_objs'] = isset($this->_data->attendees[ $attendee->ID() ]['tkt_objs'])
161
+				? $this->_data->attendees[ $attendee->ID() ]['tkt_objs']
162
+				: array();
163
+
164
+			if (isset($this->_data->attendees[ $attendee->ID() ]['evt_objs'])) {
165
+				$aee['evt_objs'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs'];
166
+				$aee['events'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs'];
167
+			} else {
168
+				$aee['evt_objs'] = $aee['events'] = array();
169
+			}
170
+
171
+			$aee['reg_obj'] = isset($details['reg_obj'])
172
+				? $details['reg_obj']
173
+				: null;
174
+			$aee['attendees'] = $this->_data->attendees;
175
+
176
+			// merge in the primary attendee data
177
+			$aee = array_merge($this->_default_addressee_data, $aee);
178
+
179
+			// make sure txn is set
180
+			if (empty($aee['txn']) && $aee['reg_obj'] instanceof EE_Registration) {
181
+				$aee['txn'] = $aee['reg_obj']->transaction();
182
+			}
183
+
184
+			$addressee[] = new EE_Messages_Addressee($aee);
185
+		}
186
+		return $addressee;
187
+	}
188
+
189
+	/**
190
+	 * Allows a message type to specifically exclude template fields for the provided messenger.
191
+	 * Filtered so this can be programmatically altered as well.
192
+	 *
193
+	 * @param string $messenger_name name of messenger
194
+	 * @return array
195
+	 */
196
+	public function excludedFieldsForMessenger($messenger_name)
197
+	{
198
+		$excluded_fields = array(
199
+			'email' => array('cc')
200
+		);
201
+		return isset($excluded_fields[ $messenger_name ])
202
+			? $excluded_fields[ $messenger_name ]
203
+			: parent::excludedFieldsForMessenger($messenger_name);
204
+	}
205 205
 }
Please login to merge, or discard this patch.