@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | <?php _e('Show on all Pages:', 'event_espresso'); ?> |
193 | 193 | </label> |
194 | 194 | <?php |
195 | - echo EEH_Form_Fields::select( |
|
196 | - __('Show on all Pages:', 'event_espresso'), |
|
197 | - $instance['show_everywhere'], |
|
198 | - $yes_no_values, |
|
199 | - $this->get_field_name('show_everywhere'), |
|
200 | - $this->get_field_id('show_everywhere') |
|
201 | - ); |
|
202 | - ?> |
|
195 | + echo EEH_Form_Fields::select( |
|
196 | + __('Show on all Pages:', 'event_espresso'), |
|
197 | + $instance['show_everywhere'], |
|
198 | + $yes_no_values, |
|
199 | + $this->get_field_name('show_everywhere'), |
|
200 | + $this->get_field_id('show_everywhere') |
|
201 | + ); |
|
202 | + ?> |
|
203 | 203 | </p> |
204 | 204 | <p> |
205 | 205 | <label for="<?php echo $this->get_field_id('date_limit'); ?>"> |
@@ -282,13 +282,13 @@ discard block |
||
282 | 282 | extract($args); |
283 | 283 | |
284 | 284 | // add function to make the title a link |
285 | - add_filter('widget_title', array($this, 'make_the_title_a_link'), 15); |
|
285 | + add_filter('widget_title', array($this, 'make_the_title_a_link'), 15); |
|
286 | 286 | |
287 | 287 | // filter the title |
288 | 288 | $title = apply_filters('widget_title', $instance['title']); |
289 | 289 | |
290 | 290 | // remove the function from the filter, so it does not affect other widgets |
291 | - remove_filter('widget_title', array($this, 'make_the_title_a_link'), 15); |
|
291 | + remove_filter('widget_title', array($this, 'make_the_title_a_link'), 15); |
|
292 | 292 | |
293 | 293 | // Before widget (defined by themes). |
294 | 294 | echo $before_widget; |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | * @return string |
386 | 386 | */ |
387 | 387 | public function make_the_title_a_link($title) { |
388 | - return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
388 | + return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | } |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | function __construct() { |
31 | 31 | parent::__construct( |
32 | 32 | 'ee-upcoming-events-widget', |
33 | - __( 'Event Espresso Upcoming Events', 'event_espresso' ), |
|
34 | - array( 'description' => __( 'A widget to display your upcoming events.', 'event_espresso' )), |
|
33 | + __('Event Espresso Upcoming Events', 'event_espresso'), |
|
34 | + array('description' => __('A widget to display your upcoming events.', 'event_espresso')), |
|
35 | 35 | array( |
36 | 36 | 'width' => 300, |
37 | 37 | 'height' => 350, |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | * @param array $instance Previously saved values from database. |
50 | 50 | * @return string|void |
51 | 51 | */ |
52 | - public function form( $instance ) { |
|
52 | + public function form($instance) { |
|
53 | 53 | |
54 | - EE_Registry::instance()->load_class( 'Question_Option', array(), FALSE, FALSE, TRUE ); |
|
54 | + EE_Registry::instance()->load_class('Question_Option', array(), FALSE, FALSE, TRUE); |
|
55 | 55 | // Set up some default widget settings. |
56 | 56 | $defaults = array( |
57 | 57 | 'title' => __('Upcoming Events', 'event_espresso'), |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | 'image_size' => 'medium' |
67 | 67 | ); |
68 | 68 | |
69 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
69 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
70 | 70 | // don't add HTML labels for EE_Form_Fields generated inputs |
71 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' ); |
|
71 | + add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
72 | 72 | $yes_no_values = array( |
73 | - EE_Question_Option::new_instance( array( 'QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))), |
|
74 | - EE_Question_Option::new_instance( array( 'QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso'))) |
|
73 | + EE_Question_Option::new_instance(array('QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))), |
|
74 | + EE_Question_Option::new_instance(array('QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso'))) |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | ?> |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | <label for="<?php echo $this->get_field_id('title'); ?>"> |
83 | 83 | <?php _e('Title:', 'event_espresso'); ?> |
84 | 84 | </label> |
85 | - <input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" type="text" /> |
|
85 | + <input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($instance['title']); ?>" type="text" /> |
|
86 | 86 | </p> |
87 | 87 | <p> |
88 | 88 | <label for="<?php echo $this->get_field_id('category_name'); ?>"> |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | <?php |
92 | 92 | $event_categories = array(); |
93 | 93 | /** @type EEM_Term $EEM_Term */ |
94 | - $EEM_Term = EE_Registry::instance()->load_model( 'Term' ); |
|
95 | - $categories = $EEM_Term->get_all_ee_categories( TRUE ); |
|
96 | - if ( $categories ) { |
|
97 | - foreach ( $categories as $category ) { |
|
98 | - if ( $category instanceof EE_Term ) { |
|
99 | - $event_categories[] = EE_Question_Option::new_instance( array( 'QSO_value' => $category->get( 'slug' ), 'QSO_desc' => $category->get( 'name' ))); |
|
94 | + $EEM_Term = EE_Registry::instance()->load_model('Term'); |
|
95 | + $categories = $EEM_Term->get_all_ee_categories(TRUE); |
|
96 | + if ($categories) { |
|
97 | + foreach ($categories as $category) { |
|
98 | + if ($category instanceof EE_Term) { |
|
99 | + $event_categories[] = EE_Question_Option::new_instance(array('QSO_value' => $category->get('slug'), 'QSO_desc' => $category->get('name'))); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
103 | - array_unshift( $event_categories, EE_Question_Option::new_instance( array( 'QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso')))); |
|
103 | + array_unshift($event_categories, EE_Question_Option::new_instance(array('QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso')))); |
|
104 | 104 | echo EEH_Form_Fields::select( |
105 | 105 | __('Event Category:', 'event_espresso'), |
106 | 106 | $instance['category_name'], |
@@ -137,16 +137,16 @@ discard block |
||
137 | 137 | <?php |
138 | 138 | $image_sizes = array(); |
139 | 139 | $sizes = get_intermediate_image_sizes(); |
140 | - if ( $sizes ) { |
|
140 | + if ($sizes) { |
|
141 | 141 | // loop thru images and create option objects out of them |
142 | - foreach ( $sizes as $image_size ) { |
|
143 | - $image_size = trim( $image_size ); |
|
142 | + foreach ($sizes as $image_size) { |
|
143 | + $image_size = trim($image_size); |
|
144 | 144 | // no big images plz |
145 | - if ( ! in_array( $image_size, array( 'large', 'post-thumbnail' ))) { |
|
146 | - $image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => $image_size, 'QSO_desc' => $image_size )); |
|
145 | + if ( ! in_array($image_size, array('large', 'post-thumbnail'))) { |
|
146 | + $image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => $image_size, 'QSO_desc' => $image_size)); |
|
147 | 147 | } |
148 | 148 | } |
149 | - $image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => 'none', 'QSO_desc' => __('don\'t show images', 'event_espresso') )); |
|
149 | + $image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => 'none', 'QSO_desc' => __('don\'t show images', 'event_espresso'))); |
|
150 | 150 | } |
151 | 151 | echo EEH_Form_Fields::select( |
152 | 152 | __('Image Size:', 'event_espresso'), |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | <label for="<?php echo $this->get_field_id('date_limit'); ?>"> |
205 | 205 | <?php _e('Number of Dates to Display:', 'event_espresso'); ?> |
206 | 206 | </label> |
207 | - <input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr( $instance['date_limit'] ); ?>" size="3" type="text" /> |
|
207 | + <input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr($instance['date_limit']); ?>" size="3" type="text" /> |
|
208 | 208 | </p> |
209 | 209 | <p> |
210 | 210 | <label for="<?php echo $this->get_field_id('date_range'); ?>"> |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @return array Updated safe values to be saved. |
238 | 238 | */ |
239 | - public function update( $new_instance, $old_instance ) { |
|
239 | + public function update($new_instance, $old_instance) { |
|
240 | 240 | $instance = $old_instance; |
241 | - $instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
241 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
242 | 242 | $instance['category_name'] = $new_instance['category_name']; |
243 | 243 | $instance['show_expired'] = $new_instance['show_expired']; |
244 | 244 | $instance['limit'] = $new_instance['limit']; |
@@ -261,18 +261,18 @@ discard block |
||
261 | 261 | * @param array $args Widget arguments. |
262 | 262 | * @param array $instance Saved values from database. |
263 | 263 | */ |
264 | - public function widget( $args, $instance ) { |
|
264 | + public function widget($args, $instance) { |
|
265 | 265 | |
266 | 266 | global $post; |
267 | 267 | // make sure there is some kinda post object |
268 | - if ( $post instanceof WP_Post ) { |
|
268 | + if ($post instanceof WP_Post) { |
|
269 | 269 | $before_widget = ''; |
270 | 270 | $before_title = ''; |
271 | 271 | $after_title = ''; |
272 | 272 | $after_widget = ''; |
273 | 273 | // but NOT an events archives page, cuz that would be like two event lists on the same page |
274 | - $show_everywhere = isset( $instance['show_everywhere'] ) ? (bool) absint( $instance['show_everywhere'] ) : TRUE; |
|
275 | - if ( $show_everywhere || ! ( $post->post_type == 'espresso_events' && is_archive() )) { |
|
274 | + $show_everywhere = isset($instance['show_everywhere']) ? (bool) absint($instance['show_everywhere']) : TRUE; |
|
275 | + if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) { |
|
276 | 276 | // let's use some of the event helper functions' |
277 | 277 | // make separate vars out of attributes |
278 | 278 | |
@@ -291,81 +291,81 @@ discard block |
||
291 | 291 | // Before widget (defined by themes). |
292 | 292 | echo $before_widget; |
293 | 293 | // Display the widget title if one was input (before and after defined by themes). |
294 | - if ( ! empty( $title )) { |
|
295 | - echo $before_title . $title . $after_title; |
|
294 | + if ( ! empty($title)) { |
|
295 | + echo $before_title.$title.$after_title; |
|
296 | 296 | } |
297 | 297 | // grab widget settings |
298 | - $category = isset( $instance['category_name'] ) && ! empty( $instance['category_name'] ) ? $instance['category_name'] : FALSE; |
|
299 | - $show_expired = isset( $instance['show_expired'] ) ? (bool) absint( $instance['show_expired'] ) : FALSE; |
|
300 | - $image_size = isset( $instance['image_size'] ) && ! empty( $instance['image_size'] ) ? $instance['image_size'] : 'medium'; |
|
301 | - $show_desc = isset( $instance['show_desc'] ) ? (bool) absint( $instance['show_desc'] ) : TRUE; |
|
302 | - $show_dates = isset( $instance['show_dates'] ) ? (bool) absint( $instance['show_dates'] ) : TRUE; |
|
303 | - $date_limit = isset( $instance['date_limit'] ) && ! empty( $instance['date_limit'] ) ? $instance['date_limit'] : NULL; |
|
304 | - $date_range = isset( $instance['date_range'] ) && ! empty( $instance['date_range'] ) ? $instance['date_range'] : FALSE; |
|
298 | + $category = isset($instance['category_name']) && ! empty($instance['category_name']) ? $instance['category_name'] : FALSE; |
|
299 | + $show_expired = isset($instance['show_expired']) ? (bool) absint($instance['show_expired']) : FALSE; |
|
300 | + $image_size = isset($instance['image_size']) && ! empty($instance['image_size']) ? $instance['image_size'] : 'medium'; |
|
301 | + $show_desc = isset($instance['show_desc']) ? (bool) absint($instance['show_desc']) : TRUE; |
|
302 | + $show_dates = isset($instance['show_dates']) ? (bool) absint($instance['show_dates']) : TRUE; |
|
303 | + $date_limit = isset($instance['date_limit']) && ! empty($instance['date_limit']) ? $instance['date_limit'] : NULL; |
|
304 | + $date_range = isset($instance['date_range']) && ! empty($instance['date_range']) ? $instance['date_range'] : FALSE; |
|
305 | 305 | // start to build our where clause |
306 | 306 | $where = array( |
307 | 307 | // 'Datetime.DTT_is_primary' => 1, |
308 | 308 | 'status' => 'publish' |
309 | 309 | ); |
310 | 310 | // add category |
311 | - if ( $category ) { |
|
311 | + if ($category) { |
|
312 | 312 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
313 | 313 | $where['Term_Taxonomy.Term.slug'] = $category; |
314 | 314 | } |
315 | 315 | // if NOT expired then we want events that start today or in the future |
316 | - if ( ! $show_expired ) { |
|
317 | - $where['Datetime.DTT_EVT_end'] = array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ); |
|
316 | + if ( ! $show_expired) { |
|
317 | + $where['Datetime.DTT_EVT_end'] = array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')); |
|
318 | 318 | } |
319 | 319 | // run the query |
320 | - $events = EE_Registry::instance()->load_model( 'Event' )->get_all( array( |
|
320 | + $events = EE_Registry::instance()->load_model('Event')->get_all(array( |
|
321 | 321 | $where, |
322 | - 'limit' => $instance['limit'] > 0 ? '0,' . $instance['limit'] : '0,10', |
|
322 | + 'limit' => $instance['limit'] > 0 ? '0,'.$instance['limit'] : '0,10', |
|
323 | 323 | 'order_by' => 'Datetime.DTT_EVT_start', |
324 | 324 | 'order' => 'ASC', |
325 | 325 | 'group_by' => 'EVT_ID' |
326 | 326 | )); |
327 | 327 | |
328 | - if ( ! empty( $events )) { |
|
328 | + if ( ! empty($events)) { |
|
329 | 329 | echo '<ul class="ee-upcoming-events-widget-ul">'; |
330 | - foreach ( $events as $event ) { |
|
331 | - if ( $event instanceof EE_Event && ( !is_single() || $post->ID != $event->ID() ) ) { |
|
330 | + foreach ($events as $event) { |
|
331 | + if ($event instanceof EE_Event && ( ! is_single() || $post->ID != $event->ID())) { |
|
332 | 332 | //printr( $event, '$event <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
333 | - echo '<li id="ee-upcoming-events-widget-li-' . $event->ID() . '" class="ee-upcoming-events-widget-li">'; |
|
333 | + echo '<li id="ee-upcoming-events-widget-li-'.$event->ID().'" class="ee-upcoming-events-widget-li">'; |
|
334 | 334 | // how big is the event name ? |
335 | - $name_length = strlen( $event->name() ); |
|
336 | - switch( $name_length ) { |
|
335 | + $name_length = strlen($event->name()); |
|
336 | + switch ($name_length) { |
|
337 | 337 | case $name_length > 70 : |
338 | - $len_class = ' three-line'; |
|
338 | + $len_class = ' three-line'; |
|
339 | 339 | break; |
340 | 340 | case $name_length > 35 : |
341 | - $len_class = ' two-line'; |
|
341 | + $len_class = ' two-line'; |
|
342 | 342 | break; |
343 | 343 | default : |
344 | - $len_class = ' one-line'; |
|
344 | + $len_class = ' one-line'; |
|
345 | 345 | } |
346 | - $event_url = apply_filters( 'FHEE_EEW_Upcoming_Events__widget__event_url', $event->get_permalink(), $event ); |
|
347 | - echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a' . $len_class . '" href="' . $event_url . '">' . $event->name() . '</a></h5>'; |
|
348 | - if ( post_password_required( $event->ID() ) ) { |
|
349 | - $pswd_form = apply_filters( 'FHEE_EEW_Upcoming_Events__widget__password_form', get_the_password_form( $event->ID() ), $event ); |
|
346 | + $event_url = apply_filters('FHEE_EEW_Upcoming_Events__widget__event_url', $event->get_permalink(), $event); |
|
347 | + echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a'.$len_class.'" href="'.$event_url.'">'.$event->name().'</a></h5>'; |
|
348 | + if (post_password_required($event->ID())) { |
|
349 | + $pswd_form = apply_filters('FHEE_EEW_Upcoming_Events__widget__password_form', get_the_password_form($event->ID()), $event); |
|
350 | 350 | echo $pswd_form; |
351 | 351 | } else { |
352 | - if ( has_post_thumbnail( $event->ID() ) && $image_size != 'none' ) { |
|
353 | - echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="' . $event_url . '">' . get_the_post_thumbnail( $event->ID(), $image_size ) . '</a></div>'; |
|
352 | + if (has_post_thumbnail($event->ID()) && $image_size != 'none') { |
|
353 | + echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="'.$event_url.'">'.get_the_post_thumbnail($event->ID(), $image_size).'</a></div>'; |
|
354 | 354 | } |
355 | - $desc = $event->short_description( 25 ); |
|
356 | - if ( $show_dates ) { |
|
357 | - $date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', get_option( 'date_format' )); |
|
358 | - $time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', get_option( 'time_format' )); |
|
359 | - $single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', get_option( 'date_format' )); |
|
360 | - $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' )); |
|
361 | - if ( $date_range == TRUE ) { |
|
362 | - echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() ); |
|
363 | - }else{ |
|
364 | - echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit ); |
|
355 | + $desc = $event->short_description(25); |
|
356 | + if ($show_dates) { |
|
357 | + $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', get_option('date_format')); |
|
358 | + $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', get_option('time_format')); |
|
359 | + $single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', get_option('date_format')); |
|
360 | + $single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', get_option('time_format')); |
|
361 | + if ($date_range == TRUE) { |
|
362 | + echo espresso_event_date_range($date_format, $time_format, $single_date_format, $single_time_format, $event->ID()); |
|
363 | + } else { |
|
364 | + echo espresso_list_of_event_dates($event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit); |
|
365 | 365 | } |
366 | 366 | } |
367 | - if ( $show_desc && $desc ) { |
|
368 | - echo '<p style="margin-top: .5em">' . $desc . '</p>'; |
|
367 | + if ($show_desc && $desc) { |
|
368 | + echo '<p style="margin-top: .5em">'.$desc.'</p>'; |
|
369 | 369 | } |
370 | 370 | } |
371 | 371 | echo '</li>'; |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * @return string |
390 | 390 | */ |
391 | 391 | public function make_the_title_a_link($title) { |
392 | - return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
392 | + return '<a href="'.EEH_Event_View::event_archive_url().'">'.$title.'</a>'; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | } |
@@ -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 | * |
@@ -360,7 +362,7 @@ discard block |
||
360 | 362 | $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' )); |
361 | 363 | if ( $date_range == TRUE ) { |
362 | 364 | echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() ); |
363 | - }else{ |
|
365 | + } else{ |
|
364 | 366 | echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit ); |
365 | 367 | } |
366 | 368 | } |
@@ -767,7 +767,7 @@ |
||
767 | 767 | * Takes care of setting up the addressee object(s) for the primary attendee. |
768 | 768 | * |
769 | 769 | * @access protected |
770 | - * @return array of EE_Addressee objects |
|
770 | + * @return EE_Messages_Addressee[] of EE_Addressee objects |
|
771 | 771 | */ |
772 | 772 | protected function _primary_attendee_addressees() { |
773 | 773 | $aee = $this->_default_addressee_data; |
@@ -326,11 +326,11 @@ |
||
326 | 326 | /** |
327 | 327 | * This sets up any action/filter hooks this message type puts in place for a specific messenger. Note that by |
328 | 328 | * default this does nothing. Child classes will need to override if they want to add specific hooks for a messenger. |
329 | - * |
|
330 | - * @since 1.0.0 |
|
331 | - * |
|
332 | - * @return void |
|
333 | - */ |
|
329 | + * |
|
330 | + * @since 1.0.0 |
|
331 | + * |
|
332 | + * @return void |
|
333 | + */ |
|
334 | 334 | protected function _do_messenger_hooks() { |
335 | 335 | return; |
336 | 336 | } |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -655,8 +656,9 @@ discard block |
||
655 | 656 | //process addressees for each context. Child classes will have to have methods for each context defined to handle the processing of the data object within them |
656 | 657 | foreach ( $this->_contexts as $context => $details ) { |
657 | 658 | $xpctd_method = '_' . $context . '_addressees'; |
658 | - if ( !method_exists( $this, $xpctd_method ) ) |
|
659 | - throw new EE_Error( sprintf( __('The data for %1$s message type cannot be prepared because there is no set method for doing so. The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method) ); |
|
659 | + if ( !method_exists( $this, $xpctd_method ) ) { |
|
660 | + throw new EE_Error( sprintf( __('The data for %1$s message type cannot be prepared because there is no set method for doing so. The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method) ); |
|
661 | + } |
|
660 | 662 | $this->_addressees[$context] = call_user_func( array( $this, $xpctd_method ) ); |
661 | 663 | } |
662 | 664 | return true; //data was processed successfully. |
@@ -823,7 +825,9 @@ discard block |
||
823 | 825 | //set the attendee array to blank on each loop; |
824 | 826 | $aee = array(); |
825 | 827 | |
826 | - if ( isset( $this->_data->reg_obj ) && ( $this->_data->reg_obj->attendee_ID() != $att_id ) && $this->_single_message ) continue; |
|
828 | + if ( isset( $this->_data->reg_obj ) && ( $this->_data->reg_obj->attendee_ID() != $att_id ) && $this->_single_message ) { |
|
829 | + continue; |
|
830 | + } |
|
827 | 831 | |
828 | 832 | //is $this->_regs_for_sending present? If so, let's make sure we ONLY generate addressee for registrations in that array. |
829 | 833 | if ( ! empty( $this->_regs_for_sending ) && is_array( $this->_regs_for_sending ) ) { |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @param int $id Optional. Integer corresponding to the value for the primary key of a EE_Base_Class_Object |
286 | 286 | * @return mixed ( EE_Base_Class||EE_Base_Class[] ) |
287 | 287 | */ |
288 | - abstract protected function _get_data_for_context( $context, EE_Registration $registration, $id ); |
|
288 | + abstract protected function _get_data_for_context($context, EE_Registration $registration, $id); |
|
289 | 289 | |
290 | 290 | |
291 | 291 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * @deprecated 4.9.0 |
316 | 316 | * @return int |
317 | 317 | */ |
318 | - protected function _get_id_for_msg_url( $context, EE_Registration $registration ) { |
|
318 | + protected function _get_id_for_msg_url($context, EE_Registration $registration) { |
|
319 | 319 | return 0; |
320 | 320 | } |
321 | 321 | |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | * what messenger is being used to send the message at the time of sending. |
347 | 347 | * @since 4.9.0 |
348 | 348 | */ |
349 | - public function do_messenger_hooks( $messenger = null ) { |
|
349 | + public function do_messenger_hooks($messenger = null) { |
|
350 | 350 | $this->_active_messenger = $messenger; |
351 | 351 | $this->_do_messenger_hooks(); |
352 | 352 | } |
@@ -405,10 +405,10 @@ discard block |
||
405 | 405 | * @param mixed $data This sets the data property for the message type with the incoming data used for generating. |
406 | 406 | * @return string (the reference for the data handler) (will be an empty string if could not be determined). |
407 | 407 | */ |
408 | - public function get_data_handler( $data ) { |
|
408 | + public function get_data_handler($data) { |
|
409 | 409 | $this->_data = $data; |
410 | 410 | $this->_set_data_handler(); |
411 | - return apply_filters( 'FHEE__EE_message_type__get_data_handler', $this->_data_handler, $this ); |
|
411 | + return apply_filters('FHEE__EE_message_type__get_data_handler', $this->_data_handler, $this); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | |
@@ -447,27 +447,27 @@ discard block |
||
447 | 447 | * @deprecated 4.9.0 Likely 4.9.10 or 4.10.0 will remove this method completely |
448 | 448 | * @return string generated url |
449 | 449 | */ |
450 | - public function get_url_trigger( $context, $sending_messenger, EE_Registration $registration ) { |
|
450 | + public function get_url_trigger($context, $sending_messenger, EE_Registration $registration) { |
|
451 | 451 | |
452 | 452 | //validate context |
453 | 453 | //valid context? |
454 | - if ( !isset( $this->_contexts[$context] ) ) { |
|
455 | - throw new EE_Error( sprintf( __('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class( $this ) ) ); |
|
454 | + if ( ! isset($this->_contexts[$context])) { |
|
455 | + throw new EE_Error(sprintf(__('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class($this))); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | //valid sending_messenger? |
459 | 459 | $not_valid_msgr = FALSE; |
460 | - foreach ( $this->_with_messengers as $generating => $sendings ) { |
|
461 | - if ( empty( $sendings ) || array_search( $sending_messenger, $sendings ) === FALSE ) { |
|
460 | + foreach ($this->_with_messengers as $generating => $sendings) { |
|
461 | + if (empty($sendings) || array_search($sending_messenger, $sendings) === FALSE) { |
|
462 | 462 | $not_valid_msgr = TRUE; |
463 | 463 | } |
464 | 464 | } |
465 | 465 | |
466 | - if ( $not_valid_msgr ) { |
|
467 | - throw new EE_Error( sprintf( __('The given sending messenger string (%s) does not match a valid sending messenger with the %s. If this is incorrect, make sure that the message type has defined this messenger as a sending messenger in its $_with_messengers array.', 'event_espresso'), $sending_messenger, get_class( $this ) ) ); |
|
466 | + if ($not_valid_msgr) { |
|
467 | + throw new EE_Error(sprintf(__('The given sending messenger string (%s) does not match a valid sending messenger with the %s. If this is incorrect, make sure that the message type has defined this messenger as a sending messenger in its $_with_messengers array.', 'event_espresso'), $sending_messenger, get_class($this))); |
|
468 | 468 | } |
469 | 469 | |
470 | - return EEH_MSG_Template::generate_url_trigger( $sending_messenger, $this->_active_messenger->name, $context, $this->name, $registration, $this->_GRP_ID, $this->_get_id_for_msg_url( $context, $registration ) ); |
|
470 | + return EEH_MSG_Template::generate_url_trigger($sending_messenger, $this->_active_messenger->name, $context, $this->name, $registration, $this->_GRP_ID, $this->_get_id_for_msg_url($context, $registration)); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | |
@@ -488,19 +488,19 @@ discard block |
||
488 | 488 | * |
489 | 489 | * @return mixed (EE_Base_Class||EE_Base_Class[]) |
490 | 490 | */ |
491 | - public function get_data_for_context( $context, EE_Registration $registration, $id = 0 ) { |
|
491 | + public function get_data_for_context($context, EE_Registration $registration, $id = 0) { |
|
492 | 492 | //valid context? |
493 | - if ( !isset( $this->_contexts[$context] ) ) { |
|
494 | - throw new EE_Error( sprintf( __('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class( $this ) ) ); |
|
493 | + if ( ! isset($this->_contexts[$context])) { |
|
494 | + throw new EE_Error(sprintf(__('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class($this))); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | //get data and apply global and class specific filters on it. |
498 | - $data = apply_filters( 'FHEE__EE_message_type__get_data_for_context__data', $this->_get_data_for_context( $context, $registration, $id ), $this ); |
|
499 | - $data = apply_filters( 'FHEE__' . get_class( $this ) . '__get_data_for_context__data', $data, $this ); |
|
498 | + $data = apply_filters('FHEE__EE_message_type__get_data_for_context__data', $this->_get_data_for_context($context, $registration, $id), $this); |
|
499 | + $data = apply_filters('FHEE__'.get_class($this).'__get_data_for_context__data', $data, $this); |
|
500 | 500 | |
501 | 501 | //if empty then something went wrong! |
502 | - if ( empty( $data ) ) { |
|
503 | - throw new EE_Error( sprintf( __('There is no data retrieved, it is possible that the id given (%d) does not match any value in the database for the corresponding EE_Base_Class used by the data handler for the %s message type.', 'event_espresso'), $id, $this->name ) ); |
|
502 | + if (empty($data)) { |
|
503 | + throw new EE_Error(sprintf(__('There is no data retrieved, it is possible that the id given (%d) does not match any value in the database for the corresponding EE_Base_Class used by the data handler for the %s message type.', 'event_espresso'), $id, $this->name)); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | return $data; |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | */ |
552 | 552 | public function with_messengers() { |
553 | 553 | |
554 | - return apply_filters( 'FHEE__EE_message_type__get_with_messengers__with_messengers__' . get_class( $this ), $this->_with_messengers); |
|
554 | + return apply_filters('FHEE__EE_message_type__get_with_messengers__with_messengers__'.get_class($this), $this->_with_messengers); |
|
555 | 555 | } |
556 | 556 | |
557 | 557 | |
@@ -569,9 +569,9 @@ discard block |
||
569 | 569 | * @access public |
570 | 570 | * @return string |
571 | 571 | */ |
572 | - public function get_message_type_admin_page_content($page, $action = NULL, $extra = array(), $messengers = array() ) { |
|
572 | + public function get_message_type_admin_page_content($page, $action = NULL, $extra = array(), $messengers = array()) { |
|
573 | 573 | //we can also further refine the context by action (if present). |
574 | - return $this->_get_admin_page_content( $page, $action, $extra, $messengers ); |
|
574 | + return $this->_get_admin_page_content($page, $action, $extra, $messengers); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | |
@@ -601,8 +601,8 @@ discard block |
||
601 | 601 | */ |
602 | 602 | public function get_master_templates() { |
603 | 603 | //first class specific filter then filter that by the global filter. |
604 | - $master_templates = apply_filters( 'FHEE__' . get_class( $this ) . '__get_master_templates', $this->_master_templates ); |
|
605 | - return apply_filters( 'FHEE__EE_message_type__get_master_templates', $master_templates, $this ); |
|
604 | + $master_templates = apply_filters('FHEE__'.get_class($this).'__get_master_templates', $this->_master_templates); |
|
605 | + return apply_filters('FHEE__EE_message_type__get_master_templates', $master_templates, $this); |
|
606 | 606 | } |
607 | 607 | |
608 | 608 | |
@@ -616,23 +616,23 @@ discard block |
||
616 | 616 | * @return array An array indexed by context where each context is an array of EE_Messages_Addressee objects for |
617 | 617 | * that context |
618 | 618 | */ |
619 | - public function get_addressees( EE_Messages_incoming_data $data, $context = '' ) { |
|
619 | + public function get_addressees(EE_Messages_incoming_data $data, $context = '') { |
|
620 | 620 | //override _data |
621 | 621 | $this->_data = $data; |
622 | 622 | $addressees = array(); |
623 | 623 | |
624 | 624 | //if incoming context then limit to that context |
625 | - if ( ! empty( $context ) ) { |
|
626 | - $cntxt = ! empty( $this->_contexts[$context] ) ? $this->_contexts[$context] : ''; |
|
627 | - if ( ! empty( $cntxt ) ) { |
|
625 | + if ( ! empty($context)) { |
|
626 | + $cntxt = ! empty($this->_contexts[$context]) ? $this->_contexts[$context] : ''; |
|
627 | + if ( ! empty($cntxt)) { |
|
628 | 628 | $this->_contexts = array(); |
629 | 629 | $this->_contexts[$context] = $cntxt; |
630 | 630 | } |
631 | 631 | } |
632 | 632 | |
633 | 633 | $this->_set_default_addressee_data(); |
634 | - if ( $this->_process_data() ) { |
|
635 | - $addressees = $this->_addressees; |
|
634 | + if ($this->_process_data()) { |
|
635 | + $addressees = $this->_addressees; |
|
636 | 636 | } |
637 | 637 | return $addressees; |
638 | 638 | } |
@@ -647,16 +647,16 @@ discard block |
||
647 | 647 | protected function _process_data() { |
648 | 648 | //at a minimum, we NEED EE_Attendee objects. |
649 | 649 | |
650 | - if ( empty( $this->_data->attendees ) ) { |
|
651 | - return false; //there's no data to process! |
|
650 | + if (empty($this->_data->attendees)) { |
|
651 | + return false; //there's no data to process! |
|
652 | 652 | } |
653 | 653 | |
654 | 654 | //process addressees for each context. Child classes will have to have methods for each context defined to handle the processing of the data object within them |
655 | - foreach ( $this->_contexts as $context => $details ) { |
|
656 | - $xpctd_method = '_' . $context . '_addressees'; |
|
657 | - if ( !method_exists( $this, $xpctd_method ) ) |
|
658 | - throw new EE_Error( sprintf( __('The data for %1$s message type cannot be prepared because there is no set method for doing so. The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method) ); |
|
659 | - $this->_addressees[$context] = call_user_func( array( $this, $xpctd_method ) ); |
|
655 | + foreach ($this->_contexts as $context => $details) { |
|
656 | + $xpctd_method = '_'.$context.'_addressees'; |
|
657 | + if ( ! method_exists($this, $xpctd_method)) |
|
658 | + throw new EE_Error(sprintf(__('The data for %1$s message type cannot be prepared because there is no set method for doing so. The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method)); |
|
659 | + $this->_addressees[$context] = call_user_func(array($this, $xpctd_method)); |
|
660 | 660 | } |
661 | 661 | return true; //data was processed successfully. |
662 | 662 | } |
@@ -691,8 +691,8 @@ discard block |
||
691 | 691 | 'total_ticket_count' => $this->_data->total_ticket_count |
692 | 692 | ); |
693 | 693 | |
694 | - if ( is_array( $this->_data->primary_attendee_data ) ) { |
|
695 | - $this->_default_addressee_data = array_merge( $this->_default_addressee_data, $this->_data->primary_attendee_data ); |
|
694 | + if (is_array($this->_data->primary_attendee_data)) { |
|
695 | + $this->_default_addressee_data = array_merge($this->_default_addressee_data, $this->_data->primary_attendee_data); |
|
696 | 696 | $this->_default_addressee_data['primary_att_obj'] = $this->_data->primary_attendee_data['att_obj']; |
697 | 697 | $this->_default_addressee_data['primary_reg_obj'] = $this->_data->primary_attendee_data['reg_obj']; |
698 | 698 | } |
@@ -710,26 +710,26 @@ discard block |
||
710 | 710 | * see abstract declaration in parent class for details, children message types can override these valid shortcodes if desired (we include all for all contexts by default). |
711 | 711 | */ |
712 | 712 | protected function _set_valid_shortcodes() { |
713 | - $all_shortcodes = array( 'attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event_meta', 'event', 'organization', 'recipient_details', 'recipient_list', 'ticket_list', 'ticket', 'transaction', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author', 'email', 'messenger' ); |
|
713 | + $all_shortcodes = array('attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event_meta', 'event', 'organization', 'recipient_details', 'recipient_list', 'ticket_list', 'ticket', 'transaction', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author', 'email', 'messenger'); |
|
714 | 714 | $contexts = $this->get_contexts(); |
715 | - foreach ( $contexts as $context => $details ) { |
|
715 | + foreach ($contexts as $context => $details) { |
|
716 | 716 | $this->_valid_shortcodes[$context] = $all_shortcodes; |
717 | 717 | |
718 | 718 | //make sure non admin context does not include the event_author shortcodes |
719 | - if ( $context != 'admin' ) { |
|
720 | - if( ($key = array_search('event_author', $this->_valid_shortcodes[$context] ) ) !== false) { |
|
719 | + if ($context != 'admin') { |
|
720 | + if (($key = array_search('event_author', $this->_valid_shortcodes[$context])) !== false) { |
|
721 | 721 | unset($this->_valid_shortcodes[$context][$key]); |
722 | 722 | } |
723 | 723 | } |
724 | 724 | } |
725 | 725 | |
726 | 726 | //make sure admin context does not include the recipient_details shortcodes IF we have admin context hooked in message types might not have that context. |
727 | - if ( !empty( $this->_valid_shortcodes['admin'] ) ) { |
|
728 | - if( ($key = array_search('recipient_details', $this->_valid_shortcodes['admin'] ) ) !== false) { |
|
727 | + if ( ! empty($this->_valid_shortcodes['admin'])) { |
|
728 | + if (($key = array_search('recipient_details', $this->_valid_shortcodes['admin'])) !== false) { |
|
729 | 729 | unset($this->_valid_shortcodes['admin'][$key]); |
730 | 730 | } |
731 | 731 | //make sure admin context does not include the recipient_details shortcodes |
732 | - if( ($key = array_search('recipient_list', $this->_valid_shortcodes['admin'] ) ) !== false) { |
|
732 | + if (($key = array_search('recipient_list', $this->_valid_shortcodes['admin'])) !== false) { |
|
733 | 733 | unset($this->_valid_shortcodes['admin'][$key]); |
734 | 734 | } |
735 | 735 | } |
@@ -742,8 +742,8 @@ discard block |
||
742 | 742 | * @param array $new_config array of valid shortcodes (by context) |
743 | 743 | * @return void sets valid_shortcodes property |
744 | 744 | */ |
745 | - public function reset_valid_shortcodes_config( $new_config ) { |
|
746 | - foreach ( $new_config as $context => $shortcodes ) { |
|
745 | + public function reset_valid_shortcodes_config($new_config) { |
|
746 | + foreach ($new_config as $context => $shortcodes) { |
|
747 | 747 | $this->_valid_shortcodes[$context] = $shortcodes; |
748 | 748 | } |
749 | 749 | } |
@@ -762,13 +762,13 @@ discard block |
||
762 | 762 | $addressees = array(); |
763 | 763 | |
764 | 764 | //first we need to get the event admin user id for all the events and setup an addressee object for each unique admin user. |
765 | - foreach ( $this->_data->events as $line_ref => $event ) { |
|
766 | - $admin_id = $this->_get_event_admin_id( $event['ID'] ); |
|
765 | + foreach ($this->_data->events as $line_ref => $event) { |
|
766 | + $admin_id = $this->_get_event_admin_id($event['ID']); |
|
767 | 767 | //make sure we are just including the events that belong to this admin! |
768 | - $admin_events[ $admin_id ][$line_ref] = $event; |
|
768 | + $admin_events[$admin_id][$line_ref] = $event; |
|
769 | 769 | } |
770 | 770 | //k now we can loop through the event_admins and setup the addressee data. |
771 | - foreach ( $admin_events as $admin_id => $event_details ) { |
|
771 | + foreach ($admin_events as $admin_id => $event_details) { |
|
772 | 772 | $aee = array( |
773 | 773 | 'user_id' => $admin_id, |
774 | 774 | 'events' => $event_details, |
@@ -776,8 +776,8 @@ discard block |
||
776 | 776 | 'recipient_id' => $admin_id, |
777 | 777 | 'recipient_type' => 'WP_User' |
778 | 778 | ); |
779 | - $aee = array_merge( $this->_default_addressee_data, $aee ); |
|
780 | - $addressees[] = new EE_Messages_Addressee( $aee ); |
|
779 | + $aee = array_merge($this->_default_addressee_data, $aee); |
|
780 | + $addressees[] = new EE_Messages_Addressee($aee); |
|
781 | 781 | } |
782 | 782 | |
783 | 783 | return $addressees; |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | $aee['recipient_type'] = 'Attendee'; |
800 | 800 | |
801 | 801 | //great now we can instantiate the $addressee object and return (as an array); |
802 | - $add[] = new EE_Messages_Addressee( $aee ); |
|
802 | + $add[] = new EE_Messages_Addressee($aee); |
|
803 | 803 | return $add; |
804 | 804 | } |
805 | 805 | |
@@ -818,38 +818,38 @@ discard block |
||
818 | 818 | //use to verify unique attendee emails... we don't want to sent multiple copies to the same attendee do we? |
819 | 819 | $already_processed = array(); |
820 | 820 | |
821 | - foreach ( $this->_data->attendees as $att_id => $details ) { |
|
821 | + foreach ($this->_data->attendees as $att_id => $details) { |
|
822 | 822 | //set the attendee array to blank on each loop; |
823 | 823 | $aee = array(); |
824 | 824 | |
825 | - if ( isset( $this->_data->reg_obj ) && ( $this->_data->reg_obj->attendee_ID() != $att_id ) && $this->_single_message ) continue; |
|
825 | + if (isset($this->_data->reg_obj) && ($this->_data->reg_obj->attendee_ID() != $att_id) && $this->_single_message) continue; |
|
826 | 826 | |
827 | 827 | //is $this->_regs_for_sending present? If so, let's make sure we ONLY generate addressee for registrations in that array. |
828 | - if ( ! empty( $this->_regs_for_sending ) && is_array( $this->_regs_for_sending ) ) { |
|
829 | - $regs_allowed = array_intersect_key( array_flip( $this->_regs_for_sending ), $details['reg_objs'] ); |
|
830 | - if ( empty( $regs_allowed ) ) { |
|
828 | + if ( ! empty($this->_regs_for_sending) && is_array($this->_regs_for_sending)) { |
|
829 | + $regs_allowed = array_intersect_key(array_flip($this->_regs_for_sending), $details['reg_objs']); |
|
830 | + if (empty($regs_allowed)) { |
|
831 | 831 | continue; |
832 | 832 | } |
833 | 833 | } |
834 | 834 | |
835 | 835 | if ( |
836 | - in_array( $details['attendee_email'], $already_processed ) |
|
837 | - && apply_filters( 'FHEE__EE_message_type___attendee_addressees__prevent_duplicate_email_sends', true, $this->_data, $this ) |
|
836 | + in_array($details['attendee_email'], $already_processed) |
|
837 | + && apply_filters('FHEE__EE_message_type___attendee_addressees__prevent_duplicate_email_sends', true, $this->_data, $this) |
|
838 | 838 | ) { |
839 | 839 | continue; |
840 | 840 | } |
841 | 841 | |
842 | 842 | $already_processed[] = $details['attendee_email']; |
843 | 843 | |
844 | - foreach ( $details as $item => $value ) { |
|
844 | + foreach ($details as $item => $value) { |
|
845 | 845 | $aee[$item] = $value; |
846 | - if ( $item == 'line_ref' ) { |
|
847 | - foreach ( $value as $event_id ) { |
|
846 | + if ($item == 'line_ref') { |
|
847 | + foreach ($value as $event_id) { |
|
848 | 848 | $aee['events'][$event_id] = $this->_data->events[$event_id]; |
849 | 849 | } |
850 | 850 | } |
851 | 851 | |
852 | - if ( $item == 'attendee_email' ) { |
|
852 | + if ($item == 'attendee_email') { |
|
853 | 853 | $aee['attendee_email'] = $value; |
854 | 854 | } |
855 | 855 | |
@@ -867,8 +867,8 @@ discard block |
||
867 | 867 | $aee['recipient_type'] = 'Attendee'; |
868 | 868 | |
869 | 869 | //merge in the primary attendee data |
870 | - $aee = array_merge( $this->_default_addressee_data, $aee ); |
|
871 | - $add[] = new EE_Messages_Addressee( $aee ); |
|
870 | + $aee = array_merge($this->_default_addressee_data, $aee); |
|
871 | + $add[] = new EE_Messages_Addressee($aee); |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | return $add; |
@@ -880,8 +880,8 @@ discard block |
||
880 | 880 | * @param $event_id |
881 | 881 | * @return int |
882 | 882 | */ |
883 | - protected function _get_event_admin_id( $event_id ) { |
|
884 | - $event = EEM_Event::instance()->get_one_by_ID( $event_id ); |
|
883 | + protected function _get_event_admin_id($event_id) { |
|
884 | + $event = EEM_Event::instance()->get_one_by_ID($event_id); |
|
885 | 885 | return $event instanceof EE_Event ? $event->wp_user() : 0; |
886 | 886 | } |
887 | 887 |
@@ -410,7 +410,7 @@ |
||
410 | 410 | /** |
411 | 411 | * This simply loops through all active messengers and takes care of setting up the |
412 | 412 | * EE_Message_To_Generate objects. |
413 | - * @param $message_type |
|
413 | + * @param string $message_type |
|
414 | 414 | * @param $data |
415 | 415 | * |
416 | 416 | * @return EE_Message_To_Generate[] |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @param EE_Message_Resource_Manager $message_resource_manager |
37 | 37 | */ |
38 | - public function __construct( EE_Message_Resource_Manager $message_resource_manager ) { |
|
38 | + public function __construct(EE_Message_Resource_Manager $message_resource_manager) { |
|
39 | 39 | $this->_message_resource_manager = $message_resource_manager; |
40 | 40 | $this->_init_queue_and_generator(); |
41 | 41 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * - $_generator = holds the messages generator |
51 | 51 | */ |
52 | 52 | protected function _init_queue_and_generator() { |
53 | - $this->_generator = EE_Registry::factory( 'EE_Messages_Generator' ); |
|
53 | + $this->_generator = EE_Registry::factory('EE_Messages_Generator'); |
|
54 | 54 | $this->_queue = $this->_generator->generation_queue(); |
55 | 55 | } |
56 | 56 | |
@@ -75,31 +75,31 @@ discard block |
||
75 | 75 | * @param EE_Messages_Queue $queue_to_process |
76 | 76 | * @return bool true for success false for error. |
77 | 77 | */ |
78 | - public function process_immediately_from_queue( EE_Messages_Queue $queue_to_process ) { |
|
78 | + public function process_immediately_from_queue(EE_Messages_Queue $queue_to_process) { |
|
79 | 79 | $success = false; |
80 | 80 | $messages_to_send = array(); |
81 | 81 | $messages_to_generate = array(); |
82 | 82 | //loop through and setup the various messages from the queue so we know what is being processed |
83 | 83 | $queue_to_process->get_message_repository()->rewind(); |
84 | - foreach ( $queue_to_process->get_message_repository() as $message ) { |
|
85 | - if ( $message->STS_ID() === EEM_Message::status_incomplete ) { |
|
84 | + foreach ($queue_to_process->get_message_repository() as $message) { |
|
85 | + if ($message->STS_ID() === EEM_Message::status_incomplete) { |
|
86 | 86 | $messages_to_generate[] = $message; |
87 | 87 | continue; |
88 | 88 | } |
89 | 89 | |
90 | - if ( in_array( $message->STS_ID(), EEM_Message::instance()->stati_indicating_to_send() ) ) { |
|
90 | + if (in_array($message->STS_ID(), EEM_Message::instance()->stati_indicating_to_send())) { |
|
91 | 91 | $messages_to_send[] = $message; |
92 | 92 | continue; |
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | 96 | //do generation/sends |
97 | - if ( $messages_to_generate ) { |
|
98 | - $success = $this->batch_generate_from_queue( $messages_to_generate, true ); |
|
97 | + if ($messages_to_generate) { |
|
98 | + $success = $this->batch_generate_from_queue($messages_to_generate, true); |
|
99 | 99 | } |
100 | 100 | |
101 | - if ( $messages_to_send ) { |
|
102 | - $sent = $this->batch_send_from_queue( $messages_to_send, true ); |
|
101 | + if ($messages_to_send) { |
|
102 | + $sent = $this->batch_send_from_queue($messages_to_send, true); |
|
103 | 103 | //if there was messages to generate and it failed, then we override any success value for the sending process |
104 | 104 | //otherwise we just use the return from batch send. The intent is that there is a simple response for success/fail. |
105 | 105 | //Either everything was successful or we consider it a fail. To be clear, this is a limitation of doing |
@@ -119,13 +119,13 @@ discard block |
||
119 | 119 | * @return bool|EE_Messages_Queue return false if nothing generated. This returns a new EE_Message_Queue with |
120 | 120 | * generated messages. |
121 | 121 | */ |
122 | - public function batch_generate_from_queue( $messages = array(), $clear_queue = false ) { |
|
123 | - if ( $this->_build_queue_for_generation( $messages, $clear_queue ) ) { |
|
122 | + public function batch_generate_from_queue($messages = array(), $clear_queue = false) { |
|
123 | + if ($this->_build_queue_for_generation($messages, $clear_queue)) { |
|
124 | 124 | $new_queue = $this->_generator->generate(); |
125 | - if ( $new_queue instanceof EE_Messages_Queue ) { |
|
125 | + if ($new_queue instanceof EE_Messages_Queue) { |
|
126 | 126 | //unlock queue |
127 | 127 | $this->_queue->unlock_queue(); |
128 | - $new_queue->initiate_request_by_priority( 'send' ); |
|
128 | + $new_queue->initiate_request_by_priority('send'); |
|
129 | 129 | return $new_queue; |
130 | 130 | } |
131 | 131 | } |
@@ -146,24 +146,24 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @return bool true means queue prepped, false means there was a lock so no generation please. |
148 | 148 | */ |
149 | - protected function _build_queue_for_generation( $messages = array(), $clear_queue = false ) { |
|
149 | + protected function _build_queue_for_generation($messages = array(), $clear_queue = false) { |
|
150 | 150 | |
151 | - if ( $clear_queue ) { |
|
151 | + if ($clear_queue) { |
|
152 | 152 | $this->_init_queue_and_generator(); |
153 | 153 | } |
154 | 154 | |
155 | - if ( $messages ) { |
|
155 | + if ($messages) { |
|
156 | 156 | //if generation is locked then get out now because that means processing is already happening. |
157 | - if ( $this->_queue->is_locked() ) { |
|
157 | + if ($this->_queue->is_locked()) { |
|
158 | 158 | return false; |
159 | 159 | } |
160 | 160 | |
161 | 161 | $this->_queue->lock_queue(); |
162 | - $messages = is_array( $messages ) ? $messages : array( $messages ); |
|
163 | - foreach ( $messages as $message ) { |
|
164 | - if ( $message instanceof EE_Message ) { |
|
162 | + $messages = is_array($messages) ? $messages : array($messages); |
|
163 | + foreach ($messages as $message) { |
|
164 | + if ($message instanceof EE_Message) { |
|
165 | 165 | $data = $message->all_extra_meta_array(); |
166 | - $this->_queue->add( $message, $data ); |
|
166 | + $this->_queue->add($message, $data); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | return true; |
@@ -181,22 +181,22 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @return bool true means queue prepped, false means there was a lock so no queue prepped. |
183 | 183 | */ |
184 | - protected function _build_queue_for_sending( $messages, $clear_queue = false ) { |
|
184 | + protected function _build_queue_for_sending($messages, $clear_queue = false) { |
|
185 | 185 | //if sending is locked then get out now because that means processing is already happening. |
186 | - if ( $this->_queue->is_locked( EE_Messages_Queue::action_sending ) ) { |
|
186 | + if ($this->_queue->is_locked(EE_Messages_Queue::action_sending)) { |
|
187 | 187 | return false; |
188 | 188 | } |
189 | 189 | |
190 | - $this->_queue->lock_queue( EE_Messages_Queue::action_sending ); |
|
190 | + $this->_queue->lock_queue(EE_Messages_Queue::action_sending); |
|
191 | 191 | |
192 | - if ( $clear_queue ) { |
|
192 | + if ($clear_queue) { |
|
193 | 193 | $this->_init_queue_and_generator(); |
194 | 194 | } |
195 | 195 | |
196 | - $messages = is_array( $messages ) ? $messages : array( $messages ); |
|
196 | + $messages = is_array($messages) ? $messages : array($messages); |
|
197 | 197 | |
198 | - foreach ( $messages as $message ) { |
|
199 | - $this->_queue->add( $message ); |
|
198 | + foreach ($messages as $message) { |
|
199 | + $this->_queue->add($message); |
|
200 | 200 | } |
201 | 201 | return true; |
202 | 202 | } |
@@ -212,11 +212,11 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @return EE_Messages_Queue |
214 | 214 | */ |
215 | - public function batch_send_from_queue( $messages = array(), $clear_queue = false ) { |
|
215 | + public function batch_send_from_queue($messages = array(), $clear_queue = false) { |
|
216 | 216 | |
217 | - if ( $messages && $this->_build_queue_for_sending( $messages, $clear_queue ) ) { |
|
217 | + if ($messages && $this->_build_queue_for_sending($messages, $clear_queue)) { |
|
218 | 218 | $this->_queue->execute(); |
219 | - $this->_queue->unlock_queue( EE_Messages_Queue::action_sending ); |
|
219 | + $this->_queue->unlock_queue(EE_Messages_Queue::action_sending); |
|
220 | 220 | } else { |
221 | 221 | //get messages to send and execute. |
222 | 222 | $this->_queue->get_to_send_batch_and_send(); |
@@ -239,10 +239,10 @@ discard block |
||
239 | 239 | * @param EE_Message_To_Generate[] $messages_to_generate |
240 | 240 | * @return EE_Messages_Queue |
241 | 241 | */ |
242 | - public function generate_and_return( $messages_to_generate ) { |
|
242 | + public function generate_and_return($messages_to_generate) { |
|
243 | 243 | $this->_init_queue_and_generator(); |
244 | - $this->_queue_for_generation_loop( $messages_to_generate ); |
|
245 | - return $this->_generator->generate( false ); |
|
244 | + $this->_queue_for_generation_loop($messages_to_generate); |
|
245 | + return $this->_generator->generate(false); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | * @param bool $persist Indicate whether to instruct the generator to persist the generated queue (true) or not (false). |
254 | 254 | * @return EE_Messages_Queue |
255 | 255 | */ |
256 | - public function generate_queue( $persist = true ) { |
|
257 | - return $this->_generator->generate( $persist ); |
|
256 | + public function generate_queue($persist = true) { |
|
257 | + return $this->_generator->generate($persist); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
@@ -267,9 +267,9 @@ discard block |
||
267 | 267 | * @param bool $test_send Whether this item is for a test send or not. |
268 | 268 | * @return EE_Messages_Queue |
269 | 269 | */ |
270 | - public function queue_for_generation( EE_Message_To_Generate $message_to_generate, $test_send = false ) { |
|
271 | - if ( $message_to_generate->valid() ) { |
|
272 | - $this->_generator->create_and_add_message_to_queue( $message_to_generate, $test_send ); |
|
270 | + public function queue_for_generation(EE_Message_To_Generate $message_to_generate, $test_send = false) { |
|
271 | + if ($message_to_generate->valid()) { |
|
272 | + $this->_generator->create_and_add_message_to_queue($message_to_generate, $test_send); |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
@@ -285,9 +285,9 @@ discard block |
||
285 | 285 | * |
286 | 286 | * @param EE_Message_To_Generate[] $messages_to_generate |
287 | 287 | */ |
288 | - public function batch_queue_for_generation_and_persist( $messages_to_generate ) { |
|
288 | + public function batch_queue_for_generation_and_persist($messages_to_generate) { |
|
289 | 289 | $this->_init_queue_and_generator(); |
290 | - $this->_queue_for_generation_loop( $messages_to_generate ); |
|
290 | + $this->_queue_for_generation_loop($messages_to_generate); |
|
291 | 291 | $this->_queue->save(); |
292 | 292 | } |
293 | 293 | |
@@ -303,9 +303,9 @@ discard block |
||
303 | 303 | * |
304 | 304 | * @param EE_Message_To_Generate[] $messages_to_generate |
305 | 305 | */ |
306 | - public function batch_queue_for_generation_no_persist( $messages_to_generate ) { |
|
306 | + public function batch_queue_for_generation_no_persist($messages_to_generate) { |
|
307 | 307 | $this->_init_queue_and_generator(); |
308 | - $this->_queue_for_generation_loop( $messages_to_generate ); |
|
308 | + $this->_queue_for_generation_loop($messages_to_generate); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | |
@@ -317,15 +317,15 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @param EE_Message_To_Generate[] $messages_to_generate |
319 | 319 | */ |
320 | - protected function _queue_for_generation_loop( $messages_to_generate ) { |
|
320 | + protected function _queue_for_generation_loop($messages_to_generate) { |
|
321 | 321 | //make sure is in an array. |
322 | - if ( ! is_array( $messages_to_generate ) ) { |
|
323 | - $messages_to_generate = array( $messages_to_generate ); |
|
322 | + if ( ! is_array($messages_to_generate)) { |
|
323 | + $messages_to_generate = array($messages_to_generate); |
|
324 | 324 | } |
325 | 325 | |
326 | - foreach ( $messages_to_generate as $message_to_generate ) { |
|
327 | - if ( $message_to_generate instanceof EE_Message_To_Generate && $message_to_generate->valid() ) { |
|
328 | - $this->queue_for_generation( $message_to_generate ); |
|
326 | + foreach ($messages_to_generate as $message_to_generate) { |
|
327 | + if ($message_to_generate instanceof EE_Message_To_Generate && $message_to_generate->valid()) { |
|
328 | + $this->queue_for_generation($message_to_generate); |
|
329 | 329 | } |
330 | 330 | } |
331 | 331 | } |
@@ -340,10 +340,10 @@ discard block |
||
340 | 340 | * @param EE_Message_To_Generate[] |
341 | 341 | * @return EE_Messages_Queue |
342 | 342 | */ |
343 | - public function generate_and_queue_for_sending( $messages_to_generate ) { |
|
343 | + public function generate_and_queue_for_sending($messages_to_generate) { |
|
344 | 344 | $this->_init_queue_and_generator(); |
345 | - $this->_queue_for_generation_loop( $messages_to_generate ); |
|
346 | - return $this->_generator->generate( true ); |
|
345 | + $this->_queue_for_generation_loop($messages_to_generate); |
|
346 | + return $this->_generator->generate(true); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | |
@@ -357,10 +357,10 @@ discard block |
||
357 | 357 | * @param bool $test_send Whether this is a test send or not. |
358 | 358 | * @return EE_Messages_Queue | bool false if unable to generate otherwise the generated queue. |
359 | 359 | */ |
360 | - public function generate_for_preview( EE_Message_To_Generate $message_to_generate, $test_send = false ) { |
|
361 | - if ( ! $message_to_generate->valid() ) { |
|
360 | + public function generate_for_preview(EE_Message_To_Generate $message_to_generate, $test_send = false) { |
|
361 | + if ( ! $message_to_generate->valid()) { |
|
362 | 362 | EE_Error::add_error( |
363 | - __( 'Unable to generate preview because of invalid data', 'event_espresso' ), |
|
363 | + __('Unable to generate preview because of invalid data', 'event_espresso'), |
|
364 | 364 | __FILE__, |
365 | 365 | __FUNCTION__, |
366 | 366 | __LINE__ |
@@ -368,14 +368,14 @@ discard block |
||
368 | 368 | return false; |
369 | 369 | } |
370 | 370 | //just make sure preview is set on the $message_to_generate (in case client forgot) |
371 | - $message_to_generate->set_preview( true ); |
|
371 | + $message_to_generate->set_preview(true); |
|
372 | 372 | $this->_init_queue_and_generator(); |
373 | - $this->queue_for_generation( $message_to_generate, $test_send ); |
|
374 | - $generated_queue = $this->_generator->generate( false ); |
|
375 | - if ( $generated_queue->execute( false ) ) { |
|
373 | + $this->queue_for_generation($message_to_generate, $test_send); |
|
374 | + $generated_queue = $this->_generator->generate(false); |
|
375 | + if ($generated_queue->execute(false)) { |
|
376 | 376 | //the first queue item should be the preview |
377 | 377 | $generated_queue->get_message_repository()->rewind(); |
378 | - if ( ! $generated_queue->get_message_repository()->valid() ) { |
|
378 | + if ( ! $generated_queue->get_message_repository()->valid()) { |
|
379 | 379 | return $generated_queue; |
380 | 380 | } |
381 | 381 | return $generated_queue->get_message_repository()->is_test_send() ? true : $generated_queue; |
@@ -392,15 +392,15 @@ discard block |
||
392 | 392 | * @param EE_Message_To_Generate $message_to_generate |
393 | 393 | * @return bool true or false for success. |
394 | 394 | */ |
395 | - public function queue_for_sending( EE_Message_To_Generate $message_to_generate ) { |
|
396 | - if ( ! $message_to_generate->valid() ) { |
|
395 | + public function queue_for_sending(EE_Message_To_Generate $message_to_generate) { |
|
396 | + if ( ! $message_to_generate->valid()) { |
|
397 | 397 | return false; |
398 | 398 | } |
399 | 399 | $this->_init_queue_and_generator(); |
400 | 400 | $message = $message_to_generate->get_EE_Message(); |
401 | - $this->_queue->add( $message ); |
|
402 | - if ( $message->send_now() ) { |
|
403 | - $this->_queue->execute( false ); |
|
401 | + $this->_queue->add($message); |
|
402 | + if ($message->send_now()) { |
|
403 | + $this->_queue->execute(false); |
|
404 | 404 | } else { |
405 | 405 | $this->_queue->save(); |
406 | 406 | } |
@@ -413,12 +413,12 @@ discard block |
||
413 | 413 | * @param EE_Message_To_Generate $message_to_generate |
414 | 414 | * @return EE_Messages_Queue | null |
415 | 415 | */ |
416 | - public function generate_and_send_now( EE_Message_To_Generate $message_to_generate ) { |
|
417 | - if ( ! $message_to_generate->valid() ) { |
|
416 | + public function generate_and_send_now(EE_Message_To_Generate $message_to_generate) { |
|
417 | + if ( ! $message_to_generate->valid()) { |
|
418 | 418 | return null; |
419 | 419 | } |
420 | 420 | // is there supposed to be a sending messenger for this message? |
421 | - if ( $message_to_generate instanceof EEI_Has_Sending_Messenger ) { |
|
421 | + if ($message_to_generate instanceof EEI_Has_Sending_Messenger) { |
|
422 | 422 | // make sure it's valid, but if it's not, |
423 | 423 | // then set the value of $sending_messenger to an EE_Error object |
424 | 424 | // so that downstream code can easily see that things went wrong. |
@@ -434,14 +434,14 @@ discard block |
||
434 | 434 | $sending_messenger = null; |
435 | 435 | } |
436 | 436 | |
437 | - if ( $message_to_generate->get_EE_Message()->STS_ID() === EEM_Message::status_idle ) { |
|
437 | + if ($message_to_generate->get_EE_Message()->STS_ID() === EEM_Message::status_idle) { |
|
438 | 438 | $this->_init_queue_and_generator(); |
439 | - $this->_queue->add( $message_to_generate->get_EE_Message() ); |
|
440 | - $this->_queue->execute( false, $sending_messenger ); |
|
439 | + $this->_queue->add($message_to_generate->get_EE_Message()); |
|
440 | + $this->_queue->execute(false, $sending_messenger); |
|
441 | 441 | return $this->_queue; |
442 | - } elseif ( $message_to_generate->get_EE_Message()->STS_ID() === EEM_Message::status_incomplete ) { |
|
443 | - $generated_queue = $this->generate_and_return( array( $message_to_generate ) ); |
|
444 | - $generated_queue->execute( false, $sending_messenger ); |
|
442 | + } elseif ($message_to_generate->get_EE_Message()->STS_ID() === EEM_Message::status_incomplete) { |
|
443 | + $generated_queue = $this->generate_and_return(array($message_to_generate)); |
|
444 | + $generated_queue->execute(false, $sending_messenger); |
|
445 | 445 | return $generated_queue; |
446 | 446 | } |
447 | 447 | return null; |
@@ -458,13 +458,13 @@ discard block |
||
458 | 458 | * @param mixed $data The data being used for generation. |
459 | 459 | * @param bool $persist Whether to persist the queued messages to the db or not. |
460 | 460 | */ |
461 | - public function generate_for_all_active_messengers( $message_type, $data, $persist = true ) { |
|
462 | - $messages_to_generate = $this->setup_mtgs_for_all_active_messengers( $message_type, $data ); |
|
463 | - if ( $persist ) { |
|
464 | - $this->batch_queue_for_generation_and_persist( $messages_to_generate ); |
|
461 | + public function generate_for_all_active_messengers($message_type, $data, $persist = true) { |
|
462 | + $messages_to_generate = $this->setup_mtgs_for_all_active_messengers($message_type, $data); |
|
463 | + if ($persist) { |
|
464 | + $this->batch_queue_for_generation_and_persist($messages_to_generate); |
|
465 | 465 | $this->_queue->initiate_request_by_priority(); |
466 | 466 | } else { |
467 | - $this->batch_queue_for_generation_no_persist( $messages_to_generate ); |
|
467 | + $this->batch_queue_for_generation_no_persist($messages_to_generate); |
|
468 | 468 | } |
469 | 469 | } |
470 | 470 | |
@@ -479,11 +479,11 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @return EE_Message_To_Generate[] |
481 | 481 | */ |
482 | - public function setup_mtgs_for_all_active_messengers( $message_type, $data ) { |
|
482 | + public function setup_mtgs_for_all_active_messengers($message_type, $data) { |
|
483 | 483 | $messages_to_generate = array(); |
484 | - foreach ( $this->_message_resource_manager->active_messengers() as $messenger_slug => $messenger_object ) { |
|
485 | - $message_to_generate = new EE_Message_To_Generate( $messenger_slug, $message_type, $data ); |
|
486 | - if ( $message_to_generate->valid() ) { |
|
484 | + foreach ($this->_message_resource_manager->active_messengers() as $messenger_slug => $messenger_object) { |
|
485 | + $message_to_generate = new EE_Message_To_Generate($messenger_slug, $message_type, $data); |
|
486 | + if ($message_to_generate->valid()) { |
|
487 | 487 | $messages_to_generate[] = $message_to_generate; |
488 | 488 | } |
489 | 489 | } |
@@ -498,29 +498,29 @@ discard block |
||
498 | 498 | * and send. |
499 | 499 | * @param array $message_ids |
500 | 500 | */ |
501 | - public function setup_messages_from_ids_and_send( $message_ids ) { |
|
501 | + public function setup_messages_from_ids_and_send($message_ids) { |
|
502 | 502 | $this->_init_queue_and_generator(); |
503 | - $messages = EEM_Message::instance()->get_all( array( |
|
503 | + $messages = EEM_Message::instance()->get_all(array( |
|
504 | 504 | array( |
505 | - 'MSG_ID' => array( 'IN', $message_ids ), |
|
505 | + 'MSG_ID' => array('IN', $message_ids), |
|
506 | 506 | 'STS_ID' => array( |
507 | 507 | 'IN', |
508 | 508 | array_merge( |
509 | 509 | EEM_Message::instance()->stati_indicating_sent(), |
510 | - array( EEM_Message::status_retry ) |
|
510 | + array(EEM_Message::status_retry) |
|
511 | 511 | ), |
512 | 512 | ), |
513 | 513 | ), |
514 | 514 | )); |
515 | 515 | //set the Messages to resend. |
516 | - foreach ( $messages as $message ) { |
|
517 | - if ( $message instanceof EE_Message ) { |
|
518 | - $message->set_STS_ID( EEM_Message::status_resend ); |
|
519 | - $this->_queue->add( $message ); |
|
516 | + foreach ($messages as $message) { |
|
517 | + if ($message instanceof EE_Message) { |
|
518 | + $message->set_STS_ID(EEM_Message::status_resend); |
|
519 | + $this->_queue->add($message); |
|
520 | 520 | } |
521 | 521 | } |
522 | 522 | |
523 | - $this->_queue->initiate_request_by_priority( 'send' ); |
|
523 | + $this->_queue->initiate_request_by_priority('send'); |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | |
@@ -534,23 +534,23 @@ discard block |
||
534 | 534 | * |
535 | 535 | * @return EE_Message_To_Generate[] |
536 | 536 | */ |
537 | - public function setup_messages_to_generate_from_registration_ids_in_request( $registration_ids_key = '_REG_ID' ) { |
|
538 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
539 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
537 | + public function setup_messages_to_generate_from_registration_ids_in_request($registration_ids_key = '_REG_ID') { |
|
538 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
539 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
540 | 540 | $regs_to_send = array(); |
541 | - $regIDs = EE_Registry::instance()->REQ->get( $registration_ids_key ); |
|
542 | - if ( empty( $regIDs ) ) { |
|
543 | - EE_Error::add_error( __('Something went wrong because we\'re missing the registration ID', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
541 | + $regIDs = EE_Registry::instance()->REQ->get($registration_ids_key); |
|
542 | + if (empty($regIDs)) { |
|
543 | + EE_Error::add_error(__('Something went wrong because we\'re missing the registration ID', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
544 | 544 | return false; |
545 | 545 | } |
546 | 546 | |
547 | 547 | //make sure is an array |
548 | - $regIDs = is_array( $regIDs ) ? $regIDs : array( $regIDs ); |
|
548 | + $regIDs = is_array($regIDs) ? $regIDs : array($regIDs); |
|
549 | 549 | |
550 | - foreach( $regIDs as $regID ) { |
|
551 | - $reg = EEM_Registration::instance()->get_one_by_ID( $regID ); |
|
552 | - if ( ! $reg instanceof EE_Registration ) { |
|
553 | - EE_Error::add_error( sprintf( __('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $regID ) ); |
|
550 | + foreach ($regIDs as $regID) { |
|
551 | + $reg = EEM_Registration::instance()->get_one_by_ID($regID); |
|
552 | + if ( ! $reg instanceof EE_Registration) { |
|
553 | + EE_Error::add_error(sprintf(__('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $regID)); |
|
554 | 554 | return false; |
555 | 555 | } |
556 | 556 | $regs_to_send[$reg->transaction_ID()][$reg->status_ID()][] = $reg; |
@@ -558,13 +558,13 @@ discard block |
||
558 | 558 | |
559 | 559 | $messages_to_generate = array(); |
560 | 560 | |
561 | - foreach ( $regs_to_send as $status_group ) { |
|
562 | - foreach ( $status_group as $status_id => $registrations ) { |
|
561 | + foreach ($regs_to_send as $status_group) { |
|
562 | + foreach ($status_group as $status_id => $registrations) { |
|
563 | 563 | $messages_to_generate = array_merge( |
564 | 564 | $messages_to_generate, |
565 | 565 | $this->setup_mtgs_for_all_active_messengers( |
566 | - EEH_MSG_Template::convert_reg_status_to_message_type( $status_id ), |
|
567 | - array( $registrations, $status_id ) |
|
566 | + EEH_MSG_Template::convert_reg_status_to_message_type($status_id), |
|
567 | + array($registrations, $status_id) |
|
568 | 568 | ) |
569 | 569 | ); |
570 | 570 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | 0 => array( |
34 | 34 | 'content_id' => 'attendee-column-tip', |
35 | 35 | 'target' => '.column-attendees .dashicons-groups', |
36 | - 'content' => sprintf( __('%s Registrations', 'event_espresso'), EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') ), |
|
36 | + 'content' => sprintf(__('%s Registrations', 'event_espresso'), EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')), |
|
37 | 37 | 'options' => array( |
38 | 38 | 'position' => array( |
39 | 39 | 'my' => 'bottom left', |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param EE_Datetime constant $status What status is set (by class) |
125 | 125 | * @return string The status legend with the related status highlighted |
126 | 126 | */ |
127 | - private function _event_status_legend( $status ) { |
|
127 | + private function _event_status_legend($status) { |
|
128 | 128 | |
129 | 129 | $status_array = array( |
130 | 130 | 'active_status' => EE_Datetime::active, |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | 'inactive_status' => EE_Datetime::inactive |
137 | 137 | ); |
138 | 138 | |
139 | - return EEH_Template::status_legend( $status_array, $status ); |
|
139 | + return EEH_Template::status_legend($status_array, $status); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | } |
143 | 143 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | |
35 | 35 | public function __construct() { |
36 | 36 | //define some page related constants |
37 | - define( 'EE_MAINTENANCE_LABEL', __('Maintenance', 'event_espresso')); |
|
38 | - define( 'EE_MAINTENANCE_PG_SLUG', 'espresso_maintenance_settings' ); |
|
39 | - define( 'EE_MAINTENANCE_ADMIN_URL', admin_url( 'admin.php?page=' . EE_MAINTENANCE_PG_SLUG )); |
|
40 | - define( 'EE_MAINTENANCE_ADMIN', EE_ADMIN_PAGES . 'maintenance' . DS ); |
|
41 | - define( 'EE_MAINTENANCE_TEMPLATE_PATH', EE_MAINTENANCE_ADMIN . 'templates' . DS ); |
|
42 | - define( 'EE_MAINTENANCE_ASSETS_URL', EE_ADMIN_PAGES_URL . 'maintenance/assets/' ); |
|
37 | + define('EE_MAINTENANCE_LABEL', __('Maintenance', 'event_espresso')); |
|
38 | + define('EE_MAINTENANCE_PG_SLUG', 'espresso_maintenance_settings'); |
|
39 | + define('EE_MAINTENANCE_ADMIN_URL', admin_url('admin.php?page='.EE_MAINTENANCE_PG_SLUG)); |
|
40 | + define('EE_MAINTENANCE_ADMIN', EE_ADMIN_PAGES.'maintenance'.DS); |
|
41 | + define('EE_MAINTENANCE_TEMPLATE_PATH', EE_MAINTENANCE_ADMIN.'templates'.DS); |
|
42 | + define('EE_MAINTENANCE_ASSETS_URL', EE_ADMIN_PAGES_URL.'maintenance/assets/'); |
|
43 | 43 | //check that if we're in maintenance mode that we tell the admin that |
44 | - add_action('admin_notices',array($this,'check_maintenance_mode')); |
|
44 | + add_action('admin_notices', array($this, 'check_maintenance_mode')); |
|
45 | 45 | parent::__construct(); |
46 | 46 | } |
47 | 47 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | protected function _set_menu_map() { |
53 | 53 | $menu_map = $this->_menu_map(); |
54 | 54 | |
55 | - $this->_menu_map = EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ? new EE_Admin_Page_Main_Menu( $menu_map) : new EE_Admin_Page_Sub_Menu( $menu_map ); |
|
55 | + $this->_menu_map = EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ? new EE_Admin_Page_Main_Menu($menu_map) : new EE_Admin_Page_Sub_Menu($menu_map); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | protected function _menu_map() { |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | 'maintenance_mode_parent' => EE_MAINTENANCE_PG_SLUG, |
68 | 68 | 'admin_init_page' => $this |
69 | 69 | ); |
70 | - if( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
71 | - $map['menu_group']='main'; |
|
70 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
71 | + $map['menu_group'] = 'main'; |
|
72 | 72 | $map['subtitle'] = EE_MAINTENANCE_LABEL; |
73 | - $map['menu_label'] = __( 'Event Espresso', 'event_espresso' ); |
|
73 | + $map['menu_label'] = __('Event Espresso', 'event_espresso'); |
|
74 | 74 | } |
75 | 75 | return $map; |
76 | 76 | } |
@@ -78,26 +78,26 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * Checks if we're in maintenance mode, and if so we notify the admin adn tell them how to take the site OUT of maintenance mode |
80 | 80 | */ |
81 | - public function check_maintenance_mode(){ |
|
81 | + public function check_maintenance_mode() { |
|
82 | 82 | $notice = ''; |
83 | 83 | $maintenance_page_url = ''; |
84 | - if(EE_Maintenance_Mode::instance()->level()){ |
|
84 | + if (EE_Maintenance_Mode::instance()->level()) { |
|
85 | 85 | $maintenance_page_url = EE_Admin_Page::add_query_args_and_nonce(array(), EE_MAINTENANCE_ADMIN_URL); |
86 | - switch(EE_Maintenance_Mode::instance()->level()){ |
|
86 | + switch (EE_Maintenance_Mode::instance()->level()) { |
|
87 | 87 | case EE_Maintenance_Mode::level_1_frontend_only_maintenance: |
88 | 88 | $notice = '<div class="update-nag"> |
89 | - ' . sprintf(__("Event Espresso is in Frontend-Only MAINTENANCE MODE. This means the front-end (ie, non-wp-admin pages) is disabled for ALL users except site admins. Visit the %s Maintenance Page %s to disable maintenance mode.", "event_espresso"),"<a href='$maintenance_page_url'>","</a>"). |
|
89 | + ' . sprintf(__("Event Espresso is in Frontend-Only MAINTENANCE MODE. This means the front-end (ie, non-wp-admin pages) is disabled for ALL users except site admins. Visit the %s Maintenance Page %s to disable maintenance mode.", "event_espresso"), "<a href='$maintenance_page_url'>", "</a>"). |
|
90 | 90 | '</div>'; |
91 | 91 | break; |
92 | 92 | case EE_Maintenance_Mode::level_2_complete_maintenance: |
93 | - $notice = '<div class="error"> |
|
93 | + $notice = '<div class="error"> |
|
94 | 94 | <p>'. sprintf(__("As part of the process for updating Event Espresso, your database also |
95 | -needs to be updated. Event Espresso is in COMPLETE MAINTENANCE MODE (both WordPress admin pages and front-end event registration pages are disabled) until you run the database update script. %s Visit the Maintenance Page to get started,%s it only takes a moment.", "event_espresso"),"<a href='$maintenance_page_url'>","</a>"). |
|
95 | +needs to be updated. Event Espresso is in COMPLETE MAINTENANCE MODE (both WordPress admin pages and front-end event registration pages are disabled) until you run the database update script. %s Visit the Maintenance Page to get started,%s it only takes a moment.", "event_espresso"), "<a href='$maintenance_page_url'>", "</a>"). |
|
96 | 96 | '</div>'; |
97 | 97 | break; |
98 | 98 | } |
99 | 99 | } |
100 | - echo apply_filters( 'FHEE__Maintenance_Admin_Page_Init__check_maintenance_mode__notice', $notice, $maintenance_page_url ); |
|
100 | + echo apply_filters('FHEE__Maintenance_Admin_Page_Init__check_maintenance_mode__notice', $notice, $maintenance_page_url); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | } //end class Payments_Admin_Page_Init |
@@ -1,6 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | |
94 | 94 | private function _registration_trash_message() { |
95 | - return '<p>' . __('This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', 'event_espresso') . '</p>'; |
|
95 | + return '<p>'.__('This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', 'event_espresso').'</p>'; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param EEM_Registration constant $status What status is set (by class) |
105 | 105 | * @return string The status legend with the related status highlighted |
106 | 106 | */ |
107 | - private function _registration_status_legend( $status ) { |
|
107 | + private function _registration_status_legend($status) { |
|
108 | 108 | |
109 | 109 | $status_array = array( |
110 | 110 | 'approved_status' => EEM_Registration::status_id_approved, |
@@ -114,6 +114,6 @@ discard block |
||
114 | 114 | 'cancelled_status' => EEM_Registration::status_id_cancelled |
115 | 115 | ); |
116 | 116 | |
117 | - return EEH_Template::status_legend( $status_array, $status ); |
|
117 | + return EEH_Template::status_legend($status_array, $status); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | \ No newline at end of file |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function __construct() { |
34 | 34 | |
35 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
36 | - if ( ! defined( 'TXN_PG_SLUG' ) ) { |
|
37 | - define( 'TXN_PG_SLUG', 'espresso_transactions' ); |
|
38 | - define( 'TXN_PG_NAME', ucwords( str_replace( '_', '', TXN_PG_SLUG ) ) ); |
|
39 | - define( 'TXN_ADMIN', EE_ADMIN_PAGES . 'transactions' . DS ); |
|
40 | - define( 'TXN_ADMIN_URL', admin_url( 'admin.php?page=' . TXN_PG_SLUG ) ); |
|
41 | - define( 'TXN_ASSETS_PATH', TXN_ADMIN . 'assets' . DS ); |
|
42 | - define( 'TXN_ASSETS_URL', str_replace( '\\', '/', EE_ADMIN_PAGES_URL . 'transactions/assets' . DS ) ); |
|
43 | - define( 'TXN_TEMPLATE_PATH', TXN_ADMIN . 'templates' . DS ); |
|
44 | - define( 'TXN_TEMPLATE_URL', str_replace( '\\', '/', EE_ADMIN_PAGES_URL . 'transactions/templates' . DS ) ); |
|
35 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
36 | + if ( ! defined('TXN_PG_SLUG')) { |
|
37 | + define('TXN_PG_SLUG', 'espresso_transactions'); |
|
38 | + define('TXN_PG_NAME', ucwords(str_replace('_', '', TXN_PG_SLUG))); |
|
39 | + define('TXN_ADMIN', EE_ADMIN_PAGES.'transactions'.DS); |
|
40 | + define('TXN_ADMIN_URL', admin_url('admin.php?page='.TXN_PG_SLUG)); |
|
41 | + define('TXN_ASSETS_PATH', TXN_ADMIN.'assets'.DS); |
|
42 | + define('TXN_ASSETS_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL.'transactions/assets'.DS)); |
|
43 | + define('TXN_TEMPLATE_PATH', TXN_ADMIN.'templates'.DS); |
|
44 | + define('TXN_TEMPLATE_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL.'transactions/templates'.DS)); |
|
45 | 45 | } |
46 | 46 | parent::__construct(); |
47 | 47 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @return void |
64 | 64 | */ |
65 | 65 | protected function _set_menu_map() { |
66 | - $this->_menu_map = new EE_Admin_Page_Sub_Menu( array( |
|
66 | + $this->_menu_map = new EE_Admin_Page_Sub_Menu(array( |
|
67 | 67 | 'menu_group' => 'main', |
68 | 68 | 'menu_order' => 50, |
69 | 69 | '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 | * |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param EEM_Transaction constant $status What status is set (by class) |
84 | 84 | * @return string The status legend with the related status highlighted |
85 | 85 | */ |
86 | - private function _transaction_status_legend( $status ) { |
|
86 | + private function _transaction_status_legend($status) { |
|
87 | 87 | |
88 | 88 | $status_array = array( |
89 | 89 | 'overpaid' => EEM_Transaction::overpaid_status_code, |
@@ -92,6 +92,6 @@ discard block |
||
92 | 92 | 'failed' => EEM_Transaction::failed_status_code, |
93 | 93 | ); |
94 | 94 | |
95 | - return EEH_Template::status_legend( $status_array, $status ); |
|
95 | + return EEH_Template::status_legend($status_array, $status); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | \ No newline at end of file |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | /** |
204 | 204 | * column_REG_att_checked_in |
205 | - */ |
|
205 | + */ |
|
206 | 206 | function column__REG_att_checked_in(EE_Registration $item){ |
207 | 207 | $attendee = $item->attendee(); |
208 | 208 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | /** |
290 | 290 | * column_REG_final_price |
291 | - */ |
|
291 | + */ |
|
292 | 292 | function column__REG_final_price(EE_Registration $item){ |
293 | 293 | return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>'; |
294 | 294 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | |
300 | 300 | /** |
301 | 301 | * column_TXN_paid |
302 | - */ |
|
302 | + */ |
|
303 | 303 | function column_TXN_paid(EE_Registration $item){ |
304 | 304 | |
305 | 305 | if ( $item->count() == 1 ) { |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | |
327 | 327 | /** |
328 | 328 | * column_TXN_total |
329 | - */ |
|
329 | + */ |
|
330 | 330 | function column_TXN_total(EE_Registration $item){ |
331 | 331 | $txn = $item->transaction(); |
332 | 332 | $view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL ); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | |
18 | 18 | |
19 | - public function __construct( $admin_page ) { |
|
19 | + public function __construct($admin_page) { |
|
20 | 20 | parent::__construct($admin_page); |
21 | 21 | $this->_status = $this->_admin_page->get_registration_status_array(); |
22 | 22 | } |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | |
26 | 26 | |
27 | 27 | protected function _setup_data() { |
28 | - $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page ) : $this->_admin_page->get_event_attendees( $this->_per_page, FALSE, TRUE ); |
|
29 | - $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page, TRUE ) : $this->_admin_page->get_event_attendees( $this->_per_page, TRUE, TRUE); |
|
28 | + $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) : $this->_admin_page->get_event_attendees($this->_per_page, FALSE, TRUE); |
|
29 | + $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page, TRUE) : $this->_admin_page->get_event_attendees($this->_per_page, TRUE, TRUE); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | 35 | protected function _set_properties() { |
36 | - $evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL; |
|
36 | + $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL; |
|
37 | 37 | |
38 | 38 | $this->_wp_list_args = array( |
39 | 39 | 'singular' => __('registrant', 'event_espresso'), |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | $columns = array(); |
46 | 46 | //$columns['_Reg_Status'] = ''; |
47 | - if ( !empty( $evt_id ) ) { |
|
47 | + if ( ! empty($evt_id)) { |
|
48 | 48 | $columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text |
49 | 49 | $this->_has_checkbox_column = true; |
50 | 50 | } |
@@ -60,43 +60,43 @@ discard block |
||
60 | 60 | 'TXN_total' => __('Total', 'event_espresso') |
61 | 61 | ); |
62 | 62 | |
63 | - $this->_columns = array_merge( $columns, $this->_columns); |
|
63 | + $this->_columns = array_merge($columns, $this->_columns); |
|
64 | 64 | |
65 | 65 | $this->_primary_column = '_REG_att_checked_in'; |
66 | 66 | |
67 | - if ( !empty( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id ) ) { |
|
67 | + if ( ! empty($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id)) { |
|
68 | 68 | $this->_bottom_buttons = array( |
69 | 69 | 'report'=> array( |
70 | 70 | 'route' => 'registrations_report', |
71 | 71 | 'extra_request' => |
72 | 72 | array( |
73 | 73 | 'EVT_ID'=> $evt_id, |
74 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
74 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
75 | 75 | ) |
76 | 76 | ); |
77 | 77 | } |
78 | 78 | |
79 | 79 | $this->_sortable_columns = array( |
80 | 80 | //true means its already sorted |
81 | - 'ATT_name' => array( 'ATT_name' => TRUE ), |
|
82 | - 'Event' => array( 'Event.EVT.Name' => FALSE ) |
|
81 | + 'ATT_name' => array('ATT_name' => TRUE), |
|
82 | + 'Event' => array('Event.EVT.Name' => FALSE) |
|
83 | 83 | ); |
84 | 84 | |
85 | 85 | $this->_hidden_columns = array(); |
86 | 86 | |
87 | 87 | $this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id); |
88 | - $this->_dtts_for_event = !empty($evt_id) ? $this->_evt->datetimes_ordered() : array(); |
|
88 | + $this->_dtts_for_event = ! empty($evt_id) ? $this->_evt->datetimes_ordered() : array(); |
|
89 | 89 | |
90 | 90 | } |
91 | 91 | |
92 | 92 | |
93 | 93 | |
94 | 94 | |
95 | - protected function _get_row_class( $item ) { |
|
96 | - $class = parent::_get_row_class( $item ); |
|
95 | + protected function _get_row_class($item) { |
|
96 | + $class = parent::_get_row_class($item); |
|
97 | 97 | //add status class |
98 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
99 | - if ( $this->_has_checkbox_column ) { |
|
98 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
99 | + if ($this->_has_checkbox_column) { |
|
100 | 100 | $class .= ' has-checkbox-column'; |
101 | 101 | } |
102 | 102 | return $class; |
@@ -108,42 +108,42 @@ discard block |
||
108 | 108 | $filters = $where = array(); |
109 | 109 | |
110 | 110 | |
111 | - if ( empty( $this->_dtts_for_event ) ) { |
|
111 | + if (empty($this->_dtts_for_event)) { |
|
112 | 112 | //this means we don't have an event so let's setup a filter dropdown for all the events to select |
113 | 113 | //note possible capability restrictions |
114 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events') ) { |
|
115 | - $where['status**'] = array( '!=', 'private' ); |
|
114 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
115 | + $where['status**'] = array('!=', 'private'); |
|
116 | 116 | } |
117 | 117 | |
118 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
119 | - $where['EVT_wp_user'] = get_current_user_id(); |
|
118 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
119 | + $where['EVT_wp_user'] = get_current_user_id(); |
|
120 | 120 | } |
121 | 121 | |
122 | - $events = EEM_Event::instance()->get_all(array( $where, 'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ) ) ); |
|
123 | - $evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') ); |
|
124 | - foreach ( $events as $evt ) { |
|
122 | + $events = EEM_Event::instance()->get_all(array($where, 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'))); |
|
123 | + $evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso')); |
|
124 | + foreach ($events as $evt) { |
|
125 | 125 | //any registrations for this event? |
126 | - if ( ! $evt->get_count_of_all_registrations() ) |
|
126 | + if ( ! $evt->get_count_of_all_registrations()) |
|
127 | 127 | continue; |
128 | 128 | $evts[] = array( |
129 | 129 | 'id' => $evt->ID(), |
130 | - 'text' => $evt->get( 'EVT_name' ), |
|
130 | + 'text' => $evt->get('EVT_name'), |
|
131 | 131 | 'class' => $evt->is_expired() ? 'ee-expired-event' : '' |
132 | 132 | ); |
133 | 133 | } |
134 | 134 | $event_filter = '<div class="ee-event-filter">'; |
135 | - $event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts ); |
|
136 | - $event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>' . ' ' . __( 'Hide Expired Events', 'event_espresso' ) . '</span>'; |
|
135 | + $event_filter .= EEH_Form_Fields::select_input('event_id', $evts); |
|
136 | + $event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>'.' '.__('Hide Expired Events', 'event_espresso').'</span>'; |
|
137 | 137 | $event_filter .= '</div>'; |
138 | 138 | $filters[] = $event_filter; |
139 | 139 | |
140 | 140 | } else { |
141 | 141 | //DTT datetimes filter |
142 | - $cur_dtt = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID(); |
|
142 | + $cur_dtt = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID(); |
|
143 | 143 | $dtts = array(); |
144 | - foreach ( $this->_dtts_for_event as $dtt ) { |
|
145 | - $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time(); |
|
146 | - $dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string ); |
|
144 | + foreach ($this->_dtts_for_event as $dtt) { |
|
145 | + $datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time(); |
|
146 | + $dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string); |
|
147 | 147 | } |
148 | 148 | $filters[] = EEH_Form_Fields::select_input('DTT_ID', $dtts, $cur_dtt); |
149 | 149 | } |
@@ -164,19 +164,19 @@ discard block |
||
164 | 164 | |
165 | 165 | |
166 | 166 | protected function _get_total_event_attendees() { |
167 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
168 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
167 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
168 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
169 | 169 | $query_params = array(); |
170 | - if ($EVT_ID){ |
|
171 | - $query_params[0]['EVT_ID']=$EVT_ID; |
|
170 | + if ($EVT_ID) { |
|
171 | + $query_params[0]['EVT_ID'] = $EVT_ID; |
|
172 | 172 | } |
173 | 173 | //if DTT is included we do multiple datetimes. Otherwise we just do primary datetime |
174 | - if ( $DTT_ID ) { |
|
174 | + if ($DTT_ID) { |
|
175 | 175 | $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
176 | 176 | } |
177 | - $status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) ); |
|
177 | + $status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)); |
|
178 | 178 | |
179 | - $query_params[0]['STS_ID']= array('IN', $status_ids_array ); |
|
179 | + $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
180 | 180 | |
181 | 181 | return EEM_Registration::instance()->count($query_params); |
182 | 182 | } |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | |
188 | 188 | |
189 | 189 | |
190 | - function column__Reg_Status( EE_Registration $item ) { |
|
191 | - return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>'; |
|
190 | + function column__Reg_Status(EE_Registration $item) { |
|
191 | + return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>'; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | |
198 | 198 | function column_cb($item) { |
199 | - return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() ); |
|
199 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID()); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -209,18 +209,18 @@ discard block |
||
209 | 209 | /** |
210 | 210 | * column_REG_att_checked_in |
211 | 211 | */ |
212 | - function column__REG_att_checked_in(EE_Registration $item){ |
|
212 | + function column__REG_att_checked_in(EE_Registration $item) { |
|
213 | 213 | $attendee = $item->attendee(); |
214 | 214 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
215 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0; |
|
215 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0; |
|
216 | 216 | $checkinstatus = $item->check_in_status_for_datetime($DTT_ID); |
217 | 217 | $nonce = wp_create_nonce('checkin_nonce'); |
218 | - $evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL; |
|
219 | - $toggle_active = !empty ( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID() ) ? ' clickable trigger-checkin' : ''; |
|
218 | + $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL; |
|
219 | + $toggle_active = ! empty ($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID()) ? ' clickable trigger-checkin' : ''; |
|
220 | 220 | |
221 | - $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>'; |
|
221 | + $mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>'; |
|
222 | 222 | |
223 | - return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '" data-_regid="' . $item->ID() . '" data-dttid="' . $DTT_ID . '" data-nonce="' . $nonce . '"></span>' . $mobile_view_content; |
|
223 | + return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'" data-_regid="'.$item->ID().'" data-dttid="'.$DTT_ID.'" data-nonce="'.$nonce.'"></span>'.$mobile_view_content; |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
@@ -229,43 +229,43 @@ discard block |
||
229 | 229 | |
230 | 230 | function column_ATT_name(EE_Registration $item) { |
231 | 231 | $attendee = $item->attendee(); |
232 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
232 | + if ( ! $attendee instanceof EE_Attendee) { |
|
233 | 233 | return __('No contact record for this registration.', 'event_espresso'); |
234 | 234 | } |
235 | 235 | |
236 | 236 | // edit attendee link |
237 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
238 | - $name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_contacts', 'espresso_registrations_edit_attendee' ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">' . $item->attendee()->full_name() . '</a>' : $item->attendee()->full_name(); |
|
237 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
238 | + $name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact', 'event_espresso').'">'.$item->attendee()->full_name().'</a>' : $item->attendee()->full_name(); |
|
239 | 239 | $name_link .= $item->count() == 1 ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup> ' : ''; |
240 | 240 | |
241 | 241 | //add group details |
242 | - $name_link .= ' ' . sprintf(__( '(%s of %s)', 'event_espresso' ),$item->count(), $item->group_size()); |
|
242 | + $name_link .= ' '.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
243 | 243 | |
244 | 244 | //add regcode |
245 | - $link = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), REG_ADMIN_URL ); |
|
245 | + $link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $item->ID()), REG_ADMIN_URL); |
|
246 | 246 | $name_link .= '<br>'; |
247 | - $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID() ) |
|
248 | - ? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') .'">' . $item->reg_code() . '</a>' |
|
247 | + $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID()) |
|
248 | + ? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$item->reg_code().'</a>' |
|
249 | 249 | : $item->reg_code(); |
250 | 250 | |
251 | 251 | //status |
252 | - $name_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
252 | + $name_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
253 | 253 | |
254 | 254 | $actions = array(); |
255 | - $DTT_ID = !empty( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
256 | - $DTT_ID = empty( $DTT_ID ) && !empty( $this->_req_data['event_id'] ) ? EEM_Event::instance()->get_one_by_ID( $this->_req_data['event_id'] )->primary_datetime()->ID() : $DTT_ID; |
|
255 | + $DTT_ID = ! empty($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
256 | + $DTT_ID = empty($DTT_ID) && ! empty($this->_req_data['event_id']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['event_id'])->primary_datetime()->ID() : $DTT_ID; |
|
257 | 257 | |
258 | - if ( !empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ) { |
|
259 | - $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID)); |
|
260 | - $actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso' ) . '">' . __('View', 'event_espresso') . '</a>'; |
|
258 | + if ( ! empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins')) { |
|
259 | + $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID)); |
|
260 | + $actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso').'">'.__('View', 'event_espresso').'</a>'; |
|
261 | 261 | } |
262 | 262 | |
263 | - return !empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions($actions) ) : $name_link; |
|
263 | + return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | |
267 | 267 | |
268 | - function column_ATT_email( EE_Registration $item ) { |
|
268 | + function column_ATT_email(EE_Registration $item) { |
|
269 | 269 | $attendee = $item->attendee(); |
270 | 270 | return $attendee instanceof EE_Attendee ? $attendee->email() : ''; |
271 | 271 | return $item->get_first_related('Attendee')->email(); |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | |
278 | 278 | function column_Event(EE_Registration $item) { |
279 | 279 | $event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event(); |
280 | - $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$event->ID() ), REG_ADMIN_URL ); |
|
281 | - $event_label = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ? '<a href="'.$chkin_lnk_url.'" title="' . esc_attr__( 'View Checkins for this Event', 'event_espresso' ) . '">' . $event->name() . '</a>' : $event->name(); |
|
280 | + $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$event->ID()), REG_ADMIN_URL); |
|
281 | + $event_label = EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins') ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__('View Checkins for this Event', 'event_espresso').'">'.$event->name().'</a>' : $event->name(); |
|
282 | 282 | return $event_label; |
283 | 283 | } |
284 | 284 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | |
287 | 287 | |
288 | 288 | |
289 | - function column_PRC_name(EE_Registration $item){ |
|
289 | + function column_PRC_name(EE_Registration $item) { |
|
290 | 290 | return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso"); |
291 | 291 | } |
292 | 292 | |
@@ -298,8 +298,8 @@ discard block |
||
298 | 298 | /** |
299 | 299 | * column_REG_final_price |
300 | 300 | */ |
301 | - function column__REG_final_price(EE_Registration $item){ |
|
302 | - return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>'; |
|
301 | + function column__REG_final_price(EE_Registration $item) { |
|
302 | + return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>'; |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
@@ -309,20 +309,20 @@ discard block |
||
309 | 309 | /** |
310 | 310 | * column_TXN_paid |
311 | 311 | */ |
312 | - function column_TXN_paid(EE_Registration $item){ |
|
312 | + function column_TXN_paid(EE_Registration $item) { |
|
313 | 313 | |
314 | - if ( $item->count() == 1 ) { |
|
314 | + if ($item->count() == 1) { |
|
315 | 315 | |
316 | - if ( $item->transaction()->paid() >= $item->transaction()->total() ) { |
|
316 | + if ($item->transaction()->paid() >= $item->transaction()->total()) { |
|
317 | 317 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
318 | 318 | } else { |
319 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
320 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? ' |
|
319 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
320 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? ' |
|
321 | 321 | <span class="reg-pad-rght"> |
322 | - <a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '"> |
|
323 | - ' . $item->transaction()->pretty_paid(). ' |
|
322 | + <a class="status-'. $item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"> |
|
323 | + ' . $item->transaction()->pretty_paid().' |
|
324 | 324 | </a> |
325 | - <span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
325 | + <span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
326 | 326 | } |
327 | 327 | } else { |
328 | 328 | return '<span class="reg-pad-rght"></span>'; |
@@ -336,13 +336,13 @@ discard block |
||
336 | 336 | /** |
337 | 337 | * column_TXN_total |
338 | 338 | */ |
339 | - function column_TXN_total(EE_Registration $item){ |
|
339 | + function column_TXN_total(EE_Registration $item) { |
|
340 | 340 | $txn = $item->transaction(); |
341 | - $view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL ); |
|
342 | - if ( $item->get('REG_count') == 1 ) { |
|
341 | + $view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL); |
|
342 | + if ($item->get('REG_count') == 1) { |
|
343 | 343 | $line_total_obj = $txn->total_line_item(); |
344 | 344 | $txn_total = $line_total_obj instanceof EE_Line_Item ? $line_total_obj->get_pretty('LIN_total') : __('View Transaction', 'event_espresso'); |
345 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? '<a href="' . $view_txn_url . '" title="' . esc_attr__('View Transaction', 'event_espresso') . '"><span class="reg-pad-rght">'. $txn_total .'</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>'; |
|
345 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_txn_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"><span class="reg-pad-rght">'.$txn_total.'</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>'; |
|
346 | 346 | } else { |
347 | 347 | return '<span class="reg-pad-rght"></span>'; |
348 | 348 | } |
@@ -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 | class EE_Event_Registrations_List_Table extends EE_Admin_List_Table { |
@@ -123,8 +125,9 @@ discard block |
||
123 | 125 | $evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') ); |
124 | 126 | foreach ( $events as $evt ) { |
125 | 127 | //any registrations for this event? |
126 | - if ( ! $evt->get_count_of_all_registrations() ) |
|
127 | - continue; |
|
128 | + if ( ! $evt->get_count_of_all_registrations() ) { |
|
129 | + continue; |
|
130 | + } |
|
128 | 131 | $evts[] = array( |
129 | 132 | 'id' => $evt->ID(), |
130 | 133 | 'text' => $evt->get( 'EVT_name' ), |