@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | protected function _set_page_routes() { |
54 | 54 | |
55 | - $tkt_id = ! empty( $this->_req_data['TKT_ID'] ) && ! is_array( $this->_req_data['TKT_ID'] ) ? $this->_req_data['TKT_ID'] : 0; |
|
55 | + $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) ? $this->_req_data['TKT_ID'] : 0; |
|
56 | 56 | |
57 | 57 | $this->_page_routes = array( |
58 | 58 | 'default' => array( |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | 'trash_ticket' => array( |
63 | 63 | 'func' => '_trash_or_restore_ticket', |
64 | 64 | 'noheader' => TRUE, |
65 | - 'args' => array( 'trash' => TRUE ), |
|
65 | + 'args' => array('trash' => TRUE), |
|
66 | 66 | 'capability' => 'ee_delete_default_ticket', |
67 | 67 | 'obj_id' => $tkt_id |
68 | 68 | ), |
69 | 69 | 'trash_tickets' => array( |
70 | 70 | 'func' => '_trash_or_restore_ticket', |
71 | 71 | 'noheader' => TRUE, |
72 | - 'args' => array( 'trash' => TRUE ), |
|
72 | + 'args' => array('trash' => TRUE), |
|
73 | 73 | 'capability' => 'ee_delete_default_tickets' |
74 | 74 | ), |
75 | 75 | 'restore_ticket' => array( |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | 'label' => __('Trash', 'event_espresso'), |
144 | 144 | 'count' => 0, |
145 | 145 | 'bulk_action' => array( |
146 | - 'restore_tickets' => __('Restore from Trash' , 'event_espresso'), |
|
146 | + 'restore_tickets' => __('Restore from Trash', 'event_espresso'), |
|
147 | 147 | 'delete_tickets' => __('Delete Permanently', 'event_espresso') |
148 | 148 | ) |
149 | 149 | ) |
@@ -161,53 +161,53 @@ discard block |
||
161 | 161 | |
162 | 162 | |
163 | 163 | |
164 | - public function get_default_tickets( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
164 | + public function get_default_tickets($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
165 | 165 | |
166 | - $orderby= empty( $this->_req_data['orderby'] ) ? 'TKT_name' : $this->_req_data['orderby']; |
|
167 | - $order = empty( $this->_req_data['order'] ) ? 'ASC' : $order; |
|
166 | + $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby']; |
|
167 | + $order = empty($this->_req_data['order']) ? 'ASC' : $order; |
|
168 | 168 | |
169 | - switch ( $orderby ) { |
|
169 | + switch ($orderby) { |
|
170 | 170 | case 'TKT_name' : |
171 | - $orderby = array( 'TKT_name' => $order ); |
|
171 | + $orderby = array('TKT_name' => $order); |
|
172 | 172 | break; |
173 | 173 | |
174 | 174 | case 'TKT_price' : |
175 | - $orderby = array( 'TKT_price' => $order ); |
|
175 | + $orderby = array('TKT_price' => $order); |
|
176 | 176 | break; |
177 | 177 | |
178 | 178 | case 'TKT_uses' : |
179 | - $orderby = array( 'TKT_uses' => $order ); |
|
179 | + $orderby = array('TKT_uses' => $order); |
|
180 | 180 | break; |
181 | 181 | |
182 | 182 | case 'TKT_min' : |
183 | - $orderby = array( 'TKT_min' => $order ); |
|
183 | + $orderby = array('TKT_min' => $order); |
|
184 | 184 | break; |
185 | 185 | |
186 | 186 | case 'TKT_max' : |
187 | - $orderby = array( 'TKT_max' => $order ); |
|
187 | + $orderby = array('TKT_max' => $order); |
|
188 | 188 | break; |
189 | 189 | |
190 | 190 | case 'TKT_qty' : |
191 | - $orderby = array( 'TKT_qty' => $order ); |
|
191 | + $orderby = array('TKT_qty' => $order); |
|
192 | 192 | break; |
193 | 193 | } |
194 | 194 | |
195 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
196 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
195 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
196 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
197 | 197 | |
198 | 198 | $_where = array( |
199 | 199 | 'TKT_is_default' => 1, |
200 | 200 | 'TKT_deleted' => $trashed |
201 | 201 | ); |
202 | 202 | |
203 | - $offset = ($current_page-1)*$per_page; |
|
204 | - $limit = array( $offset, $per_page ); |
|
203 | + $offset = ($current_page - 1) * $per_page; |
|
204 | + $limit = array($offset, $per_page); |
|
205 | 205 | |
206 | - if ( isset( $this->_req_data['s'] ) ) { |
|
207 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
206 | + if (isset($this->_req_data['s'])) { |
|
207 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
208 | 208 | $_where['OR'] = array( |
209 | - 'TKT_name' => array('LIKE',$sstr ), |
|
210 | - 'TKT_description' => array('LIKE',$sstr ) |
|
209 | + 'TKT_name' => array('LIKE', $sstr), |
|
210 | + 'TKT_description' => array('LIKE', $sstr) |
|
211 | 211 | ); |
212 | 212 | } |
213 | 213 | |
@@ -218,9 +218,9 @@ discard block |
||
218 | 218 | 'group_by'=>'TKT_ID' |
219 | 219 | ); |
220 | 220 | |
221 | - if($count){ |
|
221 | + if ($count) { |
|
222 | 222 | return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
223 | - }else{ |
|
223 | + } else { |
|
224 | 224 | return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
225 | 225 | } |
226 | 226 | |
@@ -230,41 +230,41 @@ discard block |
||
230 | 230 | |
231 | 231 | |
232 | 232 | |
233 | - protected function _trash_or_restore_ticket( $trash = FALSE ) { |
|
233 | + protected function _trash_or_restore_ticket($trash = FALSE) { |
|
234 | 234 | $success = 1; |
235 | 235 | |
236 | 236 | $TKT = EEM_Ticket::instance(); |
237 | 237 | |
238 | 238 | //checkboxes? |
239 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
239 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
240 | 240 | //if array has more than one element then success message should be plural |
241 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
241 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
242 | 242 | |
243 | 243 | //cycle thru the boxes |
244 | - while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
245 | - if ( $trash ) { |
|
246 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
244 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
245 | + if ($trash) { |
|
246 | + if ( ! $TKT->delete_by_ID($TKT_ID)) |
|
247 | 247 | $success = 0; |
248 | 248 | } else { |
249 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
249 | + if ( ! $TKT->restore_by_ID($TKT_ID)) |
|
250 | 250 | $success = 0; |
251 | 251 | } |
252 | 252 | } |
253 | 253 | } else { |
254 | 254 | //grab single id and trash |
255 | - $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
255 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
256 | 256 | |
257 | - if ( $trash ) { |
|
258 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
257 | + if ($trash) { |
|
258 | + if ( ! $TKT->delete_by_ID($TKT_ID)) |
|
259 | 259 | $success = 0; |
260 | 260 | } else { |
261 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
261 | + if ( ! $TKT->restore_by_ID($TKT_ID)) |
|
262 | 262 | $success = 0; |
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
266 | 266 | $action_desc = $trash ? 'moved to the trash' : 'restored'; |
267 | - $this->_redirect_after_action( $success, 'Tickets', $action_desc, array() ); |
|
267 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, array()); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | |
@@ -277,34 +277,34 @@ discard block |
||
277 | 277 | $TKT = EEM_Ticket::instance(); |
278 | 278 | |
279 | 279 | //checkboxes? |
280 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
280 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
281 | 281 | //if array has more than one element then success message should be plural |
282 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
282 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
283 | 283 | |
284 | 284 | //cycle thru the boxes |
285 | - while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
285 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
286 | 286 | //delete |
287 | - if ( ! $this->_delete_the_ticket( $TKT_ID ) ) { |
|
287 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
288 | 288 | $success = 0; |
289 | 289 | } |
290 | 290 | } |
291 | 291 | } else { |
292 | 292 | //grab single id and trash |
293 | - $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
294 | - if ( ! $this->_delete_the_ticket( $TKT_ID ) ) { |
|
293 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
294 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
295 | 295 | $success = 0; |
296 | 296 | } |
297 | 297 | } |
298 | 298 | |
299 | 299 | $action_desc = 'deleted'; |
300 | - $this->_redirect_after_action( $success, 'Tickets', $action_desc, array() ); |
|
300 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, array()); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | |
304 | 304 | |
305 | 305 | |
306 | - protected function _delete_the_ticket( $TKT_ID ) { |
|
307 | - $tkt = EEM_Ticket::instance()->get_one_by_ID( $TKT_ID ); |
|
306 | + protected function _delete_the_ticket($TKT_ID) { |
|
307 | + $tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID); |
|
308 | 308 | |
309 | 309 | //delete all related prices first |
310 | 310 | $tkt->delete_related_permanently('Price'); |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -220,7 +222,7 @@ discard block |
||
220 | 222 | |
221 | 223 | if($count){ |
222 | 224 | return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
223 | - }else{ |
|
225 | + } else{ |
|
224 | 226 | return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
225 | 227 | } |
226 | 228 | |
@@ -243,11 +245,13 @@ discard block |
||
243 | 245 | //cycle thru the boxes |
244 | 246 | while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
245 | 247 | if ( $trash ) { |
246 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
247 | - $success = 0; |
|
248 | + if ( ! $TKT->delete_by_ID( $TKT_ID ) ) { |
|
249 | + $success = 0; |
|
250 | + } |
|
248 | 251 | } else { |
249 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
250 | - $success = 0; |
|
252 | + if ( ! $TKT->restore_by_ID( $TKT_ID ) ) { |
|
253 | + $success = 0; |
|
254 | + } |
|
251 | 255 | } |
252 | 256 | } |
253 | 257 | } else { |
@@ -255,11 +259,13 @@ discard block |
||
255 | 259 | $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
256 | 260 | |
257 | 261 | if ( $trash ) { |
258 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
259 | - $success = 0; |
|
262 | + if ( ! $TKT->delete_by_ID( $TKT_ID ) ) { |
|
263 | + $success = 0; |
|
264 | + } |
|
260 | 265 | } else { |
261 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
262 | - $success = 0; |
|
266 | + if ( ! $TKT->restore_by_ID( $TKT_ID ) ) { |
|
267 | + $success = 0; |
|
268 | + } |
|
263 | 269 | } |
264 | 270 | } |
265 | 271 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * ------------------------------------------------------------------------ |
25 | 25 | */ |
26 | -class Tickets_Admin_Page_Init extends EE_Admin_Page_Init { |
|
26 | +class Tickets_Admin_Page_Init extends EE_Admin_Page_Init { |
|
27 | 27 | |
28 | 28 | |
29 | 29 | |
@@ -36,19 +36,19 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | 38 | |
39 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
39 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
40 | 40 | |
41 | - define( 'TICKETS_PG_SLUG', 'tickets' ); |
|
42 | - define( 'TICKETS_LABEL', __('Default Tickets', 'event_espresso')); |
|
43 | - define( 'TICKETS_ADMIN', EE_CORE_CAF_ADMIN . 'new' . DS . TICKETS_PG_SLUG . DS ); |
|
44 | - define( 'TICKETS_ADMIN_URL', admin_url( 'admin.php?page=' . TICKETS_PG_SLUG )); |
|
45 | - define( 'TICKETS_ASSETS_PATH', TICKETS_ADMIN . 'assets' . DS ); |
|
46 | - define( 'TICKETS_ASSETS_URL', EE_CORE_CAF_ADMIN_URL . 'new' . DS . TICKETS_PG_SLUG .'/assets/' ); |
|
47 | - define( 'TICKETS_TEMPLATE_PATH', TICKETS_ADMIN . 'templates' . DS ); |
|
48 | - define( 'TICKETS_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL . 'new' . DS . TICKETS_PG_SLUG . DS . 'templates/' ); |
|
41 | + define('TICKETS_PG_SLUG', 'tickets'); |
|
42 | + define('TICKETS_LABEL', __('Default Tickets', 'event_espresso')); |
|
43 | + define('TICKETS_ADMIN', EE_CORE_CAF_ADMIN.'new'.DS.TICKETS_PG_SLUG.DS); |
|
44 | + define('TICKETS_ADMIN_URL', admin_url('admin.php?page='.TICKETS_PG_SLUG)); |
|
45 | + define('TICKETS_ASSETS_PATH', TICKETS_ADMIN.'assets'.DS); |
|
46 | + define('TICKETS_ASSETS_URL', EE_CORE_CAF_ADMIN_URL.'new'.DS.TICKETS_PG_SLUG.'/assets/'); |
|
47 | + define('TICKETS_TEMPLATE_PATH', TICKETS_ADMIN.'templates'.DS); |
|
48 | + define('TICKETS_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL.'new'.DS.TICKETS_PG_SLUG.DS.'templates/'); |
|
49 | 49 | |
50 | 50 | parent::__construct(); |
51 | - $this->_folder_path = EE_CORE_CAF_ADMIN . 'new' . DS . $this->_folder_name . DS; |
|
51 | + $this->_folder_path = EE_CORE_CAF_ADMIN.'new'.DS.$this->_folder_name.DS; |
|
52 | 52 | |
53 | 53 | } |
54 | 54 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | |
64 | 64 | protected function _set_menu_map() { |
65 | - $this->_menu_map = new EE_Admin_Page_Sub_Menu( array( |
|
65 | + $this->_menu_map = new EE_Admin_Page_Sub_Menu(array( |
|
66 | 66 | 'menu_group' => 'management', |
67 | 67 | 'menu_order' => 15, |
68 | 68 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'TKT_taxable' => __('Taxable', 'event_espresso') |
60 | 60 | ); |
61 | 61 | |
62 | - $this->_sortable_columns = array( |
|
62 | + $this->_sortable_columns = array( |
|
63 | 63 | // TRUE means its already sorted |
64 | 64 | 'TKT_name' => array( 'TKT_name', TRUE ), |
65 | 65 | 'TKT_description' => array( 'TKT_description', FALSE ), |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | 'TKT_min' => array( 'TKT_min', FALSE ), |
69 | 69 | 'TKT_max' => array( 'TKT_max', FALSE ), |
70 | 70 | 'TKT_price' => array( 'TKT_price', FALSE ) |
71 | - ); |
|
71 | + ); |
|
72 | 72 | |
73 | - $this->_hidden_columns = array( |
|
73 | + $this->_hidden_columns = array( |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | } |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | |
32 | 32 | protected function _setup_data() { |
33 | 33 | $trashed = $this->_admin_page->get_view() == 'trashed' ? TRUE : FALSE; |
34 | - $this->_data = $this->_admin_page->get_default_tickets( $this->_per_page, FALSE, $trashed ); |
|
35 | - $this->_all_data_count = $this->_admin_page->get_default_tickets( $this->_per_page, TRUE, FALSE ); |
|
36 | - $this->_trashed_count = $this->_admin_page->get_default_tickets( $this->_per_page, TRUE, TRUE ); |
|
34 | + $this->_data = $this->_admin_page->get_default_tickets($this->_per_page, FALSE, $trashed); |
|
35 | + $this->_all_data_count = $this->_admin_page->get_default_tickets($this->_per_page, TRUE, FALSE); |
|
36 | + $this->_trashed_count = $this->_admin_page->get_default_tickets($this->_per_page, TRUE, TRUE); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | |
62 | 62 | $this->_sortable_columns = array( |
63 | 63 | // TRUE means its already sorted |
64 | - 'TKT_name' => array( 'TKT_name', TRUE ), |
|
65 | - 'TKT_description' => array( 'TKT_description', FALSE ), |
|
66 | - 'TKT_qty' => array( 'TKT_qty', FALSE ), |
|
67 | - 'TKT_uses' => array( 'TKT_uses', FALSE ), |
|
68 | - 'TKT_min' => array( 'TKT_min', FALSE ), |
|
69 | - 'TKT_max' => array( 'TKT_max', FALSE ), |
|
70 | - 'TKT_price' => array( 'TKT_price', FALSE ) |
|
64 | + 'TKT_name' => array('TKT_name', TRUE), |
|
65 | + 'TKT_description' => array('TKT_description', FALSE), |
|
66 | + 'TKT_qty' => array('TKT_qty', FALSE), |
|
67 | + 'TKT_uses' => array('TKT_uses', FALSE), |
|
68 | + 'TKT_min' => array('TKT_min', FALSE), |
|
69 | + 'TKT_max' => array('TKT_max', FALSE), |
|
70 | + 'TKT_price' => array('TKT_price', FALSE) |
|
71 | 71 | ); |
72 | 72 | |
73 | 73 | $this->_hidden_columns = array( |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | |
88 | 88 | protected function _add_view_counts() { |
89 | 89 | $this->_views['all']['count'] = $this->_all_data_count; |
90 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_tickets', 'trash_ticket')) |
|
90 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_tickets', 'trash_ticket')) |
|
91 | 91 | $this->_views['trashed']['count'] = $this->_trashed_count; |
92 | 92 | } |
93 | 93 | |
94 | 94 | |
95 | 95 | |
96 | 96 | function column_cb($item) { |
97 | - return $item->ID() === 1 ? '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID() ); |
|
97 | + return $item->ID() === 1 ? '<span class="ee-lock-icon"></span>' : sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID()); |
|
98 | 98 | |
99 | 99 | } |
100 | 100 | |
@@ -105,21 +105,21 @@ discard block |
||
105 | 105 | $actions = array(); |
106 | 106 | |
107 | 107 | //trash links |
108 | - if ( $item->ID() !== 1 ) { |
|
109 | - if ( $this->_view == 'all' ) { |
|
110 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'trash_ticket', 'TKT_ID' => $item->ID() ), TICKETS_ADMIN_URL ); |
|
111 | - $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' . esc_attr__('Move Ticket to trash', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
108 | + if ($item->ID() !== 1) { |
|
109 | + if ($this->_view == 'all') { |
|
110 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'trash_ticket', 'TKT_ID' => $item->ID()), TICKETS_ADMIN_URL); |
|
111 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Move Ticket to trash', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
112 | 112 | } else { |
113 | 113 | // restore price link |
114 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_ticket', 'TKT_ID'=>$item->ID() ), TICKETS_ADMIN_URL ); |
|
115 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Ticket', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
114 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_ticket', 'TKT_ID'=>$item->ID()), TICKETS_ADMIN_URL); |
|
115 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Ticket', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
116 | 116 | // delete price link |
117 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_ticket', 'TKT_ID'=>$item->ID() ), TICKETS_ADMIN_URL ); |
|
118 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Ticket Permanently', 'event_espresso' ) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>'; |
|
117 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_ticket', 'TKT_ID'=>$item->ID()), TICKETS_ADMIN_URL); |
|
118 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Ticket Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
122 | - return $item->get('TKT_name') . $this->row_actions( $actions ); |
|
122 | + return $item->get('TKT_name').$this->row_actions($actions); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -132,13 +132,13 @@ discard block |
||
132 | 132 | |
133 | 133 | |
134 | 134 | function column_TKT_qty($item) { |
135 | - return $item->get_pretty('TKT_qty','text'); |
|
135 | + return $item->get_pretty('TKT_qty', 'text'); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
139 | 139 | |
140 | 140 | function column_TKT_uses($item) { |
141 | - return $item->get_pretty('TKT_uses','text'); |
|
141 | + return $item->get_pretty('TKT_uses', 'text'); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | |
151 | 151 | function column_TKT_max($item) { |
152 | - return $item->get_pretty('TKT_max','text'); |
|
152 | + return $item->get_pretty('TKT_max', 'text'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | |
3 | 5 | /** |
4 | 6 | * Event Espresso |
@@ -87,8 +89,9 @@ discard block |
||
87 | 89 | |
88 | 90 | protected function _add_view_counts() { |
89 | 91 | $this->_views['all']['count'] = $this->_all_data_count; |
90 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_tickets', 'trash_ticket')) |
|
91 | - $this->_views['trashed']['count'] = $this->_trashed_count; |
|
92 | + if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_tickets', 'trash_ticket')) { |
|
93 | + $this->_views['trashed']['count'] = $this->_trashed_count; |
|
94 | + } |
|
92 | 95 | } |
93 | 96 | |
94 | 97 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | <tbody> |
34 | 34 | <tr> |
35 | 35 | <td> |
36 | - <h2><?php printf( __('Hello, %s:', 'event_espresso'), '[RECIPIENT_FNAME]' ); ?></h2> |
|
36 | + <h2><?php printf(__('Hello, %s:', 'event_espresso'), '[RECIPIENT_FNAME]'); ?></h2> |
|
37 | 37 | <p class="lead"><?php _e("We've got a few things we want to share with you!", 'event_espresso'); ?></p> |
38 | 38 | <div> |
39 | 39 | [NEWSLETTER_CONTENT] |
@@ -1,1 +1,1 @@ |
||
1 | -<?php printf( __('Message from %s', 'event_espresso'), EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) ); ?> |
|
1 | +<?php printf(__('Message from %s', 'event_espresso'), EE_Registry::instance()->CFG->organization->get_pretty('name')); ?> |
@@ -80,7 +80,7 @@ |
||
80 | 80 | //remove unwanted transaction shortcode |
81 | 81 | foreach ( $this->_valid_shortcodes as $context => $shortcodes ) { |
82 | 82 | if( ($key = array_search('transaction', $shortcodes) ) !== false) { |
83 | - unset($this->_valid_shortcodes[$context][$key]); |
|
83 | + unset($this->_valid_shortcodes[$context][$key]); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | parent::_set_valid_shortcodes(); |
79 | 79 | |
80 | 80 | //remove unwanted transaction shortcode |
81 | - foreach ( $this->_valid_shortcodes as $context => $shortcodes ) { |
|
82 | - if( ($key = array_search('transaction', $shortcodes) ) !== false) { |
|
81 | + foreach ($this->_valid_shortcodes as $context => $shortcodes) { |
|
82 | + if (($key = array_search('transaction', $shortcodes)) !== false) { |
|
83 | 83 | unset($this->_valid_shortcodes[$context][$key]); |
84 | 84 | } |
85 | 85 | } |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -19,63 +19,63 @@ |
||
19 | 19 | class EE_Messages_Contacts_incoming_data extends EE_Messages_incoming_data { |
20 | 20 | |
21 | 21 | |
22 | - /** |
|
23 | - * Constructor. |
|
24 | - * |
|
25 | - * @since 4.3.0 |
|
26 | - * @param EE_Attendee[] $data expecting an array of EE_Attendee objects. |
|
27 | - * @access protected |
|
28 | - */ |
|
29 | - public function __construct( $data = array() ) { |
|
22 | + /** |
|
23 | + * Constructor. |
|
24 | + * |
|
25 | + * @since 4.3.0 |
|
26 | + * @param EE_Attendee[] $data expecting an array of EE_Attendee objects. |
|
27 | + * @access protected |
|
28 | + */ |
|
29 | + public function __construct( $data = array() ) { |
|
30 | 30 | |
31 | - //validate that the first element in the array is an EE_Attendee object. Note that the array may be indexed by REG_ID so we will just shift off the first element. |
|
32 | - $ctc_chk = reset( $data ); |
|
33 | - if ( ! $ctc_chk instanceof EE_Attendee ) |
|
34 | - throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso') ); |
|
31 | + //validate that the first element in the array is an EE_Attendee object. Note that the array may be indexed by REG_ID so we will just shift off the first element. |
|
32 | + $ctc_chk = reset( $data ); |
|
33 | + if ( ! $ctc_chk instanceof EE_Attendee ) |
|
34 | + throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso') ); |
|
35 | 35 | |
36 | - parent::__construct( $data ); |
|
37 | - } |
|
36 | + parent::__construct( $data ); |
|
37 | + } |
|
38 | 38 | |
39 | 39 | |
40 | 40 | |
41 | - /** |
|
42 | - * setup the data. |
|
43 | - * |
|
44 | - * Sets up the expected data object for the messages prep using incoming registration objects. |
|
45 | - * |
|
46 | - * @since 4.3.0 |
|
47 | - * |
|
48 | - * @return void |
|
49 | - * @access protected |
|
50 | - */ |
|
51 | - protected function _setup_data() { |
|
41 | + /** |
|
42 | + * setup the data. |
|
43 | + * |
|
44 | + * Sets up the expected data object for the messages prep using incoming registration objects. |
|
45 | + * |
|
46 | + * @since 4.3.0 |
|
47 | + * |
|
48 | + * @return void |
|
49 | + * @access protected |
|
50 | + */ |
|
51 | + protected function _setup_data() { |
|
52 | 52 | |
53 | - //we'll loop through each contact and setup the data needed. Note that many properties will just be set as empty because the contacts data handler is for a very specific set of data (i.e. just what's related to the contact). |
|
54 | - $this->txn = NULL; |
|
55 | - $this->taxes = NULL; |
|
56 | - $this->grand_total_price_object = ''; |
|
57 | - $this->user_id = $this->ip_address = $this->user_agent = $this->init_access = ''; |
|
58 | - $this->payment = NULL; |
|
59 | - $this->billing = array(); |
|
60 | - $this->reg_objs = array(); |
|
61 | - $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
62 | - $this->total_ticket_count = 0; |
|
63 | - $this->primary_attendee_data = array( |
|
64 | - 'registration_id' => 0, |
|
65 | - 'att_obj' => NULL, |
|
66 | - 'reg_obj' => NULL, |
|
67 | - 'primary_att_obj' => NULL, |
|
68 | - 'primary_reg_obj' => NULL |
|
69 | - ); |
|
53 | + //we'll loop through each contact and setup the data needed. Note that many properties will just be set as empty because the contacts data handler is for a very specific set of data (i.e. just what's related to the contact). |
|
54 | + $this->txn = NULL; |
|
55 | + $this->taxes = NULL; |
|
56 | + $this->grand_total_price_object = ''; |
|
57 | + $this->user_id = $this->ip_address = $this->user_agent = $this->init_access = ''; |
|
58 | + $this->payment = NULL; |
|
59 | + $this->billing = array(); |
|
60 | + $this->reg_objs = array(); |
|
61 | + $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
62 | + $this->total_ticket_count = 0; |
|
63 | + $this->primary_attendee_data = array( |
|
64 | + 'registration_id' => 0, |
|
65 | + 'att_obj' => NULL, |
|
66 | + 'reg_obj' => NULL, |
|
67 | + 'primary_att_obj' => NULL, |
|
68 | + 'primary_reg_obj' => NULL |
|
69 | + ); |
|
70 | 70 | |
71 | - foreach ( $this->_data as $contact ) { |
|
72 | - $id = $contact->ID(); |
|
73 | - $reg = $contact->get_first_related('Registration'); |
|
74 | - $this->attendees[$id]['att_obj'] = $contact; |
|
75 | - $this->attendees[$id]['reg_objs'][$reg->ID()] = $reg; |
|
76 | - $this->attendees[$id]['attendee_email'] = $contact->email(); |
|
77 | - $this->attendees[$id]['tkt_objs'] = array(); |
|
78 | - $this->attendees[$id]['evt_objs'] = array(); |
|
79 | - } |
|
80 | - } |
|
71 | + foreach ( $this->_data as $contact ) { |
|
72 | + $id = $contact->ID(); |
|
73 | + $reg = $contact->get_first_related('Registration'); |
|
74 | + $this->attendees[$id]['att_obj'] = $contact; |
|
75 | + $this->attendees[$id]['reg_objs'][$reg->ID()] = $reg; |
|
76 | + $this->attendees[$id]['attendee_email'] = $contact->email(); |
|
77 | + $this->attendees[$id]['tkt_objs'] = array(); |
|
78 | + $this->attendees[$id]['evt_objs'] = array(); |
|
79 | + } |
|
80 | + } |
|
81 | 81 | } |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | * @param EE_Attendee[] $data expecting an array of EE_Attendee objects. |
27 | 27 | * @access protected |
28 | 28 | */ |
29 | - public function __construct( $data = array() ) { |
|
29 | + public function __construct($data = array()) { |
|
30 | 30 | |
31 | 31 | //validate that the first element in the array is an EE_Attendee object. Note that the array may be indexed by REG_ID so we will just shift off the first element. |
32 | - $ctc_chk = reset( $data ); |
|
33 | - if ( ! $ctc_chk instanceof EE_Attendee ) |
|
34 | - throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso') ); |
|
32 | + $ctc_chk = reset($data); |
|
33 | + if ( ! $ctc_chk instanceof EE_Attendee) |
|
34 | + throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso')); |
|
35 | 35 | |
36 | - parent::__construct( $data ); |
|
36 | + parent::__construct($data); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $this->payment = NULL; |
59 | 59 | $this->billing = array(); |
60 | 60 | $this->reg_objs = array(); |
61 | - $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
61 | + $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
62 | 62 | $this->total_ticket_count = 0; |
63 | 63 | $this->primary_attendee_data = array( |
64 | 64 | 'registration_id' => 0, |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | 'primary_reg_obj' => NULL |
69 | 69 | ); |
70 | 70 | |
71 | - foreach ( $this->_data as $contact ) { |
|
71 | + foreach ($this->_data as $contact) { |
|
72 | 72 | $id = $contact->ID(); |
73 | 73 | $reg = $contact->get_first_related('Registration'); |
74 | 74 | $this->attendees[$id]['att_obj'] = $contact; |
@@ -5,7 +5,9 @@ discard block |
||
5 | 5 | * @subpackage helpers |
6 | 6 | * @since 4.3.0 |
7 | 7 | */ |
8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | +} |
|
9 | 11 | |
10 | 12 | /** |
11 | 13 | * This prepares data for message types that send messages for multiple contacts and handles |
@@ -30,8 +32,9 @@ discard block |
||
30 | 32 | |
31 | 33 | //validate that the first element in the array is an EE_Attendee object. Note that the array may be indexed by REG_ID so we will just shift off the first element. |
32 | 34 | $ctc_chk = reset( $data ); |
33 | - if ( ! $ctc_chk instanceof EE_Attendee ) |
|
34 | - throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso') ); |
|
35 | + if ( ! $ctc_chk instanceof EE_Attendee ) { |
|
36 | + throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso') ); |
|
37 | + } |
|
35 | 38 | |
36 | 39 | parent::__construct( $data ); |
37 | 40 | } |
@@ -18,27 +18,27 @@ |
||
18 | 18 | * @author Darren Ethier |
19 | 19 | */ |
20 | 20 | class EE_Messages_Email_Newsletter_Validator extends EE_Messages_Validator { |
21 | - public function __construct( $fields, $context ) { |
|
21 | + public function __construct($fields, $context) { |
|
22 | 22 | $this->_m_name = 'email'; |
23 | 23 | $this->_mt_name = 'newsletter'; |
24 | 24 | |
25 | - parent::__construct( $fields, $context ); |
|
25 | + parent::__construct($fields, $context); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
29 | 29 | * custom validator (restricting what was originally set by the messenger) |
30 | 30 | */ |
31 | 31 | protected function _modify_validator() { |
32 | - if ( $this->_context == 'attendee' ) |
|
32 | + if ($this->_context == 'attendee') |
|
33 | 33 | $this->_valid_shortcodes_modifier[$this->_context]['from'] = array('recipient_details', 'email', 'organization'); |
34 | 34 | |
35 | 35 | //excluded shortcodes |
36 | - $fields = array('to','from','subject','content','newsletter_content'); |
|
37 | - foreach ( $fields as $field ) { |
|
36 | + $fields = array('to', 'from', 'subject', 'content', 'newsletter_content'); |
|
37 | + foreach ($fields as $field) { |
|
38 | 38 | $this->_specific_shortcode_excludes[$field] = array('[RECIPIENT_REGISTRATION_CODE]', '[RECIPIENT_EDIT_REGISTRATION_LINK]', '[EVENT_AUTHOR_FORMATTED_EMAIL]', '[EVENT_AUTHOR_EMAIL]'); |
39 | 39 | } |
40 | - $add_excludes = array( '[RECIPIENT_FNAME]', '[RECIPIENT_LNAME]', '[RECIPIENT_EMAIL]', '[COMPANY]', '[CO_ADD1]','[CO_ADD2]', '[CO_CITY]', '[CO_STATE]','[CO_ZIP]','[CO_LOGO]','[CO_PHONE]','[CO_LOGO_URL]','[CO_FACEBOOK_URL]','[CO_TWITTER_URL]','[CO_PINTEREST_URL]','[CO_GOOGLE_URL]','[CO_LINKEDIN_URL]','[CO_INSTAGRAM_URL]'); |
|
40 | + $add_excludes = array('[RECIPIENT_FNAME]', '[RECIPIENT_LNAME]', '[RECIPIENT_EMAIL]', '[COMPANY]', '[CO_ADD1]', '[CO_ADD2]', '[CO_CITY]', '[CO_STATE]', '[CO_ZIP]', '[CO_LOGO]', '[CO_PHONE]', '[CO_LOGO_URL]', '[CO_FACEBOOK_URL]', '[CO_TWITTER_URL]', '[CO_PINTEREST_URL]', '[CO_GOOGLE_URL]', '[CO_LINKEDIN_URL]', '[CO_INSTAGRAM_URL]'); |
|
41 | 41 | $this->_specific_shortcode_excludes['from'] = array_merge($this->_specific_shortcode_excludes['from'], $add_excludes); |
42 | - $this->_specific_shortcode_excludes['content'] = array_merge( $this->_specific_shortcode_excludes['content'], array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]') ); |
|
42 | + $this->_specific_shortcode_excludes['content'] = array_merge($this->_specific_shortcode_excludes['content'], array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]')); |
|
43 | 43 | } |
44 | 44 | } |
@@ -5,7 +5,9 @@ discard block |
||
5 | 5 | * @subpackage helpers |
6 | 6 | * @since 4.3.0 |
7 | 7 | */ |
8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | +} |
|
9 | 11 | |
10 | 12 | /** |
11 | 13 | * Holds any special validation rules for template fields with Email messenger and Newsletter |
@@ -29,8 +31,9 @@ discard block |
||
29 | 31 | * custom validator (restricting what was originally set by the messenger) |
30 | 32 | */ |
31 | 33 | protected function _modify_validator() { |
32 | - if ( $this->_context == 'attendee' ) |
|
33 | - $this->_valid_shortcodes_modifier[$this->_context]['from'] = array('recipient_details', 'email', 'organization'); |
|
34 | + if ( $this->_context == 'attendee' ) { |
|
35 | + $this->_valid_shortcodes_modifier[$this->_context]['from'] = array('recipient_details', 'email', 'organization'); |
|
36 | + } |
|
34 | 37 | |
35 | 38 | //excluded shortcodes |
36 | 39 | $fields = array('to','from','subject','content','newsletter_content'); |
@@ -18,27 +18,27 @@ |
||
18 | 18 | * @author Darren Ethier |
19 | 19 | */ |
20 | 20 | class EE_Messages_Email_Newsletter_Validator extends EE_Messages_Validator { |
21 | - public function __construct( $fields, $context ) { |
|
22 | - $this->_m_name = 'email'; |
|
23 | - $this->_mt_name = 'newsletter'; |
|
21 | + public function __construct( $fields, $context ) { |
|
22 | + $this->_m_name = 'email'; |
|
23 | + $this->_mt_name = 'newsletter'; |
|
24 | 24 | |
25 | - parent::__construct( $fields, $context ); |
|
26 | - } |
|
25 | + parent::__construct( $fields, $context ); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * custom validator (restricting what was originally set by the messenger) |
|
30 | - */ |
|
31 | - protected function _modify_validator() { |
|
32 | - if ( $this->_context == 'attendee' ) |
|
33 | - $this->_valid_shortcodes_modifier[$this->_context]['from'] = array('recipient_details', 'email', 'organization'); |
|
28 | + /** |
|
29 | + * custom validator (restricting what was originally set by the messenger) |
|
30 | + */ |
|
31 | + protected function _modify_validator() { |
|
32 | + if ( $this->_context == 'attendee' ) |
|
33 | + $this->_valid_shortcodes_modifier[$this->_context]['from'] = array('recipient_details', 'email', 'organization'); |
|
34 | 34 | |
35 | - //excluded shortcodes |
|
36 | - $fields = array('to','from','subject','content','newsletter_content'); |
|
37 | - foreach ( $fields as $field ) { |
|
38 | - $this->_specific_shortcode_excludes[$field] = array('[RECIPIENT_REGISTRATION_CODE]', '[RECIPIENT_EDIT_REGISTRATION_LINK]', '[EVENT_AUTHOR_FORMATTED_EMAIL]', '[EVENT_AUTHOR_EMAIL]'); |
|
39 | - } |
|
40 | - $add_excludes = array( '[RECIPIENT_FNAME]', '[RECIPIENT_LNAME]', '[RECIPIENT_EMAIL]', '[COMPANY]', '[CO_ADD1]','[CO_ADD2]', '[CO_CITY]', '[CO_STATE]','[CO_ZIP]','[CO_LOGO]','[CO_PHONE]','[CO_LOGO_URL]','[CO_FACEBOOK_URL]','[CO_TWITTER_URL]','[CO_PINTEREST_URL]','[CO_GOOGLE_URL]','[CO_LINKEDIN_URL]','[CO_INSTAGRAM_URL]'); |
|
41 | - $this->_specific_shortcode_excludes['from'] = array_merge($this->_specific_shortcode_excludes['from'], $add_excludes); |
|
42 | - $this->_specific_shortcode_excludes['content'] = array_merge( $this->_specific_shortcode_excludes['content'], array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]') ); |
|
43 | - } |
|
35 | + //excluded shortcodes |
|
36 | + $fields = array('to','from','subject','content','newsletter_content'); |
|
37 | + foreach ( $fields as $field ) { |
|
38 | + $this->_specific_shortcode_excludes[$field] = array('[RECIPIENT_REGISTRATION_CODE]', '[RECIPIENT_EDIT_REGISTRATION_LINK]', '[EVENT_AUTHOR_FORMATTED_EMAIL]', '[EVENT_AUTHOR_EMAIL]'); |
|
39 | + } |
|
40 | + $add_excludes = array( '[RECIPIENT_FNAME]', '[RECIPIENT_LNAME]', '[RECIPIENT_EMAIL]', '[COMPANY]', '[CO_ADD1]','[CO_ADD2]', '[CO_CITY]', '[CO_STATE]','[CO_ZIP]','[CO_LOGO]','[CO_PHONE]','[CO_LOGO_URL]','[CO_FACEBOOK_URL]','[CO_TWITTER_URL]','[CO_PINTEREST_URL]','[CO_GOOGLE_URL]','[CO_LINKEDIN_URL]','[CO_INSTAGRAM_URL]'); |
|
41 | + $this->_specific_shortcode_excludes['from'] = array_merge($this->_specific_shortcode_excludes['from'], $add_excludes); |
|
42 | + $this->_specific_shortcode_excludes['content'] = array_merge( $this->_specific_shortcode_excludes['content'], array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]') ); |
|
43 | + } |
|
44 | 44 | } |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | |
49 | 49 | |
50 | 50 | |
51 | - protected function _get_data_for_context( $context, EE_Registration $registration, $id ) { |
|
51 | + protected function _get_data_for_context($context, EE_Registration $registration, $id) { |
|
52 | 52 | //newsletter message type data handler is 'Contacts' and it expects an array of EE_Attendee objects. |
53 | 53 | $contact = $registration->attendee(); |
54 | - if ( $contact instanceof EE_Attendee ) { |
|
55 | - return array( $contact ); |
|
54 | + if ($contact instanceof EE_Attendee) { |
|
55 | + return array($contact); |
|
56 | 56 | } |
57 | 57 | return array(); |
58 | 58 | } |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | 'recipient_details', 'organization', 'newsletter' |
100 | 100 | ); |
101 | 101 | |
102 | - foreach ( $this->_valid_shortcodes as $context => $shortcodes ) { |
|
103 | - foreach ( $shortcodes as $key => $shortcode ) { |
|
104 | - if ( !in_array( $shortcode, $included_shortcodes ) ) |
|
105 | - unset( $this->_valid_shortcodes[$context][$key] ); |
|
102 | + foreach ($this->_valid_shortcodes as $context => $shortcodes) { |
|
103 | + foreach ($shortcodes as $key => $shortcode) { |
|
104 | + if ( ! in_array($shortcode, $included_shortcodes)) |
|
105 | + unset($this->_valid_shortcodes[$context][$key]); |
|
106 | 106 | } |
107 | 107 | $this->_valid_shortcodes[$context][] = 'newsletter'; |
108 | 108 | } |
@@ -5,7 +5,9 @@ discard block |
||
5 | 5 | * @subpackage helpers |
6 | 6 | * @since 4.3.0 |
7 | 7 | */ |
8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | +} |
|
9 | 11 | |
10 | 12 | /** |
11 | 13 | * The message type for newsletter type of messages. |
@@ -101,8 +103,9 @@ discard block |
||
101 | 103 | |
102 | 104 | foreach ( $this->_valid_shortcodes as $context => $shortcodes ) { |
103 | 105 | foreach ( $shortcodes as $key => $shortcode ) { |
104 | - if ( !in_array( $shortcode, $included_shortcodes ) ) |
|
105 | - unset( $this->_valid_shortcodes[$context][$key] ); |
|
106 | + if ( !in_array( $shortcode, $included_shortcodes ) ) { |
|
107 | + unset( $this->_valid_shortcodes[$context][$key] ); |
|
108 | + } |
|
106 | 109 | } |
107 | 110 | $this->_valid_shortcodes[$context][] = 'newsletter'; |
108 | 111 | } |
@@ -20,94 +20,94 @@ |
||
20 | 20 | */ |
21 | 21 | class EE_Newsletter_message_type extends EE_message_type { |
22 | 22 | |
23 | - public function __construct() { |
|
24 | - $this->name = 'newsletter'; |
|
25 | - $this->description = __('Newsletter message types are triggered manually by the admin for sending mass email to select groups of registrants.', 'event_espresso'); |
|
26 | - $this->label = array( |
|
27 | - 'singular' => __('newsletter', 'event_espresso'), |
|
28 | - 'plural' => __('newsletters', 'event_espresso') |
|
29 | - ); |
|
30 | - $this->_master_templates = array( |
|
31 | - 'email' => 'registration' |
|
32 | - ); |
|
33 | - parent::__construct(); |
|
34 | - } |
|
23 | + public function __construct() { |
|
24 | + $this->name = 'newsletter'; |
|
25 | + $this->description = __('Newsletter message types are triggered manually by the admin for sending mass email to select groups of registrants.', 'event_espresso'); |
|
26 | + $this->label = array( |
|
27 | + 'singular' => __('newsletter', 'event_espresso'), |
|
28 | + 'plural' => __('newsletters', 'event_espresso') |
|
29 | + ); |
|
30 | + $this->_master_templates = array( |
|
31 | + 'email' => 'registration' |
|
32 | + ); |
|
33 | + parent::__construct(); |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | 37 | |
38 | - protected function _set_admin_pages() { |
|
39 | - $this->admin_registered_pages = array(); //no admin pages to register this with. |
|
40 | - } |
|
38 | + protected function _set_admin_pages() { |
|
39 | + $this->admin_registered_pages = array(); //no admin pages to register this with. |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | 43 | |
44 | - protected function _set_data_handler() { |
|
45 | - $this->_data_handler = 'Contacts'; |
|
46 | - $this->_single_message = $this->_data instanceof EE_Registration ? TRUE : FALSE; |
|
47 | - } |
|
44 | + protected function _set_data_handler() { |
|
45 | + $this->_data_handler = 'Contacts'; |
|
46 | + $this->_single_message = $this->_data instanceof EE_Registration ? TRUE : FALSE; |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | 50 | |
51 | - protected function _get_data_for_context( $context, EE_Registration $registration, $id ) { |
|
52 | - //newsletter message type data handler is 'Contacts' and it expects an array of EE_Attendee objects. |
|
53 | - $contact = $registration->attendee(); |
|
54 | - if ( $contact instanceof EE_Attendee ) { |
|
55 | - return array( $contact ); |
|
56 | - } |
|
57 | - return array(); |
|
58 | - } |
|
51 | + protected function _get_data_for_context( $context, EE_Registration $registration, $id ) { |
|
52 | + //newsletter message type data handler is 'Contacts' and it expects an array of EE_Attendee objects. |
|
53 | + $contact = $registration->attendee(); |
|
54 | + if ( $contact instanceof EE_Attendee ) { |
|
55 | + return array( $contact ); |
|
56 | + } |
|
57 | + return array(); |
|
58 | + } |
|
59 | 59 | |
60 | 60 | |
61 | 61 | |
62 | - protected function _set_admin_settings_fields() { |
|
63 | - $this->_admin_settings_fields = array(); |
|
64 | - } |
|
62 | + protected function _set_admin_settings_fields() { |
|
63 | + $this->_admin_settings_fields = array(); |
|
64 | + } |
|
65 | 65 | |
66 | 66 | |
67 | 67 | |
68 | - protected function _set_contexts() { |
|
69 | - $this->_context_label = array( |
|
70 | - 'label' => __('recipient', 'event_espresso'), |
|
71 | - 'plural' => __('recipients', 'event_espresso'), |
|
72 | - 'description' => __('Recipient\'s are who will receive the message.', 'event_espresso') |
|
73 | - ); |
|
68 | + protected function _set_contexts() { |
|
69 | + $this->_context_label = array( |
|
70 | + 'label' => __('recipient', 'event_espresso'), |
|
71 | + 'plural' => __('recipients', 'event_espresso'), |
|
72 | + 'description' => __('Recipient\'s are who will receive the message.', 'event_espresso') |
|
73 | + ); |
|
74 | 74 | |
75 | - $this->_contexts = array( |
|
76 | - 'attendee' => array( |
|
77 | - 'label' => __('Registrant', 'event_espresso'), |
|
78 | - 'description' => __('This template goes to selected registrants.', 'event_espresso') |
|
79 | - ) |
|
80 | - ); |
|
81 | - } |
|
75 | + $this->_contexts = array( |
|
76 | + 'attendee' => array( |
|
77 | + 'label' => __('Registrant', 'event_espresso'), |
|
78 | + 'description' => __('This template goes to selected registrants.', 'event_espresso') |
|
79 | + ) |
|
80 | + ); |
|
81 | + } |
|
82 | 82 | |
83 | 83 | |
84 | 84 | |
85 | 85 | |
86 | - /** |
|
87 | - * used to set the valid shortcodes. |
|
88 | - * |
|
89 | - * For the newsletter message type we only have two valid shortcode libraries in use, recipient details and organization. That's it! |
|
90 | - * |
|
91 | - * @since 4.3.0 |
|
92 | - * |
|
93 | - * @return void |
|
94 | - */ |
|
95 | - protected function _set_valid_shortcodes() { |
|
96 | - parent::_set_valid_shortcodes(); |
|
86 | + /** |
|
87 | + * used to set the valid shortcodes. |
|
88 | + * |
|
89 | + * For the newsletter message type we only have two valid shortcode libraries in use, recipient details and organization. That's it! |
|
90 | + * |
|
91 | + * @since 4.3.0 |
|
92 | + * |
|
93 | + * @return void |
|
94 | + */ |
|
95 | + protected function _set_valid_shortcodes() { |
|
96 | + parent::_set_valid_shortcodes(); |
|
97 | 97 | |
98 | - $included_shortcodes = array( |
|
99 | - 'recipient_details', 'organization', 'newsletter' |
|
100 | - ); |
|
98 | + $included_shortcodes = array( |
|
99 | + 'recipient_details', 'organization', 'newsletter' |
|
100 | + ); |
|
101 | 101 | |
102 | - foreach ( $this->_valid_shortcodes as $context => $shortcodes ) { |
|
103 | - foreach ( $shortcodes as $key => $shortcode ) { |
|
104 | - if ( !in_array( $shortcode, $included_shortcodes ) ) |
|
105 | - unset( $this->_valid_shortcodes[$context][$key] ); |
|
106 | - } |
|
107 | - $this->_valid_shortcodes[$context][] = 'newsletter'; |
|
108 | - } |
|
102 | + foreach ( $this->_valid_shortcodes as $context => $shortcodes ) { |
|
103 | + foreach ( $shortcodes as $key => $shortcode ) { |
|
104 | + if ( !in_array( $shortcode, $included_shortcodes ) ) |
|
105 | + unset( $this->_valid_shortcodes[$context][$key] ); |
|
106 | + } |
|
107 | + $this->_valid_shortcodes[$context][] = 'newsletter'; |
|
108 | + } |
|
109 | 109 | |
110 | - } |
|
110 | + } |
|
111 | 111 | |
112 | 112 | |
113 | 113 | } |