@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | |
125 | 125 | /** |
126 | 126 | * grab url requests and route them |
127 | - * @access private |
|
128 | - * @return void |
|
129 | - */ |
|
127 | + * @access private |
|
128 | + * @return void |
|
129 | + */ |
|
130 | 130 | public function _set_page_routes() { |
131 | 131 | |
132 | 132 | $this->_get_registration_status_array(); |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | 'title' => __('Registrations Other', 'event_espresso'), |
399 | 399 | 'filename' => 'registrations_overview_other' |
400 | 400 | ) |
401 | - ), |
|
401 | + ), |
|
402 | 402 | 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
403 | 403 | 'qtips' => array('Registration_List_Table_Tips'), |
404 | 404 | 'list_table' => 'EE_Registrations_List_Table', |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
413 | 413 | 'persistent' => FALSE |
414 | 414 | ), |
415 | - 'help_tabs' => array( |
|
415 | + 'help_tabs' => array( |
|
416 | 416 | 'registrations_details_help_tab' => array( |
417 | 417 | 'title' => __('Registration Details', 'event_espresso'), |
418 | 418 | 'filename' => 'registrations_details' |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | 'order' => 20 |
477 | 477 | ), |
478 | 478 | 'list_table' => 'EE_Attendee_Contact_List_Table', |
479 | - 'help_tabs' => array( |
|
479 | + 'help_tabs' => array( |
|
480 | 480 | 'registrations_contact_list_help_tab' => array( |
481 | 481 | 'title' => __('Registrations Contact List', 'event_espresso'), |
482 | 482 | 'filename' => 'registrations_contact_list' |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | 'title' => __('Contact List Other', 'event_espresso'), |
494 | 494 | 'filename' => 'registrations_contact_list_other' |
495 | 495 | ) |
496 | - ), |
|
496 | + ), |
|
497 | 497 | 'help_tour' => array( 'Contact_List_Help_Tour' ), |
498 | 498 | 'metaboxes' => array(), |
499 | 499 | 'require_nonce' => FALSE |
@@ -527,9 +527,9 @@ discard block |
||
527 | 527 | |
528 | 528 | /** |
529 | 529 | * get list of registration statuses |
530 | - * @access private |
|
531 | - * @return void |
|
532 | - */ |
|
530 | + * @access private |
|
531 | + * @return void |
|
532 | + */ |
|
533 | 533 | private function _get_registration_status_array() { |
534 | 534 | self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
535 | 535 | } |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | return TRUE; |
831 | 831 | } |
832 | 832 | |
833 | - $REG = EEM_Registration::instance(); |
|
833 | + $REG = EEM_Registration::instance(); |
|
834 | 834 | |
835 | 835 | $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
836 | 836 | |
@@ -1051,9 +1051,9 @@ discard block |
||
1051 | 1051 | |
1052 | 1052 | /** |
1053 | 1053 | * generates HTML for the View Registration Details Admin page |
1054 | - * @access protected |
|
1055 | - * @return void |
|
1056 | - */ |
|
1054 | + * @access protected |
|
1055 | + * @return void |
|
1056 | + */ |
|
1057 | 1057 | protected function _registration_details() { |
1058 | 1058 | |
1059 | 1059 | $this->_template_args = array(); |
@@ -1130,9 +1130,9 @@ discard block |
||
1130 | 1130 | |
1131 | 1131 | /** |
1132 | 1132 | * _set_approve_or_decline_reg_status_buttons |
1133 | - * @access protected |
|
1134 | - * @return string |
|
1135 | - */ |
|
1133 | + * @access protected |
|
1134 | + * @return string |
|
1135 | + */ |
|
1136 | 1136 | public function set_reg_status_buttons_metabox() { |
1137 | 1137 | |
1138 | 1138 | //is registration for free event OR for a completed transaction? This will determine whether the set to pending option is shown. |
@@ -1321,10 +1321,10 @@ discard block |
||
1321 | 1321 | |
1322 | 1322 | /** |
1323 | 1323 | * approve_registration |
1324 | - * @access protected |
|
1325 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1326 | - * @return void |
|
1327 | - */ |
|
1324 | + * @access protected |
|
1325 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1326 | + * @return void |
|
1327 | + */ |
|
1328 | 1328 | protected function approve_registration( $notify = false ) { |
1329 | 1329 | $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
1330 | 1330 | } |
@@ -1334,10 +1334,10 @@ discard block |
||
1334 | 1334 | |
1335 | 1335 | /** |
1336 | 1336 | * decline_registration |
1337 | - * @access protected |
|
1338 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1339 | - * @return void |
|
1340 | - */ |
|
1337 | + * @access protected |
|
1338 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1339 | + * @return void |
|
1340 | + */ |
|
1341 | 1341 | protected function decline_registration( $notify = false ) { |
1342 | 1342 | $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
1343 | 1343 | } |
@@ -1347,10 +1347,10 @@ discard block |
||
1347 | 1347 | |
1348 | 1348 | /** |
1349 | 1349 | * cancel_registration |
1350 | - * @access protected |
|
1351 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1352 | - * @return void |
|
1353 | - */ |
|
1350 | + * @access protected |
|
1351 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1352 | + * @return void |
|
1353 | + */ |
|
1354 | 1354 | protected function cancel_registration( $notify = false ) { |
1355 | 1355 | $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
1356 | 1356 | } |
@@ -1361,10 +1361,10 @@ discard block |
||
1361 | 1361 | |
1362 | 1362 | /** |
1363 | 1363 | * not_approve_registration |
1364 | - * @access protected |
|
1365 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1366 | - * @return void |
|
1367 | - */ |
|
1364 | + * @access protected |
|
1365 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1366 | + * @return void |
|
1367 | + */ |
|
1368 | 1368 | protected function not_approve_registration( $notify = false ) { |
1369 | 1369 | $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
1370 | 1370 | } |
@@ -1373,10 +1373,10 @@ discard block |
||
1373 | 1373 | |
1374 | 1374 | /** |
1375 | 1375 | * decline_registration |
1376 | - * @access protected |
|
1377 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1378 | - * @return void |
|
1379 | - */ |
|
1376 | + * @access protected |
|
1377 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1378 | + * @return void |
|
1379 | + */ |
|
1380 | 1380 | protected function pending_registration( $notify = false ) { |
1381 | 1381 | $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
1382 | 1382 | } |
@@ -1386,9 +1386,9 @@ discard block |
||
1386 | 1386 | |
1387 | 1387 | /** |
1388 | 1388 | * generates HTML for the Registration main meta box |
1389 | - * @access public |
|
1390 | - * @return void |
|
1391 | - */ |
|
1389 | + * @access public |
|
1390 | + * @return void |
|
1391 | + */ |
|
1392 | 1392 | public function _reg_details_meta_box() { |
1393 | 1393 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1394 | 1394 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
@@ -1471,9 +1471,9 @@ discard block |
||
1471 | 1471 | |
1472 | 1472 | /** |
1473 | 1473 | * generates HTML for the Registration Questions meta box |
1474 | - * @access public |
|
1475 | - * @return void |
|
1476 | - */ |
|
1474 | + * @access public |
|
1475 | + * @return void |
|
1476 | + */ |
|
1477 | 1477 | public function _reg_questions_meta_box() { |
1478 | 1478 | |
1479 | 1479 | add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 ); |
@@ -1581,9 +1581,9 @@ discard block |
||
1581 | 1581 | |
1582 | 1582 | /** |
1583 | 1583 | * generates HTML for the Registration main meta box |
1584 | - * @access protected |
|
1585 | - * @return void |
|
1586 | - */ |
|
1584 | + * @access protected |
|
1585 | + * @return void |
|
1586 | + */ |
|
1587 | 1587 | protected function _update_attendee_registration_form() { |
1588 | 1588 | $qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE; |
1589 | 1589 | $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
@@ -1665,12 +1665,12 @@ discard block |
||
1665 | 1665 | |
1666 | 1666 | /** |
1667 | 1667 | * generates HTML for the Registration main meta box |
1668 | - * @access public |
|
1669 | - * @return void |
|
1670 | - */ |
|
1668 | + * @access public |
|
1669 | + * @return void |
|
1670 | + */ |
|
1671 | 1671 | public function _reg_attendees_meta_box() { |
1672 | 1672 | |
1673 | - $REG = EEM_Registration::instance(); |
|
1673 | + $REG = EEM_Registration::instance(); |
|
1674 | 1674 | //get all other registrations on this transaction, and cache |
1675 | 1675 | //the attendees for them so we don't have to run another query using force_join |
1676 | 1676 | $registrations = $REG->get_all(array( |
@@ -1723,9 +1723,9 @@ discard block |
||
1723 | 1723 | |
1724 | 1724 | /** |
1725 | 1725 | * generates HTML for the Edit Registration side meta box |
1726 | - * @access public |
|
1727 | - * @return void |
|
1728 | - */ |
|
1726 | + * @access public |
|
1727 | + * @return void |
|
1728 | + */ |
|
1729 | 1729 | public function _reg_registrant_side_meta_box() { |
1730 | 1730 | |
1731 | 1731 | /*@var $attendee EE_Attendee */ |
@@ -2071,9 +2071,9 @@ discard block |
||
2071 | 2071 | |
2072 | 2072 | /** |
2073 | 2073 | * set_reg_event |
2074 | - * @access private |
|
2075 | - * @return boolean |
|
2076 | - */ |
|
2074 | + * @access private |
|
2075 | + * @return boolean |
|
2076 | + */ |
|
2077 | 2077 | private function _set_reg_event() { |
2078 | 2078 | if ( is_object( $this->_reg_event )) { |
2079 | 2079 | return TRUE; |
@@ -2177,9 +2177,9 @@ discard block |
||
2177 | 2177 | |
2178 | 2178 | /** |
2179 | 2179 | * generates HTML for the Attendee Contact List |
2180 | - * @access protected |
|
2181 | - * @return void |
|
2182 | - */ |
|
2180 | + * @access protected |
|
2181 | + * @return void |
|
2182 | + */ |
|
2183 | 2183 | protected function _attendee_contact_list_table() { |
2184 | 2184 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
2185 | 2185 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
@@ -2193,9 +2193,9 @@ discard block |
||
2193 | 2193 | /** |
2194 | 2194 | * get_attendees |
2195 | 2195 | * @param bool $count whether to return count or data. |
2196 | - * @access public |
|
2197 | - * @return array |
|
2198 | - */ |
|
2196 | + * @access public |
|
2197 | + * @return array |
|
2198 | + */ |
|
2199 | 2199 | public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
2200 | 2200 | |
2201 | 2201 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -2513,9 +2513,9 @@ discard block |
||
2513 | 2513 | |
2514 | 2514 | /** |
2515 | 2515 | * _attendee_details |
2516 | - * @access protected |
|
2517 | - * @return void |
|
2518 | - */ |
|
2516 | + * @access protected |
|
2517 | + * @return void |
|
2518 | + */ |
|
2519 | 2519 | public function attendee_registrations_meta_box( $post ) { |
2520 | 2520 | |
2521 | 2521 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
@@ -2548,10 +2548,10 @@ discard block |
||
2548 | 2548 | |
2549 | 2549 | /** |
2550 | 2550 | * _trash_or_restore_attendee |
2551 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
2552 | - * @access protected |
|
2553 | - * @return void |
|
2554 | - */ |
|
2551 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
2552 | + * @access protected |
|
2553 | + * @return void |
|
2554 | + */ |
|
2555 | 2555 | protected function _trash_or_restore_attendees( $trash = TRUE ) { |
2556 | 2556 | |
2557 | 2557 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param bool $routing |
43 | 43 | * @return Registrations_Admin_Page |
44 | 44 | */ |
45 | - public function __construct( $routing = TRUE ) { |
|
46 | - parent::__construct( $routing ); |
|
45 | + public function __construct($routing = TRUE) { |
|
46 | + parent::__construct($routing); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -75,16 +75,16 @@ discard block |
||
75 | 75 | 'trash' => 'post.php' |
76 | 76 | ); |
77 | 77 | |
78 | - add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 ); |
|
78 | + add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10); |
|
79 | 79 | //add filters so that the comment urls don't take users to a confusing 404 page |
80 | - add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 ); |
|
80 | + add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
84 | - public function clear_comment_link( $link, $comment, $args ) { |
|
84 | + public function clear_comment_link($link, $comment, $args) { |
|
85 | 85 | //gotta make sure this only happens on this route |
86 | - $post_type = get_post_type( $comment->comment_post_ID); |
|
87 | - if ( $post_type == 'espresso_attendees' ) |
|
86 | + $post_type = get_post_type($comment->comment_post_ID); |
|
87 | + if ($post_type == 'espresso_attendees') |
|
88 | 88 | return '#commentsdiv'; |
89 | 89 | return $link; |
90 | 90 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | protected function _ajax_hooks() { |
94 | 94 | //todo: all hooks for registrations ajax goes in here |
95 | - add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' )); |
|
95 | + add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status')); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | 'add-attendee' => __('Add Contact', 'event_espresso'), |
108 | 108 | 'edit' => __('Edit Contact', 'event_espresso'), |
109 | 109 | 'report'=> __("Event Registrations CSV Report", "event_espresso"), |
110 | - 'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ), |
|
111 | - 'contact_list_report' => __( 'Contact List Report', 'event_espresso' ), |
|
110 | + 'report_all' => __('All Registrations CSV Report', 'event_espresso'), |
|
111 | + 'contact_list_report' => __('Contact List Report', 'event_espresso'), |
|
112 | 112 | 'contact_list_export'=> __("Export Data", "event_espresso"), |
113 | 113 | ), |
114 | 114 | 'publishbox' => array( |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | |
137 | 137 | $this->_get_registration_status_array(); |
138 | 138 | |
139 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
140 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0; |
|
141 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
139 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
140 | + $att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0; |
|
141 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
142 | 142 | |
143 | 143 | $this->_page_routes = array( |
144 | 144 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | 'edit_registration' => array( |
157 | 157 | 'func' => '_registration_details', |
158 | - 'args' => array( 'edit' ), |
|
158 | + 'args' => array('edit'), |
|
159 | 159 | 'noheader' => TRUE, |
160 | 160 | 'capability' => 'ee_edit_registration', |
161 | 161 | 'obj_id' => $reg_id |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | 'restore_registrations' => array( |
172 | 172 | 'func' => '_trash_or_restore_registrations', |
173 | - 'args' => array( 'trash' => FALSE ), |
|
173 | + 'args' => array('trash' => FALSE), |
|
174 | 174 | 'noheader' => TRUE, |
175 | 175 | 'capability' => 'ee_delete_registrations' |
176 | 176 | ), |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | 'filename' => 'registrations_overview_other' |
405 | 405 | ) |
406 | 406 | ), |
407 | - 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
|
407 | + 'help_tour' => array('Registration_Overview_Help_Tour'), |
|
408 | 408 | 'qtips' => array('Registration_List_Table_Tips'), |
409 | 409 | 'list_table' => 'EE_Registrations_List_Table', |
410 | 410 | 'require_nonce' => FALSE |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | 'nav' => array( |
415 | 415 | 'label' => __('REG Details', 'event_espresso'), |
416 | 416 | 'order' => 15, |
417 | - 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
417 | + 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
418 | 418 | 'persistent' => FALSE |
419 | 419 | ), |
420 | 420 | 'help_tabs' => array( |
@@ -435,8 +435,8 @@ discard block |
||
435 | 435 | 'filename' => 'registrations_details_registrant_details' |
436 | 436 | ) |
437 | 437 | ), |
438 | - 'help_tour' => array( 'Registration_Details_Help_Tour' ), |
|
439 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ), |
|
438 | + 'help_tour' => array('Registration_Details_Help_Tour'), |
|
439 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')), |
|
440 | 440 | 'require_nonce' => FALSE |
441 | 441 | ), |
442 | 442 | |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | 'order' => 15, |
461 | 461 | 'persistent' => FALSE |
462 | 462 | ), |
463 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ), |
|
463 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')), |
|
464 | 464 | 'require_nonce' => FALSE |
465 | 465 | ), |
466 | 466 | |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | 'label' => __('Edit Contact', 'event_espresso'), |
470 | 470 | 'order' => 15, |
471 | 471 | 'persistent' => FALSE, |
472 | - 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
472 | + 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
473 | 473 | ), |
474 | 474 | 'metaboxes' => array('attendee_editor_metaboxes'), |
475 | 475 | 'require_nonce' => FALSE |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | 'filename' => 'registrations_contact_list_other' |
500 | 500 | ) |
501 | 501 | ), |
502 | - 'help_tour' => array( 'Contact_List_Help_Tour' ), |
|
502 | + 'help_tour' => array('Contact_List_Help_Tour'), |
|
503 | 503 | 'metaboxes' => array(), |
504 | 504 | 'require_nonce' => FALSE |
505 | 505 | ), |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | protected function _add_screen_options() {} |
519 | 519 | protected function _add_feature_pointers() {} |
520 | 520 | public function admin_init() { |
521 | - EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' ); |
|
521 | + EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso'); |
|
522 | 522 | } |
523 | 523 | public function admin_notices() {} |
524 | 524 | public function admin_footer_scripts() {} |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | * @return void |
537 | 537 | */ |
538 | 538 | private function _get_registration_status_array() { |
539 | - self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
|
539 | + self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE); |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | |
@@ -559,11 +559,11 @@ discard block |
||
559 | 559 | public function load_scripts_styles() { |
560 | 560 | //style |
561 | 561 | //wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
562 | - wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
562 | + wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
563 | 563 | wp_enqueue_style('espresso_reg'); |
564 | 564 | |
565 | 565 | //script |
566 | - wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
566 | + wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
567 | 567 | wp_enqueue_script('espresso_reg'); |
568 | 568 | } |
569 | 569 | |
@@ -572,9 +572,9 @@ discard block |
||
572 | 572 | public function load_scripts_styles_edit_attendee() { |
573 | 573 | //stuff to only show up on our attendee edit details page. |
574 | 574 | $attendee_details_translations = array( |
575 | - 'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') ) |
|
575 | + 'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created')) |
|
576 | 576 | ); |
577 | - wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations ); |
|
577 | + wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
|
578 | 578 | wp_enqueue_script('jquery-validate'); |
579 | 579 | } |
580 | 580 | |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | |
593 | 593 | public function load_scripts_styles_contact_list() { |
594 | 594 | wp_deregister_style('espresso_reg'); |
595 | - wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
595 | + wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
596 | 596 | wp_enqueue_style('espresso_att'); |
597 | 597 | } |
598 | 598 | |
@@ -601,9 +601,9 @@ discard block |
||
601 | 601 | |
602 | 602 | |
603 | 603 | public function load_scripts_styles_new_registration() { |
604 | - wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
604 | + wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
605 | 605 | wp_enqueue_script('ee-spco-for-admin'); |
606 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
606 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
607 | 607 | EE_Form_Section_Proper::wp_enqueue_scripts(); |
608 | 608 | EED_Ticket_Selector::load_tckt_slctr_assets(); |
609 | 609 | EE_Datepicker_Input::enqueue_styles_and_scripts(); |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | //for notification related bulk actions we need to make sure only active messengers have an option. |
631 | 631 | EED_Messages::set_autoloaders(); |
632 | 632 | /** @type EE_Messages $messages_controller */ |
633 | - $messages_controller = EE_Registry::instance()->load_lib( 'messages' ); |
|
633 | + $messages_controller = EE_Registry::instance()->load_lib('messages'); |
|
634 | 634 | $active_mts = $messages_controller->get_active_message_types(); |
635 | 635 | //key= bulk_action_slug, value= message type. |
636 | 636 | $match_array = array( |
@@ -643,23 +643,23 @@ discard block |
||
643 | 643 | |
644 | 644 | /** setup reg status bulk actions **/ |
645 | 645 | $def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); |
646 | - if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
646 | + if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
647 | 647 | $def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); |
648 | 648 | } |
649 | 649 | $def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); |
650 | - if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
650 | + if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
651 | 651 | $def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); |
652 | 652 | } |
653 | 653 | $def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); |
654 | - if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
654 | + if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
655 | 655 | $def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); |
656 | 656 | } |
657 | 657 | $def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); |
658 | - if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
658 | + if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
659 | 659 | $def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); |
660 | 660 | } |
661 | 661 | $def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); |
662 | - if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
662 | + if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
663 | 663 | $def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); |
664 | 664 | } |
665 | 665 | |
@@ -668,29 +668,29 @@ discard block |
||
668 | 668 | 'slug' => 'all', |
669 | 669 | 'label' => __('View All Registrations', 'event_espresso'), |
670 | 670 | 'count' => 0, |
671 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
671 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
672 | 672 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
673 | - ) ) |
|
673 | + )) |
|
674 | 674 | ), |
675 | 675 | 'month' => array( |
676 | 676 | 'slug' => 'month', |
677 | 677 | 'label' => __('This Month', 'event_espresso'), |
678 | 678 | 'count' => 0, |
679 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
679 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
680 | 680 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
681 | 681 | )) |
682 | 682 | ), |
683 | 683 | 'today' => array( |
684 | 684 | 'slug' => 'today', |
685 | - 'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ), |
|
685 | + 'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))), |
|
686 | 686 | 'count' => 0, |
687 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
687 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
688 | 688 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
689 | 689 | )) |
690 | 690 | ) |
691 | 691 | ); |
692 | 692 | |
693 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) { |
|
693 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) { |
|
694 | 694 | $this->_views['incomplete'] = array( |
695 | 695 | 'slug' => 'incomplete', |
696 | 696 | 'label' => __('Incomplete', 'event_espresso'), |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | ) |
727 | 727 | ); |
728 | 728 | |
729 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) { |
|
729 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) { |
|
730 | 730 | $this->_views['trash'] = array( |
731 | 731 | 'slug' => 'trash', |
732 | 732 | 'label' => __('Trash', 'event_espresso'), |
@@ -765,42 +765,42 @@ discard block |
||
765 | 765 | 'desc' => __('View Transaction Invoice', 'event_espresso') |
766 | 766 | ), |
767 | 767 | ); |
768 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
768 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
769 | 769 | $fc_items['resend_registration'] = array( |
770 | 770 | 'class' => 'dashicons dashicons-email-alt', |
771 | 771 | 'desc' => __('Resend Registration Details', 'event_espresso') |
772 | 772 | ); |
773 | 773 | } else { |
774 | - $fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' ); |
|
774 | + $fc_items['blank'] = array('class' => 'blank', 'desc' => ''); |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | $sc_items = array( |
778 | 778 | 'approved_status' => array( |
779 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
780 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
779 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
780 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
781 | 781 | ), |
782 | 782 | 'pending_status' => array( |
783 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
784 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
783 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
784 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
785 | 785 | ), |
786 | 786 | 'incomplete_status' => array( |
787 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete, |
|
788 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' ) |
|
787 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete, |
|
788 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence') |
|
789 | 789 | ), |
790 | 790 | 'not_approved' => array( |
791 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
792 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
791 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
792 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
793 | 793 | ), |
794 | 794 | 'declined_status' => array( |
795 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
796 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
795 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
796 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
797 | 797 | ), |
798 | 798 | 'cancelled_status' => array( |
799 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
800 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
799 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
800 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
801 | 801 | ) |
802 | 802 | ); |
803 | - return array_merge( $fc_items, $sc_items ); |
|
803 | + return array_merge($fc_items, $sc_items); |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | |
@@ -813,15 +813,15 @@ discard block |
||
813 | 813 | |
814 | 814 | |
815 | 815 | protected function _registrations_overview_list_table() { |
816 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
817 | - if ( $EVT_ID ) { |
|
818 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) { |
|
819 | - $this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' ); |
|
816 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
817 | + if ($EVT_ID) { |
|
818 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) { |
|
819 | + $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2'); |
|
820 | 820 | } |
821 | - $event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
822 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : ''; |
|
821 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
822 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : ''; |
|
823 | 823 | } |
824 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() ); |
|
824 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
825 | 825 | $this->display_admin_list_table_page_with_no_sidebar(); |
826 | 826 | } |
827 | 827 | |
@@ -836,19 +836,19 @@ discard block |
||
836 | 836 | */ |
837 | 837 | private function _set_registration_object() { |
838 | 838 | //get out if we've already set the object |
839 | - if ( is_object( $this->_registration )) { |
|
839 | + if (is_object($this->_registration)) { |
|
840 | 840 | return TRUE; |
841 | 841 | } |
842 | 842 | |
843 | 843 | $REG = EEM_Registration::instance(); |
844 | 844 | |
845 | - $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
845 | + $REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
846 | 846 | |
847 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
847 | + if ($this->_registration = $REG->get_one_by_ID($REG_ID)) |
|
848 | 848 | return TRUE; |
849 | 849 | else { |
850 | - $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
|
851 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
850 | + $error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID); |
|
851 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
852 | 852 | $this->_registration = NULL; |
853 | 853 | return FALSE; |
854 | 854 | } |
@@ -867,25 +867,25 @@ discard block |
||
867 | 867 | * @internal param bool $all whether to ignore all query params and just return ALL registrations (or count if count is set) |
868 | 868 | * @return mixed (int|array) int = count || array of registration objects |
869 | 869 | */ |
870 | - public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) { |
|
871 | - |
|
872 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
873 | - $CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE; |
|
874 | - $reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE; |
|
875 | - $month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april |
|
876 | - $today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ? TRUE : FALSE; |
|
877 | - $this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ? TRUE : FALSE; |
|
870 | + public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) { |
|
871 | + |
|
872 | + $EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE; |
|
873 | + $CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE; |
|
874 | + $reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE; |
|
875 | + $month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april |
|
876 | + $today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'today' ? TRUE : FALSE; |
|
877 | + $this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'month' ? TRUE : FALSE; |
|
878 | 878 | $start_date = FALSE; |
879 | 879 | $end_date = FALSE; |
880 | 880 | $_where = array(); |
881 | - $trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE; |
|
882 | - $incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE; |
|
881 | + $trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE; |
|
882 | + $incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE; |
|
883 | 883 | |
884 | 884 | //set orderby |
885 | 885 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
886 | 886 | |
887 | 887 | |
888 | - switch ( $this->_req_data['orderby'] ) { |
|
888 | + switch ($this->_req_data['orderby']) { |
|
889 | 889 | case '_REG_ID': |
890 | 890 | $orderby = 'REG_ID'; |
891 | 891 | break; |
@@ -905,26 +905,26 @@ discard block |
||
905 | 905 | $orderby = 'REG_date'; |
906 | 906 | } |
907 | 907 | |
908 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
909 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
910 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
908 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
909 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
910 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
911 | 911 | |
912 | 912 | |
913 | - $offset = ($current_page-1)*$per_page; |
|
914 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
913 | + $offset = ($current_page - 1) * $per_page; |
|
914 | + $limit = $count ? NULL : array($offset, $per_page); |
|
915 | 915 | |
916 | - if($EVT_ID){ |
|
917 | - $_where['EVT_ID']=$EVT_ID; |
|
916 | + if ($EVT_ID) { |
|
917 | + $_where['EVT_ID'] = $EVT_ID; |
|
918 | 918 | } |
919 | - if($CAT_ID){ |
|
919 | + if ($CAT_ID) { |
|
920 | 920 | $_where['Event.Term_Taxonomy.term_id'] = $CAT_ID; |
921 | 921 | } |
922 | - if ( $incomplete ) { |
|
922 | + if ($incomplete) { |
|
923 | 923 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
924 | 924 | } else if ( ! $trash) { |
925 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
925 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
926 | 926 | } |
927 | - if($reg_status){ |
|
927 | + if ($reg_status) { |
|
928 | 928 | $_where['STS_ID'] = $reg_status; |
929 | 929 | } |
930 | 930 | |
@@ -936,105 +936,105 @@ discard block |
||
936 | 936 | $time_start = ' 00:00:00'; |
937 | 937 | $time_end = ' 23:59:59'; |
938 | 938 | |
939 | - if($today_a || $today ){ |
|
939 | + if ($today_a || $today) { |
|
940 | 940 | $curdate = date('Y-m-d', current_time('timestamp')); |
941 | - $_where['REG_date']= array('BETWEEN', |
|
941 | + $_where['REG_date'] = array('BETWEEN', |
|
942 | 942 | array( |
943 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
|
944 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
|
943 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'), |
|
944 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'), |
|
945 | 945 | )); |
946 | - }elseif($this_month_a || $this_month){ |
|
946 | + }elseif ($this_month_a || $this_month) { |
|
947 | 947 | $this_month_r = date('m', current_time('timestamp')); |
948 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
949 | - $_where['REG_date']= array('BETWEEN', |
|
948 | + $days_this_month = date('t', current_time('timestamp')); |
|
949 | + $_where['REG_date'] = array('BETWEEN', |
|
950 | 950 | array( |
951 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
|
952 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ) |
|
951 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'), |
|
952 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s') |
|
953 | 953 | )); |
954 | - }elseif($month_range){ |
|
954 | + }elseif ($month_range) { |
|
955 | 955 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
956 | - $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
957 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
958 | - $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
|
959 | - $_where['REG_date']= array('BETWEEN', |
|
960 | - array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) ); |
|
961 | - }elseif($start_date && $end_date){ |
|
956 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
957 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
958 | + $days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01')); |
|
959 | + $_where['REG_date'] = array('BETWEEN', |
|
960 | + array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s'))); |
|
961 | + }elseif ($start_date && $end_date) { |
|
962 | 962 | throw new EE_Error("not yet supported"); |
963 | - }elseif($start_date){ |
|
963 | + }elseif ($start_date) { |
|
964 | 964 | throw new EE_Error("not yet supported"); |
965 | - }elseif($end_date){ |
|
965 | + }elseif ($end_date) { |
|
966 | 966 | throw new EE_Error("not yet supported"); |
967 | 967 | } |
968 | 968 | |
969 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
970 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
969 | + if ( ! empty($this->_req_data['s'])) { |
|
970 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
971 | 971 | $_where['OR'] = array( |
972 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
973 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
974 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
975 | - 'Attendee.ATT_full_name' => array( 'LIKE', $sstr ), |
|
976 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
977 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
978 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
979 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
980 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
981 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
982 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
983 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
984 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
985 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
986 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
987 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
988 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ), |
|
989 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr ) |
|
972 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
973 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
974 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
975 | + 'Attendee.ATT_full_name' => array('LIKE', $sstr), |
|
976 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
977 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
978 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
979 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
980 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
981 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
982 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
983 | + 'REG_final_price' => array('LIKE', $sstr), |
|
984 | + 'REG_code' => array('LIKE', $sstr), |
|
985 | + 'REG_count' => array('LIKE', $sstr), |
|
986 | + 'REG_group_size' => array('LIKE', $sstr), |
|
987 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
988 | + 'Ticket.TKT_description' => array('LIKE', $sstr), |
|
989 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr) |
|
990 | 990 | ); |
991 | 991 | } |
992 | 992 | |
993 | 993 | //capability checks |
994 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) { |
|
994 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) { |
|
995 | 995 | $_where['AND'] = array( |
996 | 996 | 'Event.EVT_wp_user' => get_current_user_id() |
997 | 997 | ); |
998 | 998 | } |
999 | 999 | |
1000 | 1000 | |
1001 | - if( $count ){ |
|
1002 | - if ( $trash ) { |
|
1003 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
1004 | - } else if ( $incomplete ) { |
|
1005 | - return EEM_Registration::instance()->count( array( $_where )); |
|
1001 | + if ($count) { |
|
1002 | + if ($trash) { |
|
1003 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
1004 | + } else if ($incomplete) { |
|
1005 | + return EEM_Registration::instance()->count(array($_where)); |
|
1006 | 1006 | } else { |
1007 | - return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' )); |
|
1007 | + return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only')); |
|
1008 | 1008 | } |
1009 | 1009 | } else { |
1010 | 1010 | //make sure we remove default where conditions cause all registrations matching query are returned |
1011 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' ); |
|
1012 | - if ( $per_page !== -1 ) { |
|
1011 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only'); |
|
1012 | + if ($per_page !== -1) { |
|
1013 | 1013 | $query_params['limit'] = $limit; |
1014 | 1014 | } |
1015 | - $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1015 | + $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1016 | 1016 | |
1017 | 1017 | |
1018 | - if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1018 | + if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1019 | 1019 | $first_registration = $registrations[0]; |
1020 | 1020 | //EEH_Debug_Tools::printr( $registrations[0], '$registrations <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1021 | 1021 | $event_name = $first_registration->event_obj()->name(); |
1022 | - $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1022 | + $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1023 | 1023 | // edit event link |
1024 | - if ( $event_name != '' ) { |
|
1025 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1026 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1027 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1024 | + if ($event_name != '') { |
|
1025 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1026 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1027 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1031 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
1030 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1031 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
1032 | 1032 | |
1033 | 1033 | $this->_template_args['before_admin_page_content'] = ' |
1034 | 1034 | <div id="admin-page-header"> |
1035 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1036 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1037 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1035 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1036 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1037 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1038 | 1038 | </div> |
1039 | 1039 | '; |
1040 | 1040 | |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | |
1073 | 1073 | $this->_set_registration_object(); |
1074 | 1074 | |
1075 | - if ( is_object( $this->_registration )) { |
|
1075 | + if (is_object($this->_registration)) { |
|
1076 | 1076 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1077 | 1077 | $this->_session = $transaction->session_data(); |
1078 | 1078 | |
@@ -1080,10 +1080,10 @@ discard block |
||
1080 | 1080 | |
1081 | 1081 | |
1082 | 1082 | $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
1083 | - $this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' ); |
|
1083 | + $this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso'); |
|
1084 | 1084 | |
1085 | - $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y','g:i:s a') ; |
|
1086 | - $this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
1085 | + $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y', 'g:i:s a'); |
|
1086 | + $this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso'); |
|
1087 | 1087 | |
1088 | 1088 | $this->_template_args['grand_total'] = $transaction->total(); |
1089 | 1089 | |
@@ -1091,19 +1091,19 @@ discard block |
||
1091 | 1091 | // link back to overview |
1092 | 1092 | $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
1093 | 1093 | $this->_template_args['registration'] = $this->_registration; |
1094 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL ); |
|
1095 | - $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) ); |
|
1096 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) ); |
|
1094 | + $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL); |
|
1095 | + $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php')); |
|
1096 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php')); |
|
1097 | 1097 | |
1098 | 1098 | //next and previous links |
1099 | - $next_reg = $this->_registration->next(null, array(), 'REG_ID' ); |
|
1100 | - $this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : ''; |
|
1101 | - $previous_reg = $this->_registration->previous( null, array(), 'REG_ID' ); |
|
1102 | - $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : ''; |
|
1099 | + $next_reg = $this->_registration->next(null, array(), 'REG_ID'); |
|
1100 | + $this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : ''; |
|
1101 | + $previous_reg = $this->_registration->previous(null, array(), 'REG_ID'); |
|
1102 | + $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : ''; |
|
1103 | 1103 | |
1104 | 1104 | // grab header |
1105 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
1106 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1105 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php'; |
|
1106 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1107 | 1107 | |
1108 | 1108 | } else { |
1109 | 1109 | |
@@ -1124,14 +1124,14 @@ discard block |
||
1124 | 1124 | protected function _registration_details_metaboxes() { |
1125 | 1125 | $this->_set_registration_object(); |
1126 | 1126 | $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
1127 | - add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1128 | - add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1129 | - if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) { |
|
1130 | - add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1127 | + add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high'); |
|
1128 | + add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1129 | + if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) { |
|
1130 | + add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1131 | 1131 | } |
1132 | - add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' ); |
|
1133 | - if ( $this->_registration->group_size() > 1 ) { |
|
1134 | - add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1132 | + add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high'); |
|
1133 | + if ($this->_registration->group_size() > 1) { |
|
1134 | + add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1135 | 1135 | } |
1136 | 1136 | } |
1137 | 1137 | |
@@ -1152,23 +1152,23 @@ discard block |
||
1152 | 1152 | |
1153 | 1153 | //let's get an array of all possible buttons that we can just reference |
1154 | 1154 | $status_buttons = $this->_get_reg_status_buttons(); |
1155 | - $template_args[ 'reg_status_value' ] = $this->_registration->pretty_status(); |
|
1156 | - $template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID(); |
|
1155 | + $template_args['reg_status_value'] = $this->_registration->pretty_status(); |
|
1156 | + $template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID(); |
|
1157 | 1157 | $template_args['attendee'] = $this->_registration->attendee(); |
1158 | - $template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php'; |
|
1159 | - if ( $this->_set_registration_object() ) { |
|
1158 | + $template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php'; |
|
1159 | + if ($this->_set_registration_object()) { |
|
1160 | 1160 | $current_status = $this->_registration->status_ID(); |
1161 | - unset( $status_buttons[$current_status] ); |
|
1162 | - if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) { |
|
1163 | - unset( $status_buttons[EEM_Registration::status_id_pending_payment] ); |
|
1161 | + unset($status_buttons[$current_status]); |
|
1162 | + if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) { |
|
1163 | + unset($status_buttons[EEM_Registration::status_id_pending_payment]); |
|
1164 | 1164 | } |
1165 | - $template_args['status_buttons'] = implode( "\n", $status_buttons ); |
|
1165 | + $template_args['status_buttons'] = implode("\n", $status_buttons); |
|
1166 | 1166 | } |
1167 | 1167 | $template_args['form_url'] = REG_ADMIN_URL; |
1168 | 1168 | $template_args['REG_ID'] = $this->_registration->ID(); |
1169 | - $template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE ); |
|
1169 | + $template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE); |
|
1170 | 1170 | |
1171 | - EEH_Template::display_template( $template, $template_args ); |
|
1171 | + EEH_Template::display_template($template, $template_args); |
|
1172 | 1172 | |
1173 | 1173 | } |
1174 | 1174 | |
@@ -1182,11 +1182,11 @@ discard block |
||
1182 | 1182 | private function _get_reg_status_buttons() { |
1183 | 1183 | |
1184 | 1184 | $buttons = array( |
1185 | - EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">', |
|
1186 | - EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">', |
|
1187 | - EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">', |
|
1188 | - EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">', |
|
1189 | - EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">', |
|
1185 | + EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">', |
|
1186 | + EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">', |
|
1187 | + EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">', |
|
1188 | + EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">', |
|
1189 | + EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">', |
|
1190 | 1190 | ); |
1191 | 1191 | return $buttons; |
1192 | 1192 | } |
@@ -1200,13 +1200,13 @@ discard block |
||
1200 | 1200 | * |
1201 | 1201 | * @return array (array with reg_id(s) updated and whether update was successful. |
1202 | 1202 | */ |
1203 | - protected function _set_registration_status_from_request( $status = false, $notify = false ) { |
|
1204 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1203 | + protected function _set_registration_status_from_request($status = false, $notify = false) { |
|
1204 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1205 | 1205 | |
1206 | - $success = $this->_set_registration_status( $REG_ID, $status ); |
|
1206 | + $success = $this->_set_registration_status($REG_ID, $status); |
|
1207 | 1207 | |
1208 | 1208 | //notify? |
1209 | - if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
1209 | + if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
1210 | 1210 | $this->_process_resend_registration(); |
1211 | 1211 | } |
1212 | 1212 | |
@@ -1224,19 +1224,19 @@ discard block |
||
1224 | 1224 | * @param bool $status |
1225 | 1225 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations). |
1226 | 1226 | */ |
1227 | - protected function _set_registration_status( $REG_ID, $status = false ) { |
|
1227 | + protected function _set_registration_status($REG_ID, $status = false) { |
|
1228 | 1228 | $success = true; |
1229 | 1229 | // set default status if none is passed |
1230 | 1230 | $status = $status ? $status : EEM_Registration::status_id_pending_payment; |
1231 | 1231 | |
1232 | 1232 | //typecast and sanitize reg_id |
1233 | - $reg_ids = array_filter( (array) $REG_ID, 'absint' ); |
|
1233 | + $reg_ids = array_filter((array) $REG_ID, 'absint'); |
|
1234 | 1234 | |
1235 | 1235 | //loop through REG_ID's and change status |
1236 | - foreach ( $reg_ids as $r_id ) { |
|
1237 | - $registration = EEM_Registration::instance()->get_one_by_ID( $r_id ); |
|
1238 | - if ( $registration instanceof EE_Registration ) { |
|
1239 | - $registration->set_status( $status ); |
|
1236 | + foreach ($reg_ids as $r_id) { |
|
1237 | + $registration = EEM_Registration::instance()->get_one_by_ID($r_id); |
|
1238 | + if ($registration instanceof EE_Registration) { |
|
1239 | + $registration->set_status($status); |
|
1240 | 1240 | $result = $registration->save(); |
1241 | 1241 | |
1242 | 1242 | //verifying explicit fails because update *may* just return 0 for 0 rows affected |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | $this->_req_data['_REG_ID'] = $reg_ids; |
1249 | 1249 | |
1250 | 1250 | //return $success and processed registrations |
1251 | - return array( 'REG_ID' => $reg_ids, 'success' => $success ); |
|
1251 | + return array('REG_ID' => $reg_ids, 'success' => $success); |
|
1252 | 1252 | } |
1253 | 1253 | |
1254 | 1254 | |
@@ -1260,37 +1260,37 @@ discard block |
||
1260 | 1260 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
1261 | 1261 | * @return void |
1262 | 1262 | */ |
1263 | - protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
|
1263 | + protected function _reg_status_change_return($STS_ID, $notify = false) { |
|
1264 | 1264 | |
1265 | - $result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false ); |
|
1265 | + $result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false); |
|
1266 | 1266 | |
1267 | 1267 | |
1268 | - $success = isset( $result['success'] ) && $result['success']; |
|
1268 | + $success = isset($result['success']) && $result['success']; |
|
1269 | 1269 | |
1270 | 1270 | //setup success message |
1271 | - if ( $success ) { |
|
1272 | - $msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1 ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) : sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ; |
|
1273 | - EE_Error::add_success( $msg ); |
|
1271 | + if ($success) { |
|
1272 | + $msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')); |
|
1273 | + EE_Error::add_success($msg); |
|
1274 | 1274 | } else { |
1275 | - EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ ); |
|
1275 | + EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
1276 | 1276 | } |
1277 | 1277 | |
1278 | - $route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' ); |
|
1278 | + $route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default'); |
|
1279 | 1279 | //unset nonces |
1280 | - foreach ( $this->_req_data as $ref => $value ) { |
|
1281 | - if ( strpos( $ref, 'nonce' ) !== false ) { |
|
1282 | - unset( $this->_req_data[$ref] ); |
|
1280 | + foreach ($this->_req_data as $ref => $value) { |
|
1281 | + if (strpos($ref, 'nonce') !== false) { |
|
1282 | + unset($this->_req_data[$ref]); |
|
1283 | 1283 | continue; |
1284 | 1284 | } |
1285 | 1285 | |
1286 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value ); |
|
1286 | + $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); |
|
1287 | 1287 | $this->_req_data[$ref] = $value; |
1288 | 1288 | } |
1289 | 1289 | |
1290 | 1290 | //merge request vars so that the reloaded list table contains any existing filter query params |
1291 | - $route = array_merge( $this->_req_data, $route ); |
|
1291 | + $route = array_merge($this->_req_data, $route); |
|
1292 | 1292 | |
1293 | - $this->_redirect_after_action( $success, '', '', $route, true ); |
|
1293 | + $this->_redirect_after_action($success, '', '', $route, true); |
|
1294 | 1294 | |
1295 | 1295 | } |
1296 | 1296 | |
@@ -1303,29 +1303,29 @@ discard block |
||
1303 | 1303 | protected function _change_reg_status() { |
1304 | 1304 | $this->_req_data['return'] = 'view_registration'; |
1305 | 1305 | //set notify based on whether the send notifications toggle is set or not |
1306 | - $notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] ); |
|
1307 | - $this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : ''; |
|
1306 | + $notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']); |
|
1307 | + $this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : ''; |
|
1308 | 1308 | |
1309 | - switch ( $this->_req_data['_reg_status_id'] ) { |
|
1310 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) : |
|
1311 | - $this->approve_registration( $notify ); |
|
1309 | + switch ($this->_req_data['_reg_status_id']) { |
|
1310 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') : |
|
1311 | + $this->approve_registration($notify); |
|
1312 | 1312 | break; |
1313 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) : |
|
1314 | - $this->pending_registration( $notify ); |
|
1313 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') : |
|
1314 | + $this->pending_registration($notify); |
|
1315 | 1315 | break; |
1316 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) : |
|
1317 | - $this->not_approve_registration( $notify ); |
|
1316 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') : |
|
1317 | + $this->not_approve_registration($notify); |
|
1318 | 1318 | break; |
1319 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) : |
|
1320 | - $this->decline_registration( $notify ); |
|
1319 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') : |
|
1320 | + $this->decline_registration($notify); |
|
1321 | 1321 | break; |
1322 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) : |
|
1323 | - $this->cancel_registration( $notify ); |
|
1322 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') : |
|
1323 | + $this->cancel_registration($notify); |
|
1324 | 1324 | break; |
1325 | 1325 | default : |
1326 | 1326 | $result['success'] = false; |
1327 | - unset( $this->_req_data['return'] ); |
|
1328 | - $this->_reg_status_change_return( '', false ); |
|
1327 | + unset($this->_req_data['return']); |
|
1328 | + $this->_reg_status_change_return('', false); |
|
1329 | 1329 | break; |
1330 | 1330 | } |
1331 | 1331 | } |
@@ -1338,8 +1338,8 @@ discard block |
||
1338 | 1338 | * @param bool $notify whether or not to notify the registrant about their approval. |
1339 | 1339 | * @return void |
1340 | 1340 | */ |
1341 | - protected function approve_registration( $notify = false ) { |
|
1342 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
|
1341 | + protected function approve_registration($notify = false) { |
|
1342 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify); |
|
1343 | 1343 | } |
1344 | 1344 | |
1345 | 1345 | |
@@ -1351,8 +1351,8 @@ discard block |
||
1351 | 1351 | * @param bool $notify whether or not to notify the registrant about their approval. |
1352 | 1352 | * @return void |
1353 | 1353 | */ |
1354 | - protected function decline_registration( $notify = false ) { |
|
1355 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
|
1354 | + protected function decline_registration($notify = false) { |
|
1355 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify); |
|
1356 | 1356 | } |
1357 | 1357 | |
1358 | 1358 | |
@@ -1364,8 +1364,8 @@ discard block |
||
1364 | 1364 | * @param bool $notify whether or not to notify the registrant about their approval. |
1365 | 1365 | * @return void |
1366 | 1366 | */ |
1367 | - protected function cancel_registration( $notify = false ) { |
|
1368 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
|
1367 | + protected function cancel_registration($notify = false) { |
|
1368 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify); |
|
1369 | 1369 | } |
1370 | 1370 | |
1371 | 1371 | |
@@ -1378,8 +1378,8 @@ discard block |
||
1378 | 1378 | * @param bool $notify whether or not to notify the registrant about their approval. |
1379 | 1379 | * @return void |
1380 | 1380 | */ |
1381 | - protected function not_approve_registration( $notify = false ) { |
|
1382 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
|
1381 | + protected function not_approve_registration($notify = false) { |
|
1382 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify); |
|
1383 | 1383 | } |
1384 | 1384 | |
1385 | 1385 | |
@@ -1390,8 +1390,8 @@ discard block |
||
1390 | 1390 | * @param bool $notify whether or not to notify the registrant about their approval. |
1391 | 1391 | * @return void |
1392 | 1392 | */ |
1393 | - protected function pending_registration( $notify = false ) { |
|
1394 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
|
1393 | + protected function pending_registration($notify = false) { |
|
1394 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify); |
|
1395 | 1395 | } |
1396 | 1396 | |
1397 | 1397 | |
@@ -1405,75 +1405,75 @@ discard block |
||
1405 | 1405 | public function _reg_details_meta_box() { |
1406 | 1406 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1407 | 1407 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
1408 | - EE_Registry::instance()->load_Helper( 'Line_Item' ); |
|
1408 | + EE_Registry::instance()->load_Helper('Line_Item'); |
|
1409 | 1409 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1410 | 1410 | $this->_session = $transaction->session_data(); |
1411 | 1411 | |
1412 | 1412 | $filters = new EE_Line_Item_Filter_Collection(); |
1413 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) ); |
|
1414 | - $filters->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
1415 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() ); |
|
1413 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
1414 | + $filters->add(new EE_Non_Zero_Line_Item_Filter()); |
|
1415 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); |
|
1416 | 1416 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
1417 | 1417 | |
1418 | 1418 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1419 | - $line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' ); |
|
1420 | - $this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) ); |
|
1419 | + $line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); |
|
1420 | + $this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); |
|
1421 | 1421 | |
1422 | 1422 | |
1423 | 1423 | $attendee = $this->_registration->attendee(); |
1424 | 1424 | |
1425 | 1425 | |
1426 | - $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart' ) : ''; |
|
1427 | - $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : ''; |
|
1426 | + $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : ''; |
|
1427 | + $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : ''; |
|
1428 | 1428 | |
1429 | 1429 | |
1430 | 1430 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
1431 | - $payment = $transaction->get_first_related( 'Payment' ); |
|
1431 | + $payment = $transaction->get_first_related('Payment'); |
|
1432 | 1432 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; |
1433 | - $payment_method = $payment->get_first_related( 'Payment_Method' ); |
|
1433 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
1434 | 1434 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; |
1435 | - $reg_status_class = 'status-' . $this->_registration->status_ID(); |
|
1435 | + $reg_status_class = 'status-'.$this->_registration->status_ID(); |
|
1436 | 1436 | $reg_details = array( |
1437 | 1437 | 'payment_method' => $payment_method->name(), |
1438 | 1438 | 'response_msg' => $payment->gateway_response(), |
1439 | - 'registration_id' => $this->_registration->get( 'REG_code' ), |
|
1439 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
1440 | 1440 | 'registration_session' => $this->_registration->session_ID(), |
1441 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '', |
|
1442 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '', |
|
1441 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', |
|
1442 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '', |
|
1443 | 1443 | ); |
1444 | 1444 | |
1445 | 1445 | |
1446 | - if ( isset( $reg_details['registration_id'] )) { |
|
1446 | + if (isset($reg_details['registration_id'])) { |
|
1447 | 1447 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
1448 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' ); |
|
1448 | + $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); |
|
1449 | 1449 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
1450 | 1450 | } |
1451 | 1451 | |
1452 | - if ( isset( $reg_details['payment_method'] ) ) { |
|
1452 | + if (isset($reg_details['payment_method'])) { |
|
1453 | 1453 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
1454 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' ); |
|
1454 | + $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); |
|
1455 | 1455 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
1456 | 1456 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
1457 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' ); |
|
1457 | + $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); |
|
1458 | 1458 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
1459 | 1459 | } |
1460 | 1460 | |
1461 | 1461 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
1462 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
1462 | + $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
1463 | 1463 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
1464 | 1464 | |
1465 | 1465 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
1466 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' ); |
|
1466 | + $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); |
|
1467 | 1467 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
1468 | 1468 | |
1469 | 1469 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
1470 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
1470 | + $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
1471 | 1471 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
1472 | 1472 | |
1473 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL ); |
|
1473 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL); |
|
1474 | 1474 | |
1475 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1476 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1475 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1476 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1477 | 1477 | |
1478 | 1478 | } |
1479 | 1479 | |
@@ -1489,23 +1489,23 @@ discard block |
||
1489 | 1489 | */ |
1490 | 1490 | public function _reg_questions_meta_box() { |
1491 | 1491 | |
1492 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 ); |
|
1493 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $this, 'form_after_question_group' ), 10, 1 ); |
|
1494 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'form_form_field_label_wrap' ), 10, 1 ); |
|
1495 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'form_form_field_input__wrap' ), 10, 1 ); |
|
1492 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($this, 'form_before_question_group'), 10, 1); |
|
1493 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($this, 'form_after_question_group'), 10, 1); |
|
1494 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'form_form_field_label_wrap'), 10, 1); |
|
1495 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'form_form_field_input__wrap'), 10, 1); |
|
1496 | 1496 | |
1497 | - $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $this->_registration, $this->_registration->get('EVT_ID') ); |
|
1497 | + $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($this->_registration, $this->_registration->get('EVT_ID')); |
|
1498 | 1498 | |
1499 | 1499 | //EEH_Debug_Tools::printr( $question_groups, '$question_groups <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1500 | 1500 | |
1501 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
1502 | - $this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html( $question_groups ); |
|
1501 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
1502 | + $this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html($question_groups); |
|
1503 | 1503 | |
1504 | 1504 | $this->_template_args['reg_questions_form_action'] = 'update_attendee_registration_form'; |
1505 | 1505 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1506 | 1506 | |
1507 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1508 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1507 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1508 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1509 | 1509 | |
1510 | 1510 | } |
1511 | 1511 | |
@@ -1520,7 +1520,7 @@ discard block |
||
1520 | 1520 | * @param string $output |
1521 | 1521 | * @return string |
1522 | 1522 | */ |
1523 | - public function form_before_question_group( $output ) { |
|
1523 | + public function form_before_question_group($output) { |
|
1524 | 1524 | return ' |
1525 | 1525 | <table class="form-table ee-width-100"> |
1526 | 1526 | <tbody> |
@@ -1537,13 +1537,13 @@ discard block |
||
1537 | 1537 | * @param string $output |
1538 | 1538 | * @return string |
1539 | 1539 | */ |
1540 | - public function form_after_question_group( $output ) { |
|
1540 | + public function form_after_question_group($output) { |
|
1541 | 1541 | return ' |
1542 | 1542 | <tr class="hide-if-no-js"> |
1543 | 1543 | <th> </th> |
1544 | 1544 | <td class="reg-admin-edit-attendee-question-td"> |
1545 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '"> |
|
1546 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span> |
|
1545 | + <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> |
|
1546 | + <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> |
|
1547 | 1547 | <div class="dashicons dashicons-edit"></div> |
1548 | 1548 | </a> |
1549 | 1549 | </td> |
@@ -1563,11 +1563,11 @@ discard block |
||
1563 | 1563 | * @param string $label |
1564 | 1564 | * @return string |
1565 | 1565 | */ |
1566 | - public function form_form_field_label_wrap( $label ) { |
|
1566 | + public function form_form_field_label_wrap($label) { |
|
1567 | 1567 | return ' |
1568 | 1568 | <tr> |
1569 | 1569 | <th> |
1570 | - ' . $label . ' |
|
1570 | + ' . $label.' |
|
1571 | 1571 | </th>'; |
1572 | 1572 | } |
1573 | 1573 | |
@@ -1581,10 +1581,10 @@ discard block |
||
1581 | 1581 | * @param string $label |
1582 | 1582 | * @return string |
1583 | 1583 | */ |
1584 | - public function form_form_field_input__wrap( $input ) { |
|
1584 | + public function form_form_field_input__wrap($input) { |
|
1585 | 1585 | return ' |
1586 | 1586 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
1587 | - ' . $input . ' |
|
1587 | + ' . $input.' |
|
1588 | 1588 | </td> |
1589 | 1589 | </tr>'; |
1590 | 1590 | } |
@@ -1598,13 +1598,13 @@ discard block |
||
1598 | 1598 | * @return void |
1599 | 1599 | */ |
1600 | 1600 | protected function _update_attendee_registration_form() { |
1601 | - $qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE; |
|
1602 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
1603 | - $qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns ); |
|
1604 | - $success = $this->_save_attendee_registration_form( $REG_ID, $qstns ); |
|
1601 | + $qstns = isset($this->_req_data['qstn']) ? $this->_req_data['qstn'] : FALSE; |
|
1602 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
1603 | + $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns); |
|
1604 | + $success = $this->_save_attendee_registration_form($REG_ID, $qstns); |
|
1605 | 1605 | $what = __('Registration Form', 'event_espresso'); |
1606 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
1607 | - $this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
1606 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
1607 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
1608 | 1608 | |
1609 | 1609 | } |
1610 | 1610 | |
@@ -1617,26 +1617,26 @@ discard block |
||
1617 | 1617 | * @param bool $qstns |
1618 | 1618 | * @return bool |
1619 | 1619 | */ |
1620 | - private function _save_attendee_registration_form( $REG_ID = FALSE, $qstns = FALSE ) { |
|
1620 | + private function _save_attendee_registration_form($REG_ID = FALSE, $qstns = FALSE) { |
|
1621 | 1621 | |
1622 | - if ( ! $REG_ID || ! $qstns ) { |
|
1623 | - EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1622 | + if ( ! $REG_ID || ! $qstns) { |
|
1623 | + EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1624 | 1624 | } |
1625 | 1625 | $success = TRUE; |
1626 | 1626 | |
1627 | 1627 | // allow others to get in on this awesome fun :D |
1628 | - do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns ); |
|
1628 | + do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns); |
|
1629 | 1629 | // loop thru questions... FINALLY!!! |
1630 | 1630 | |
1631 | - foreach ( $qstns as $QST_ID => $qstn ) { |
|
1631 | + foreach ($qstns as $QST_ID => $qstn) { |
|
1632 | 1632 | //if $qstn isn't an array then it doesn't already have an answer, so let's create the answer |
1633 | - if ( !is_array($qstn) ) { |
|
1634 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
1633 | + if ( ! is_array($qstn)) { |
|
1634 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
1635 | 1635 | continue; |
1636 | 1636 | } |
1637 | 1637 | |
1638 | 1638 | |
1639 | - foreach ( $qstn as $ANS_ID => $ANS_value ) { |
|
1639 | + foreach ($qstn as $ANS_ID => $ANS_value) { |
|
1640 | 1640 | //get answer |
1641 | 1641 | $query_params = array( |
1642 | 1642 | 0 => array( |
@@ -1647,8 +1647,8 @@ discard block |
||
1647 | 1647 | ); |
1648 | 1648 | $answer = EEM_Answer::instance()->get_one($query_params); |
1649 | 1649 | //this MAY be an array but NOT have an answer because its multi select. If so then we need to create the answer |
1650 | - if ( ! $answer instanceof EE_Answer ) { |
|
1651 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
1650 | + if ( ! $answer instanceof EE_Answer) { |
|
1651 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
1652 | 1652 | continue 2; |
1653 | 1653 | } |
1654 | 1654 | |
@@ -1662,7 +1662,7 @@ discard block |
||
1662 | 1662 | |
1663 | 1663 | |
1664 | 1664 | //TODO: try changing this to use the model directly... not indirectly through creating a default object... |
1665 | - private function _save_new_answer( $REG_ID, $QST_ID, $ans ) { |
|
1665 | + private function _save_new_answer($REG_ID, $QST_ID, $ans) { |
|
1666 | 1666 | $set_values = array( |
1667 | 1667 | 'QST_ID' => $QST_ID, |
1668 | 1668 | 'REG_ID' => $REG_ID, |
@@ -1689,30 +1689,30 @@ discard block |
||
1689 | 1689 | $registrations = $REG->get_all(array( |
1690 | 1690 | array( |
1691 | 1691 | 'TXN_ID'=>$this->_registration->transaction_ID(), |
1692 | - 'REG_ID'=>array('!=',$this->_registration->ID()) |
|
1692 | + 'REG_ID'=>array('!=', $this->_registration->ID()) |
|
1693 | 1693 | ), |
1694 | 1694 | 'force_join'=>array('Attendee'))); |
1695 | 1695 | |
1696 | 1696 | $this->_template_args['attendees'] = array(); |
1697 | 1697 | $this->_template_args['attendee_notice'] = ''; |
1698 | 1698 | EE_Registry::instance()->load_helper('Array'); |
1699 | - if ( empty( $registrations) || ( is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations) ) ) { |
|
1700 | - EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1699 | + if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { |
|
1700 | + EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1701 | 1701 | $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
1702 | 1702 | } else { |
1703 | 1703 | |
1704 | 1704 | $att_nmbr = 1; |
1705 | - foreach ( $registrations as $registration ) { |
|
1705 | + foreach ($registrations as $registration) { |
|
1706 | 1706 | /* @var $registration EE_Registration */ |
1707 | 1707 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object(); |
1708 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1709 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1710 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1711 | - $this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1708 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1709 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1710 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1711 | + $this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1712 | 1712 | |
1713 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() ); |
|
1713 | + $this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); |
|
1714 | 1714 | |
1715 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1715 | + $this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1716 | 1716 | |
1717 | 1717 | $att_nmbr++; |
1718 | 1718 | } |
@@ -1724,8 +1724,8 @@ discard block |
||
1724 | 1724 | |
1725 | 1725 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL ); |
1726 | 1726 | } |
1727 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1728 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1727 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1728 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1729 | 1729 | |
1730 | 1730 | } |
1731 | 1731 | |
@@ -1746,11 +1746,11 @@ discard block |
||
1746 | 1746 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object(); |
1747 | 1747 | |
1748 | 1748 | //now let's determine if this is not the primary registration. If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show cereate button or not) |
1749 | - if ( ! $this->_registration->is_primary_registrant() ) { |
|
1749 | + if ( ! $this->_registration->is_primary_registrant()) { |
|
1750 | 1750 | $primary_registration = $this->_registration->get_primary_registration(); |
1751 | 1751 | $primary_attendee = $primary_registration->attendee(); |
1752 | 1752 | |
1753 | - if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { |
|
1753 | + if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
1754 | 1754 | //in here? This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg. |
1755 | 1755 | $primary_registration = NULL; |
1756 | 1756 | } |
@@ -1759,28 +1759,28 @@ discard block |
||
1759 | 1759 | } |
1760 | 1760 | |
1761 | 1761 | $this->_template_args['ATT_ID'] = $attendee->ID(); |
1762 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname; |
|
1763 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname; |
|
1764 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email; |
|
1762 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname; |
|
1763 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname; |
|
1764 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email; |
|
1765 | 1765 | $this->_template_args['phone'] = $attendee->phone(); |
1766 | 1766 | |
1767 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1768 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee ); |
|
1767 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1768 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
1769 | 1769 | |
1770 | 1770 | |
1771 | 1771 | //edit link |
1772 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1773 | - $this->_template_args['att_edit_label'] = __('View/Edit Contact' ); |
|
1772 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1773 | + $this->_template_args['att_edit_label'] = __('View/Edit Contact'); |
|
1774 | 1774 | |
1775 | 1775 | //create link |
1776 | - $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): ''; |
|
1776 | + $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : ''; |
|
1777 | 1777 | $this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); |
1778 | 1778 | |
1779 | 1779 | $this->_template_args['att_check'] = $att_check; |
1780 | 1780 | |
1781 | 1781 | |
1782 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1783 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1782 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1783 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1784 | 1784 | } |
1785 | 1785 | |
1786 | 1786 | |
@@ -1793,7 +1793,7 @@ discard block |
||
1793 | 1793 | * @access protected |
1794 | 1794 | * @return void |
1795 | 1795 | */ |
1796 | - protected function _trash_or_restore_registrations( $trash = TRUE ) { |
|
1796 | + protected function _trash_or_restore_registrations($trash = TRUE) { |
|
1797 | 1797 | $REGM = EEM_Registration::instance(); |
1798 | 1798 | |
1799 | 1799 | $success = 1; |
@@ -1803,26 +1803,26 @@ discard block |
||
1803 | 1803 | $dtts = array(); |
1804 | 1804 | |
1805 | 1805 | //if empty _REG_ID then get out because there's nothing to do |
1806 | - if ( empty( $this->_req_data['_REG_ID'] ) ) { |
|
1806 | + if (empty($this->_req_data['_REG_ID'])) { |
|
1807 | 1807 | $msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso'); |
1808 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ ); |
|
1809 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE ); |
|
1808 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__); |
|
1809 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
1810 | 1810 | } |
1811 | 1811 | |
1812 | 1812 | //Checkboxes |
1813 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1813 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1814 | 1814 | // if array has more than one element than success message should be plural |
1815 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1815 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1816 | 1816 | // cycle thru checkboxes |
1817 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1817 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1818 | 1818 | |
1819 | 1819 | $REG = $REGM->get_one_by_ID($REG_ID); |
1820 | 1820 | $payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); |
1821 | - if ( $payment_count > 0 ) { |
|
1822 | - $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ); |
|
1821 | + if ($payment_count > 0) { |
|
1822 | + $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso'); |
|
1823 | 1823 | $error = 1; |
1824 | 1824 | $success = 0; |
1825 | - EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1825 | + EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__); |
|
1826 | 1826 | continue; //can't trash this registration because it has payments. |
1827 | 1827 | } |
1828 | 1828 | $ticket = $REG->get_first_related('Ticket'); |
@@ -1831,7 +1831,7 @@ discard block |
||
1831 | 1831 | $dtts = array_merge($dtts, $dtt); |
1832 | 1832 | |
1833 | 1833 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1834 | - if ( !$updated ) { |
|
1834 | + if ( ! $updated) { |
|
1835 | 1835 | $success = 0; |
1836 | 1836 | } else { |
1837 | 1837 | $success = 2; |
@@ -1846,7 +1846,7 @@ discard block |
||
1846 | 1846 | $tickets[$ticket->ID()] = $ticket; |
1847 | 1847 | $dtts = $ticket->get_many_related('Datetime'); |
1848 | 1848 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1849 | - if ( ! $updated ) { |
|
1849 | + if ( ! $updated) { |
|
1850 | 1850 | $success = 0; |
1851 | 1851 | } |
1852 | 1852 | |
@@ -1856,10 +1856,10 @@ discard block |
||
1856 | 1856 | EEM_Ticket::instance()->update_tickets_sold($tickets); |
1857 | 1857 | EEM_Datetime::instance()->update_sold($dtts); |
1858 | 1858 | |
1859 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1860 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
1859 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1860 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
1861 | 1861 | $overwrite_msgs = $error ? TRUE : FALSE; |
1862 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs ); |
|
1862 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); |
|
1863 | 1863 | } |
1864 | 1864 | |
1865 | 1865 | |
@@ -1883,16 +1883,16 @@ discard block |
||
1883 | 1883 | $success = 1; |
1884 | 1884 | |
1885 | 1885 | //Checkboxes |
1886 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1886 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1887 | 1887 | // if array has more than one element than success message should be plural |
1888 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1888 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1889 | 1889 | // cycle thru checkboxes |
1890 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1890 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1891 | 1891 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1892 | - if ( ! $REG instanceof EE_Registration ) |
|
1892 | + if ( ! $REG instanceof EE_Registration) |
|
1893 | 1893 | continue; |
1894 | 1894 | $deleted = $this->_delete_registration($REG); |
1895 | - if ( !$deleted ) { |
|
1895 | + if ( ! $deleted) { |
|
1896 | 1896 | $success = 0; |
1897 | 1897 | } |
1898 | 1898 | } |
@@ -1902,15 +1902,15 @@ discard block |
||
1902 | 1902 | $REG_ID = $this->_req_data['_REG_ID']; |
1903 | 1903 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1904 | 1904 | $deleted = $this->_delete_registration($REG); |
1905 | - if ( ! $deleted ) { |
|
1905 | + if ( ! $deleted) { |
|
1906 | 1906 | $success = 0; |
1907 | 1907 | } |
1908 | 1908 | |
1909 | 1909 | } |
1910 | 1910 | |
1911 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1912 | - $action_desc = __( 'permanently deleted.', 'event_espresso' ); |
|
1913 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE ); |
|
1911 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1912 | + $action_desc = __('permanently deleted.', 'event_espresso'); |
|
1913 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); |
|
1914 | 1914 | } |
1915 | 1915 | |
1916 | 1916 | |
@@ -1922,31 +1922,31 @@ discard block |
||
1922 | 1922 | * @param EE_Registration $REG registration to be deleted permenantly |
1923 | 1923 | * @return boolean true = successful deletion, false = fail. |
1924 | 1924 | */ |
1925 | - protected function _delete_registration( EE_Registration $REG ) { |
|
1925 | + protected function _delete_registration(EE_Registration $REG) { |
|
1926 | 1926 | //first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed. |
1927 | 1927 | $TXN = $REG->get_first_related('Transaction'); |
1928 | 1928 | $REGS = $TXN->get_many_related('Registration'); |
1929 | 1929 | |
1930 | 1930 | $all_trashed = TRUE; |
1931 | - foreach ( $REGS as $registration ) { |
|
1932 | - if ( ! $registration->get('REG_deleted') ) |
|
1931 | + foreach ($REGS as $registration) { |
|
1932 | + if ( ! $registration->get('REG_deleted')) |
|
1933 | 1933 | $all_trashed = FALSE; |
1934 | 1934 | } |
1935 | 1935 | |
1936 | - if ( ! $all_trashed ) { |
|
1937 | - EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1936 | + if ( ! $all_trashed) { |
|
1937 | + EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1938 | 1938 | return false; |
1939 | 1939 | } |
1940 | 1940 | |
1941 | 1941 | //k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one). |
1942 | - foreach ( $REGS as $registration ) { |
|
1942 | + foreach ($REGS as $registration) { |
|
1943 | 1943 | |
1944 | 1944 | //delete related answers |
1945 | 1945 | $registration->delete_related_permanently('Answer'); |
1946 | 1946 | |
1947 | 1947 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
1948 | 1948 | $attendee = $registration->get_first_related('Attendee'); |
1949 | - if ( $attendee instanceof EE_Attendee ) { |
|
1949 | + if ($attendee instanceof EE_Attendee) { |
|
1950 | 1950 | $registration->_remove_relation_to($attendee, 'Attendee'); |
1951 | 1951 | } |
1952 | 1952 | |
@@ -1956,7 +1956,7 @@ discard block |
||
1956 | 1956 | //now delete permanently the checkins related to this registration. |
1957 | 1957 | $registration->delete_related_permanently('Checkin'); |
1958 | 1958 | |
1959 | - if ( $registration->ID() === $REG->ID() ) |
|
1959 | + if ($registration->ID() === $REG->ID()) |
|
1960 | 1960 | continue; //we don't want to delete permanently the existing registration just yet. |
1961 | 1961 | |
1962 | 1962 | //remove relation to transaction for these registrations if NOT the existing registrations |
@@ -1989,34 +1989,34 @@ discard block |
||
1989 | 1989 | * @return void |
1990 | 1990 | */ |
1991 | 1991 | public function new_registration() { |
1992 | - if ( ! $this->_set_reg_event() ) { |
|
1993 | - throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); |
|
1992 | + if ( ! $this->_set_reg_event()) { |
|
1993 | + throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); |
|
1994 | 1994 | } |
1995 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
1995 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
1996 | 1996 | |
1997 | 1997 | // gotta start with a clean slate if we're not coming here via ajax |
1998 | - if ( ! defined('DOING_AJAX' ) && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ))) { |
|
1999 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
1998 | + if ( ! defined('DOING_AJAX') && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))) { |
|
1999 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2000 | 2000 | } |
2001 | 2001 | |
2002 | - $this->_template_args['event_name'] = '' ; |
|
2002 | + $this->_template_args['event_name'] = ''; |
|
2003 | 2003 | // event name |
2004 | - if ( $this->_reg_event ) { |
|
2004 | + if ($this->_reg_event) { |
|
2005 | 2005 | $this->_template_args['event_name'] = $this->_reg_event->name(); |
2006 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL ); |
|
2007 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
2008 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
2006 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); |
|
2007 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
2008 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
2009 | 2009 | } |
2010 | 2010 | |
2011 | 2011 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
2012 | 2012 | |
2013 | - if ( defined('DOING_AJAX' ) ) |
|
2013 | + if (defined('DOING_AJAX')) |
|
2014 | 2014 | $this->_return_json(); |
2015 | 2015 | |
2016 | 2016 | |
2017 | 2017 | // grab header |
2018 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
2019 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2018 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php'; |
|
2019 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2020 | 2020 | |
2021 | 2021 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
2022 | 2022 | // the details template wrapper |
@@ -2034,7 +2034,7 @@ discard block |
||
2034 | 2034 | */ |
2035 | 2035 | protected function _get_registration_step_content() { |
2036 | 2036 | |
2037 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php'; |
|
2037 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php'; |
|
2038 | 2038 | $template_args = array( |
2039 | 2039 | 'title' => '', |
2040 | 2040 | 'content' => '', |
@@ -2055,11 +2055,11 @@ discard block |
||
2055 | 2055 | |
2056 | 2056 | //if the cart is empty then we know we're at step one so we'll display ticket selector |
2057 | 2057 | $cart = EE_Registry::instance()->SSN->get_session_data('cart'); |
2058 | - $step = empty( $cart ) ? 'ticket' : 'questions'; |
|
2059 | - switch ( $step ) { |
|
2058 | + $step = empty($cart) ? 'ticket' : 'questions'; |
|
2059 | + switch ($step) { |
|
2060 | 2060 | case 'ticket' : |
2061 | 2061 | $template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); |
2062 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event ); |
|
2062 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
2063 | 2063 | $template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); |
2064 | 2064 | $template_args['show_notification_toggle'] = FALSE; |
2065 | 2065 | break; |
@@ -2072,9 +2072,9 @@ discard block |
||
2072 | 2072 | break; |
2073 | 2073 | } |
2074 | 2074 | |
2075 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route. |
|
2075 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. |
|
2076 | 2076 | |
2077 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
2077 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
2078 | 2078 | } |
2079 | 2079 | |
2080 | 2080 | |
@@ -2088,11 +2088,11 @@ discard block |
||
2088 | 2088 | * @return boolean |
2089 | 2089 | */ |
2090 | 2090 | private function _set_reg_event() { |
2091 | - if ( is_object( $this->_reg_event )) { |
|
2091 | + if (is_object($this->_reg_event)) { |
|
2092 | 2092 | return TRUE; |
2093 | 2093 | } |
2094 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
2095 | - if ( ! $EVT_ID ) { |
|
2094 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
2095 | + if ( ! $EVT_ID) { |
|
2096 | 2096 | return FALSE; |
2097 | 2097 | } |
2098 | 2098 | |
@@ -2113,62 +2113,62 @@ discard block |
||
2113 | 2113 | public function process_reg_step() { |
2114 | 2114 | |
2115 | 2115 | $this->_set_reg_event(); |
2116 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2116 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2117 | 2117 | |
2118 | 2118 | //what step are we on? |
2119 | - $cart = EE_Registry::instance()->SSN->get_session_data( 'cart' ); |
|
2120 | - $step = empty( $cart ) ? 'ticket' : 'questions'; |
|
2119 | + $cart = EE_Registry::instance()->SSN->get_session_data('cart'); |
|
2120 | + $step = empty($cart) ? 'ticket' : 'questions'; |
|
2121 | 2121 | |
2122 | 2122 | //if doing ajax then we need to verify the nonce |
2123 | - if ( 'DOING_AJAX' ) { |
|
2124 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : ''; |
|
2125 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
2123 | + if ('DOING_AJAX') { |
|
2124 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
2125 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
2126 | 2126 | } |
2127 | 2127 | |
2128 | - switch ( $step ) { |
|
2128 | + switch ($step) { |
|
2129 | 2129 | case 'ticket' : |
2130 | 2130 | //process ticket selection |
2131 | 2131 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
2132 | - if ( $success ) { |
|
2133 | - EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2132 | + if ($success) { |
|
2133 | + EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2134 | 2134 | } else { |
2135 | 2135 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE; |
2136 | 2136 | } |
2137 | - if ( defined('DOING_AJAX') ) { |
|
2137 | + if (defined('DOING_AJAX')) { |
|
2138 | 2138 | $this->new_registration(); //display next step |
2139 | 2139 | } else { |
2140 | 2140 | $query_args['action'] = 'new_registration'; |
2141 | 2141 | $query_args['processing_registration'] = true; |
2142 | 2142 | $query_args['event_id'] = $this->_reg_event->ID(); |
2143 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2143 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2144 | 2144 | } |
2145 | 2145 | break; |
2146 | 2146 | case 'questions' : |
2147 | - if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
2148 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
2147 | + if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) { |
|
2148 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
2149 | 2149 | } |
2150 | 2150 | //process registration |
2151 | 2151 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
2152 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
2152 | + if ( ! $transaction instanceof EE_Transaction) { |
|
2153 | 2153 | $query_args = array( |
2154 | 2154 | 'action' => 'new_registration', |
2155 | 2155 | 'processing_registration' => true, |
2156 | 2156 | 'event_id' => $this->_reg_event->ID() |
2157 | 2157 | ); |
2158 | 2158 | |
2159 | - if ( defined('DOING_AJAX' )) { |
|
2159 | + if (defined('DOING_AJAX')) { |
|
2160 | 2160 | //display registration form again because there are errors (maybe validation?) |
2161 | 2161 | $this->new_registration(); |
2162 | 2162 | return; |
2163 | 2163 | } else { |
2164 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2164 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2165 | 2165 | return; |
2166 | 2166 | } |
2167 | 2167 | } |
2168 | 2168 | /** @type EE_Transaction_Payments $transaction_payments */ |
2169 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
2169 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
2170 | 2170 | // maybe update status, and make sure to save transaction if not done already |
2171 | - if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { |
|
2171 | + if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { |
|
2172 | 2172 | $transaction->save(); |
2173 | 2173 | } |
2174 | 2174 | $query_args = array( |
@@ -2176,8 +2176,8 @@ discard block |
||
2176 | 2176 | 'TXN_ID' => $transaction->ID(), |
2177 | 2177 | 'page' => 'espresso_transactions' |
2178 | 2178 | ); |
2179 | - EE_Error::add_success( __('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso') ); |
|
2180 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2179 | + EE_Error::add_success(__('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso')); |
|
2180 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2181 | 2181 | break; |
2182 | 2182 | } |
2183 | 2183 | |
@@ -2197,7 +2197,7 @@ discard block |
||
2197 | 2197 | * @return void |
2198 | 2198 | */ |
2199 | 2199 | protected function _attendee_contact_list_table() { |
2200 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2200 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2201 | 2201 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
2202 | 2202 | $this->display_admin_list_table_page_with_no_sidebar(); |
2203 | 2203 | } |
@@ -2212,10 +2212,10 @@ discard block |
||
2212 | 2212 | * @access public |
2213 | 2213 | * @return array |
2214 | 2214 | */ |
2215 | - public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
|
2215 | + public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { |
|
2216 | 2216 | |
2217 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2218 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' ); |
|
2217 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2218 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php'); |
|
2219 | 2219 | $ATT_MDL = EEM_Attendee::instance(); |
2220 | 2220 | |
2221 | 2221 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
@@ -2243,47 +2243,47 @@ discard block |
||
2243 | 2243 | $orderby = 'ATT_lname'; |
2244 | 2244 | } |
2245 | 2245 | |
2246 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
2246 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
2247 | 2247 | |
2248 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
2249 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
2250 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
2248 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
2249 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
2250 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
2251 | 2251 | |
2252 | 2252 | $_where = array(); |
2253 | 2253 | |
2254 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2255 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2254 | + if (isset($this->_req_data['s'])) { |
|
2255 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2256 | 2256 | $_where['OR'] = array( |
2257 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr), |
|
2258 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
2259 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
2260 | - 'ATT_fname' => array( 'LIKE', $sstr ), |
|
2261 | - 'ATT_lname' => array( 'LIKE', $sstr ), |
|
2262 | - 'ATT_short_bio' => array( 'LIKE', $sstr ), |
|
2263 | - 'ATT_email' => array('LIKE', $sstr ), |
|
2264 | - 'ATT_address' => array( 'LIKE', $sstr ), |
|
2265 | - 'ATT_address2' => array( 'LIKE', $sstr ), |
|
2266 | - 'ATT_city' => array( 'LIKE', $sstr ), |
|
2267 | - 'Country.CNT_name' => array( 'LIKE', $sstr ), |
|
2268 | - 'State.STA_name' => array('LIKE', $sstr ), |
|
2269 | - 'ATT_phone' => array( 'LIKE', $sstr ), |
|
2270 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ), |
|
2271 | - 'Registration.REG_code' => array( 'LIKE', $sstr ), |
|
2272 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ), |
|
2273 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr ) |
|
2257 | + 'Registration.Event.EVT_name' => array('LIKE', $sstr), |
|
2258 | + 'Registration.Event.EVT_desc' => array('LIKE', $sstr), |
|
2259 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), |
|
2260 | + 'ATT_fname' => array('LIKE', $sstr), |
|
2261 | + 'ATT_lname' => array('LIKE', $sstr), |
|
2262 | + 'ATT_short_bio' => array('LIKE', $sstr), |
|
2263 | + 'ATT_email' => array('LIKE', $sstr), |
|
2264 | + 'ATT_address' => array('LIKE', $sstr), |
|
2265 | + 'ATT_address2' => array('LIKE', $sstr), |
|
2266 | + 'ATT_city' => array('LIKE', $sstr), |
|
2267 | + 'Country.CNT_name' => array('LIKE', $sstr), |
|
2268 | + 'State.STA_name' => array('LIKE', $sstr), |
|
2269 | + 'ATT_phone' => array('LIKE', $sstr), |
|
2270 | + 'Registration.REG_final_price' => array('LIKE', $sstr), |
|
2271 | + 'Registration.REG_code' => array('LIKE', $sstr), |
|
2272 | + 'Registration.REG_count' => array('LIKE', $sstr), |
|
2273 | + 'Registration.REG_group_size' => array('LIKE', $sstr) |
|
2274 | 2274 | ); |
2275 | 2275 | } |
2276 | 2276 | |
2277 | 2277 | |
2278 | - $offset = ($current_page-1)*$per_page; |
|
2279 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
2278 | + $offset = ($current_page - 1) * $per_page; |
|
2279 | + $limit = $count ? NULL : array($offset, $per_page); |
|
2280 | 2280 | |
2281 | - if ( $trash ) { |
|
2282 | - $_where['status'] = array( '!=', 'publish' ); |
|
2283 | - $all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2281 | + if ($trash) { |
|
2282 | + $_where['status'] = array('!=', 'publish'); |
|
2283 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2284 | 2284 | } else { |
2285 | - $_where['status'] = array( 'IN', array( 'publish' ) ); |
|
2286 | - $all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) ); |
|
2285 | + $_where['status'] = array('IN', array('publish')); |
|
2286 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2287 | 2287 | } |
2288 | 2288 | |
2289 | 2289 | return $all_attendees; |
@@ -2300,10 +2300,10 @@ discard block |
||
2300 | 2300 | */ |
2301 | 2301 | protected function _resend_registration() { |
2302 | 2302 | $this->_process_resend_registration(); |
2303 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( |
|
2303 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( |
|
2304 | 2304 | 'action' => 'default' |
2305 | 2305 | ); |
2306 | - $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE ); |
|
2306 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2307 | 2307 | } |
2308 | 2308 | |
2309 | 2309 | |
@@ -2311,27 +2311,27 @@ discard block |
||
2311 | 2311 | |
2312 | 2312 | |
2313 | 2313 | |
2314 | - public function _registrations_report(){ |
|
2315 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2316 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2314 | + public function _registrations_report() { |
|
2315 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2316 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2317 | 2317 | array( |
2318 | 2318 | 'page' => 'espresso_batch', |
2319 | 2319 | 'batch' => 'file', |
2320 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2321 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ), |
|
2322 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2323 | - )) ); |
|
2320 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2321 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'), |
|
2322 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2323 | + ))); |
|
2324 | 2324 | } else { |
2325 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2325 | + EE_Registry::instance()->load_helper('File'); |
|
2326 | 2326 | $new_request_args = array( |
2327 | 2327 | 'export' => 'report', |
2328 | 2328 | 'action' => 'registrations_report_for_event', |
2329 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2329 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2330 | 2330 | ); |
2331 | 2331 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
2332 | 2332 | |
2333 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2334 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2333 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2334 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2335 | 2335 | $EE_Export = EE_Export::instance($this->_req_data); |
2336 | 2336 | $EE_Export->export(); |
2337 | 2337 | } |
@@ -2340,28 +2340,28 @@ discard block |
||
2340 | 2340 | |
2341 | 2341 | |
2342 | 2342 | |
2343 | - public function _contact_list_export(){ |
|
2344 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2345 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2346 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2343 | + public function _contact_list_export() { |
|
2344 | + EE_Registry::instance()->load_helper('File'); |
|
2345 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2346 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2347 | 2347 | $EE_Export = EE_Export::instance($this->_req_data); |
2348 | 2348 | $EE_Export->export_attendees(); |
2349 | 2349 | } |
2350 | 2350 | } |
2351 | 2351 | |
2352 | - public function _contact_list_report(){ |
|
2353 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2354 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2352 | + public function _contact_list_report() { |
|
2353 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2354 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2355 | 2355 | array( |
2356 | 2356 | 'page' => 'espresso_batch', |
2357 | 2357 | 'batch' => 'file', |
2358 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ), |
|
2359 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2360 | - )) ); |
|
2358 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'), |
|
2359 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2360 | + ))); |
|
2361 | 2361 | } else { |
2362 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2363 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2364 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2362 | + EE_Registry::instance()->load_helper('File'); |
|
2363 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2364 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2365 | 2365 | $EE_Export = EE_Export::instance($this->_req_data); |
2366 | 2366 | $EE_Export->report_attendees(); |
2367 | 2367 | } |
@@ -2381,73 +2381,73 @@ discard block |
||
2381 | 2381 | * @return void |
2382 | 2382 | */ |
2383 | 2383 | protected function _duplicate_attendee() { |
2384 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default'; |
|
2384 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default'; |
|
2385 | 2385 | //verify we have necessary info |
2386 | - if ( empty($this->_req_data['_REG_ID'] ) ) { |
|
2387 | - EE_Error::add_error( __('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__ ); |
|
2388 | - $query_args = array( 'action' => $action ); |
|
2386 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2387 | + EE_Error::add_error(__('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
2388 | + $query_args = array('action' => $action); |
|
2389 | 2389 | $this->_redirect_after_action('', '', '', $query_args, TRUE); |
2390 | 2390 | } |
2391 | 2391 | |
2392 | 2392 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
2393 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] ); |
|
2393 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']); |
|
2394 | 2394 | $attendee = $registration->attendee(); |
2395 | 2395 | |
2396 | 2396 | //remove relation of existing attendee on registration |
2397 | - $registration->_remove_relation_to($attendee, 'Attendee' ); |
|
2397 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
2398 | 2398 | //new attendee |
2399 | 2399 | $new_attendee = clone $attendee; |
2400 | - $new_attendee->set( 'ATT_ID', 0 ); |
|
2400 | + $new_attendee->set('ATT_ID', 0); |
|
2401 | 2401 | $new_attendee->save(); |
2402 | 2402 | |
2403 | 2403 | //add new attendee to reg |
2404 | - $registration->_add_relation_to( $new_attendee, 'Attendee'); |
|
2404 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
2405 | 2405 | |
2406 | - EE_Error::add_success( __('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso') ); |
|
2406 | + EE_Error::add_success(__('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso')); |
|
2407 | 2407 | |
2408 | 2408 | //redirect to edit page for attendee |
2409 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' ); |
|
2409 | + $query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); |
|
2410 | 2410 | |
2411 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE ); |
|
2411 | + $this->_redirect_after_action('', '', '', $query_args, TRUE); |
|
2412 | 2412 | } |
2413 | 2413 | |
2414 | 2414 | |
2415 | 2415 | //related to cpt routes |
2416 | 2416 | protected function _insert_update_cpt_item($post_id, $post) { |
2417 | 2417 | $success = true; |
2418 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id ); |
|
2418 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id); |
|
2419 | 2419 | //for attendee updates |
2420 | - if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { |
|
2420 | + if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { |
|
2421 | 2421 | //note we should only be UPDATING attendees at this point. |
2422 | 2422 | $updated_fields = array( |
2423 | 2423 | 'ATT_fname' => $this->_req_data['ATT_fname'], |
2424 | 2424 | 'ATT_lname' => $this->_req_data['ATT_lname'], |
2425 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'], |
|
2425 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'], |
|
2426 | 2426 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '', |
2427 | 2427 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '', |
2428 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '', |
|
2429 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '', |
|
2430 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '', |
|
2431 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '', |
|
2432 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '', |
|
2433 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : '' |
|
2428 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '', |
|
2429 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '', |
|
2430 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '', |
|
2431 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '', |
|
2432 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '', |
|
2433 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : '' |
|
2434 | 2434 | ); |
2435 | - foreach ( $updated_fields as $field => $value ) { |
|
2435 | + foreach ($updated_fields as $field => $value) { |
|
2436 | 2436 | $attendee->set($field, $value); |
2437 | 2437 | } |
2438 | 2438 | |
2439 | 2439 | $success = $attendee->save(); |
2440 | 2440 | |
2441 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() ); |
|
2442 | - foreach ( $attendee_update_callbacks as $a_callback ) { |
|
2443 | - if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { |
|
2444 | - throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback ) ); |
|
2441 | + $attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); |
|
2442 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
2443 | + if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { |
|
2444 | + throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback)); |
|
2445 | 2445 | } |
2446 | 2446 | } |
2447 | 2447 | } |
2448 | 2448 | |
2449 | - if ( $success === FALSE ) |
|
2450 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2449 | + if ($success === FALSE) |
|
2450 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2451 | 2451 | |
2452 | 2452 | } |
2453 | 2453 | |
@@ -2467,17 +2467,17 @@ discard block |
||
2467 | 2467 | remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2468 | 2468 | remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2469 | 2469 | |
2470 | - if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { |
|
2471 | - add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); |
|
2470 | + if (post_type_supports('espresso_attendees', 'excerpt')) { |
|
2471 | + add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); |
|
2472 | 2472 | } |
2473 | 2473 | |
2474 | - if ( post_type_supports( 'espresso_attendees', 'comments') ) { |
|
2474 | + if (post_type_supports('espresso_attendees', 'comments')) { |
|
2475 | 2475 | add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2476 | 2476 | } |
2477 | 2477 | |
2478 | - add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
2479 | - add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); |
|
2480 | - add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2478 | + add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
2479 | + add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
|
2480 | + add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2481 | 2481 | } |
2482 | 2482 | |
2483 | 2483 | |
@@ -2486,10 +2486,10 @@ discard block |
||
2486 | 2486 | * @param WP_Post $post wp post object |
2487 | 2487 | * @return string attendee contact info ( and form ) |
2488 | 2488 | */ |
2489 | - public function attendee_contact_info( $post ) { |
|
2489 | + public function attendee_contact_info($post) { |
|
2490 | 2490 | //get attendee object ( should already have it ) |
2491 | 2491 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2492 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php'; |
|
2492 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php'; |
|
2493 | 2493 | EEH_Template::display_template($template, $this->_template_args); |
2494 | 2494 | } |
2495 | 2495 | |
@@ -2505,12 +2505,12 @@ discard block |
||
2505 | 2505 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2506 | 2506 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
2507 | 2507 | new EE_Question_Form_Input( |
2508 | - EE_Question::new_instance( array( |
|
2508 | + EE_Question::new_instance(array( |
|
2509 | 2509 | 'QST_ID' => 0, |
2510 | 2510 | 'QST_display_text' => __('State/Province', 'event_espresso'), |
2511 | 2511 | 'QST_system' => 'admin-state' |
2512 | 2512 | )), |
2513 | - EE_Answer::new_instance( array( |
|
2513 | + EE_Answer::new_instance(array( |
|
2514 | 2514 | 'ANS_ID' => 0, |
2515 | 2515 | 'ANS_value' => $this->_cpt_model_obj->state_ID() |
2516 | 2516 | )), |
@@ -2523,12 +2523,12 @@ discard block |
||
2523 | 2523 | )); |
2524 | 2524 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
2525 | 2525 | new EE_Question_Form_Input( |
2526 | - EE_Question::new_instance( array( |
|
2526 | + EE_Question::new_instance(array( |
|
2527 | 2527 | 'QST_ID' => 0, |
2528 | 2528 | 'QST_display_text' => __('Country', 'event_espresso'), |
2529 | 2529 | 'QST_system' => 'admin-country' |
2530 | 2530 | )), |
2531 | - EE_Answer::new_instance( array( |
|
2531 | + EE_Answer::new_instance(array( |
|
2532 | 2532 | 'ANS_ID' => 0, |
2533 | 2533 | 'ANS_value' => $this->_cpt_model_obj->country_ID() |
2534 | 2534 | )), |
@@ -2539,8 +2539,8 @@ discard block |
||
2539 | 2539 | 'append_qstn_id' => FALSE |
2540 | 2540 | ) |
2541 | 2541 | )); |
2542 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
2543 | - EEH_Template::display_template($template, $this->_template_args ); |
|
2542 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php'; |
|
2543 | + EEH_Template::display_template($template, $this->_template_args); |
|
2544 | 2544 | |
2545 | 2545 | } |
2546 | 2546 | |
@@ -2550,11 +2550,11 @@ discard block |
||
2550 | 2550 | * @access protected |
2551 | 2551 | * @return void |
2552 | 2552 | */ |
2553 | - public function attendee_registrations_meta_box( $post ) { |
|
2553 | + public function attendee_registrations_meta_box($post) { |
|
2554 | 2554 | |
2555 | 2555 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2556 | 2556 | $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
2557 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
2557 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php'; |
|
2558 | 2558 | EEH_Template::display_template($template, $this->_template_args); |
2559 | 2559 | |
2560 | 2560 | } |
@@ -2568,8 +2568,8 @@ discard block |
||
2568 | 2568 | * @return string html for new form. |
2569 | 2569 | */ |
2570 | 2570 | public function after_title_form_fields($post) { |
2571 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
2572 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
2571 | + if ($post->post_type == 'espresso_attendees') { |
|
2572 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php'; |
|
2573 | 2573 | $template_args['attendee'] = $this->_cpt_model_obj; |
2574 | 2574 | EEH_Template::display_template($template, $template_args); |
2575 | 2575 | } |
@@ -2586,21 +2586,21 @@ discard block |
||
2586 | 2586 | * @access protected |
2587 | 2587 | * @return void |
2588 | 2588 | */ |
2589 | - protected function _trash_or_restore_attendees( $trash = TRUE ) { |
|
2589 | + protected function _trash_or_restore_attendees($trash = TRUE) { |
|
2590 | 2590 | |
2591 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2591 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2592 | 2592 | |
2593 | 2593 | $ATT_MDL = EEM_Attendee::instance(); |
2594 | 2594 | |
2595 | 2595 | $success = 1; |
2596 | 2596 | //Checkboxes |
2597 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2597 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2598 | 2598 | // if array has more than one element than success message should be plural |
2599 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2599 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2600 | 2600 | // cycle thru checkboxes |
2601 | - while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
2602 | - $updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); |
|
2603 | - if ( !$updated ) { |
|
2601 | + while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2602 | + $updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); |
|
2603 | + if ( ! $updated) { |
|
2604 | 2604 | $success = 0; |
2605 | 2605 | } |
2606 | 2606 | } |
@@ -2609,18 +2609,18 @@ discard block |
||
2609 | 2609 | // grab single id and delete |
2610 | 2610 | $ATT_ID = absint($this->_req_data['ATT_ID']); |
2611 | 2611 | //get attendee |
2612 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID ); |
|
2612 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID); |
|
2613 | 2613 | $updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); |
2614 | 2614 | $updated = $att->save(); |
2615 | - if ( ! $updated ) { |
|
2615 | + if ( ! $updated) { |
|
2616 | 2616 | $success = 0; |
2617 | 2617 | } |
2618 | 2618 | |
2619 | 2619 | } |
2620 | 2620 | |
2621 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' ); |
|
2622 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2623 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) ); |
|
2621 | + $what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); |
|
2622 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2623 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); |
|
2624 | 2624 | |
2625 | 2625 | } |
2626 | 2626 |
@@ -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 | /** |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | class Support_Admin_Page extends EE_Admin_Page { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( $routing = TRUE ) { |
|
34 | - parent::__construct( $routing ); |
|
33 | + public function __construct($routing = TRUE) { |
|
34 | + parent::__construct($routing); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | 'nav' => array( |
86 | 86 | 'label' => __('Shortcodes', 'event_espresso'), |
87 | 87 | 'order' => 30), |
88 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_shortcodes_boxes' ) ), |
|
88 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_shortcodes_boxes')), |
|
89 | 89 | 'require_nonce' => FALSE |
90 | 90 | ), |
91 | 91 | 'contact_support' => array( |
92 | 92 | 'nav' => array( |
93 | 93 | 'label' => __('Support', 'event_espresso'), |
94 | 94 | 'order' => 40), |
95 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_support_boxes' ) ), |
|
95 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_support_boxes')), |
|
96 | 96 | 'require_nonce' => FALSE |
97 | 97 | ), |
98 | 98 | 'developers' => array( |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | |
121 | 121 | |
122 | 122 | protected function _installation() { |
123 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_installation.template.php'; |
|
124 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, '', TRUE); |
|
123 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_installation.template.php'; |
|
124 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, '', TRUE); |
|
125 | 125 | $this->display_admin_page_with_sidebar(); |
126 | 126 | } |
127 | 127 | |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | 'other_resources' => __('Other Resources', 'event_espresso') |
147 | 147 | ); |
148 | 148 | |
149 | - foreach ( $boxes as $box => $label ) { |
|
150 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
149 | + foreach ($boxes as $box => $label) { |
|
150 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
151 | 151 | $callback_args = array('template_path' => $template_path); |
152 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
152 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
@@ -170,15 +170,15 @@ discard block |
||
170 | 170 | 'shortcodes_event_listings' => __('Event Listings', 'event_espresso'), |
171 | 171 | 'shortcodes_ticket_selector' => __('Event Ticket Selector', 'event_espresso'), |
172 | 172 | 'shortcodes_category' => __('Event Categories', 'event_espresso'), |
173 | - 'shortcodes_attendee' => __( 'Event Attendees', 'event_espresso' ) |
|
173 | + 'shortcodes_attendee' => __('Event Attendees', 'event_espresso') |
|
174 | 174 | /*'shortcodes_single_events' => __('Single Events', 'event_espresso'),*/ |
175 | 175 | /*'shortcodes_attendee_listings' => __('Attendee Listings', 'event_espresso'),*/ |
176 | 176 | ); |
177 | 177 | |
178 | - foreach ( $boxes as $box => $label ) { |
|
179 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
178 | + foreach ($boxes as $box => $label) { |
|
179 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
180 | 180 | $callback_args = array('template_path' => $template_path); |
181 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
181 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
@@ -197,17 +197,17 @@ discard block |
||
197 | 197 | 'important_information' => __('Important Information', 'event_espresso') |
198 | 198 | ); |
199 | 199 | |
200 | - foreach ( $boxes as $box => $label ) { |
|
201 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
200 | + foreach ($boxes as $box => $label) { |
|
201 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
202 | 202 | $callback_args = array('template_path' => $template_path, 'template_args' => $this->_template_args); |
203 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
203 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
207 | 207 | |
208 | 208 | protected function _developers() { |
209 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'developers_admin_details.template.php'; |
|
210 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true ); |
|
209 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'developers_admin_details.template.php'; |
|
210 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true); |
|
211 | 211 | $this->display_admin_page_with_sidebar(); |
212 | 212 | } |
213 | 213 |
@@ -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 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | class Registration_Form_Question_Groups_Admin_List_Table extends EE_Admin_List_Table { |
32 | 32 | |
33 | 33 | |
34 | - public function __construct( $admin_page ) { |
|
34 | + public function __construct($admin_page) { |
|
35 | 35 | parent::__construct($admin_page); |
36 | 36 | } |
37 | 37 | |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | |
40 | 40 | |
41 | 41 | protected function _setup_data() { |
42 | - $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_question_groups( $this->_per_page,$this->_current_page, FALSE ) : $this->_admin_page->get_trashed_question_groups( $this->_per_page,$this->_current_page, FALSE ); |
|
43 | - $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_question_groups( $this->_per_page,$this->_current_page, TRUE ) : $this->_admin_page->get_trashed_question_groups( $this->_per_page,$this->_current_page, TRUE ); |
|
42 | + $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, FALSE) : $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, FALSE); |
|
43 | + $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, TRUE) : $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, TRUE); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | |
50 | 50 | protected function _set_properties() { |
51 | 51 | $this->_wp_list_args = array( |
52 | - 'singular' => __('question group', 'event_espresso' ), |
|
53 | - 'plural' => __('question groups', 'event_espresso' ), |
|
52 | + 'singular' => __('question group', 'event_espresso'), |
|
53 | + 'plural' => __('question groups', 'event_espresso'), |
|
54 | 54 | 'ajax' => TRUE, //for now, |
55 | 55 | 'screen' => $this->_admin_page->get_current_screen()->id |
56 | 56 | ); |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | ); |
66 | 66 | |
67 | 67 | $this->_sortable_columns = array( |
68 | - 'id' => array( 'QSG_ID' => FALSE ), |
|
69 | - 'name' => array( 'QSG_name' => FALSE ) |
|
68 | + 'id' => array('QSG_ID' => FALSE), |
|
69 | + 'name' => array('QSG_name' => FALSE) |
|
70 | 70 | ); |
71 | 71 | |
72 | 72 | $this->_hidden_columns = array( |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | |
93 | 93 | |
94 | 94 | protected function _add_view_counts() { |
95 | - $this->_views['all']['count'] = $this->_admin_page->get_question_groups( $this->_per_page,$this->_current_page, TRUE ); |
|
96 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_group' ) ) { |
|
97 | - $this->_views['trash']['count'] = $this->_admin_page->get_trashed_question_groups( $this->_per_page,$this->_current_page, TRUE ); |
|
95 | + $this->_views['all']['count'] = $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, TRUE); |
|
96 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_group')) { |
|
97 | + $this->_views['trash']['count'] = $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, TRUE); |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $system_group = $item->get('QSG_system'); |
108 | 108 | $has_questions_with_answers = $item->has_questions_with_answers(); |
109 | 109 | $lock_icon = $system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers ? 'ee-lock-icon ee-alternate-color' : 'ee-lock-icon ee-system-lock'; |
110 | - return $system_group > 0 || ( $system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_groups', $item->ID() ) ? '<span class="' . $lock_icon . '"></span>' . sprintf( '<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', $item->ID() ) : sprintf( '<input type="checkbox" id="QSG_ID[%1$d]" name="checkbox[%1$d]" value="%1$d" />', $item->ID() ); |
|
110 | + return $system_group > 0 || ($system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers) || ! EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_groups', $item->ID()) ? '<span class="'.$lock_icon.'"></span>'.sprintf('<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', $item->ID()) : sprintf('<input type="checkbox" id="QSG_ID[%1$d]" name="checkbox[%1$d]" value="%1$d" />', $item->ID()); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | public function column_id(EE_Question_Group $item) { |
119 | 119 | $content = $item->ID(); |
120 | - $content .= ' <span class="show-on-mobile-view-only">' .$item->name() . '</span>'; |
|
120 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->name().'</span>'; |
|
121 | 121 | return $content; |
122 | 122 | } |
123 | 123 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $actions = array(); |
128 | 128 | |
129 | 129 | //return $item->name(); |
130 | - if ( !defined('REG_ADMIN_URL') ) |
|
130 | + if ( ! defined('REG_ADMIN_URL')) |
|
131 | 131 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
132 | 132 | |
133 | 133 | $edit_query_args = array( |
@@ -152,32 +152,32 @@ discard block |
||
152 | 152 | |
153 | 153 | |
154 | 154 | |
155 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EE_FORMS_ADMIN_URL ); |
|
156 | - $trash_link = EE_Admin_Page::add_query_args_and_nonce( $trash_query_args, EE_FORMS_ADMIN_URL ); |
|
157 | - $restore_link = EE_Admin_Page::add_query_args_and_nonce( $restore_query_args, EE_FORMS_ADMIN_URL ); |
|
158 | - $delete_link = EE_Admin_Page::add_query_args_and_nonce( $delete_query_args, EE_FORMS_ADMIN_URL ); |
|
155 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
156 | + $trash_link = EE_Admin_Page::add_query_args_and_nonce($trash_query_args, EE_FORMS_ADMIN_URL); |
|
157 | + $restore_link = EE_Admin_Page::add_query_args_and_nonce($restore_query_args, EE_FORMS_ADMIN_URL); |
|
158 | + $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_FORMS_ADMIN_URL); |
|
159 | 159 | |
160 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID() ) ) { |
|
160 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID())) { |
|
161 | 161 | $actions = array( |
162 | - 'edit' => '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Question Group', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>' |
|
162 | + 'edit' => '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Question Group', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>' |
|
163 | 163 | ); |
164 | 164 | } |
165 | - if ( $item->get('QSG_system') < 1 && $this->_view != 'trash' && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_group', 'espresso_registration_form_trash_question_group', $item->ID() ) ) { |
|
166 | - $actions['delete'] = '<a href="' . $trash_link . '" title="' . esc_attr__('Delete Question Group', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
165 | + if ($item->get('QSG_system') < 1 && $this->_view != 'trash' && EE_Registry::instance()->CAP->current_user_can('ee_delete_question_group', 'espresso_registration_form_trash_question_group', $item->ID())) { |
|
166 | + $actions['delete'] = '<a href="'.$trash_link.'" title="'.esc_attr__('Delete Question Group', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
167 | 167 | } |
168 | 168 | |
169 | - if ( $this->_view == 'trash' ) { |
|
169 | + if ($this->_view == 'trash') { |
|
170 | 170 | |
171 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_group', 'espresso_registration_form_restore_question_group', $item->ID() ) ) { |
|
172 | - $actions['restore'] = '<a href="' . $restore_link . '" title="' . esc_attr__('Restore Question Group', 'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>'; |
|
171 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_group', 'espresso_registration_form_restore_question_group', $item->ID())) { |
|
172 | + $actions['restore'] = '<a href="'.$restore_link.'" title="'.esc_attr__('Restore Question Group', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
173 | 173 | } |
174 | 174 | |
175 | - if ( !$item->has_questions_with_answers() && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_group', 'espresso_registration_form_delete_question_group', $item->ID() ) ) { |
|
176 | - $actions['delete'] = '<a href="' . $delete_link . '" title="' . esc_attr__('Delete Question Group Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
175 | + if ( ! $item->has_questions_with_answers() && EE_Registry::instance()->CAP->current_user_can('ee_delete_question_group', 'espresso_registration_form_delete_question_group', $item->ID())) { |
|
176 | + $actions['delete'] = '<a href="'.$delete_link.'" title="'.esc_attr__('Delete Question Group Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | - $content = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID() ) ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->name() . '</a></strong>' : $item->name(); |
|
180 | + $content = EE_Registry::instance()->CAP->current_user_can('ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID()) ? '<strong><a class="row-title" href="'.$edit_link.'">'.$item->name().'</a></strong>' : $item->name(); |
|
181 | 181 | $content .= $this->row_actions($actions); |
182 | 182 | return $content; |
183 | 183 | } |
@@ -198,13 +198,13 @@ discard block |
||
198 | 198 | |
199 | 199 | |
200 | 200 | public function column_show_group_name(EE_Question_Group $item) { |
201 | - return $this->_yes_no[ $item->show_group_name() ]; |
|
201 | + return $this->_yes_no[$item->show_group_name()]; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
205 | 205 | |
206 | 206 | public function column_show_group_desc(EE_Question_Group $item) { |
207 | - return $this->_yes_no[ $item->show_group_desc() ]; |
|
207 | + return $this->_yes_no[$item->show_group_desc()]; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 |
@@ -71,12 +71,12 @@ |
||
71 | 71 | |
72 | 72 | <?php |
73 | 73 | /** |
74 | - * template args used |
|
75 | - * |
|
76 | - * $dtt_row |
|
77 | - * $DTT_description |
|
78 | - * $show_tickets_row |
|
79 | - * $datetime_tickets_list |
|
80 | - * $add_new_datetime_ticket_help_link |
|
81 | - * $DTT_ID |
|
82 | - */ |
|
83 | 74 | \ No newline at end of file |
75 | + * template args used |
|
76 | + * |
|
77 | + * $dtt_row |
|
78 | + * $DTT_description |
|
79 | + * $show_tickets_row |
|
80 | + * $datetime_tickets_list |
|
81 | + * $add_new_datetime_ticket_help_link |
|
82 | + * $DTT_ID |
|
83 | + */ |
|
84 | 84 | \ No newline at end of file |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | return array(); |
100 | 100 | } |
101 | 101 | if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
102 | - unset( $espresso_themes[ $key ] ); |
|
102 | + unset( $espresso_themes[ $key ] ); |
|
103 | 103 | } |
104 | 104 | EEH_Template::$_espresso_themes = array(); |
105 | 105 | foreach ( $espresso_themes as $espresso_theme ) { |
@@ -709,9 +709,9 @@ discard block |
||
709 | 709 | ); |
710 | 710 | |
711 | 711 | if ( empty( $items_label ) |
712 | - || ! is_array( $items_label ) |
|
713 | - || ! isset( $items_label['single'] ) |
|
714 | - || ! isset( $items_label['plural'] ) ) { |
|
712 | + || ! is_array( $items_label ) |
|
713 | + || ! isset( $items_label['single'] ) |
|
714 | + || ! isset( $items_label['plural'] ) ) { |
|
715 | 715 | $items_label = array( |
716 | 716 | 'single' => __( '1 item', 'event_espresso' ), |
717 | 717 | 'plural' => __( '%s items', 'event_espresso' ) |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | -if ( ! function_exists( 'espresso_get_template_part' )) { |
|
18 | +if ( ! function_exists('espresso_get_template_part')) { |
|
19 | 19 | /** |
20 | 20 | * espresso_get_template_part |
21 | 21 | * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @param string $name The name of the specialised template. |
26 | 26 | * @return string the html output for the formatted money value |
27 | 27 | */ |
28 | - function espresso_get_template_part( $slug = NULL, $name = NULL ) { |
|
29 | - EEH_Template::get_template_part( $slug, $name ); |
|
28 | + function espresso_get_template_part($slug = NULL, $name = NULL) { |
|
29 | + EEH_Template::get_template_part($slug, $name); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | -if ( ! function_exists( 'espresso_get_object_css_class' )) { |
|
35 | +if ( ! function_exists('espresso_get_object_css_class')) { |
|
36 | 36 | /** |
37 | 37 | * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed |
38 | 38 | * |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $suffix added to the end of the generated class |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
46 | - return EEH_Template::get_object_css_class( $object, $prefix, $suffix ); |
|
45 | + function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
46 | + return EEH_Template::get_object_css_class($object, $prefix, $suffix); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return boolean |
71 | 71 | */ |
72 | 72 | public static function is_espresso_theme() { |
73 | - return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE; |
|
73 | + return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | public static function load_espresso_theme_functions() { |
82 | - if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) { |
|
83 | - if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) { |
|
84 | - require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' ); |
|
82 | + if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) { |
|
83 | + if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) { |
|
84 | + require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | * @return array |
94 | 94 | */ |
95 | 95 | public static function get_espresso_themes() { |
96 | - if ( empty( EEH_Template::$_espresso_themes )) { |
|
97 | - $espresso_themes = glob( EE_PUBLIC . '*', GLOB_ONLYDIR ); |
|
98 | - if ( empty( $espresso_themes ) ) { |
|
96 | + if (empty(EEH_Template::$_espresso_themes)) { |
|
97 | + $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR); |
|
98 | + if (empty($espresso_themes)) { |
|
99 | 99 | return array(); |
100 | 100 | } |
101 | - if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
|
102 | - unset( $espresso_themes[ $key ] ); |
|
101 | + if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) { |
|
102 | + unset($espresso_themes[$key]); |
|
103 | 103 | } |
104 | 104 | EEH_Template::$_espresso_themes = array(); |
105 | - foreach ( $espresso_themes as $espresso_theme ) { |
|
106 | - EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme; |
|
105 | + foreach ($espresso_themes as $espresso_theme) { |
|
106 | + EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | return EEH_Template::$_espresso_themes; |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @param bool $return_string |
123 | 123 | * @return string the html output for the formatted money value |
124 | 124 | */ |
125 | - public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE ) { |
|
126 | - do_action( "get_template_part_{$slug}-{$name}", $slug, $name ); |
|
125 | + public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) { |
|
126 | + do_action("get_template_part_{$slug}-{$name}", $slug, $name); |
|
127 | 127 | $templates = array(); |
128 | 128 | $name = (string) $name; |
129 | - if ( $name != '' ) { |
|
129 | + if ($name != '') { |
|
130 | 130 | $templates[] = "{$slug}-{$name}.php"; |
131 | 131 | } |
132 | 132 | // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' ); |
133 | - if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) { |
|
134 | - EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string ); |
|
133 | + if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) { |
|
134 | + EEH_Template::locate_template($templates, $template_args, TRUE, $return_string); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -182,26 +182,26 @@ discard block |
||
182 | 182 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
183 | 183 | * @return mixed |
184 | 184 | */ |
185 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
185 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
186 | 186 | // first use WP locate_template to check for template in the current theme folder |
187 | - $template_path = locate_template( $templates ); |
|
187 | + $template_path = locate_template($templates); |
|
188 | 188 | |
189 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
189 | + if ($check_if_custom && ! empty($template_path)) |
|
190 | 190 | return TRUE; |
191 | 191 | |
192 | 192 | // not in the theme |
193 | - if ( empty( $template_path )) { |
|
193 | + if (empty($template_path)) { |
|
194 | 194 | // not even a template to look for ? |
195 | - if ( empty( $templates )) { |
|
195 | + if (empty($templates)) { |
|
196 | 196 | // get post_type |
197 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
197 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
198 | 198 | // get array of EE Custom Post Types |
199 | 199 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
200 | 200 | // build template name based on request |
201 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
202 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
201 | + if (isset($EE_CPTs[$post_type])) { |
|
202 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | // currently active EE template theme |
@@ -210,80 +210,80 @@ discard block |
||
210 | 210 | // array of paths to folders that may contain templates |
211 | 211 | $template_folder_paths = array( |
212 | 212 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
213 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
213 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
214 | 214 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
215 | 215 | EVENT_ESPRESSO_TEMPLATE_DIR |
216 | 216 | ); |
217 | 217 | |
218 | 218 | //add core plugin folders for checking only if we're not $check_if_custom |
219 | - if ( ! $check_if_custom ) { |
|
219 | + if ( ! $check_if_custom) { |
|
220 | 220 | $core_paths = array( |
221 | 221 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
222 | - EE_PUBLIC . $current_theme, |
|
222 | + EE_PUBLIC.$current_theme, |
|
223 | 223 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
224 | - EE_TEMPLATES . $current_theme, |
|
224 | + EE_TEMPLATES.$current_theme, |
|
225 | 225 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
226 | 226 | EE_PLUGIN_DIR_PATH |
227 | 227 | ); |
228 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
228 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // now filter that array |
232 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
233 | - $templates = is_array( $templates ) ? $templates : array( $templates ); |
|
234 | - $template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths ); |
|
232 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
233 | + $templates = is_array($templates) ? $templates : array($templates); |
|
234 | + $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths); |
|
235 | 235 | // array to hold all possible template paths |
236 | 236 | $full_template_paths = array(); |
237 | 237 | |
238 | 238 | EE_Registry::instance()->load_helper('File'); |
239 | 239 | // loop through $templates |
240 | - foreach ( $templates as $template ) { |
|
240 | + foreach ($templates as $template) { |
|
241 | 241 | // normalize directory separators |
242 | - $template = EEH_File::standardise_directory_separators( $template ); |
|
243 | - $file_name = basename( $template ); |
|
244 | - $template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) ); |
|
242 | + $template = EEH_File::standardise_directory_separators($template); |
|
243 | + $file_name = basename($template); |
|
244 | + $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1)); |
|
245 | 245 | // while looping through all template folder paths |
246 | - foreach ( $template_folder_paths as $template_folder_path ) { |
|
246 | + foreach ($template_folder_paths as $template_folder_path) { |
|
247 | 247 | // normalize directory separators |
248 | - $template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path ); |
|
248 | + $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path); |
|
249 | 249 | // determine if any common base path exists between the two paths |
250 | 250 | $common_base_path = EEH_Template::_find_common_base_path( |
251 | - array( $template_folder_path, $template_path_minus_file_name ) |
|
251 | + array($template_folder_path, $template_path_minus_file_name) |
|
252 | 252 | ); |
253 | - if ( $common_base_path !== '' ) { |
|
253 | + if ($common_base_path !== '') { |
|
254 | 254 | // both paths have a common base, so just tack the filename onto our search path |
255 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name; |
|
255 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name; |
|
256 | 256 | } else { |
257 | 257 | // no common base path, so let's just concatenate |
258 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template; |
|
258 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template; |
|
259 | 259 | } |
260 | 260 | // build up our template locations array by adding our resolved paths |
261 | 261 | $full_template_paths[] = $resolved_path; |
262 | 262 | } |
263 | 263 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
264 | - array_unshift( $full_template_paths, $template ); |
|
264 | + array_unshift($full_template_paths, $template); |
|
265 | 265 | // path to the directory of the current theme: /wp-content/themes/(current WP theme)/ |
266 | - array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name ); |
|
266 | + array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name); |
|
267 | 267 | } |
268 | 268 | // filter final array of full template paths |
269 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name ); |
|
269 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name); |
|
270 | 270 | // now loop through our final array of template location paths and check each location |
271 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
272 | - if ( is_readable( $full_template_path )) { |
|
273 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
271 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
272 | + if (is_readable($full_template_path)) { |
|
273 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
274 | 274 | break; |
275 | 275 | } |
276 | 276 | } |
277 | 277 | } |
278 | 278 | // if we got it and you want to see it... |
279 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
280 | - if ( $return_string ) { |
|
281 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
279 | + if ($template_path && $load && ! $check_if_custom) { |
|
280 | + if ($return_string) { |
|
281 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
282 | 282 | } else { |
283 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
283 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
284 | 284 | } |
285 | 285 | } |
286 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
286 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | |
@@ -296,21 +296,21 @@ discard block |
||
296 | 296 | * @param array $paths |
297 | 297 | * @return string |
298 | 298 | */ |
299 | - protected static function _find_common_base_path( $paths ) { |
|
299 | + protected static function _find_common_base_path($paths) { |
|
300 | 300 | $last_offset = 0; |
301 | 301 | $common_base_path = ''; |
302 | - while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) { |
|
302 | + while (($index = strpos($paths[0], DS, $last_offset)) !== false) { |
|
303 | 303 | $dir_length = $index - $last_offset + 1; |
304 | - $directory = substr( $paths[ 0 ], $last_offset, $dir_length ); |
|
305 | - foreach ( $paths as $path ) { |
|
306 | - if ( substr( $path, $last_offset, $dir_length ) != $directory ) { |
|
304 | + $directory = substr($paths[0], $last_offset, $dir_length); |
|
305 | + foreach ($paths as $path) { |
|
306 | + if (substr($path, $last_offset, $dir_length) != $directory) { |
|
307 | 307 | return $common_base_path; |
308 | 308 | } |
309 | 309 | } |
310 | 310 | $common_base_path .= $directory; |
311 | 311 | $last_offset = $index + 1; |
312 | 312 | } |
313 | - return substr( $common_base_path, 0, -1 ); |
|
313 | + return substr($common_base_path, 0, -1); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | |
@@ -322,9 +322,9 @@ discard block |
||
322 | 322 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
323 | 323 | * @return mixed string |
324 | 324 | */ |
325 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
325 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
326 | 326 | //require the template validator for verifying variables are set according to how the template requires |
327 | - EE_Registry::instance()->load_helper( 'Template_Validator' ); |
|
327 | + EE_Registry::instance()->load_helper('Template_Validator'); |
|
328 | 328 | |
329 | 329 | /** |
330 | 330 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -335,26 +335,26 @@ discard block |
||
335 | 335 | * |
336 | 336 | * @since 4.6.0 |
337 | 337 | */ |
338 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
339 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
338 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
339 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
340 | 340 | |
341 | 341 | // you gimme nuttin - YOU GET NUTTIN !! |
342 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
342 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
343 | 343 | return ''; |
344 | 344 | } |
345 | 345 | // if $template_args are not in an array, then make it so |
346 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
347 | - $template_args = array( $template_args ); |
|
346 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
347 | + $template_args = array($template_args); |
|
348 | 348 | } |
349 | - extract( (array) $template_args); |
|
349 | + extract((array) $template_args); |
|
350 | 350 | |
351 | - if ( $return_string ) { |
|
351 | + if ($return_string) { |
|
352 | 352 | // because we want to return a string, we are going to capture the output |
353 | 353 | ob_start(); |
354 | - include( $template_path ); |
|
354 | + include($template_path); |
|
355 | 355 | return ob_get_clean(); |
356 | 356 | } else { |
357 | - include( $template_path ); |
|
357 | + include($template_path); |
|
358 | 358 | } |
359 | 359 | return ''; |
360 | 360 | } |
@@ -372,27 +372,27 @@ discard block |
||
372 | 372 | * @param string $suffix added to the end of the generated class |
373 | 373 | * @return string |
374 | 374 | */ |
375 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
375 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
376 | 376 | // in the beginning... |
377 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
377 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
378 | 378 | // da muddle |
379 | 379 | $class = ''; |
380 | 380 | // the end |
381 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
381 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
382 | 382 | // is the passed object an EE object ? |
383 | - if ( $object instanceof EE_Base_Class ) { |
|
383 | + if ($object instanceof EE_Base_Class) { |
|
384 | 384 | // grab the exact type of object |
385 | - $obj_class = get_class( $object ); |
|
385 | + $obj_class = get_class($object); |
|
386 | 386 | // depending on the type of object... |
387 | - switch ( $obj_class ) { |
|
387 | + switch ($obj_class) { |
|
388 | 388 | // no specifics just yet... |
389 | 389 | default : |
390 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
391 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
390 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
391 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
392 | 392 | |
393 | 393 | } |
394 | 394 | } |
395 | - return $prefix . $class . $suffix; |
|
395 | + return $prefix.$class.$suffix; |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | |
@@ -408,50 +408,50 @@ discard block |
||
408 | 408 | * @param string $cur_code_span_class |
409 | 409 | * @return string the html output for the formatted money value |
410 | 410 | */ |
411 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
411 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
412 | 412 | // ensure amount was received |
413 | - if ( is_null( $amount ) ) { |
|
414 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
415 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
413 | + if (is_null($amount)) { |
|
414 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
415 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
416 | 416 | return ''; |
417 | 417 | } |
418 | 418 | //ensure amount is float |
419 | 419 | $amount = (float) $amount; |
420 | 420 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
421 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
421 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
422 | 422 | // still a number or was amount converted to a string like "free" ? |
423 | - if ( is_float( $amount_formatted )) { |
|
423 | + if (is_float($amount_formatted)) { |
|
424 | 424 | // was a country ISO code passed ? if so generate currency config object for that country |
425 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
425 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
426 | 426 | // verify results |
427 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
427 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
428 | 428 | // set default config country currency settings |
429 | 429 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
430 | 430 | } |
431 | 431 | // format float |
432 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
432 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
433 | 433 | // add formatting ? |
434 | - if ( ! $return_raw ) { |
|
434 | + if ( ! $return_raw) { |
|
435 | 435 | // add currency sign |
436 | - if( $mny->sign_b4 ){ |
|
437 | - if( $amount >= 0 ){ |
|
438 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
439 | - }else{ |
|
440 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
436 | + if ($mny->sign_b4) { |
|
437 | + if ($amount >= 0) { |
|
438 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
439 | + } else { |
|
440 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
441 | 441 | } |
442 | 442 | |
443 | - }else{ |
|
444 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
443 | + } else { |
|
444 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | // add currency code ? |
448 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
448 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
449 | 449 | } |
450 | 450 | // filter results |
451 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
451 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
452 | 452 | } |
453 | 453 | // clean up vars |
454 | - unset( $mny ); |
|
454 | + unset($mny); |
|
455 | 455 | // return formatted currency amount |
456 | 456 | return $amount_formatted; |
457 | 457 | } |
@@ -466,11 +466,11 @@ discard block |
||
466 | 466 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
467 | 467 | * @return string The localized label for the status id. |
468 | 468 | */ |
469 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
469 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
470 | 470 | /** @type EEM_Status $EEM_Status */ |
471 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
472 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
473 | - return $status[ $status_id ]; |
|
471 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
472 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
473 | + return $status[$status_id]; |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | |
@@ -483,9 +483,9 @@ discard block |
||
483 | 483 | * @param string $icon |
484 | 484 | * @return string the html output for the button |
485 | 485 | */ |
486 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) { |
|
487 | - $label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label; |
|
488 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>'; |
|
486 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') { |
|
487 | + $label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label; |
|
488 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>'; |
|
489 | 489 | return $button; |
490 | 490 | } |
491 | 491 | |
@@ -502,21 +502,21 @@ discard block |
||
502 | 502 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
503 | 503 | * @return string generated link |
504 | 504 | */ |
505 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
505 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
506 | 506 | |
507 | - if ( ! $page ) |
|
508 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
507 | + if ( ! $page) |
|
508 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
509 | 509 | |
510 | - if ( ! $action ) |
|
511 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
510 | + if ( ! $action) |
|
511 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
512 | 512 | |
513 | 513 | $action = empty($action) ? 'default' : $action; |
514 | 514 | |
515 | 515 | |
516 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
517 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
518 | - $help_text = !$help_text ? '' : $help_text; |
|
519 | - return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>'; |
|
516 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
517 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
518 | + $help_text = ! $help_text ? '' : $help_text; |
|
519 | + return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>'; |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | |
@@ -528,31 +528,31 @@ discard block |
||
528 | 528 | * @param EE_Help_Tour |
529 | 529 | * @return string html |
530 | 530 | */ |
531 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
531 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
532 | 532 | $id = $tour->get_slug(); |
533 | 533 | $stops = $tour->get_stops(); |
534 | 534 | |
535 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
535 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
536 | 536 | |
537 | - foreach ( $stops as $stop ) { |
|
538 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
539 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
537 | + foreach ($stops as $stop) { |
|
538 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
539 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
540 | 540 | |
541 | 541 | //if container is set to modal then let's make sure we set the options accordingly |
542 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
542 | + if (empty($data_id) && empty($data_class)) { |
|
543 | 543 | $stop['options']['modal'] = true; |
544 | 544 | $stop['options']['expose'] = true; |
545 | 545 | } |
546 | 546 | |
547 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
548 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
547 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
548 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
549 | 549 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
550 | 550 | |
551 | 551 | //options |
552 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
552 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
553 | 553 | $options = ' data-options="'; |
554 | - foreach ( $stop['options'] as $option => $value ) { |
|
555 | - $options .= $option . ':' . $value . ';'; |
|
554 | + foreach ($stop['options'] as $option => $value) { |
|
555 | + $options .= $option.':'.$value.';'; |
|
556 | 556 | } |
557 | 557 | $options .= '"'; |
558 | 558 | } else { |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | } |
561 | 561 | |
562 | 562 | //let's put all together |
563 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
563 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | $content .= '</ol>'; |
@@ -581,31 +581,31 @@ discard block |
||
581 | 581 | * @throws EE_Error |
582 | 582 | * @return string html structure for status. |
583 | 583 | */ |
584 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
585 | - if ( !is_array( $status_array ) ) |
|
586 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
584 | + public static function status_legend($status_array, $active_status = '') { |
|
585 | + if ( ! is_array($status_array)) |
|
586 | + throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
587 | 587 | |
588 | 588 | $setup_array = array(); |
589 | - foreach ( $status_array as $item => $status ) { |
|
589 | + foreach ($status_array as $item => $status) { |
|
590 | 590 | $setup_array[$item] = array( |
591 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
592 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
591 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
592 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
593 | 593 | 'status' => $status |
594 | 594 | ); |
595 | 595 | } |
596 | 596 | |
597 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
598 | - $content .= '<h3>' . __('Status Legend', 'event_espresso') . '</h3>' . "\n"; |
|
599 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
600 | - foreach ( $setup_array as $item => $details ) { |
|
597 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
598 | + $content .= '<h3>'.__('Status Legend', 'event_espresso').'</h3>'."\n"; |
|
599 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
600 | + foreach ($setup_array as $item => $details) { |
|
601 | 601 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
602 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
603 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
604 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
605 | - $content .= '</dt>' . "\n"; |
|
602 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
603 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
604 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
605 | + $content .= '</dt>'."\n"; |
|
606 | 606 | } |
607 | - $content .= '</dl>' . "\n"; |
|
608 | - $content .= '</div>' . "\n"; |
|
607 | + $content .= '</dl>'."\n"; |
|
608 | + $content .= '</div>'."\n"; |
|
609 | 609 | return $content; |
610 | 610 | } |
611 | 611 | |
@@ -618,8 +618,8 @@ discard block |
||
618 | 618 | * @return string |
619 | 619 | */ |
620 | 620 | public static function layout_array_as_table($data) { |
621 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
622 | - $data = (array)$data; |
|
621 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
622 | + $data = (array) $data; |
|
623 | 623 | } |
624 | 624 | EE_Registry::instance()->load_helper('Array'); |
625 | 625 | ob_start(); |
@@ -633,10 +633,10 @@ discard block |
||
633 | 633 | ?> |
634 | 634 | <tr> |
635 | 635 | <td> |
636 | - <?php echo $data_key;?> |
|
636 | + <?php echo $data_key; ?> |
|
637 | 637 | </td> |
638 | 638 | <td> |
639 | - <?php echo self::layout_array_as_table($data_values);?> |
|
639 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
640 | 640 | </td> |
641 | 641 | </tr> |
642 | 642 | <?php |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | <ul> |
651 | 651 | <?php |
652 | 652 | foreach ($data as $datum) { |
653 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
653 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
654 | 654 | }?> |
655 | 655 | </ul> |
656 | 656 | <?php |
@@ -680,8 +680,8 @@ discard block |
||
680 | 680 | * |
681 | 681 | * @return string |
682 | 682 | */ |
683 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
684 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
683 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
684 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | |
@@ -705,13 +705,13 @@ discard block |
||
705 | 705 | * ) |
706 | 706 | * @return string |
707 | 707 | */ |
708 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
708 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
709 | 709 | $page_links = array(); |
710 | 710 | $disable_first = $disable_last = ''; |
711 | 711 | $total_items = (int) $total_items; |
712 | 712 | $per_page = (int) $per_page; |
713 | 713 | $current = (int) $current; |
714 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
714 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
715 | 715 | |
716 | 716 | //filter items_label |
717 | 717 | $items_label = apply_filters( |
@@ -719,68 +719,68 @@ discard block |
||
719 | 719 | $items_label |
720 | 720 | ); |
721 | 721 | |
722 | - if ( empty( $items_label ) |
|
723 | - || ! is_array( $items_label ) |
|
724 | - || ! isset( $items_label['single'] ) |
|
725 | - || ! isset( $items_label['plural'] ) ) { |
|
722 | + if (empty($items_label) |
|
723 | + || ! is_array($items_label) |
|
724 | + || ! isset($items_label['single']) |
|
725 | + || ! isset($items_label['plural'])) { |
|
726 | 726 | $items_label = array( |
727 | - 'single' => __( '1 item', 'event_espresso' ), |
|
728 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
727 | + 'single' => __('1 item', 'event_espresso'), |
|
728 | + 'plural' => __('%s items', 'event_espresso') |
|
729 | 729 | ); |
730 | 730 | } else { |
731 | 731 | $items_label = array( |
732 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
733 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
732 | + 'single' => '1 '.esc_html($items_label['single']), |
|
733 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
734 | 734 | ); |
735 | 735 | } |
736 | 736 | |
737 | - $total_pages = ceil( $total_items / $per_page ); |
|
737 | + $total_pages = ceil($total_items / $per_page); |
|
738 | 738 | |
739 | - if ( $total_pages <= 1 ) |
|
739 | + if ($total_pages <= 1) |
|
740 | 740 | return ''; |
741 | 741 | |
742 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
742 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
743 | 743 | |
744 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
744 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
745 | 745 | |
746 | - if ( $current === 1 ) { |
|
746 | + if ($current === 1) { |
|
747 | 747 | $disable_first = ' disabled'; |
748 | 748 | } |
749 | - if ( $current == $total_pages ) { |
|
749 | + if ($current == $total_pages) { |
|
750 | 750 | $disable_last = ' disabled'; |
751 | 751 | } |
752 | 752 | |
753 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
754 | - 'first-page' . $disable_first, |
|
755 | - esc_attr__( 'Go to the first page' ), |
|
756 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
753 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
754 | + 'first-page'.$disable_first, |
|
755 | + esc_attr__('Go to the first page'), |
|
756 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
757 | 757 | '«' |
758 | 758 | ); |
759 | 759 | |
760 | 760 | $page_links[] = sprintf( |
761 | 761 | '<a class="%s" title="%s" href="%s">%s</a>', |
762 | - 'prev-page' . $disable_first, |
|
763 | - esc_attr__( 'Go to the previous page' ), |
|
764 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
762 | + 'prev-page'.$disable_first, |
|
763 | + esc_attr__('Go to the previous page'), |
|
764 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
765 | 765 | '‹' |
766 | 766 | ); |
767 | 767 | |
768 | - if ( ! $show_num_field ) { |
|
768 | + if ( ! $show_num_field) { |
|
769 | 769 | $html_current_page = $current; |
770 | 770 | } else { |
771 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
772 | - esc_attr__( 'Current page' ), |
|
771 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
772 | + esc_attr__('Current page'), |
|
773 | 773 | $current, |
774 | - strlen( $total_pages ) |
|
774 | + strlen($total_pages) |
|
775 | 775 | ); |
776 | 776 | } |
777 | 777 | |
778 | 778 | $html_total_pages = sprintf( |
779 | 779 | '<span class="total-pages">%s</span>', |
780 | - number_format_i18n( $total_pages ) |
|
780 | + number_format_i18n($total_pages) |
|
781 | 781 | ); |
782 | 782 | $page_links[] = sprintf( |
783 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
783 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
784 | 784 | $html_current_page, |
785 | 785 | $html_total_pages, |
786 | 786 | '<span class="paging-input">', |
@@ -789,29 +789,29 @@ discard block |
||
789 | 789 | |
790 | 790 | $page_links[] = sprintf( |
791 | 791 | '<a class="%s" title="%s" href="%s">%s</a>', |
792 | - 'next-page' . $disable_last, |
|
793 | - esc_attr__( 'Go to the next page' ), |
|
794 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
792 | + 'next-page'.$disable_last, |
|
793 | + esc_attr__('Go to the next page'), |
|
794 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
795 | 795 | '›' |
796 | 796 | ); |
797 | 797 | |
798 | 798 | $page_links[] = sprintf( |
799 | 799 | '<a class="%s" title="%s" href="%s">%s</a>', |
800 | - 'last-page' . $disable_last, |
|
801 | - esc_attr__( 'Go to the last page' ), |
|
802 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
800 | + 'last-page'.$disable_last, |
|
801 | + esc_attr__('Go to the last page'), |
|
802 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
803 | 803 | '»' |
804 | 804 | ); |
805 | 805 | |
806 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
806 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
807 | 807 | // set page class |
808 | - if ( $total_pages ) { |
|
808 | + if ($total_pages) { |
|
809 | 809 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
810 | 810 | } else { |
811 | 811 | $page_class = ' no-pages'; |
812 | 812 | } |
813 | 813 | |
814 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
814 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
815 | 815 | } |
816 | 816 | |
817 | 817 |
@@ -1,26 +1,26 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
11 | - * @ link {@link http://www.eventespresso.com} |
|
12 | - * @ since 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * Registrations Table class |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage includes/admin_screens/Registrations_List_Table.class.php |
|
20 | - * @author Brent Christensen |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
11 | + * @ link {@link http://www.eventespresso.com} |
|
12 | + * @ since 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * Registrations Table class |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage includes/admin_screens/Registrations_List_Table.class.php |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | |
25 | 25 | |
26 | 26 | class EE_Registrations_List_Table extends EE_Admin_List_Table { |
@@ -332,12 +332,12 @@ discard block |
||
332 | 332 | * @param \EE_Registration $item |
333 | 333 | * @return string |
334 | 334 | */ |
335 | - function column_cb($item){ |
|
335 | + function column_cb($item){ |
|
336 | 336 | /** checkbox/lock **/ |
337 | 337 | $transaction = $item->get_first_related( 'Transaction' ); |
338 | 338 | $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
339 | 339 | return $payment_count > 0 ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) . '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ); |
340 | - } |
|
340 | + } |
|
341 | 341 | |
342 | 342 | |
343 | 343 | |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | function column__REG_date(EE_Registration $item){ |
373 | 373 | $this->_set_related_details($item); |
374 | - //Build row actions |
|
374 | + //Build row actions |
|
375 | 375 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
376 | 376 | $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
377 | 377 | $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>'; |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | } else { |
424 | 424 | return __( 'There is no ticket on this registration', 'event_espresso' ); |
425 | 425 | } |
426 | - } |
|
426 | + } |
|
427 | 427 | |
428 | 428 | |
429 | 429 | |
@@ -445,14 +445,14 @@ discard block |
||
445 | 445 | $t = $item->get_first_related('Transaction'); |
446 | 446 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
447 | 447 | |
448 | - //append group count to name |
|
449 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
448 | + //append group count to name |
|
449 | + $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
450 | 450 | |
451 | - //append reg_code |
|
452 | - $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
451 | + //append reg_code |
|
452 | + $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
453 | 453 | |
454 | - //reg status text for accessibility |
|
455 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
454 | + //reg status text for accessibility |
|
455 | + $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
456 | 456 | |
457 | 457 | //trash/restore/delete actions |
458 | 458 | $actions = array(); |
@@ -57,20 +57,20 @@ discard block |
||
57 | 57 | * @param \EE_Admin_Page $admin_page |
58 | 58 | * @return EE_Registrations_List_Table |
59 | 59 | */ |
60 | - function __construct( $admin_page ){ |
|
60 | + function __construct($admin_page) { |
|
61 | 61 | |
62 | - if ( ! empty( $_GET['event_id'] ) ) { |
|
62 | + if ( ! empty($_GET['event_id'])) { |
|
63 | 63 | $extra_query_args = array(); |
64 | - foreach ( $admin_page->get_views() as $key => $view_details ) { |
|
65 | - $extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] ); |
|
64 | + foreach ($admin_page->get_views() as $key => $view_details) { |
|
65 | + $extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']); |
|
66 | 66 | } |
67 | - $this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args ); |
|
67 | + $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | parent::__construct($admin_page); |
71 | 71 | $this->_status = $this->_admin_page->get_registration_status_array(); |
72 | 72 | |
73 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
73 | + EE_Registry::instance()->load_helper('Template'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | * @return void |
82 | 82 | */ |
83 | 83 | protected function _setup_data() { |
84 | - $this->_data = $this->_admin_page->get_registrations( $this->_per_page ); |
|
85 | - $this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE ); |
|
84 | + $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
85 | + $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -101,45 +101,45 @@ discard block |
||
101 | 101 | ); |
102 | 102 | |
103 | 103 | |
104 | - if ( isset( $_GET['event_id'] )) { |
|
104 | + if (isset($_GET['event_id'])) { |
|
105 | 105 | $this->_columns = array( |
106 | 106 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
107 | - '_REG_ID' => __( 'ID', 'event_espresso' ), |
|
108 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
107 | + '_REG_ID' => __('ID', 'event_espresso'), |
|
108 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
109 | 109 | 'ATT_email' => __('Email', 'event_espresso'), |
110 | - '_REG_date' => __( 'Reg Date', 'event_espresso' ), |
|
111 | - 'PRC_amount' => __( 'TKT Price', 'event_espresso' ), |
|
112 | - '_REG_final_price' => __( 'Final Price', 'event_espresso' ), |
|
113 | - 'TXN_total' => __( 'Total Txn', 'event_espresso' ), |
|
110 | + '_REG_date' => __('Reg Date', 'event_espresso'), |
|
111 | + 'PRC_amount' => __('TKT Price', 'event_espresso'), |
|
112 | + '_REG_final_price' => __('Final Price', 'event_espresso'), |
|
113 | + 'TXN_total' => __('Total Txn', 'event_espresso'), |
|
114 | 114 | 'TXN_paid' => __('Paid', 'event_espresso'), |
115 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
115 | + 'actions' => __('Actions', 'event_espresso') |
|
116 | 116 | ); |
117 | 117 | $this->_bottom_buttons = array( |
118 | 118 | 'report'=> array( |
119 | 119 | 'route' => 'registrations_report', |
120 | 120 | 'extra_request' => |
121 | 121 | array( |
122 | - 'EVT_ID'=> isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null, |
|
123 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) ) |
|
122 | + 'EVT_ID'=> isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, |
|
123 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
124 | 124 | ), |
125 | 125 | ); |
126 | 126 | } else { |
127 | 127 | $this->_columns = array( |
128 | 128 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
129 | - '_REG_ID' => __( 'ID', 'event_espresso' ), |
|
130 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
131 | - '_REG_date' => __( 'TXN Date', 'event_espresso' ), |
|
132 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
133 | - 'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ), |
|
134 | - '_REG_final_price' => __( 'Price', 'event_espresso' ), |
|
135 | - '_REG_paid' => __( 'Paid', 'event_espresso' ), |
|
136 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
129 | + '_REG_ID' => __('ID', 'event_espresso'), |
|
130 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
131 | + '_REG_date' => __('TXN Date', 'event_espresso'), |
|
132 | + 'event_name' => __('Event', 'event_espresso'), |
|
133 | + 'DTT_EVT_start' => __('Event Date', 'event_espresso'), |
|
134 | + '_REG_final_price' => __('Price', 'event_espresso'), |
|
135 | + '_REG_paid' => __('Paid', 'event_espresso'), |
|
136 | + 'actions' => __('Actions', 'event_espresso') |
|
137 | 137 | ); |
138 | 138 | $this->_bottom_buttons = array( |
139 | 139 | 'report_all'=> array( |
140 | 140 | 'route' => 'registrations_report', |
141 | 141 | 'extra_request' => array( |
142 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) ) |
|
142 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
143 | 143 | ), |
144 | 144 | ); |
145 | 145 | } |
@@ -147,11 +147,11 @@ discard block |
||
147 | 147 | $this->_primary_column = '_REG_ID'; |
148 | 148 | |
149 | 149 | $this->_sortable_columns = array( |
150 | - '_REG_date' => array( '_REG_date' => TRUE ), //true means its already sorted |
|
151 | - 'ATT_fname' => array( 'ATT_fname' => FALSE ), |
|
152 | - 'event_name' => array( 'event_name' => FALSE ), |
|
153 | - 'DTT_EVT_start' => array( 'DTT_EVT_start' => FALSE ), |
|
154 | - '_REG_ID' => array( '_REG_ID' => FALSE ), |
|
150 | + '_REG_date' => array('_REG_date' => TRUE), //true means its already sorted |
|
151 | + 'ATT_fname' => array('ATT_fname' => FALSE), |
|
152 | + 'event_name' => array('event_name' => FALSE), |
|
153 | + 'DTT_EVT_start' => array('DTT_EVT_start' => FALSE), |
|
154 | + '_REG_ID' => array('_REG_ID' => FALSE), |
|
155 | 155 | ); |
156 | 156 | |
157 | 157 | $this->_hidden_columns = array(); |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | |
161 | 161 | |
162 | 162 | |
163 | - protected function _get_row_class( $item ) { |
|
164 | - $class = parent::_get_row_class( $item ); |
|
163 | + protected function _get_row_class($item) { |
|
164 | + $class = parent::_get_row_class($item); |
|
165 | 165 | //add status class |
166 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
167 | - if ( $this->_has_checkbox_column ) { |
|
166 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
167 | + if ($this->_has_checkbox_column) { |
|
168 | 168 | $class .= ' has-checkbox-column'; |
169 | 169 | } |
170 | 170 | return $class; |
@@ -177,15 +177,15 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @param EE_Registration $registration |
179 | 179 | */ |
180 | - protected function _set_related_details( EE_Registration $registration ) { |
|
180 | + protected function _set_related_details(EE_Registration $registration) { |
|
181 | 181 | |
182 | - $transaction = $registration->get_first_related( 'Transaction' ); |
|
182 | + $transaction = $registration->get_first_related('Transaction'); |
|
183 | 183 | $status = $transaction instanceof EE_Transaction ? $transaction->status_ID() : EEM_Transaction::failed_status_code; |
184 | 184 | $this->_transaction_details = array( |
185 | 185 | 'transaction' => $transaction, |
186 | 186 | 'status' => $status, |
187 | 187 | 'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0, |
188 | - 'title_attr' => sprintf( __('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) ) |
|
188 | + 'title_attr' => sprintf(__('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence')) |
|
189 | 189 | ); |
190 | 190 | |
191 | 191 | $event = $registration->event(); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | 'event' => $event, |
195 | 195 | 'status' => $status, |
196 | 196 | 'id' => $event instanceof EE_Event ? $event->ID() : 0, |
197 | - 'title_attr' => sprintf( __('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) ) |
|
197 | + 'title_attr' => sprintf(__('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence')) |
|
198 | 198 | ); |
199 | 199 | } |
200 | 200 | |
@@ -209,26 +209,26 @@ discard block |
||
209 | 209 | $filters = array(); |
210 | 210 | |
211 | 211 | //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods. |
212 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
212 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
213 | 213 | |
214 | - $cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : ''; |
|
215 | - $cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1; |
|
216 | - $reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : ''; |
|
214 | + $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
215 | + $cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
216 | + $reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : ''; |
|
217 | 217 | |
218 | - $filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category ); |
|
219 | - $filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category ); |
|
218 | + $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
219 | + $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
220 | 220 | |
221 | 221 | $status = array(); |
222 | - $status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') ); |
|
223 | - foreach ( $this->_status as $key => $value ) { |
|
224 | - $status[] = array( 'id' => $key, 'text' => $value ); |
|
222 | + $status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso')); |
|
223 | + foreach ($this->_status as $key => $value) { |
|
224 | + $status[] = array('id' => $key, 'text' => $value); |
|
225 | 225 | } |
226 | - if ( $this->_view != 'incomplete' ) { |
|
227 | - $filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset( $this->_req_data['_reg_status'] ) ? strtoupper( sanitize_key( $this->_req_data['_reg_status'] )) : '' ); |
|
226 | + if ($this->_view != 'incomplete') { |
|
227 | + $filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) : ''); |
|
228 | 228 | } |
229 | 229 | |
230 | - if ( isset( $this->_req_data['event_id'] ) ) { |
|
231 | - $filters[] = EEH_Form_Fields::hidden_input( 'event_id', $this->_req_data['event_id'], 'reg_event_id' ); |
|
230 | + if (isset($this->_req_data['event_id'])) { |
|
231 | + $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | return $filters; |
@@ -245,9 +245,9 @@ discard block |
||
245 | 245 | $this->_views['all']['count'] = $this->_total_registrations(); |
246 | 246 | $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
247 | 247 | $this->_views['today']['count'] = $this->_total_registrations_today(); |
248 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) { |
|
249 | - $this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' ); |
|
250 | - $this->_views['trash']['count'] = $this->_total_registrations( 'trash' ); |
|
248 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) { |
|
249 | + $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
250 | + $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
@@ -259,23 +259,23 @@ discard block |
||
259 | 259 | * @param string $view |
260 | 260 | * @return int |
261 | 261 | */ |
262 | - protected function _total_registrations( $view = '' ){ |
|
262 | + protected function _total_registrations($view = '') { |
|
263 | 263 | $_where = array(); |
264 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
265 | - if( $EVT_ID ) { |
|
264 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
265 | + if ($EVT_ID) { |
|
266 | 266 | $_where['EVT_ID'] = $EVT_ID; |
267 | 267 | } |
268 | - switch ( $view ) { |
|
268 | + switch ($view) { |
|
269 | 269 | case 'trash' : |
270 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
270 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
271 | 271 | break; |
272 | 272 | case 'incomplete' : |
273 | 273 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
274 | 274 | break; |
275 | 275 | default : |
276 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
276 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
277 | 277 | } |
278 | - return EEM_Registration::instance()->count( array( $_where )); |
|
278 | + return EEM_Registration::instance()->count(array($_where)); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | |
@@ -285,24 +285,24 @@ discard block |
||
285 | 285 | * @access protected |
286 | 286 | * @return int |
287 | 287 | */ |
288 | - protected function _total_registrations_this_month(){ |
|
289 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
290 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
288 | + protected function _total_registrations_this_month() { |
|
289 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
290 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
291 | 291 | $this_year_r = date('Y', current_time('timestamp')); |
292 | 292 | $time_start = ' 00:00:00'; |
293 | 293 | $time_end = ' 23:59:59'; |
294 | 294 | $this_month_r = date('m', current_time('timestamp')); |
295 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
295 | + $days_this_month = date('t', current_time('timestamp')); |
|
296 | 296 | //setup date query. |
297 | - $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ); |
|
298 | - $end_string = EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ); |
|
299 | - $_where['REG_date']= array('BETWEEN', |
|
297 | + $beginning_string = EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'); |
|
298 | + $end_string = EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s'); |
|
299 | + $_where['REG_date'] = array('BETWEEN', |
|
300 | 300 | array( |
301 | 301 | $beginning_string, |
302 | 302 | $end_string |
303 | 303 | )); |
304 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
305 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
304 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
305 | + return EEM_Registration::instance()->count(array($_where)); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | |
@@ -312,20 +312,20 @@ discard block |
||
312 | 312 | * @access protected |
313 | 313 | * @return int |
314 | 314 | */ |
315 | - protected function _total_registrations_today(){ |
|
315 | + protected function _total_registrations_today() { |
|
316 | 316 | |
317 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
318 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
317 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
318 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
319 | 319 | $current_date = date('Y-m-d', current_time('timestamp')); |
320 | 320 | $time_start = ' 00:00:00'; |
321 | 321 | $time_end = ' 23:59:59'; |
322 | - $_where['REG_date']= array('BETWEEN', |
|
322 | + $_where['REG_date'] = array('BETWEEN', |
|
323 | 323 | array( |
324 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_start, 'Y-m-d H:i:s' ), |
|
325 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_end, 'Y-m-d H:i:s' ) |
|
324 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'), |
|
325 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s') |
|
326 | 326 | )); |
327 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
328 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
327 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
328 | + return EEM_Registration::instance()->count(array($_where)); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | * @param \EE_Registration $item |
338 | 338 | * @return string |
339 | 339 | */ |
340 | - function column_cb($item){ |
|
340 | + function column_cb($item) { |
|
341 | 341 | /** checkbox/lock **/ |
342 | - $transaction = $item->get_first_related( 'Transaction' ); |
|
343 | - $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
|
344 | - return $payment_count > 0 ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) . '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ); |
|
342 | + $transaction = $item->get_first_related('Transaction'); |
|
343 | + $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0; |
|
344 | + return $payment_count > 0 ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()).'<span class="ee-lock-icon"></span>' : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
@@ -353,14 +353,14 @@ discard block |
||
353 | 353 | * @param \EE_Registration $item |
354 | 354 | * @return string |
355 | 355 | */ |
356 | - function column__REG_ID(EE_Registration $item){ |
|
356 | + function column__REG_ID(EE_Registration $item) { |
|
357 | 357 | $attendee = $item->attendee(); |
358 | 358 | $content = $item->ID(); |
359 | 359 | $content .= '<div class="show-on-mobile-view-only">'; |
360 | 360 | $content .= '<br>'; |
361 | 361 | $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
362 | - $content .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
363 | - $content .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
362 | + $content .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
363 | + $content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
364 | 364 | $content .= '</div>'; |
365 | 365 | return $content; |
366 | 366 | } |
@@ -374,12 +374,12 @@ discard block |
||
374 | 374 | * @param \EE_Registration $item |
375 | 375 | * @return string |
376 | 376 | */ |
377 | - function column__REG_date(EE_Registration $item){ |
|
377 | + function column__REG_date(EE_Registration $item) { |
|
378 | 378 | $this->_set_related_details($item); |
379 | 379 | //Build row actions |
380 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
381 | - $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
|
382 | - $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>'; |
|
380 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL); |
|
381 | + $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date'); |
|
382 | + $view_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence').'</span>'; |
|
383 | 383 | return $view_link; |
384 | 384 | } |
385 | 385 | |
@@ -392,18 +392,18 @@ discard block |
||
392 | 392 | * @param \EE_Registration $item |
393 | 393 | * @return string |
394 | 394 | */ |
395 | - function column_event_name(EE_Registration $item){ |
|
396 | - $this->_set_related_details( $item ); |
|
395 | + function column_event_name(EE_Registration $item) { |
|
396 | + $this->_set_related_details($item); |
|
397 | 397 | // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62 |
398 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$item->event_ID() ), EVENTS_ADMIN_URL ); |
|
398 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$item->event_ID()), EVENTS_ADMIN_URL); |
|
399 | 399 | $event_name = $item->event_name(); |
400 | 400 | $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso'); |
401 | - $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID() ) ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr( $this->_event_details['title_attr'] ) .'">' . wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ) ; |
|
401 | + $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID()) ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'); |
|
402 | 402 | |
403 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'event_id'=>$item->event_ID() ), REG_ADMIN_URL ); |
|
404 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Filter this list to only show registrations for %s', 'event_espresso' ), $event_name ) .'">' . __( 'View Registrations', 'event_espresso' ) . '</a>'; |
|
403 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id'=>$item->event_ID()), REG_ADMIN_URL); |
|
404 | + $actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), $event_name).'">'.__('View Registrations', 'event_espresso').'</a>'; |
|
405 | 405 | |
406 | - return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) ); |
|
406 | + return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | |
@@ -415,18 +415,18 @@ discard block |
||
415 | 415 | * @param \EE_Registration $item |
416 | 416 | * @return string |
417 | 417 | */ |
418 | - function column_DTT_EVT_start(EE_Registration $item){ |
|
418 | + function column_DTT_EVT_start(EE_Registration $item) { |
|
419 | 419 | $datetime_strings = array(); |
420 | - $ticket = $item->ticket( TRUE ); |
|
421 | - if ( $ticket instanceof EE_Ticket ) { |
|
420 | + $ticket = $item->ticket(TRUE); |
|
421 | + if ($ticket instanceof EE_Ticket) { |
|
422 | 422 | $remove_defaults = array('default_where_conditions' => 'none'); |
423 | 423 | $datetimes = $ticket->datetimes($remove_defaults); |
424 | - foreach($datetimes as $datetime){ |
|
425 | - $datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
424 | + foreach ($datetimes as $datetime) { |
|
425 | + $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
426 | 426 | } |
427 | - return implode("<br />",$datetime_strings); |
|
427 | + return implode("<br />", $datetime_strings); |
|
428 | 428 | } else { |
429 | - return __( 'There is no ticket on this registration', 'event_espresso' ); |
|
429 | + return __('There is no ticket on this registration', 'event_espresso'); |
|
430 | 430 | } |
431 | 431 | } |
432 | 432 | |
@@ -439,45 +439,45 @@ discard block |
||
439 | 439 | * @param \EE_Registration $item |
440 | 440 | * @return string |
441 | 441 | */ |
442 | - function column_ATT_fname(EE_Registration $item){ |
|
442 | + function column_ATT_fname(EE_Registration $item) { |
|
443 | 443 | $attendee = $item->attendee(); |
444 | 444 | |
445 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
445 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
446 | 446 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
447 | - $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' : $attendee_name; |
|
447 | + $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>' : $attendee_name; |
|
448 | 448 | $link .= $item->count() == 1 ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : ''; |
449 | 449 | |
450 | 450 | $t = $item->get_first_related('Transaction'); |
451 | 451 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
452 | 452 | |
453 | 453 | //append group count to name |
454 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
454 | + $link .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
455 | 455 | |
456 | 456 | //append reg_code |
457 | - $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
457 | + $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
458 | 458 | |
459 | 459 | //reg status text for accessibility |
460 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
460 | + $link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
461 | 461 | |
462 | 462 | //trash/restore/delete actions |
463 | 463 | $actions = array(); |
464 | - if ( $this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) { |
|
465 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
466 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>'; |
|
467 | - } elseif ( $this->_view == 'trash' ) { |
|
464 | + if ($this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) { |
|
465 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
466 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
467 | + } elseif ($this->_view == 'trash') { |
|
468 | 468 | // restore registration link |
469 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) { |
|
470 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
471 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
469 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) { |
|
470 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
471 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
472 | 472 | } |
473 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) { |
|
474 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
473 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) { |
|
474 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
475 | 475 | |
476 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>'; |
|
476 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>'; |
|
477 | 477 | } |
478 | 478 | } |
479 | 479 | |
480 | - return sprintf('%1$s %2$s', $link, $this->row_actions($actions) ); |
|
480 | + return sprintf('%1$s %2$s', $link, $this->row_actions($actions)); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | * @param \EE_Registration $item |
490 | 490 | * @return string |
491 | 491 | */ |
492 | - function column_ATT_email( EE_Registration $item ) { |
|
492 | + function column_ATT_email(EE_Registration $item) { |
|
493 | 493 | $attendee = $item->get_first_related('Attendee'); |
494 | 494 | return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email(); |
495 | 495 | } |
@@ -503,8 +503,8 @@ discard block |
||
503 | 503 | * @param \EE_Registration $item |
504 | 504 | * @return string |
505 | 505 | */ |
506 | - function column__REG_count(EE_Registration $item){ |
|
507 | - return sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size()); |
|
506 | + function column__REG_count(EE_Registration $item) { |
|
507 | + return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size()); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
@@ -516,16 +516,16 @@ discard block |
||
516 | 516 | * @param \EE_Registration $item |
517 | 517 | * @return string |
518 | 518 | */ |
519 | - function column_PRC_amount(EE_Registration $item){ |
|
519 | + function column_PRC_amount(EE_Registration $item) { |
|
520 | 520 | $ticket = $item->ticket(); |
521 | 521 | |
522 | - $content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : ''; |
|
522 | + $content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : ''; |
|
523 | 523 | |
524 | - if ( $item->final_price() > 0 ) { |
|
525 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
524 | + if ($item->final_price() > 0) { |
|
525 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
526 | 526 | } else { |
527 | 527 | // free event |
528 | - $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
528 | + $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>'; |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | return $content; |
@@ -541,11 +541,11 @@ discard block |
||
541 | 541 | * @param \EE_Registration $item |
542 | 542 | * @return string |
543 | 543 | */ |
544 | - function column__REG_final_price(EE_Registration $item){ |
|
544 | + function column__REG_final_price(EE_Registration $item) { |
|
545 | 545 | $ticket = $item->ticket(); |
546 | - $content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />'; |
|
546 | + $content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />'; |
|
547 | 547 | |
548 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
548 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
549 | 549 | return $content; |
550 | 550 | |
551 | 551 | } |
@@ -559,13 +559,13 @@ discard block |
||
559 | 559 | * @param \EE_Registration $item |
560 | 560 | * @return string |
561 | 561 | */ |
562 | - function column__REG_paid(EE_Registration $item){ |
|
562 | + function column__REG_paid(EE_Registration $item) { |
|
563 | 563 | $payment_method = $item->payment_method(); |
564 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' ); |
|
564 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); |
|
565 | 565 | |
566 | - $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
567 | - if ( $item->paid() > 0 ) { |
|
568 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>'; |
|
566 | + $content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>'; |
|
567 | + if ($item->paid() > 0) { |
|
568 | + $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; |
|
569 | 569 | } |
570 | 570 | return $content; |
571 | 571 | } |
@@ -579,11 +579,11 @@ discard block |
||
579 | 579 | * @param \EE_Registration $item |
580 | 580 | * @return string |
581 | 581 | */ |
582 | - function column_TXN_total(EE_Registration $item){ |
|
583 | - if($item->transaction()){ |
|
584 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
585 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
586 | - }else{ |
|
582 | + function column_TXN_total(EE_Registration $item) { |
|
583 | + if ($item->transaction()) { |
|
584 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
585 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>'; |
|
586 | + } else { |
|
587 | 587 | return __("None", "event_espresso"); |
588 | 588 | } |
589 | 589 | } |
@@ -597,15 +597,15 @@ discard block |
||
597 | 597 | * @param \EE_Registration $item |
598 | 598 | * @return string |
599 | 599 | */ |
600 | - function column_TXN_paid(EE_Registration $item){ |
|
600 | + function column_TXN_paid(EE_Registration $item) { |
|
601 | 601 | |
602 | - if ( $item->count() == 1 ) { |
|
602 | + if ($item->count() == 1) { |
|
603 | 603 | $transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance(); |
604 | - if ( $transaction->paid() >= $transaction->total() ) { |
|
604 | + if ($transaction->paid() >= $transaction->total()) { |
|
605 | 605 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
606 | 606 | } else { |
607 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
608 | - return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
607 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
608 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
609 | 609 | } |
610 | 610 | } |
611 | 611 | |
@@ -626,44 +626,44 @@ discard block |
||
626 | 626 | EE_Registry::instance()->load_helper('MSG_Template'); |
627 | 627 | $attendee = $item->attendee(); |
628 | 628 | $ticket = $item->ticket(); |
629 | - $this->_set_related_details( $item ); |
|
629 | + $this->_set_related_details($item); |
|
630 | 630 | |
631 | 631 | //Build row actions |
632 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
633 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL ); |
|
632 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
633 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL); |
|
634 | 634 | |
635 | 635 | // page=attendees&event_admin_reports=resend_email®istration_id=43653465634&event_id=2&form_action=resend_email |
636 | 636 | //$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID ); |
637 | - $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true ); |
|
637 | + $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true); |
|
638 | 638 | |
639 | 639 | |
640 | 640 | //Build row actions |
641 | - $view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? ' |
|
641 | + $view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? ' |
|
642 | 642 | <li> |
643 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
643 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
644 | 644 | <div class="dashicons dashicons-clipboard"></div> |
645 | 645 | </a> |
646 | 646 | </li>' : ''; |
647 | 647 | |
648 | - $edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) && $attendee instanceof EE_Attendee ?' |
|
648 | + $edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? ' |
|
649 | 649 | <li> |
650 | - <a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text"> |
|
650 | + <a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text"> |
|
651 | 651 | <div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div> |
652 | 652 | </a> |
653 | 653 | </li>' : ''; |
654 | 654 | |
655 | - $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? ' |
|
655 | + $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? ' |
|
656 | 656 | <li> |
657 | - <a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
657 | + <a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text"> |
|
658 | 658 | <div class="dashicons dashicons-email-alt"></div> |
659 | 659 | </a> |
660 | 660 | </li>' : ''; |
661 | 661 | |
662 | 662 | // page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb |
663 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
664 | - $view_txn_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? ' |
|
663 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL); |
|
664 | + $view_txn_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? ' |
|
665 | 665 | <li> |
666 | - <a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_txn_lnk_url.'" title="' . $this->_transaction_details['title_attr'] . '" class="tiny-text"> |
|
666 | + <a class="ee-status-color-' . $this->_transaction_details['status'].'" href="'.$view_txn_lnk_url.'" title="'.$this->_transaction_details['title_attr'].'" class="tiny-text"> |
|
667 | 667 | <div class="dashicons dashicons-cart"></div> |
668 | 668 | </a> |
669 | 669 | </li>' : ''; |
@@ -671,10 +671,10 @@ discard block |
||
671 | 671 | //invoice link |
672 | 672 | $dl_invoice_lnk_url = $item->invoice_url(); |
673 | 673 | //only show invoice link if message type is active. |
674 | - if ( $item->is_primary_registrant() && $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
674 | + if ($item->is_primary_registrant() && $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) { |
|
675 | 675 | $dl_invoice_lnk = ' |
676 | 676 | <li> |
677 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
677 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
678 | 678 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
679 | 679 | </a> |
680 | 680 | </li>'; |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | $dl_invoice_lnk = ''; |
683 | 683 | } |
684 | 684 | |
685 | - return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk . $dl_invoice_lnk, $item, 'ul', 'reg-overview-actions-ul' ); |
|
685 | + return $this->_action_string($view_lnk.$edit_lnk.$resend_reg_lnk.$view_txn_lnk.$dl_invoice_lnk, $item, 'ul', 'reg-overview-actions-ul'); |
|
686 | 686 | } |
687 | 687 | |
688 | 688 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @return EED_Core_Rest_Api |
23 | 23 | */ |
24 | 24 | public static function instance() { |
25 | - return parent::get_instance( __CLASS__ ); |
|
25 | + return parent::get_instance(__CLASS__); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | |
53 | 53 | |
54 | 54 | public static function set_hooks_both() { |
55 | - add_action( 'rest_api_init', array( 'EED_Core_REST_API', 'register_routes' ) ); |
|
56 | - add_filter( 'rest_route_data', array( 'EED_Core_REST_API', 'hide_old_endpoints' ), 10, 2 ); |
|
57 | - add_filter( 'rest_index', array( 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index' ) ); |
|
55 | + add_action('rest_api_init', array('EED_Core_REST_API', 'register_routes')); |
|
56 | + add_filter('rest_route_data', array('EED_Core_REST_API', 'hide_old_endpoints'), 10, 2); |
|
57 | + add_filter('rest_index', array('EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index')); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -63,16 +63,16 @@ discard block |
||
63 | 63 | * so we actually prefer to only do it when an EE plugin is activated or upgraded |
64 | 64 | */ |
65 | 65 | public static function register_routes() { |
66 | - foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) { |
|
67 | - foreach( $relative_urls as $endpoint => $routes ) { |
|
68 | - foreach( $routes as $route ) { |
|
66 | + foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) { |
|
67 | + foreach ($relative_urls as $endpoint => $routes) { |
|
68 | + foreach ($routes as $route) { |
|
69 | 69 | register_rest_route( |
70 | 70 | $namespace, |
71 | 71 | $endpoint, |
72 | 72 | array( |
73 | - 'callback' => $route[ 'callback' ], |
|
74 | - 'methods' => $route[ 'methods' ], |
|
75 | - 'args' => isset( $route[ 'args' ] ) ? $route[ 'args' ] : array(), |
|
73 | + 'callback' => $route['callback'], |
|
74 | + 'methods' => $route['methods'], |
|
75 | + 'args' => isset($route['args']) ? $route['args'] : array(), |
|
76 | 76 | ) |
77 | 77 | ); |
78 | 78 | } |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | * } |
90 | 90 | */ |
91 | 91 | public static function get_ee_route_data() { |
92 | - $ee_routes = get_option( self::saved_routes_option_names, null ); |
|
93 | - if( ! $ee_routes || ( defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE )){ |
|
92 | + $ee_routes = get_option(self::saved_routes_option_names, null); |
|
93 | + if ( ! $ee_routes || (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE)) { |
|
94 | 94 | self::save_ee_routes(); |
95 | - $ee_routes = get_option( self::saved_routes_option_names, array() ); |
|
95 | + $ee_routes = get_option(self::saved_routes_option_names, array()); |
|
96 | 96 | } |
97 | 97 | return $ee_routes; |
98 | 98 | } |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | * @return void |
104 | 104 | */ |
105 | 105 | public static function save_ee_routes() { |
106 | - if( EE_Maintenance_Mode::instance()->models_can_query() ){ |
|
106 | + if (EE_Maintenance_Mode::instance()->models_can_query()) { |
|
107 | 107 | $instance = self::instance(); |
108 | 108 | $routes = array_replace_recursive( |
109 | 109 | $instance->_register_config_routes(), |
110 | 110 | $instance->_register_meta_routes(), |
111 | 111 | $instance->_register_model_routes() |
112 | 112 | ); |
113 | - update_option( self::saved_routes_option_names, $routes, true ); |
|
113 | + update_option(self::saved_routes_option_names, $routes, true); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @return array @see get_ee_route_data |
120 | 120 | */ |
121 | 121 | protected function _register_model_routes() { |
122 | - EE_Registry::instance()->load_helper( 'Inflector' ); |
|
122 | + EE_Registry::instance()->load_helper('Inflector'); |
|
123 | 123 | $models_to_register = apply_filters( |
124 | 124 | 'FHEE__EED_Core_REST_API___register_model_routes', |
125 | 125 | EE_Registry::instance()->non_abstract_db_models |
@@ -128,23 +128,23 @@ discard block |
||
128 | 128 | unset($models_to_register['Extra_Meta']); |
129 | 129 | unset($models_to_register['Extra_Join']); |
130 | 130 | $model_routes = array( ); |
131 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
131 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
132 | 132 | |
133 | - foreach ( $models_to_register as $model_name => $model_classname ) { |
|
133 | + foreach ($models_to_register as $model_name => $model_classname) { |
|
134 | 134 | //yes we could just register one route for ALL models, but then they wouldn't show up in the index |
135 | - $ee_namespace = self::ee_api_namespace . $version; |
|
136 | - $plural_model_route = EEH_Inflector::pluralize_and_lower( $model_name ); |
|
137 | - $singular_model_route = $plural_model_route . '/(?P<id>\d+)' ; |
|
138 | - $model_routes[ $ee_namespace ][ $plural_model_route ] = array( |
|
135 | + $ee_namespace = self::ee_api_namespace.$version; |
|
136 | + $plural_model_route = EEH_Inflector::pluralize_and_lower($model_name); |
|
137 | + $singular_model_route = $plural_model_route.'/(?P<id>\d+)'; |
|
138 | + $model_routes[$ee_namespace][$plural_model_route] = array( |
|
139 | 139 | array( |
140 | 140 | 'callback' => array( |
141 | 141 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
142 | 142 | 'handle_request_get_all' ), |
143 | 143 | 'methods' => WP_REST_Server::READABLE, |
144 | 144 | 'hidden_endpoint' => $hidden_endpoint, |
145 | - 'args' => $this->_get_read_query_params( $model_name ), |
|
145 | + 'args' => $this->_get_read_query_params($model_name), |
|
146 | 146 | '_links' => array( |
147 | - 'self' => rest_url( $ee_namespace . $singular_model_route ), |
|
147 | + 'self' => rest_url($ee_namespace.$singular_model_route), |
|
148 | 148 | ) |
149 | 149 | ), |
150 | 150 | // array( |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | // 'hidden_endpoint' => $hidden_endpoint |
156 | 156 | // ) |
157 | 157 | ); |
158 | - $model_routes[ $ee_namespace ][ $singular_model_route ] = array( |
|
158 | + $model_routes[$ee_namespace][$singular_model_route] = array( |
|
159 | 159 | array( |
160 | 160 | 'callback' => array( |
161 | 161 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | 'include' => array( |
167 | 167 | 'required' => false, |
168 | 168 | 'default' => '*', |
169 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso' ), |
|
169 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso'), |
|
170 | 170 | ), |
171 | 171 | ) |
172 | 172 | ), |
@@ -179,20 +179,20 @@ discard block |
||
179 | 179 | // ), |
180 | 180 | ); |
181 | 181 | //@todo: also handle DELETE for a single item |
182 | - $model = EE_Registry::instance()->load_model( $model_classname ); |
|
183 | - foreach ( $model->relation_settings() as $relation_name => $relation_obj ) { |
|
182 | + $model = EE_Registry::instance()->load_model($model_classname); |
|
183 | + foreach ($model->relation_settings() as $relation_name => $relation_obj) { |
|
184 | 184 | $related_model_name_endpoint_part = EventEspresso\core\libraries\rest_api\controllers\model\Read::get_related_entity_name( |
185 | 185 | $relation_name, |
186 | 186 | $relation_obj |
187 | 187 | ); |
188 | - $model_routes[ $ee_namespace ][ $singular_model_route . '/' . $related_model_name_endpoint_part ] = array( |
|
188 | + $model_routes[$ee_namespace][$singular_model_route.'/'.$related_model_name_endpoint_part] = array( |
|
189 | 189 | array( |
190 | 190 | 'callback' => array( |
191 | 191 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
192 | 192 | 'handle_request_get_related' ), |
193 | 193 | 'methods' => WP_REST_Server::READABLE, |
194 | 194 | 'hidden_endpoint' => $hidden_endpoint, |
195 | - 'args' => $this->_get_read_query_params( $relation_name ), |
|
195 | + 'args' => $this->_get_read_query_params($relation_name), |
|
196 | 196 | ), |
197 | 197 | // array( |
198 | 198 | // 'callback' => array( |
@@ -215,47 +215,47 @@ discard block |
||
215 | 215 | * @param string $model_name eg 'Event' or 'Venue' |
216 | 216 | * @return array describing the args acceptable when querying this model |
217 | 217 | */ |
218 | - protected function _get_read_query_params( $model_name ) { |
|
219 | - $model = EE_Registry::instance()->load_model( $model_name ); |
|
218 | + protected function _get_read_query_params($model_name) { |
|
219 | + $model = EE_Registry::instance()->load_model($model_name); |
|
220 | 220 | $default_orderby = array(); |
221 | - foreach( $model->get_combined_primary_key_fields() as $key_field ) { |
|
222 | - $default_orderby[ $key_field->get_name() ] = 'ASC'; |
|
221 | + foreach ($model->get_combined_primary_key_fields() as $key_field) { |
|
222 | + $default_orderby[$key_field->get_name()] = 'ASC'; |
|
223 | 223 | } |
224 | 224 | return array( |
225 | 225 | 'where' => array( |
226 | 226 | 'required' => false, |
227 | 227 | 'default' => array(), |
228 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#where for documentation', 'event_espresso' ), |
|
228 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#where for documentation', 'event_espresso'), |
|
229 | 229 | ), |
230 | 230 | 'limit' => array( |
231 | 231 | 'required' => false, |
232 | 232 | 'default' => 50, |
233 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#limit for documentation', 'event_espresso' ) |
|
233 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#limit for documentation', 'event_espresso') |
|
234 | 234 | ), |
235 | 235 | 'order_by' => array( |
236 | 236 | 'required' => false, |
237 | 237 | 'default' => $default_orderby, |
238 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#order_by for documentation', 'event_espresso' ) |
|
238 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#order_by for documentation', 'event_espresso') |
|
239 | 239 | ), |
240 | 240 | 'group_by' => array( |
241 | 241 | 'required' => false, |
242 | 242 | 'default' => null, |
243 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#group_by for documentation', 'event_espresso' ) |
|
243 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#group_by for documentation', 'event_espresso') |
|
244 | 244 | ), |
245 | 245 | 'having' => array( |
246 | 246 | 'required' => false, |
247 | 247 | 'default' => null, |
248 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#having for documentation', 'event_espresso' ) |
|
248 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#having for documentation', 'event_espresso') |
|
249 | 249 | ), |
250 | 250 | 'caps' => array( |
251 | 251 | 'required' => false, |
252 | 252 | 'default' => EEM_Base::caps_read, |
253 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#caps for documentation', 'event_espresso' ) |
|
253 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#caps for documentation', 'event_espresso') |
|
254 | 254 | ), |
255 | 255 | 'include' => array( |
256 | 256 | 'required' => false, |
257 | 257 | 'default' => '*', |
258 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso' ), |
|
258 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso'), |
|
259 | 259 | ), |
260 | 260 | ); |
261 | 261 | } |
@@ -266,8 +266,8 @@ discard block |
||
266 | 266 | */ |
267 | 267 | protected function _register_config_routes() { |
268 | 268 | $config_routes = array(); |
269 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
270 | - $config_routes[ self::ee_api_namespace . $version ][ 'config' ] = array( |
|
269 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
270 | + $config_routes[self::ee_api_namespace.$version]['config'] = array( |
|
271 | 271 | array( |
272 | 272 | 'callback' => array( |
273 | 273 | 'EventEspresso\core\libraries\rest_api\controllers\config\Read', |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | */ |
287 | 287 | protected function _register_meta_routes() { |
288 | 288 | $meta_routes = array(); |
289 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
290 | - $meta_routes[ self::ee_api_namespace . $version ][ '/resources' ] = array( |
|
289 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
290 | + $meta_routes[self::ee_api_namespace.$version]['/resources'] = array( |
|
291 | 291 | array( |
292 | 292 | 'callback' => array( |
293 | 293 | 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', |
@@ -308,13 +308,13 @@ discard block |
||
308 | 308 | * @param array $route_data |
309 | 309 | * @return array |
310 | 310 | */ |
311 | - public function hide_old_endpoints( $route_data ) { |
|
312 | - foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) { |
|
313 | - foreach( $relative_urls as $endpoint => $routes ) { |
|
314 | - foreach( $routes as $route ) { |
|
315 | - if( $route[ 'hidden_endpoint' ] ) { |
|
316 | - $full_route = '/' . ltrim( $namespace, '/' ) . '/' . ltrim( $endpoint, '/' ); |
|
317 | - unset( $route_data[ $full_route ] ); |
|
311 | + public function hide_old_endpoints($route_data) { |
|
312 | + foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) { |
|
313 | + foreach ($relative_urls as $endpoint => $routes) { |
|
314 | + foreach ($routes as $route) { |
|
315 | + if ($route['hidden_endpoint']) { |
|
316 | + $full_route = '/'.ltrim($namespace, '/').'/'.ltrim($endpoint, '/'); |
|
317 | + unset($route_data[$full_route]); |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | } |
@@ -354,17 +354,17 @@ discard block |
||
354 | 354 | public static function versions_served() { |
355 | 355 | $version_compatibilities = EED_Core_Rest_Api::version_compatibilities(); |
356 | 356 | $versions_served = array(); |
357 | - $lowest_compatible_version = $version_compatibilities[ EED_Core_Rest_Api::core_version() ]; |
|
357 | + $lowest_compatible_version = $version_compatibilities[EED_Core_Rest_Api::core_version()]; |
|
358 | 358 | //for each version of core we have ever served: |
359 | - foreach( array_keys( EED_Core_Rest_Api::version_compatibilities() ) as $possibly_served_version ) { |
|
359 | + foreach (array_keys(EED_Core_Rest_Api::version_compatibilities()) as $possibly_served_version) { |
|
360 | 360 | //if it's not above the current core version, and it's compatible with the current version of core |
361 | - if( |
|
361 | + if ( |
|
362 | 362 | $possibly_served_version < EED_Core_Rest_Api::core_version() |
363 | 363 | && $possibly_served_version >= $lowest_compatible_version |
364 | 364 | ) { |
365 | - $versions_served[ $possibly_served_version ] = true; |
|
366 | - }else { |
|
367 | - $versions_served[ $possibly_served_version ] = false; |
|
365 | + $versions_served[$possibly_served_version] = true; |
|
366 | + } else { |
|
367 | + $versions_served[$possibly_served_version] = false; |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | return $versions_served; |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | * @return string |
378 | 378 | */ |
379 | 379 | public static function core_version() { |
380 | - return apply_filters( 'FHEE__EED_Core_REST_API__core_version', implode('.', array_slice( explode( '.', espresso_version() ), 0, 3 ) ) ); |
|
380 | + return apply_filters('FHEE__EED_Core_REST_API__core_version', implode('.', array_slice(explode('.', espresso_version()), 0, 3))); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * @param WP $WP |
390 | 390 | * @return void |
391 | 391 | */ |
392 | - public function run( $WP ) { |
|
392 | + public function run($WP) { |
|
393 | 393 | |
394 | 394 | } |
395 | 395 |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | //(all other times it gets resurrected from a wordpress option) |
9 | 9 | $stages = glob(EE_CORE.'data_migration_scripts/4_9_0_stages/*'); |
10 | 10 | $class_to_filepath = array(); |
11 | -foreach($stages as $filepath){ |
|
11 | +foreach ($stages as $filepath) { |
|
12 | 12 | $matches = array(); |
13 | - preg_match('~4_9_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
13 | + preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
14 | 14 | $class_to_filepath[$matches[1]] = $filepath; |
15 | 15 | } |
16 | 16 | //give addons a chance to autoload their stages too |
17 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages',$class_to_filepath); |
|
17 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages', $class_to_filepath); |
|
18 | 18 | EEH_Autoloader::register_autoloader($class_to_filepath); |
19 | 19 | |
20 | 20 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @since 4.6.0 |
31 | 31 | * |
32 | 32 | */ |
33 | -class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base{ |
|
33 | +class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base { |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * return EE_DMS_Core_4_9_0 |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function can_migrate_from_version($version_array) { |
53 | 53 | $version_string = $version_array['Core']; |
54 | - if( $version_string <= '4.9.0' && $version_string >= '4.8.0' ){ |
|
54 | + if ($version_string <= '4.9.0' && $version_string >= '4.8.0') { |
|
55 | 55 | // echo "$version_string can be migrated from"; |
56 | 56 | return true; |
57 | - } elseif( ! $version_string ){ |
|
57 | + } elseif ( ! $version_string) { |
|
58 | 58 | // echo "no version string provided: $version_string"; |
59 | 59 | //no version string provided... this must be pre 4.3 |
60 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
61 | - }else{ |
|
60 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
61 | + } else { |
|
62 | 62 | // echo "$version_string doesnt apply"; |
63 | 63 | return false; |
64 | 64 | } |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | * @return bool |
80 | 80 | */ |
81 | 81 | public function schema_changes_before_migration() { |
82 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
83 | - $now_in_mysql = current_time( 'mysql', true ); |
|
82 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
83 | + $now_in_mysql = current_time('mysql', true); |
|
84 | 84 | |
85 | 85 | $table_name = 'esp_message'; |
86 | - $sql="MSG_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
86 | + $sql = "MSG_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
87 | 87 | GRP_ID INT(10) UNSIGNED NULL, |
88 | 88 | MSG_token VARCHAR(255) NULL, |
89 | 89 | TXN_ID INT(10) UNSIGNED NULL, |
@@ -115,17 +115,17 @@ discard block |
||
115 | 115 | KEY STS_ID (STS_ID), |
116 | 116 | KEY MSG_created (MSG_created), |
117 | 117 | KEY MSG_modified (MSG_modified)"; |
118 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
118 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
119 | 119 | |
120 | - $table_name='esp_answer'; |
|
121 | - $sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
120 | + $table_name = 'esp_answer'; |
|
121 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
122 | 122 | REG_ID INT UNSIGNED NOT NULL, |
123 | 123 | QST_ID INT UNSIGNED NOT NULL, |
124 | 124 | ANS_value TEXT NOT NULL, |
125 | 125 | PRIMARY KEY (ANS_ID), |
126 | 126 | KEY REG_ID (REG_ID), |
127 | 127 | KEY QST_ID (QST_ID)"; |
128 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
128 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
129 | 129 | |
130 | 130 | $table_name = 'esp_attendee_meta'; |
131 | 131 | $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | CNT_is_EU TINYINT(1) DEFAULT '0', |
166 | 166 | CNT_active TINYINT(1) DEFAULT '0', |
167 | 167 | PRIMARY KEY (CNT_ISO)"; |
168 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
168 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
169 | 169 | |
170 | 170 | $table_name = 'esp_currency'; |
171 | 171 | $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
176 | 176 | CUR_active TINYINT(1) DEFAULT '0', |
177 | 177 | PRIMARY KEY (CUR_code)"; |
178 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
178 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
179 | 179 | |
180 | 180 | |
181 | 181 | $table_name = 'esp_currency_payment_method'; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | KEY EVT_ID (EVT_ID), |
206 | 206 | KEY DTT_is_primary (DTT_is_primary)"; |
207 | 207 | |
208 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
208 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
209 | 209 | |
210 | 210 | $table_name = 'esp_event_meta'; |
211 | 211 | $sql = " |
@@ -224,41 +224,41 @@ discard block |
||
224 | 224 | EVT_donations TINYINT(1) NULL, |
225 | 225 | PRIMARY KEY (EVTM_ID), |
226 | 226 | KEY EVT_ID (EVT_ID)"; |
227 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
227 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
228 | 228 | |
229 | 229 | |
230 | 230 | |
231 | - $table_name='esp_event_question_group'; |
|
232 | - $sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
231 | + $table_name = 'esp_event_question_group'; |
|
232 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
233 | 233 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
234 | 234 | QSG_ID INT UNSIGNED NOT NULL, |
235 | 235 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
236 | 236 | PRIMARY KEY (EQG_ID), |
237 | 237 | KEY EVT_ID (EVT_ID), |
238 | 238 | KEY QSG_ID (QSG_ID)"; |
239 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
239 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
240 | 240 | |
241 | 241 | |
242 | 242 | |
243 | - $table_name='esp_event_venue'; |
|
244 | - $sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
243 | + $table_name = 'esp_event_venue'; |
|
244 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
245 | 245 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
246 | 246 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
247 | 247 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
248 | 248 | PRIMARY KEY (EVV_ID)"; |
249 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
249 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
250 | 250 | |
251 | 251 | |
252 | 252 | |
253 | - $table_name='esp_extra_meta'; |
|
254 | - $sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
253 | + $table_name = 'esp_extra_meta'; |
|
254 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
255 | 255 | OBJ_ID INT(11) DEFAULT NULL, |
256 | 256 | EXM_type VARCHAR(45) DEFAULT NULL, |
257 | 257 | EXM_key VARCHAR(45) DEFAULT NULL, |
258 | 258 | EXM_value TEXT, |
259 | 259 | PRIMARY KEY (EXM_ID), |
260 | 260 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
261 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
261 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
262 | 262 | |
263 | 263 | $table_name = 'esp_extra_join'; |
264 | 264 | $sql = "EXJ_ID INT(11) NOT NULL AUTO_INCREMENT, |
@@ -271,8 +271,8 @@ discard block |
||
271 | 271 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
272 | 272 | $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
273 | 273 | |
274 | - $table_name='esp_line_item'; |
|
275 | - $sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
274 | + $table_name = 'esp_line_item'; |
|
275 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
276 | 276 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
277 | 277 | TXN_ID INT(11) DEFAULT NULL, |
278 | 278 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | PRIMARY KEY (LIN_ID), |
292 | 292 | KEY LIN_code (LIN_code(191)), |
293 | 293 | KEY TXN_ID (TXN_ID)"; |
294 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB' ); |
|
294 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
295 | 295 | |
296 | 296 | $table_name = 'esp_log'; |
297 | 297 | $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
331 | 331 | PRIMARY KEY (GRP_ID), |
332 | 332 | KEY MTP_user_id (MTP_user_id)"; |
333 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
333 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
334 | 334 | |
335 | 335 | $table_name = 'esp_event_message_template'; |
336 | 336 | $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | PRIMARY KEY (EMT_ID), |
340 | 340 | KEY EVT_ID (EVT_ID), |
341 | 341 | KEY GRP_ID (GRP_ID)"; |
342 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
342 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
343 | 343 | |
344 | 344 | |
345 | 345 | $table_name = 'esp_payment'; |
@@ -412,8 +412,8 @@ discard block |
||
412 | 412 | PRIMARY KEY (TTM_ID)"; |
413 | 413 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
414 | 414 | |
415 | - $table_name='esp_question'; |
|
416 | - $sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
415 | + $table_name = 'esp_question'; |
|
416 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
417 | 417 | QST_display_text TEXT NOT NULL, |
418 | 418 | QST_admin_label VARCHAR(255) NOT NULL, |
419 | 419 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -427,22 +427,22 @@ discard block |
||
427 | 427 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
428 | 428 | PRIMARY KEY (QST_ID), |
429 | 429 | KEY QST_order (QST_order)'; |
430 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
430 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
431 | 431 | |
432 | - $table_name='esp_question_group_question'; |
|
433 | - $sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
432 | + $table_name = 'esp_question_group_question'; |
|
433 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
434 | 434 | QSG_ID INT UNSIGNED NOT NULL, |
435 | 435 | QST_ID INT UNSIGNED NOT NULL, |
436 | 436 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
437 | 437 | PRIMARY KEY (QGQ_ID), |
438 | 438 | KEY QST_ID (QST_ID), |
439 | 439 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
440 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
440 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
441 | 441 | |
442 | 442 | |
443 | 443 | |
444 | - $table_name='esp_question_option'; |
|
445 | - $sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
444 | + $table_name = 'esp_question_option'; |
|
445 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
446 | 446 | QSO_value VARCHAR(255) NOT NULL, |
447 | 447 | QSO_desc TEXT NOT NULL, |
448 | 448 | QST_ID INT UNSIGNED NOT NULL, |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | PRIMARY KEY (QSO_ID), |
453 | 453 | KEY QST_ID (QST_ID), |
454 | 454 | KEY QSO_order (QSO_order)"; |
455 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
455 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
456 | 456 | |
457 | 457 | |
458 | 458 | |
@@ -498,8 +498,8 @@ discard block |
||
498 | 498 | |
499 | 499 | |
500 | 500 | |
501 | - $table_name='esp_checkin'; |
|
502 | - $sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
501 | + $table_name = 'esp_checkin'; |
|
502 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
503 | 503 | REG_ID INT(10) UNSIGNED NOT NULL, |
504 | 504 | DTT_ID INT(10) UNSIGNED NOT NULL, |
505 | 505 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
595 | 595 | PRIMARY KEY (PRC_ID), |
596 | 596 | KEY PRT_ID (PRT_ID)"; |
597 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
597 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
598 | 598 | |
599 | 599 | $table_name = "esp_price_type"; |
600 | 600 | $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -632,10 +632,10 @@ discard block |
||
632 | 632 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
633 | 633 | PRIMARY KEY (TKT_ID), |
634 | 634 | KEY TKT_start_date (TKT_start_date)"; |
635 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
635 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
636 | 636 | |
637 | 637 | $table_name = 'esp_question_group'; |
638 | - $sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
638 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
639 | 639 | QSG_name VARCHAR(255) NOT NULL, |
640 | 640 | QSG_identifier VARCHAR(100) NOT NULL, |
641 | 641 | QSG_desc TEXT NULL, |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | PRIMARY KEY (QSG_ID), |
649 | 649 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
650 | 650 | KEY QSG_order (QSG_order)'; |
651 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
651 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
652 | 652 | |
653 | 653 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
654 | 654 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -682,5 +682,5 @@ discard block |
||
682 | 682 | return true; |
683 | 683 | } |
684 | 684 | |
685 | - public function migration_page_hooks(){} |
|
685 | + public function migration_page_hooks() {} |
|
686 | 686 | } |
687 | 687 | \ No newline at end of file |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once ( EE_CLASSES . 'EE_Ticket.class.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once (EE_CLASSES.'EE_Ticket.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Ticket extends EEM_Soft_Delete_Base { |
28 | 28 | |
@@ -35,35 +35,35 @@ discard block |
||
35 | 35 | * @access private |
36 | 36 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
37 | 37 | */ |
38 | - protected function __construct( $timezone ) { |
|
39 | - $this->singular_item = __('Ticket','event_espresso'); |
|
40 | - $this->plural_item = __('Tickets','event_espresso'); |
|
38 | + protected function __construct($timezone) { |
|
39 | + $this->singular_item = __('Ticket', 'event_espresso'); |
|
40 | + $this->plural_item = __('Tickets', 'event_espresso'); |
|
41 | 41 | |
42 | 42 | $this->_tables = array( |
43 | 43 | 'Ticket'=> new EE_Primary_Table('esp_ticket', 'TKT_ID') |
44 | 44 | ); |
45 | 45 | $this->_fields = array( |
46 | 46 | 'Ticket'=>array( |
47 | - 'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso')), |
|
48 | - 'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID','event_espresso'), false, 0, 'Ticket_Template'), |
|
47 | + 'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso')), |
|
48 | + 'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso'), false, 0, 'Ticket_Template'), |
|
49 | 49 | 'TKT_name'=>new EE_Plain_Text_Field('TKT_name', __('Ticket Name', 'event_espresso'), false, ''), |
50 | - 'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, '' ), |
|
51 | - 'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket','event_espresso'), false, time(), $timezone ), |
|
52 | - 'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket','event_espresso'), false, time(), $timezone ), |
|
53 | - 'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0 ), |
|
54 | - 'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF ), |
|
50 | + 'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, ''), |
|
51 | + 'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket', 'event_espresso'), false, time(), $timezone), |
|
52 | + 'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket', 'event_espresso'), false, time(), $timezone), |
|
53 | + 'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0), |
|
54 | + 'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF), |
|
55 | 55 | 'TKT_price'=> new EE_Money_Field('TKT_price', 'Final calculated price for ticket', false, 0), |
56 | 56 | 'TKT_sold' => new EE_Integer_Field('TKT_sold', __('Number of this ticket sold', 'event_espresso'), false, 0), |
57 | - 'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available','event_espresso'), false, EE_INF), |
|
58 | - 'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF ), |
|
59 | - 'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false ), |
|
60 | - 'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false,false), |
|
61 | - 'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false ), |
|
57 | + 'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available', 'event_espresso'), false, EE_INF), |
|
58 | + 'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF), |
|
59 | + 'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false), |
|
60 | + 'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false, false), |
|
61 | + 'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false), |
|
62 | 62 | 'TKT_order' => new EE_Integer_Field('TKT_order', __('The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', 'event_espresso'), false, 0), |
63 | - 'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0 ), |
|
63 | + 'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0), |
|
64 | 64 | 'TKT_deleted' => new EE_Trashed_Flag_Field('TKT_deleted', __('Flag indicating if this has been archived or not', 'event_espresso'), false, false), |
65 | - 'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE ), |
|
66 | - 'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0 ) |
|
65 | + 'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE), |
|
66 | + 'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0) |
|
67 | 67 | )); |
68 | 68 | $this->_model_relations = array( |
69 | 69 | 'Datetime'=>new EE_HABTM_Relation('Datetime_Ticket'), |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | ); |
76 | 76 | |
77 | 77 | //this model is generally available for reading |
78 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event'); |
|
78 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event'); |
|
79 | 79 | //account for default tickets in the caps |
80 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
81 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
82 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
83 | - parent::__construct( $timezone ); |
|
80 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
81 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
82 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
83 | + parent::__construct($timezone); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function get_all_default_tickets() { |
93 | 93 | /** @type EE_Ticket[] $tickets */ |
94 | - $tickets = $this->get_all( array( array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC')) ); |
|
94 | + $tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC'))); |
|
95 | 95 | //we need to set the start date and end date to today's date and the start of the default dtt |
96 | - return $this->_set_default_dates( $tickets ); |
|
96 | + return $this->_set_default_dates($tickets); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | * @param EE_Ticket[] $tickets |
104 | 104 | * @return EE_Ticket[] |
105 | 105 | */ |
106 | - private function _set_default_dates( $tickets ) { |
|
107 | - foreach ( $tickets as $ticket ) { |
|
108 | - $ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true) ); |
|
109 | - $ticket->set('TKT_end_date', $this->current_time_for_query( 'TKT_end_date', true ) + (60 * 60 * 24 * 30 ) ); |
|
110 | - $ticket->set_end_time( $this->convert_datetime_for_query( 'TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone ) ); |
|
106 | + private function _set_default_dates($tickets) { |
|
107 | + foreach ($tickets as $ticket) { |
|
108 | + $ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true)); |
|
109 | + $ticket->set('TKT_end_date', $this->current_time_for_query('TKT_end_date', true) + (60 * 60 * 24 * 30)); |
|
110 | + $ticket->set_end_time($this->convert_datetime_for_query('TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone)); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $tickets; |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @param array $query_params |
123 | 123 | * @return int |
124 | 124 | */ |
125 | - public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()){ |
|
126 | - return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params ); |
|
125 | + public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) { |
|
126 | + return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @param EE_Ticket[] $tickets |
134 | 134 | * @return void |
135 | 135 | */ |
136 | - public function update_tickets_sold($tickets){ |
|
137 | - foreach($tickets as $ticket){ |
|
136 | + public function update_tickets_sold($tickets) { |
|
137 | + foreach ($tickets as $ticket) { |
|
138 | 138 | /* @var $ticket EE_Ticket */ |
139 | 139 | $ticket->update_tickets_sold(); |
140 | 140 | } |