@@ -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(); |
@@ -642,23 +642,23 @@ discard block |
||
642 | 642 | |
643 | 643 | /** setup reg status bulk actions **/ |
644 | 644 | $def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); |
645 | - if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
645 | + if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
646 | 646 | $def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); |
647 | 647 | } |
648 | 648 | $def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); |
649 | - if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
649 | + if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
650 | 650 | $def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); |
651 | 651 | } |
652 | 652 | $def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); |
653 | - if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
653 | + if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
654 | 654 | $def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); |
655 | 655 | } |
656 | 656 | $def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); |
657 | - if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
657 | + if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
658 | 658 | $def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); |
659 | 659 | } |
660 | 660 | $def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); |
661 | - if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
661 | + if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
662 | 662 | $def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); |
663 | 663 | } |
664 | 664 | |
@@ -667,29 +667,29 @@ discard block |
||
667 | 667 | 'slug' => 'all', |
668 | 668 | 'label' => __('View All Registrations', 'event_espresso'), |
669 | 669 | 'count' => 0, |
670 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
670 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
671 | 671 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
672 | - ) ) |
|
672 | + )) |
|
673 | 673 | ), |
674 | 674 | 'month' => array( |
675 | 675 | 'slug' => 'month', |
676 | 676 | 'label' => __('This Month', 'event_espresso'), |
677 | 677 | 'count' => 0, |
678 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
678 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
679 | 679 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
680 | 680 | )) |
681 | 681 | ), |
682 | 682 | 'today' => array( |
683 | 683 | 'slug' => 'today', |
684 | - 'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ), |
|
684 | + 'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))), |
|
685 | 685 | 'count' => 0, |
686 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
686 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
687 | 687 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
688 | 688 | )) |
689 | 689 | ) |
690 | 690 | ); |
691 | 691 | |
692 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) { |
|
692 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) { |
|
693 | 693 | $this->_views['incomplete'] = array( |
694 | 694 | 'slug' => 'incomplete', |
695 | 695 | 'label' => __('Incomplete', 'event_espresso'), |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | ) |
726 | 726 | ); |
727 | 727 | |
728 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) { |
|
728 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) { |
|
729 | 729 | $this->_views['trash'] = array( |
730 | 730 | 'slug' => 'trash', |
731 | 731 | 'label' => __('Trash', 'event_espresso'), |
@@ -764,42 +764,42 @@ discard block |
||
764 | 764 | 'desc' => __('View Transaction Invoice', 'event_espresso') |
765 | 765 | ), |
766 | 766 | ); |
767 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
767 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
768 | 768 | $fc_items['resend_registration'] = array( |
769 | 769 | 'class' => 'dashicons dashicons-email-alt', |
770 | 770 | 'desc' => __('Resend Registration Details', 'event_espresso') |
771 | 771 | ); |
772 | 772 | } else { |
773 | - $fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' ); |
|
773 | + $fc_items['blank'] = array('class' => 'blank', 'desc' => ''); |
|
774 | 774 | } |
775 | 775 | |
776 | 776 | $sc_items = array( |
777 | 777 | 'approved_status' => array( |
778 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
779 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
778 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
779 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
780 | 780 | ), |
781 | 781 | 'pending_status' => array( |
782 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
783 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
782 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
783 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
784 | 784 | ), |
785 | 785 | 'incomplete_status' => array( |
786 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete, |
|
787 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' ) |
|
786 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete, |
|
787 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence') |
|
788 | 788 | ), |
789 | 789 | 'not_approved' => array( |
790 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
791 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
790 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
791 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
792 | 792 | ), |
793 | 793 | 'declined_status' => array( |
794 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
795 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
794 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
795 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
796 | 796 | ), |
797 | 797 | 'cancelled_status' => array( |
798 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
799 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
798 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
799 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
800 | 800 | ) |
801 | 801 | ); |
802 | - return array_merge( $fc_items, $sc_items ); |
|
802 | + return array_merge($fc_items, $sc_items); |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | |
@@ -812,15 +812,15 @@ discard block |
||
812 | 812 | |
813 | 813 | |
814 | 814 | protected function _registrations_overview_list_table() { |
815 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
816 | - if ( $EVT_ID ) { |
|
817 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) { |
|
818 | - $this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' ); |
|
815 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
816 | + if ($EVT_ID) { |
|
817 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) { |
|
818 | + $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2'); |
|
819 | 819 | } |
820 | - $event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
821 | - $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>' ) : ''; |
|
820 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
821 | + $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>') : ''; |
|
822 | 822 | } |
823 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() ); |
|
823 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
824 | 824 | $this->display_admin_list_table_page_with_no_sidebar(); |
825 | 825 | } |
826 | 826 | |
@@ -835,19 +835,19 @@ discard block |
||
835 | 835 | */ |
836 | 836 | private function _set_registration_object() { |
837 | 837 | //get out if we've already set the object |
838 | - if ( is_object( $this->_registration )) { |
|
838 | + if (is_object($this->_registration)) { |
|
839 | 839 | return TRUE; |
840 | 840 | } |
841 | 841 | |
842 | 842 | $REG = EEM_Registration::instance(); |
843 | 843 | |
844 | - $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
844 | + $REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
845 | 845 | |
846 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
846 | + if ($this->_registration = $REG->get_one_by_ID($REG_ID)) |
|
847 | 847 | return TRUE; |
848 | 848 | else { |
849 | - $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
|
850 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
849 | + $error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID); |
|
850 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
851 | 851 | $this->_registration = NULL; |
852 | 852 | return FALSE; |
853 | 853 | } |
@@ -866,25 +866,25 @@ discard block |
||
866 | 866 | * @internal param bool $all whether to ignore all query params and just return ALL registrations (or count if count is set) |
867 | 867 | * @return mixed (int|array) int = count || array of registration objects |
868 | 868 | */ |
869 | - public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) { |
|
870 | - |
|
871 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
872 | - $CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE; |
|
873 | - $reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE; |
|
874 | - $month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april |
|
875 | - $today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ? TRUE : FALSE; |
|
876 | - $this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ? TRUE : FALSE; |
|
869 | + public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) { |
|
870 | + |
|
871 | + $EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE; |
|
872 | + $CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE; |
|
873 | + $reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE; |
|
874 | + $month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april |
|
875 | + $today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'today' ? TRUE : FALSE; |
|
876 | + $this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'month' ? TRUE : FALSE; |
|
877 | 877 | $start_date = FALSE; |
878 | 878 | $end_date = FALSE; |
879 | 879 | $_where = array(); |
880 | - $trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE; |
|
881 | - $incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE; |
|
880 | + $trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE; |
|
881 | + $incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE; |
|
882 | 882 | |
883 | 883 | //set orderby |
884 | 884 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
885 | 885 | |
886 | 886 | |
887 | - switch ( $this->_req_data['orderby'] ) { |
|
887 | + switch ($this->_req_data['orderby']) { |
|
888 | 888 | case '_REG_ID': |
889 | 889 | $orderby = 'REG_ID'; |
890 | 890 | break; |
@@ -904,26 +904,26 @@ discard block |
||
904 | 904 | $orderby = 'REG_date'; |
905 | 905 | } |
906 | 906 | |
907 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
908 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
909 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
907 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
908 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
909 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
910 | 910 | |
911 | 911 | |
912 | - $offset = ($current_page-1)*$per_page; |
|
913 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
912 | + $offset = ($current_page - 1) * $per_page; |
|
913 | + $limit = $count ? NULL : array($offset, $per_page); |
|
914 | 914 | |
915 | - if($EVT_ID){ |
|
916 | - $_where['EVT_ID']=$EVT_ID; |
|
915 | + if ($EVT_ID) { |
|
916 | + $_where['EVT_ID'] = $EVT_ID; |
|
917 | 917 | } |
918 | - if($CAT_ID){ |
|
918 | + if ($CAT_ID) { |
|
919 | 919 | $_where['Event.Term_Taxonomy.term_id'] = $CAT_ID; |
920 | 920 | } |
921 | - if ( $incomplete ) { |
|
921 | + if ($incomplete) { |
|
922 | 922 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
923 | 923 | } else if ( ! $trash) { |
924 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
924 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
925 | 925 | } |
926 | - if($reg_status){ |
|
926 | + if ($reg_status) { |
|
927 | 927 | $_where['STS_ID'] = $reg_status; |
928 | 928 | } |
929 | 929 | |
@@ -935,105 +935,105 @@ discard block |
||
935 | 935 | $time_start = ' 00:00:00'; |
936 | 936 | $time_end = ' 23:59:59'; |
937 | 937 | |
938 | - if($today_a || $today ){ |
|
938 | + if ($today_a || $today) { |
|
939 | 939 | $curdate = date('Y-m-d', current_time('timestamp')); |
940 | - $_where['REG_date']= array('BETWEEN', |
|
940 | + $_where['REG_date'] = array('BETWEEN', |
|
941 | 941 | array( |
942 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
|
943 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
|
942 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'), |
|
943 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'), |
|
944 | 944 | )); |
945 | - }elseif($this_month_a || $this_month){ |
|
945 | + }elseif ($this_month_a || $this_month) { |
|
946 | 946 | $this_month_r = date('m', current_time('timestamp')); |
947 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
948 | - $_where['REG_date']= array('BETWEEN', |
|
947 | + $days_this_month = date('t', current_time('timestamp')); |
|
948 | + $_where['REG_date'] = array('BETWEEN', |
|
949 | 949 | array( |
950 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
|
951 | - 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' ) |
|
950 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'), |
|
951 | + 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') |
|
952 | 952 | )); |
953 | - }elseif($month_range){ |
|
953 | + }elseif ($month_range) { |
|
954 | 954 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
955 | - $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
956 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
957 | - $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
|
958 | - $_where['REG_date']= array('BETWEEN', |
|
959 | - 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' ) ) ); |
|
960 | - }elseif($start_date && $end_date){ |
|
955 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
956 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
957 | + $days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01')); |
|
958 | + $_where['REG_date'] = array('BETWEEN', |
|
959 | + 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'))); |
|
960 | + }elseif ($start_date && $end_date) { |
|
961 | 961 | throw new EE_Error("not yet supported"); |
962 | - }elseif($start_date){ |
|
962 | + }elseif ($start_date) { |
|
963 | 963 | throw new EE_Error("not yet supported"); |
964 | - }elseif($end_date){ |
|
964 | + }elseif ($end_date) { |
|
965 | 965 | throw new EE_Error("not yet supported"); |
966 | 966 | } |
967 | 967 | |
968 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
969 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
968 | + if ( ! empty($this->_req_data['s'])) { |
|
969 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
970 | 970 | $_where['OR'] = array( |
971 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
972 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
973 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
974 | - 'Attendee.ATT_full_name' => array( 'LIKE', $sstr ), |
|
975 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
976 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
977 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
978 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
979 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
980 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
981 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
982 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
983 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
984 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
985 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
986 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
987 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ), |
|
988 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr ) |
|
971 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
972 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
973 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
974 | + 'Attendee.ATT_full_name' => array('LIKE', $sstr), |
|
975 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
976 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
977 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
978 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
979 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
980 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
981 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
982 | + 'REG_final_price' => array('LIKE', $sstr), |
|
983 | + 'REG_code' => array('LIKE', $sstr), |
|
984 | + 'REG_count' => array('LIKE', $sstr), |
|
985 | + 'REG_group_size' => array('LIKE', $sstr), |
|
986 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
987 | + 'Ticket.TKT_description' => array('LIKE', $sstr), |
|
988 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr) |
|
989 | 989 | ); |
990 | 990 | } |
991 | 991 | |
992 | 992 | //capability checks |
993 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) { |
|
993 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) { |
|
994 | 994 | $_where['AND'] = array( |
995 | 995 | 'Event.EVT_wp_user' => get_current_user_id() |
996 | 996 | ); |
997 | 997 | } |
998 | 998 | |
999 | 999 | |
1000 | - if( $count ){ |
|
1001 | - if ( $trash ) { |
|
1002 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
1003 | - } else if ( $incomplete ) { |
|
1004 | - return EEM_Registration::instance()->count( array( $_where )); |
|
1000 | + if ($count) { |
|
1001 | + if ($trash) { |
|
1002 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
1003 | + } else if ($incomplete) { |
|
1004 | + return EEM_Registration::instance()->count(array($_where)); |
|
1005 | 1005 | } else { |
1006 | - return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' )); |
|
1006 | + return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only')); |
|
1007 | 1007 | } |
1008 | 1008 | } else { |
1009 | 1009 | //make sure we remove default where conditions cause all registrations matching query are returned |
1010 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' ); |
|
1011 | - if ( $per_page !== -1 ) { |
|
1010 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only'); |
|
1011 | + if ($per_page !== -1) { |
|
1012 | 1012 | $query_params['limit'] = $limit; |
1013 | 1013 | } |
1014 | - $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1014 | + $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1015 | 1015 | |
1016 | 1016 | |
1017 | - if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1017 | + if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1018 | 1018 | $first_registration = $registrations[0]; |
1019 | 1019 | //EEH_Debug_Tools::printr( $registrations[0], '$registrations <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1020 | 1020 | $event_name = $first_registration->event_obj()->name(); |
1021 | - $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 ) : ''; |
|
1021 | + $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 | 1022 | // edit event link |
1023 | - if ( $event_name != '' ) { |
|
1024 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1025 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1026 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1023 | + if ($event_name != '') { |
|
1024 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1025 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1026 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1030 | - $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>'; |
|
1029 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1030 | + $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>'; |
|
1031 | 1031 | |
1032 | 1032 | $this->_template_args['before_admin_page_content'] = ' |
1033 | 1033 | <div id="admin-page-header"> |
1034 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1035 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1036 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1034 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1035 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1036 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1037 | 1037 | </div> |
1038 | 1038 | '; |
1039 | 1039 | |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | |
1072 | 1072 | $this->_set_registration_object(); |
1073 | 1073 | |
1074 | - if ( is_object( $this->_registration )) { |
|
1074 | + if (is_object($this->_registration)) { |
|
1075 | 1075 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1076 | 1076 | $this->_session = $transaction->session_data(); |
1077 | 1077 | |
@@ -1079,10 +1079,10 @@ discard block |
||
1079 | 1079 | |
1080 | 1080 | |
1081 | 1081 | $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
1082 | - $this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' ); |
|
1082 | + $this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso'); |
|
1083 | 1083 | |
1084 | - $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y','g:i:s a') ; |
|
1085 | - $this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
1084 | + $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y', 'g:i:s a'); |
|
1085 | + $this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso'); |
|
1086 | 1086 | |
1087 | 1087 | $this->_template_args['grand_total'] = $transaction->total(); |
1088 | 1088 | |
@@ -1090,19 +1090,19 @@ discard block |
||
1090 | 1090 | // link back to overview |
1091 | 1091 | $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
1092 | 1092 | $this->_template_args['registration'] = $this->_registration; |
1093 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL ); |
|
1094 | - $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' ) ); |
|
1095 | - $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' ) ); |
|
1093 | + $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL); |
|
1094 | + $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')); |
|
1095 | + $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')); |
|
1096 | 1096 | |
1097 | 1097 | //next and previous links |
1098 | - $next_reg = $this->_registration->next(null, array(), 'REG_ID' ); |
|
1099 | - $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' ) : ''; |
|
1100 | - $previous_reg = $this->_registration->previous( null, array(), 'REG_ID' ); |
|
1101 | - $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' ) : ''; |
|
1098 | + $next_reg = $this->_registration->next(null, array(), 'REG_ID'); |
|
1099 | + $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') : ''; |
|
1100 | + $previous_reg = $this->_registration->previous(null, array(), 'REG_ID'); |
|
1101 | + $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') : ''; |
|
1102 | 1102 | |
1103 | 1103 | // grab header |
1104 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
1105 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1104 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php'; |
|
1105 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1106 | 1106 | |
1107 | 1107 | } else { |
1108 | 1108 | |
@@ -1123,14 +1123,14 @@ discard block |
||
1123 | 1123 | protected function _registration_details_metaboxes() { |
1124 | 1124 | $this->_set_registration_object(); |
1125 | 1125 | $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
1126 | - add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1127 | - add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1128 | - if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) { |
|
1129 | - add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1126 | + add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high'); |
|
1127 | + add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1128 | + if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) { |
|
1129 | + add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1130 | 1130 | } |
1131 | - add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' ); |
|
1132 | - if ( $this->_registration->group_size() > 1 ) { |
|
1133 | - 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' ); |
|
1131 | + add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high'); |
|
1132 | + if ($this->_registration->group_size() > 1) { |
|
1133 | + 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'); |
|
1134 | 1134 | } |
1135 | 1135 | } |
1136 | 1136 | |
@@ -1151,23 +1151,23 @@ discard block |
||
1151 | 1151 | |
1152 | 1152 | //let's get an array of all possible buttons that we can just reference |
1153 | 1153 | $status_buttons = $this->_get_reg_status_buttons(); |
1154 | - $template_args[ 'reg_status_value' ] = $this->_registration->pretty_status(); |
|
1155 | - $template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID(); |
|
1154 | + $template_args['reg_status_value'] = $this->_registration->pretty_status(); |
|
1155 | + $template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID(); |
|
1156 | 1156 | $template_args['attendee'] = $this->_registration->attendee(); |
1157 | - $template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php'; |
|
1158 | - if ( $this->_set_registration_object() ) { |
|
1157 | + $template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php'; |
|
1158 | + if ($this->_set_registration_object()) { |
|
1159 | 1159 | $current_status = $this->_registration->status_ID(); |
1160 | - unset( $status_buttons[$current_status] ); |
|
1161 | - if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) { |
|
1162 | - unset( $status_buttons[EEM_Registration::status_id_pending_payment] ); |
|
1160 | + unset($status_buttons[$current_status]); |
|
1161 | + if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) { |
|
1162 | + unset($status_buttons[EEM_Registration::status_id_pending_payment]); |
|
1163 | 1163 | } |
1164 | - $template_args['status_buttons'] = implode( "\n", $status_buttons ); |
|
1164 | + $template_args['status_buttons'] = implode("\n", $status_buttons); |
|
1165 | 1165 | } |
1166 | 1166 | $template_args['form_url'] = REG_ADMIN_URL; |
1167 | 1167 | $template_args['REG_ID'] = $this->_registration->ID(); |
1168 | - $template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE ); |
|
1168 | + $template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE); |
|
1169 | 1169 | |
1170 | - EEH_Template::display_template( $template, $template_args ); |
|
1170 | + EEH_Template::display_template($template, $template_args); |
|
1171 | 1171 | |
1172 | 1172 | } |
1173 | 1173 | |
@@ -1181,11 +1181,11 @@ discard block |
||
1181 | 1181 | private function _get_reg_status_buttons() { |
1182 | 1182 | |
1183 | 1183 | $buttons = array( |
1184 | - 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' ) . '">', |
|
1185 | - 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' ) . '">', |
|
1186 | - 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' ) . '">', |
|
1187 | - 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' ) . '">', |
|
1188 | - 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' ) . '">', |
|
1184 | + 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').'">', |
|
1185 | + 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').'">', |
|
1186 | + 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').'">', |
|
1187 | + 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').'">', |
|
1188 | + 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').'">', |
|
1189 | 1189 | ); |
1190 | 1190 | return $buttons; |
1191 | 1191 | } |
@@ -1199,13 +1199,13 @@ discard block |
||
1199 | 1199 | * |
1200 | 1200 | * @return array (array with reg_id(s) updated and whether update was successful. |
1201 | 1201 | */ |
1202 | - protected function _set_registration_status_from_request( $status = false, $notify = false ) { |
|
1203 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1202 | + protected function _set_registration_status_from_request($status = false, $notify = false) { |
|
1203 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1204 | 1204 | |
1205 | - $success = $this->_set_registration_status( $REG_ID, $status ); |
|
1205 | + $success = $this->_set_registration_status($REG_ID, $status); |
|
1206 | 1206 | |
1207 | 1207 | //notify? |
1208 | - if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
1208 | + if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
1209 | 1209 | $this->_process_resend_registration(); |
1210 | 1210 | } |
1211 | 1211 | |
@@ -1223,19 +1223,19 @@ discard block |
||
1223 | 1223 | * @param bool $status |
1224 | 1224 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations). |
1225 | 1225 | */ |
1226 | - protected function _set_registration_status( $REG_ID, $status = false ) { |
|
1226 | + protected function _set_registration_status($REG_ID, $status = false) { |
|
1227 | 1227 | $success = true; |
1228 | 1228 | // set default status if none is passed |
1229 | 1229 | $status = $status ? $status : EEM_Registration::status_id_pending_payment; |
1230 | 1230 | |
1231 | 1231 | //typecast and sanitize reg_id |
1232 | - $reg_ids = array_filter( (array) $REG_ID, 'absint' ); |
|
1232 | + $reg_ids = array_filter((array) $REG_ID, 'absint'); |
|
1233 | 1233 | |
1234 | 1234 | //loop through REG_ID's and change status |
1235 | - foreach ( $reg_ids as $r_id ) { |
|
1236 | - $registration = EEM_Registration::instance()->get_one_by_ID( $r_id ); |
|
1237 | - if ( $registration instanceof EE_Registration ) { |
|
1238 | - $registration->set_status( $status ); |
|
1235 | + foreach ($reg_ids as $r_id) { |
|
1236 | + $registration = EEM_Registration::instance()->get_one_by_ID($r_id); |
|
1237 | + if ($registration instanceof EE_Registration) { |
|
1238 | + $registration->set_status($status); |
|
1239 | 1239 | $result = $registration->save(); |
1240 | 1240 | |
1241 | 1241 | //verifying explicit fails because update *may* just return 0 for 0 rows affected |
@@ -1247,7 +1247,7 @@ discard block |
||
1247 | 1247 | $this->_req_data['_REG_ID'] = $reg_ids; |
1248 | 1248 | |
1249 | 1249 | //return $success and processed registrations |
1250 | - return array( 'REG_ID' => $reg_ids, 'success' => $success ); |
|
1250 | + return array('REG_ID' => $reg_ids, 'success' => $success); |
|
1251 | 1251 | } |
1252 | 1252 | |
1253 | 1253 | |
@@ -1259,37 +1259,37 @@ discard block |
||
1259 | 1259 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
1260 | 1260 | * @return void |
1261 | 1261 | */ |
1262 | - protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
|
1262 | + protected function _reg_status_change_return($STS_ID, $notify = false) { |
|
1263 | 1263 | |
1264 | - $result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false ); |
|
1264 | + $result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false); |
|
1265 | 1265 | |
1266 | 1266 | |
1267 | - $success = isset( $result['success'] ) && $result['success']; |
|
1267 | + $success = isset($result['success']) && $result['success']; |
|
1268 | 1268 | |
1269 | 1269 | //setup success message |
1270 | - if ( $success ) { |
|
1271 | - $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' ) ) ; |
|
1272 | - EE_Error::add_success( $msg ); |
|
1270 | + if ($success) { |
|
1271 | + $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')); |
|
1272 | + EE_Error::add_success($msg); |
|
1273 | 1273 | } else { |
1274 | - EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ ); |
|
1274 | + EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
1275 | 1275 | } |
1276 | 1276 | |
1277 | - $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' ); |
|
1277 | + $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 | 1278 | //unset nonces |
1279 | - foreach ( $this->_req_data as $ref => $value ) { |
|
1280 | - if ( strpos( $ref, 'nonce' ) !== false ) { |
|
1281 | - unset( $this->_req_data[$ref] ); |
|
1279 | + foreach ($this->_req_data as $ref => $value) { |
|
1280 | + if (strpos($ref, 'nonce') !== false) { |
|
1281 | + unset($this->_req_data[$ref]); |
|
1282 | 1282 | continue; |
1283 | 1283 | } |
1284 | 1284 | |
1285 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value ); |
|
1285 | + $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); |
|
1286 | 1286 | $this->_req_data[$ref] = $value; |
1287 | 1287 | } |
1288 | 1288 | |
1289 | 1289 | //merge request vars so that the reloaded list table contains any existing filter query params |
1290 | - $route = array_merge( $this->_req_data, $route ); |
|
1290 | + $route = array_merge($this->_req_data, $route); |
|
1291 | 1291 | |
1292 | - $this->_redirect_after_action( $success, '', '', $route, true ); |
|
1292 | + $this->_redirect_after_action($success, '', '', $route, true); |
|
1293 | 1293 | |
1294 | 1294 | } |
1295 | 1295 | |
@@ -1302,29 +1302,29 @@ discard block |
||
1302 | 1302 | protected function _change_reg_status() { |
1303 | 1303 | $this->_req_data['return'] = 'view_registration'; |
1304 | 1304 | //set notify based on whether the send notifications toggle is set or not |
1305 | - $notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] ); |
|
1306 | - $this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : ''; |
|
1305 | + $notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']); |
|
1306 | + $this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : ''; |
|
1307 | 1307 | |
1308 | - switch ( $this->_req_data['_reg_status_id'] ) { |
|
1309 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) : |
|
1310 | - $this->approve_registration( $notify ); |
|
1308 | + switch ($this->_req_data['_reg_status_id']) { |
|
1309 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') : |
|
1310 | + $this->approve_registration($notify); |
|
1311 | 1311 | break; |
1312 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) : |
|
1313 | - $this->pending_registration( $notify ); |
|
1312 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') : |
|
1313 | + $this->pending_registration($notify); |
|
1314 | 1314 | break; |
1315 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) : |
|
1316 | - $this->not_approve_registration( $notify ); |
|
1315 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') : |
|
1316 | + $this->not_approve_registration($notify); |
|
1317 | 1317 | break; |
1318 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) : |
|
1319 | - $this->decline_registration( $notify ); |
|
1318 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') : |
|
1319 | + $this->decline_registration($notify); |
|
1320 | 1320 | break; |
1321 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) : |
|
1322 | - $this->cancel_registration( $notify ); |
|
1321 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') : |
|
1322 | + $this->cancel_registration($notify); |
|
1323 | 1323 | break; |
1324 | 1324 | default : |
1325 | 1325 | $result['success'] = false; |
1326 | - unset( $this->_req_data['return'] ); |
|
1327 | - $this->_reg_status_change_return( '', false ); |
|
1326 | + unset($this->_req_data['return']); |
|
1327 | + $this->_reg_status_change_return('', false); |
|
1328 | 1328 | break; |
1329 | 1329 | } |
1330 | 1330 | } |
@@ -1337,8 +1337,8 @@ discard block |
||
1337 | 1337 | * @param bool $notify whether or not to notify the registrant about their approval. |
1338 | 1338 | * @return void |
1339 | 1339 | */ |
1340 | - protected function approve_registration( $notify = false ) { |
|
1341 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
|
1340 | + protected function approve_registration($notify = false) { |
|
1341 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify); |
|
1342 | 1342 | } |
1343 | 1343 | |
1344 | 1344 | |
@@ -1350,8 +1350,8 @@ discard block |
||
1350 | 1350 | * @param bool $notify whether or not to notify the registrant about their approval. |
1351 | 1351 | * @return void |
1352 | 1352 | */ |
1353 | - protected function decline_registration( $notify = false ) { |
|
1354 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
|
1353 | + protected function decline_registration($notify = false) { |
|
1354 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify); |
|
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | |
@@ -1363,8 +1363,8 @@ discard block |
||
1363 | 1363 | * @param bool $notify whether or not to notify the registrant about their approval. |
1364 | 1364 | * @return void |
1365 | 1365 | */ |
1366 | - protected function cancel_registration( $notify = false ) { |
|
1367 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
|
1366 | + protected function cancel_registration($notify = false) { |
|
1367 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify); |
|
1368 | 1368 | } |
1369 | 1369 | |
1370 | 1370 | |
@@ -1377,8 +1377,8 @@ discard block |
||
1377 | 1377 | * @param bool $notify whether or not to notify the registrant about their approval. |
1378 | 1378 | * @return void |
1379 | 1379 | */ |
1380 | - protected function not_approve_registration( $notify = false ) { |
|
1381 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
|
1380 | + protected function not_approve_registration($notify = false) { |
|
1381 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify); |
|
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | |
@@ -1389,8 +1389,8 @@ discard block |
||
1389 | 1389 | * @param bool $notify whether or not to notify the registrant about their approval. |
1390 | 1390 | * @return void |
1391 | 1391 | */ |
1392 | - protected function pending_registration( $notify = false ) { |
|
1393 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
|
1392 | + protected function pending_registration($notify = false) { |
|
1393 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify); |
|
1394 | 1394 | } |
1395 | 1395 | |
1396 | 1396 | |
@@ -1404,75 +1404,75 @@ discard block |
||
1404 | 1404 | public function _reg_details_meta_box() { |
1405 | 1405 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1406 | 1406 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
1407 | - EE_Registry::instance()->load_Helper( 'Line_Item' ); |
|
1407 | + EE_Registry::instance()->load_Helper('Line_Item'); |
|
1408 | 1408 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1409 | 1409 | $this->_session = $transaction->session_data(); |
1410 | 1410 | |
1411 | 1411 | $filters = new EE_Line_Item_Filter_Collection(); |
1412 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) ); |
|
1413 | - $filters->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
1414 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() ); |
|
1412 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
1413 | + $filters->add(new EE_Non_Zero_Line_Item_Filter()); |
|
1414 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); |
|
1415 | 1415 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
1416 | 1416 | |
1417 | 1417 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1418 | - $line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' ); |
|
1419 | - $this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) ); |
|
1418 | + $line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); |
|
1419 | + $this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); |
|
1420 | 1420 | |
1421 | 1421 | |
1422 | 1422 | $attendee = $this->_registration->attendee(); |
1423 | 1423 | |
1424 | 1424 | |
1425 | - $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' ) : ''; |
|
1426 | - $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' ) : ''; |
|
1425 | + $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') : ''; |
|
1426 | + $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') : ''; |
|
1427 | 1427 | |
1428 | 1428 | |
1429 | 1429 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
1430 | - $payment = $transaction->get_first_related( 'Payment' ); |
|
1430 | + $payment = $transaction->get_first_related('Payment'); |
|
1431 | 1431 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; |
1432 | - $payment_method = $payment->get_first_related( 'Payment_Method' ); |
|
1432 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
1433 | 1433 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; |
1434 | - $reg_status_class = 'status-' . $this->_registration->status_ID(); |
|
1434 | + $reg_status_class = 'status-'.$this->_registration->status_ID(); |
|
1435 | 1435 | $reg_details = array( |
1436 | 1436 | 'payment_method' => $payment_method->name(), |
1437 | 1437 | 'response_msg' => $payment->gateway_response(), |
1438 | - 'registration_id' => $this->_registration->get( 'REG_code' ), |
|
1438 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
1439 | 1439 | 'registration_session' => $this->_registration->session_ID(), |
1440 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '', |
|
1441 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '', |
|
1440 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', |
|
1441 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '', |
|
1442 | 1442 | ); |
1443 | 1443 | |
1444 | 1444 | |
1445 | - if ( isset( $reg_details['registration_id'] )) { |
|
1445 | + if (isset($reg_details['registration_id'])) { |
|
1446 | 1446 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
1447 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' ); |
|
1447 | + $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); |
|
1448 | 1448 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
1449 | 1449 | } |
1450 | 1450 | |
1451 | - if ( isset( $reg_details['payment_method'] ) ) { |
|
1451 | + if (isset($reg_details['payment_method'])) { |
|
1452 | 1452 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
1453 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' ); |
|
1453 | + $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); |
|
1454 | 1454 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
1455 | 1455 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
1456 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' ); |
|
1456 | + $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); |
|
1457 | 1457 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
1458 | 1458 | } |
1459 | 1459 | |
1460 | 1460 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
1461 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
1461 | + $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
1462 | 1462 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
1463 | 1463 | |
1464 | 1464 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
1465 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' ); |
|
1465 | + $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); |
|
1466 | 1466 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
1467 | 1467 | |
1468 | 1468 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
1469 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
1469 | + $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
1470 | 1470 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
1471 | 1471 | |
1472 | - $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 ); |
|
1472 | + $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 | 1473 | |
1474 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1475 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1474 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1475 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1476 | 1476 | |
1477 | 1477 | } |
1478 | 1478 | |
@@ -1488,23 +1488,23 @@ discard block |
||
1488 | 1488 | */ |
1489 | 1489 | public function _reg_questions_meta_box() { |
1490 | 1490 | |
1491 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 ); |
|
1492 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $this, 'form_after_question_group' ), 10, 1 ); |
|
1493 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'form_form_field_label_wrap' ), 10, 1 ); |
|
1494 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'form_form_field_input__wrap' ), 10, 1 ); |
|
1491 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($this, 'form_before_question_group'), 10, 1); |
|
1492 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($this, 'form_after_question_group'), 10, 1); |
|
1493 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'form_form_field_label_wrap'), 10, 1); |
|
1494 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'form_form_field_input__wrap'), 10, 1); |
|
1495 | 1495 | |
1496 | - $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $this->_registration, $this->_registration->get('EVT_ID') ); |
|
1496 | + $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($this->_registration, $this->_registration->get('EVT_ID')); |
|
1497 | 1497 | |
1498 | 1498 | //EEH_Debug_Tools::printr( $question_groups, '$question_groups <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1499 | 1499 | |
1500 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
1501 | - $this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html( $question_groups ); |
|
1500 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
1501 | + $this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html($question_groups); |
|
1502 | 1502 | |
1503 | 1503 | $this->_template_args['reg_questions_form_action'] = 'update_attendee_registration_form'; |
1504 | 1504 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1505 | 1505 | |
1506 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1507 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1506 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1507 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1508 | 1508 | |
1509 | 1509 | } |
1510 | 1510 | |
@@ -1519,7 +1519,7 @@ discard block |
||
1519 | 1519 | * @param string $output |
1520 | 1520 | * @return string |
1521 | 1521 | */ |
1522 | - public function form_before_question_group( $output ) { |
|
1522 | + public function form_before_question_group($output) { |
|
1523 | 1523 | return ' |
1524 | 1524 | <table class="form-table ee-width-100"> |
1525 | 1525 | <tbody> |
@@ -1536,13 +1536,13 @@ discard block |
||
1536 | 1536 | * @param string $output |
1537 | 1537 | * @return string |
1538 | 1538 | */ |
1539 | - public function form_after_question_group( $output ) { |
|
1539 | + public function form_after_question_group($output) { |
|
1540 | 1540 | return ' |
1541 | 1541 | <tr class="hide-if-no-js"> |
1542 | 1542 | <th> </th> |
1543 | 1543 | <td class="reg-admin-edit-attendee-question-td"> |
1544 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '"> |
|
1545 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span> |
|
1544 | + <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> |
|
1545 | + <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> |
|
1546 | 1546 | <div class="dashicons dashicons-edit"></div> |
1547 | 1547 | </a> |
1548 | 1548 | </td> |
@@ -1562,11 +1562,11 @@ discard block |
||
1562 | 1562 | * @param string $label |
1563 | 1563 | * @return string |
1564 | 1564 | */ |
1565 | - public function form_form_field_label_wrap( $label ) { |
|
1565 | + public function form_form_field_label_wrap($label) { |
|
1566 | 1566 | return ' |
1567 | 1567 | <tr> |
1568 | 1568 | <th> |
1569 | - ' . $label . ' |
|
1569 | + ' . $label.' |
|
1570 | 1570 | </th>'; |
1571 | 1571 | } |
1572 | 1572 | |
@@ -1580,10 +1580,10 @@ discard block |
||
1580 | 1580 | * @param string $label |
1581 | 1581 | * @return string |
1582 | 1582 | */ |
1583 | - public function form_form_field_input__wrap( $input ) { |
|
1583 | + public function form_form_field_input__wrap($input) { |
|
1584 | 1584 | return ' |
1585 | 1585 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
1586 | - ' . $input . ' |
|
1586 | + ' . $input.' |
|
1587 | 1587 | </td> |
1588 | 1588 | </tr>'; |
1589 | 1589 | } |
@@ -1597,13 +1597,13 @@ discard block |
||
1597 | 1597 | * @return void |
1598 | 1598 | */ |
1599 | 1599 | protected function _update_attendee_registration_form() { |
1600 | - $qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE; |
|
1601 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
1602 | - $qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns ); |
|
1603 | - $success = $this->_save_attendee_registration_form( $REG_ID, $qstns ); |
|
1600 | + $qstns = isset($this->_req_data['qstn']) ? $this->_req_data['qstn'] : FALSE; |
|
1601 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
1602 | + $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns); |
|
1603 | + $success = $this->_save_attendee_registration_form($REG_ID, $qstns); |
|
1604 | 1604 | $what = __('Registration Form', 'event_espresso'); |
1605 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
1606 | - $this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
1605 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
1606 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
1607 | 1607 | |
1608 | 1608 | } |
1609 | 1609 | |
@@ -1616,26 +1616,26 @@ discard block |
||
1616 | 1616 | * @param bool $qstns |
1617 | 1617 | * @return bool |
1618 | 1618 | */ |
1619 | - private function _save_attendee_registration_form( $REG_ID = FALSE, $qstns = FALSE ) { |
|
1619 | + private function _save_attendee_registration_form($REG_ID = FALSE, $qstns = FALSE) { |
|
1620 | 1620 | |
1621 | - if ( ! $REG_ID || ! $qstns ) { |
|
1622 | - EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1621 | + if ( ! $REG_ID || ! $qstns) { |
|
1622 | + EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1623 | 1623 | } |
1624 | 1624 | $success = TRUE; |
1625 | 1625 | |
1626 | 1626 | // allow others to get in on this awesome fun :D |
1627 | - do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns ); |
|
1627 | + do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns); |
|
1628 | 1628 | // loop thru questions... FINALLY!!! |
1629 | 1629 | |
1630 | - foreach ( $qstns as $QST_ID => $qstn ) { |
|
1630 | + foreach ($qstns as $QST_ID => $qstn) { |
|
1631 | 1631 | //if $qstn isn't an array then it doesn't already have an answer, so let's create the answer |
1632 | - if ( !is_array($qstn) ) { |
|
1633 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
1632 | + if ( ! is_array($qstn)) { |
|
1633 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
1634 | 1634 | continue; |
1635 | 1635 | } |
1636 | 1636 | |
1637 | 1637 | |
1638 | - foreach ( $qstn as $ANS_ID => $ANS_value ) { |
|
1638 | + foreach ($qstn as $ANS_ID => $ANS_value) { |
|
1639 | 1639 | //get answer |
1640 | 1640 | $query_params = array( |
1641 | 1641 | 0 => array( |
@@ -1646,8 +1646,8 @@ discard block |
||
1646 | 1646 | ); |
1647 | 1647 | $answer = EEM_Answer::instance()->get_one($query_params); |
1648 | 1648 | //this MAY be an array but NOT have an answer because its multi select. If so then we need to create the answer |
1649 | - if ( ! $answer instanceof EE_Answer ) { |
|
1650 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
1649 | + if ( ! $answer instanceof EE_Answer) { |
|
1650 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
1651 | 1651 | continue 2; |
1652 | 1652 | } |
1653 | 1653 | |
@@ -1661,7 +1661,7 @@ discard block |
||
1661 | 1661 | |
1662 | 1662 | |
1663 | 1663 | //TODO: try changing this to use the model directly... not indirectly through creating a default object... |
1664 | - private function _save_new_answer( $REG_ID, $QST_ID, $ans ) { |
|
1664 | + private function _save_new_answer($REG_ID, $QST_ID, $ans) { |
|
1665 | 1665 | $set_values = array( |
1666 | 1666 | 'QST_ID' => $QST_ID, |
1667 | 1667 | 'REG_ID' => $REG_ID, |
@@ -1688,30 +1688,30 @@ discard block |
||
1688 | 1688 | $registrations = $REG->get_all(array( |
1689 | 1689 | array( |
1690 | 1690 | 'TXN_ID'=>$this->_registration->transaction_ID(), |
1691 | - 'REG_ID'=>array('!=',$this->_registration->ID()) |
|
1691 | + 'REG_ID'=>array('!=', $this->_registration->ID()) |
|
1692 | 1692 | ), |
1693 | 1693 | 'force_join'=>array('Attendee'))); |
1694 | 1694 | |
1695 | 1695 | $this->_template_args['attendees'] = array(); |
1696 | 1696 | $this->_template_args['attendee_notice'] = ''; |
1697 | 1697 | EE_Registry::instance()->load_helper('Array'); |
1698 | - if ( empty( $registrations) || ( is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations) ) ) { |
|
1699 | - 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__ ); |
|
1698 | + if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { |
|
1699 | + 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__); |
|
1700 | 1700 | $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
1701 | 1701 | } else { |
1702 | 1702 | |
1703 | 1703 | $att_nmbr = 1; |
1704 | - foreach ( $registrations as $registration ) { |
|
1704 | + foreach ($registrations as $registration) { |
|
1705 | 1705 | /* @var $registration EE_Registration */ |
1706 | 1706 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object(); |
1707 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1708 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1709 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1710 | - $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 : ''; |
|
1707 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1708 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1709 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1710 | + $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 : ''; |
|
1711 | 1711 | |
1712 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() ); |
|
1712 | + $this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); |
|
1713 | 1713 | |
1714 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1714 | + $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 | 1715 | |
1716 | 1716 | $att_nmbr++; |
1717 | 1717 | } |
@@ -1723,8 +1723,8 @@ discard block |
||
1723 | 1723 | |
1724 | 1724 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL ); |
1725 | 1725 | } |
1726 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1727 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1726 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1727 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1728 | 1728 | |
1729 | 1729 | } |
1730 | 1730 | |
@@ -1745,11 +1745,11 @@ discard block |
||
1745 | 1745 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object(); |
1746 | 1746 | |
1747 | 1747 | //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) |
1748 | - if ( ! $this->_registration->is_primary_registrant() ) { |
|
1748 | + if ( ! $this->_registration->is_primary_registrant()) { |
|
1749 | 1749 | $primary_registration = $this->_registration->get_primary_registration(); |
1750 | 1750 | $primary_attendee = $primary_registration->attendee(); |
1751 | 1751 | |
1752 | - if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { |
|
1752 | + if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
1753 | 1753 | //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. |
1754 | 1754 | $primary_registration = NULL; |
1755 | 1755 | } |
@@ -1758,28 +1758,28 @@ discard block |
||
1758 | 1758 | } |
1759 | 1759 | |
1760 | 1760 | $this->_template_args['ATT_ID'] = $attendee->ID(); |
1761 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname; |
|
1762 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname; |
|
1763 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email; |
|
1761 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname; |
|
1762 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname; |
|
1763 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email; |
|
1764 | 1764 | $this->_template_args['phone'] = $attendee->phone(); |
1765 | 1765 | |
1766 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1767 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee ); |
|
1766 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1767 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
1768 | 1768 | |
1769 | 1769 | |
1770 | 1770 | //edit link |
1771 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1772 | - $this->_template_args['att_edit_label'] = __('View/Edit Contact' ); |
|
1771 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1772 | + $this->_template_args['att_edit_label'] = __('View/Edit Contact'); |
|
1773 | 1773 | |
1774 | 1774 | //create link |
1775 | - $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 ): ''; |
|
1775 | + $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 | 1776 | $this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); |
1777 | 1777 | |
1778 | 1778 | $this->_template_args['att_check'] = $att_check; |
1779 | 1779 | |
1780 | 1780 | |
1781 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1782 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1781 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1782 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1783 | 1783 | } |
1784 | 1784 | |
1785 | 1785 | |
@@ -1792,7 +1792,7 @@ discard block |
||
1792 | 1792 | * @access protected |
1793 | 1793 | * @return void |
1794 | 1794 | */ |
1795 | - protected function _trash_or_restore_registrations( $trash = TRUE ) { |
|
1795 | + protected function _trash_or_restore_registrations($trash = TRUE) { |
|
1796 | 1796 | $REGM = EEM_Registration::instance(); |
1797 | 1797 | |
1798 | 1798 | $success = 1; |
@@ -1802,26 +1802,26 @@ discard block |
||
1802 | 1802 | $dtts = array(); |
1803 | 1803 | |
1804 | 1804 | //if empty _REG_ID then get out because there's nothing to do |
1805 | - if ( empty( $this->_req_data['_REG_ID'] ) ) { |
|
1805 | + if (empty($this->_req_data['_REG_ID'])) { |
|
1806 | 1806 | $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'); |
1807 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ ); |
|
1808 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE ); |
|
1807 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__); |
|
1808 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
1809 | 1809 | } |
1810 | 1810 | |
1811 | 1811 | //Checkboxes |
1812 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1812 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1813 | 1813 | // if array has more than one element than success message should be plural |
1814 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1814 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1815 | 1815 | // cycle thru checkboxes |
1816 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1816 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1817 | 1817 | |
1818 | 1818 | $REG = $REGM->get_one_by_ID($REG_ID); |
1819 | 1819 | $payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); |
1820 | - if ( $payment_count > 0 ) { |
|
1821 | - $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ); |
|
1820 | + if ($payment_count > 0) { |
|
1821 | + $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso'); |
|
1822 | 1822 | $error = 1; |
1823 | 1823 | $success = 0; |
1824 | - 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__ ); |
|
1824 | + 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 | 1825 | continue; //can't trash this registration because it has payments. |
1826 | 1826 | } |
1827 | 1827 | $ticket = $REG->get_first_related('Ticket'); |
@@ -1830,7 +1830,7 @@ discard block |
||
1830 | 1830 | $dtts = array_merge($dtts, $dtt); |
1831 | 1831 | |
1832 | 1832 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1833 | - if ( !$updated ) { |
|
1833 | + if ( ! $updated) { |
|
1834 | 1834 | $success = 0; |
1835 | 1835 | } else { |
1836 | 1836 | $success = 2; |
@@ -1845,7 +1845,7 @@ discard block |
||
1845 | 1845 | $tickets[$ticket->ID()] = $ticket; |
1846 | 1846 | $dtts = $ticket->get_many_related('Datetime'); |
1847 | 1847 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1848 | - if ( ! $updated ) { |
|
1848 | + if ( ! $updated) { |
|
1849 | 1849 | $success = 0; |
1850 | 1850 | } |
1851 | 1851 | |
@@ -1855,10 +1855,10 @@ discard block |
||
1855 | 1855 | EEM_Ticket::instance()->update_tickets_sold($tickets); |
1856 | 1856 | EEM_Datetime::instance()->update_sold($dtts); |
1857 | 1857 | |
1858 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1859 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
1858 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1859 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
1860 | 1860 | $overwrite_msgs = $error ? TRUE : FALSE; |
1861 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs ); |
|
1861 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); |
|
1862 | 1862 | } |
1863 | 1863 | |
1864 | 1864 | |
@@ -1882,16 +1882,16 @@ discard block |
||
1882 | 1882 | $success = 1; |
1883 | 1883 | |
1884 | 1884 | //Checkboxes |
1885 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1885 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1886 | 1886 | // if array has more than one element than success message should be plural |
1887 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1887 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1888 | 1888 | // cycle thru checkboxes |
1889 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1889 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1890 | 1890 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1891 | - if ( ! $REG instanceof EE_Registration ) |
|
1891 | + if ( ! $REG instanceof EE_Registration) |
|
1892 | 1892 | continue; |
1893 | 1893 | $deleted = $this->_delete_registration($REG); |
1894 | - if ( !$deleted ) { |
|
1894 | + if ( ! $deleted) { |
|
1895 | 1895 | $success = 0; |
1896 | 1896 | } |
1897 | 1897 | } |
@@ -1901,15 +1901,15 @@ discard block |
||
1901 | 1901 | $REG_ID = $this->_req_data['_REG_ID']; |
1902 | 1902 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1903 | 1903 | $deleted = $this->_delete_registration($REG); |
1904 | - if ( ! $deleted ) { |
|
1904 | + if ( ! $deleted) { |
|
1905 | 1905 | $success = 0; |
1906 | 1906 | } |
1907 | 1907 | |
1908 | 1908 | } |
1909 | 1909 | |
1910 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1911 | - $action_desc = __( 'permanently deleted.', 'event_espresso' ); |
|
1912 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE ); |
|
1910 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1911 | + $action_desc = __('permanently deleted.', 'event_espresso'); |
|
1912 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); |
|
1913 | 1913 | } |
1914 | 1914 | |
1915 | 1915 | |
@@ -1921,31 +1921,31 @@ discard block |
||
1921 | 1921 | * @param EE_Registration $REG registration to be deleted permenantly |
1922 | 1922 | * @return boolean true = successful deletion, false = fail. |
1923 | 1923 | */ |
1924 | - protected function _delete_registration( EE_Registration $REG ) { |
|
1924 | + protected function _delete_registration(EE_Registration $REG) { |
|
1925 | 1925 | //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. |
1926 | 1926 | $TXN = $REG->get_first_related('Transaction'); |
1927 | 1927 | $REGS = $TXN->get_many_related('Registration'); |
1928 | 1928 | |
1929 | 1929 | $all_trashed = TRUE; |
1930 | - foreach ( $REGS as $registration ) { |
|
1931 | - if ( ! $registration->get('REG_deleted') ) |
|
1930 | + foreach ($REGS as $registration) { |
|
1931 | + if ( ! $registration->get('REG_deleted')) |
|
1932 | 1932 | $all_trashed = FALSE; |
1933 | 1933 | } |
1934 | 1934 | |
1935 | - if ( ! $all_trashed ) { |
|
1936 | - 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__ ); |
|
1935 | + if ( ! $all_trashed) { |
|
1936 | + 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__); |
|
1937 | 1937 | return false; |
1938 | 1938 | } |
1939 | 1939 | |
1940 | 1940 | //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). |
1941 | - foreach ( $REGS as $registration ) { |
|
1941 | + foreach ($REGS as $registration) { |
|
1942 | 1942 | |
1943 | 1943 | //delete related answers |
1944 | 1944 | $registration->delete_related_permanently('Answer'); |
1945 | 1945 | |
1946 | 1946 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
1947 | 1947 | $attendee = $registration->get_first_related('Attendee'); |
1948 | - if ( $attendee instanceof EE_Attendee ) { |
|
1948 | + if ($attendee instanceof EE_Attendee) { |
|
1949 | 1949 | $registration->_remove_relation_to($attendee, 'Attendee'); |
1950 | 1950 | } |
1951 | 1951 | |
@@ -1955,7 +1955,7 @@ discard block |
||
1955 | 1955 | //now delete permanently the checkins related to this registration. |
1956 | 1956 | $registration->delete_related_permanently('Checkin'); |
1957 | 1957 | |
1958 | - if ( $registration->ID() === $REG->ID() ) |
|
1958 | + if ($registration->ID() === $REG->ID()) |
|
1959 | 1959 | continue; //we don't want to delete permanently the existing registration just yet. |
1960 | 1960 | |
1961 | 1961 | //remove relation to transaction for these registrations if NOT the existing registrations |
@@ -1988,34 +1988,34 @@ discard block |
||
1988 | 1988 | * @return void |
1989 | 1989 | */ |
1990 | 1990 | public function new_registration() { |
1991 | - if ( ! $this->_set_reg_event() ) { |
|
1992 | - throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); |
|
1991 | + if ( ! $this->_set_reg_event()) { |
|
1992 | + throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); |
|
1993 | 1993 | } |
1994 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
1994 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
1995 | 1995 | |
1996 | 1996 | // gotta start with a clean slate if we're not coming here via ajax |
1997 | - if ( ! defined('DOING_AJAX' ) && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ))) { |
|
1998 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
1997 | + if ( ! defined('DOING_AJAX') && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))) { |
|
1998 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
1999 | 1999 | } |
2000 | 2000 | |
2001 | - $this->_template_args['event_name'] = '' ; |
|
2001 | + $this->_template_args['event_name'] = ''; |
|
2002 | 2002 | // event name |
2003 | - if ( $this->_reg_event ) { |
|
2003 | + if ($this->_reg_event) { |
|
2004 | 2004 | $this->_template_args['event_name'] = $this->_reg_event->name(); |
2005 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL ); |
|
2006 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
2007 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
2005 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); |
|
2006 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
2007 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
2008 | 2008 | } |
2009 | 2009 | |
2010 | 2010 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
2011 | 2011 | |
2012 | - if ( defined('DOING_AJAX' ) ) |
|
2012 | + if (defined('DOING_AJAX')) |
|
2013 | 2013 | $this->_return_json(); |
2014 | 2014 | |
2015 | 2015 | |
2016 | 2016 | // grab header |
2017 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
2018 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2017 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php'; |
|
2018 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2019 | 2019 | |
2020 | 2020 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
2021 | 2021 | // the details template wrapper |
@@ -2033,7 +2033,7 @@ discard block |
||
2033 | 2033 | */ |
2034 | 2034 | protected function _get_registration_step_content() { |
2035 | 2035 | |
2036 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php'; |
|
2036 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php'; |
|
2037 | 2037 | $template_args = array( |
2038 | 2038 | 'title' => '', |
2039 | 2039 | 'content' => '', |
@@ -2054,11 +2054,11 @@ discard block |
||
2054 | 2054 | |
2055 | 2055 | //if the cart is empty then we know we're at step one so we'll display ticket selector |
2056 | 2056 | $cart = EE_Registry::instance()->SSN->get_session_data('cart'); |
2057 | - $step = empty( $cart ) ? 'ticket' : 'questions'; |
|
2058 | - switch ( $step ) { |
|
2057 | + $step = empty($cart) ? 'ticket' : 'questions'; |
|
2058 | + switch ($step) { |
|
2059 | 2059 | case 'ticket' : |
2060 | 2060 | $template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); |
2061 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event ); |
|
2061 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
2062 | 2062 | $template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); |
2063 | 2063 | $template_args['show_notification_toggle'] = FALSE; |
2064 | 2064 | break; |
@@ -2071,9 +2071,9 @@ discard block |
||
2071 | 2071 | break; |
2072 | 2072 | } |
2073 | 2073 | |
2074 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route. |
|
2074 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. |
|
2075 | 2075 | |
2076 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
2076 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
2077 | 2077 | } |
2078 | 2078 | |
2079 | 2079 | |
@@ -2087,11 +2087,11 @@ discard block |
||
2087 | 2087 | * @return boolean |
2088 | 2088 | */ |
2089 | 2089 | private function _set_reg_event() { |
2090 | - if ( is_object( $this->_reg_event )) { |
|
2090 | + if (is_object($this->_reg_event)) { |
|
2091 | 2091 | return TRUE; |
2092 | 2092 | } |
2093 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
2094 | - if ( ! $EVT_ID ) { |
|
2093 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
2094 | + if ( ! $EVT_ID) { |
|
2095 | 2095 | return FALSE; |
2096 | 2096 | } |
2097 | 2097 | |
@@ -2112,62 +2112,62 @@ discard block |
||
2112 | 2112 | public function process_reg_step() { |
2113 | 2113 | |
2114 | 2114 | $this->_set_reg_event(); |
2115 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2115 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2116 | 2116 | |
2117 | 2117 | //what step are we on? |
2118 | - $cart = EE_Registry::instance()->SSN->get_session_data( 'cart' ); |
|
2119 | - $step = empty( $cart ) ? 'ticket' : 'questions'; |
|
2118 | + $cart = EE_Registry::instance()->SSN->get_session_data('cart'); |
|
2119 | + $step = empty($cart) ? 'ticket' : 'questions'; |
|
2120 | 2120 | |
2121 | 2121 | //if doing ajax then we need to verify the nonce |
2122 | - if ( 'DOING_AJAX' ) { |
|
2123 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : ''; |
|
2124 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
2122 | + if ('DOING_AJAX') { |
|
2123 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
2124 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
2125 | 2125 | } |
2126 | 2126 | |
2127 | - switch ( $step ) { |
|
2127 | + switch ($step) { |
|
2128 | 2128 | case 'ticket' : |
2129 | 2129 | //process ticket selection |
2130 | 2130 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
2131 | - if ( $success ) { |
|
2132 | - EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2131 | + if ($success) { |
|
2132 | + EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2133 | 2133 | } else { |
2134 | 2134 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE; |
2135 | 2135 | } |
2136 | - if ( defined('DOING_AJAX') ) { |
|
2136 | + if (defined('DOING_AJAX')) { |
|
2137 | 2137 | $this->new_registration(); //display next step |
2138 | 2138 | } else { |
2139 | 2139 | $query_args['action'] = 'new_registration'; |
2140 | 2140 | $query_args['processing_registration'] = true; |
2141 | 2141 | $query_args['event_id'] = $this->_reg_event->ID(); |
2142 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2142 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2143 | 2143 | } |
2144 | 2144 | break; |
2145 | 2145 | case 'questions' : |
2146 | - if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
2147 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
2146 | + if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) { |
|
2147 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
2148 | 2148 | } |
2149 | 2149 | //process registration |
2150 | 2150 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
2151 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
2151 | + if ( ! $transaction instanceof EE_Transaction) { |
|
2152 | 2152 | $query_args = array( |
2153 | 2153 | 'action' => 'new_registration', |
2154 | 2154 | 'processing_registration' => true, |
2155 | 2155 | 'event_id' => $this->_reg_event->ID() |
2156 | 2156 | ); |
2157 | 2157 | |
2158 | - if ( defined('DOING_AJAX' )) { |
|
2158 | + if (defined('DOING_AJAX')) { |
|
2159 | 2159 | //display registration form again because there are errors (maybe validation?) |
2160 | 2160 | $this->new_registration(); |
2161 | 2161 | return; |
2162 | 2162 | } else { |
2163 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2163 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2164 | 2164 | return; |
2165 | 2165 | } |
2166 | 2166 | } |
2167 | 2167 | /** @type EE_Transaction_Payments $transaction_payments */ |
2168 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
2168 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
2169 | 2169 | // maybe update status, and make sure to save transaction if not done already |
2170 | - if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { |
|
2170 | + if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { |
|
2171 | 2171 | $transaction->save(); |
2172 | 2172 | } |
2173 | 2173 | $query_args = array( |
@@ -2175,8 +2175,8 @@ discard block |
||
2175 | 2175 | 'TXN_ID' => $transaction->ID(), |
2176 | 2176 | 'page' => 'espresso_transactions' |
2177 | 2177 | ); |
2178 | - EE_Error::add_success( __('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso') ); |
|
2179 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2178 | + EE_Error::add_success(__('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso')); |
|
2179 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2180 | 2180 | break; |
2181 | 2181 | } |
2182 | 2182 | |
@@ -2196,7 +2196,7 @@ discard block |
||
2196 | 2196 | * @return void |
2197 | 2197 | */ |
2198 | 2198 | protected function _attendee_contact_list_table() { |
2199 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2199 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2200 | 2200 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
2201 | 2201 | $this->display_admin_list_table_page_with_no_sidebar(); |
2202 | 2202 | } |
@@ -2211,10 +2211,10 @@ discard block |
||
2211 | 2211 | * @access public |
2212 | 2212 | * @return array |
2213 | 2213 | */ |
2214 | - public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
|
2214 | + public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { |
|
2215 | 2215 | |
2216 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2217 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' ); |
|
2216 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2217 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php'); |
|
2218 | 2218 | $ATT_MDL = EEM_Attendee::instance(); |
2219 | 2219 | |
2220 | 2220 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
@@ -2242,47 +2242,47 @@ discard block |
||
2242 | 2242 | $orderby = 'ATT_lname'; |
2243 | 2243 | } |
2244 | 2244 | |
2245 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
2245 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
2246 | 2246 | |
2247 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
2248 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
2249 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
2247 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
2248 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
2249 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
2250 | 2250 | |
2251 | 2251 | $_where = array(); |
2252 | 2252 | |
2253 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2254 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2253 | + if (isset($this->_req_data['s'])) { |
|
2254 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2255 | 2255 | $_where['OR'] = array( |
2256 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr), |
|
2257 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
2258 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
2259 | - 'ATT_fname' => array( 'LIKE', $sstr ), |
|
2260 | - 'ATT_lname' => array( 'LIKE', $sstr ), |
|
2261 | - 'ATT_short_bio' => array( 'LIKE', $sstr ), |
|
2262 | - 'ATT_email' => array('LIKE', $sstr ), |
|
2263 | - 'ATT_address' => array( 'LIKE', $sstr ), |
|
2264 | - 'ATT_address2' => array( 'LIKE', $sstr ), |
|
2265 | - 'ATT_city' => array( 'LIKE', $sstr ), |
|
2266 | - 'Country.CNT_name' => array( 'LIKE', $sstr ), |
|
2267 | - 'State.STA_name' => array('LIKE', $sstr ), |
|
2268 | - 'ATT_phone' => array( 'LIKE', $sstr ), |
|
2269 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ), |
|
2270 | - 'Registration.REG_code' => array( 'LIKE', $sstr ), |
|
2271 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ), |
|
2272 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr ) |
|
2256 | + 'Registration.Event.EVT_name' => array('LIKE', $sstr), |
|
2257 | + 'Registration.Event.EVT_desc' => array('LIKE', $sstr), |
|
2258 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), |
|
2259 | + 'ATT_fname' => array('LIKE', $sstr), |
|
2260 | + 'ATT_lname' => array('LIKE', $sstr), |
|
2261 | + 'ATT_short_bio' => array('LIKE', $sstr), |
|
2262 | + 'ATT_email' => array('LIKE', $sstr), |
|
2263 | + 'ATT_address' => array('LIKE', $sstr), |
|
2264 | + 'ATT_address2' => array('LIKE', $sstr), |
|
2265 | + 'ATT_city' => array('LIKE', $sstr), |
|
2266 | + 'Country.CNT_name' => array('LIKE', $sstr), |
|
2267 | + 'State.STA_name' => array('LIKE', $sstr), |
|
2268 | + 'ATT_phone' => array('LIKE', $sstr), |
|
2269 | + 'Registration.REG_final_price' => array('LIKE', $sstr), |
|
2270 | + 'Registration.REG_code' => array('LIKE', $sstr), |
|
2271 | + 'Registration.REG_count' => array('LIKE', $sstr), |
|
2272 | + 'Registration.REG_group_size' => array('LIKE', $sstr) |
|
2273 | 2273 | ); |
2274 | 2274 | } |
2275 | 2275 | |
2276 | 2276 | |
2277 | - $offset = ($current_page-1)*$per_page; |
|
2278 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
2277 | + $offset = ($current_page - 1) * $per_page; |
|
2278 | + $limit = $count ? NULL : array($offset, $per_page); |
|
2279 | 2279 | |
2280 | - if ( $trash ) { |
|
2281 | - $_where['status'] = array( '!=', 'publish' ); |
|
2282 | - $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)); |
|
2280 | + if ($trash) { |
|
2281 | + $_where['status'] = array('!=', 'publish'); |
|
2282 | + $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)); |
|
2283 | 2283 | } else { |
2284 | - $_where['status'] = array( 'IN', array( 'publish' ) ); |
|
2285 | - $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 | + $_where['status'] = array('IN', array('publish')); |
|
2285 | + $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)); |
|
2286 | 2286 | } |
2287 | 2287 | |
2288 | 2288 | return $all_attendees; |
@@ -2299,10 +2299,10 @@ discard block |
||
2299 | 2299 | */ |
2300 | 2300 | protected function _resend_registration() { |
2301 | 2301 | $this->_process_resend_registration(); |
2302 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( |
|
2302 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( |
|
2303 | 2303 | 'action' => 'default' |
2304 | 2304 | ); |
2305 | - $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE ); |
|
2305 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2306 | 2306 | } |
2307 | 2307 | |
2308 | 2308 | |
@@ -2310,17 +2310,17 @@ discard block |
||
2310 | 2310 | |
2311 | 2311 | |
2312 | 2312 | |
2313 | - public function _registrations_report(){ |
|
2314 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2313 | + public function _registrations_report() { |
|
2314 | + EE_Registry::instance()->load_helper('File'); |
|
2315 | 2315 | $new_request_args = array( |
2316 | 2316 | 'export' => 'report', |
2317 | 2317 | 'action' => 'registrations_report_for_event', |
2318 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2318 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2319 | 2319 | ); |
2320 | 2320 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
2321 | 2321 | |
2322 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2323 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2322 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2323 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2324 | 2324 | $EE_Export = EE_Export::instance($this->_req_data); |
2325 | 2325 | $EE_Export->export(); |
2326 | 2326 | } |
@@ -2328,19 +2328,19 @@ discard block |
||
2328 | 2328 | |
2329 | 2329 | |
2330 | 2330 | |
2331 | - public function _contact_list_export(){ |
|
2332 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2333 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2334 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2331 | + public function _contact_list_export() { |
|
2332 | + EE_Registry::instance()->load_helper('File'); |
|
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_attendees(); |
2337 | 2337 | } |
2338 | 2338 | } |
2339 | 2339 | |
2340 | - public function _contact_list_report(){ |
|
2341 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2342 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2343 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2340 | + public function _contact_list_report() { |
|
2341 | + EE_Registry::instance()->load_helper('File'); |
|
2342 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2343 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2344 | 2344 | $EE_Export = EE_Export::instance($this->_req_data); |
2345 | 2345 | $EE_Export->report_attendees(); |
2346 | 2346 | } |
@@ -2359,73 +2359,73 @@ discard block |
||
2359 | 2359 | * @return void |
2360 | 2360 | */ |
2361 | 2361 | protected function _duplicate_attendee() { |
2362 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default'; |
|
2362 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default'; |
|
2363 | 2363 | //verify we have necessary info |
2364 | - if ( empty($this->_req_data['_REG_ID'] ) ) { |
|
2365 | - 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__ ); |
|
2366 | - $query_args = array( 'action' => $action ); |
|
2364 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2365 | + 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__); |
|
2366 | + $query_args = array('action' => $action); |
|
2367 | 2367 | $this->_redirect_after_action('', '', '', $query_args, TRUE); |
2368 | 2368 | } |
2369 | 2369 | |
2370 | 2370 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
2371 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] ); |
|
2371 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']); |
|
2372 | 2372 | $attendee = $registration->attendee(); |
2373 | 2373 | |
2374 | 2374 | //remove relation of existing attendee on registration |
2375 | - $registration->_remove_relation_to($attendee, 'Attendee' ); |
|
2375 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
2376 | 2376 | //new attendee |
2377 | 2377 | $new_attendee = clone $attendee; |
2378 | - $new_attendee->set( 'ATT_ID', 0 ); |
|
2378 | + $new_attendee->set('ATT_ID', 0); |
|
2379 | 2379 | $new_attendee->save(); |
2380 | 2380 | |
2381 | 2381 | //add new attendee to reg |
2382 | - $registration->_add_relation_to( $new_attendee, 'Attendee'); |
|
2382 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
2383 | 2383 | |
2384 | - EE_Error::add_success( __('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso') ); |
|
2384 | + EE_Error::add_success(__('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso')); |
|
2385 | 2385 | |
2386 | 2386 | //redirect to edit page for attendee |
2387 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' ); |
|
2387 | + $query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); |
|
2388 | 2388 | |
2389 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE ); |
|
2389 | + $this->_redirect_after_action('', '', '', $query_args, TRUE); |
|
2390 | 2390 | } |
2391 | 2391 | |
2392 | 2392 | |
2393 | 2393 | //related to cpt routes |
2394 | 2394 | protected function _insert_update_cpt_item($post_id, $post) { |
2395 | 2395 | $success = true; |
2396 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id ); |
|
2396 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id); |
|
2397 | 2397 | //for attendee updates |
2398 | - if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { |
|
2398 | + if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { |
|
2399 | 2399 | //note we should only be UPDATING attendees at this point. |
2400 | 2400 | $updated_fields = array( |
2401 | 2401 | 'ATT_fname' => $this->_req_data['ATT_fname'], |
2402 | 2402 | 'ATT_lname' => $this->_req_data['ATT_lname'], |
2403 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'], |
|
2403 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'], |
|
2404 | 2404 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '', |
2405 | 2405 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '', |
2406 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '', |
|
2407 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '', |
|
2408 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '', |
|
2409 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '', |
|
2410 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '', |
|
2411 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : '' |
|
2406 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '', |
|
2407 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '', |
|
2408 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '', |
|
2409 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '', |
|
2410 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '', |
|
2411 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : '' |
|
2412 | 2412 | ); |
2413 | - foreach ( $updated_fields as $field => $value ) { |
|
2413 | + foreach ($updated_fields as $field => $value) { |
|
2414 | 2414 | $attendee->set($field, $value); |
2415 | 2415 | } |
2416 | 2416 | |
2417 | 2417 | $success = $attendee->save(); |
2418 | 2418 | |
2419 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() ); |
|
2420 | - foreach ( $attendee_update_callbacks as $a_callback ) { |
|
2421 | - if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { |
|
2422 | - 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 ) ); |
|
2419 | + $attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); |
|
2420 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
2421 | + if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { |
|
2422 | + 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)); |
|
2423 | 2423 | } |
2424 | 2424 | } |
2425 | 2425 | } |
2426 | 2426 | |
2427 | - if ( $success === FALSE ) |
|
2428 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2427 | + if ($success === FALSE) |
|
2428 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2429 | 2429 | |
2430 | 2430 | } |
2431 | 2431 | |
@@ -2445,17 +2445,17 @@ discard block |
||
2445 | 2445 | remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2446 | 2446 | remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2447 | 2447 | |
2448 | - if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { |
|
2449 | - add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); |
|
2448 | + if (post_type_supports('espresso_attendees', 'excerpt')) { |
|
2449 | + add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); |
|
2450 | 2450 | } |
2451 | 2451 | |
2452 | - if ( post_type_supports( 'espresso_attendees', 'comments') ) { |
|
2452 | + if (post_type_supports('espresso_attendees', 'comments')) { |
|
2453 | 2453 | add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2454 | 2454 | } |
2455 | 2455 | |
2456 | - add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
2457 | - add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); |
|
2458 | - 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'); |
|
2456 | + add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
2457 | + add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
|
2458 | + 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'); |
|
2459 | 2459 | } |
2460 | 2460 | |
2461 | 2461 | |
@@ -2464,10 +2464,10 @@ discard block |
||
2464 | 2464 | * @param WP_Post $post wp post object |
2465 | 2465 | * @return string attendee contact info ( and form ) |
2466 | 2466 | */ |
2467 | - public function attendee_contact_info( $post ) { |
|
2467 | + public function attendee_contact_info($post) { |
|
2468 | 2468 | //get attendee object ( should already have it ) |
2469 | 2469 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2470 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php'; |
|
2470 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php'; |
|
2471 | 2471 | EEH_Template::display_template($template, $this->_template_args); |
2472 | 2472 | } |
2473 | 2473 | |
@@ -2483,12 +2483,12 @@ discard block |
||
2483 | 2483 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2484 | 2484 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
2485 | 2485 | new EE_Question_Form_Input( |
2486 | - EE_Question::new_instance( array( |
|
2486 | + EE_Question::new_instance(array( |
|
2487 | 2487 | 'QST_ID' => 0, |
2488 | 2488 | 'QST_display_text' => __('State/Province', 'event_espresso'), |
2489 | 2489 | 'QST_system' => 'admin-state' |
2490 | 2490 | )), |
2491 | - EE_Answer::new_instance( array( |
|
2491 | + EE_Answer::new_instance(array( |
|
2492 | 2492 | 'ANS_ID' => 0, |
2493 | 2493 | 'ANS_value' => $this->_cpt_model_obj->state_ID() |
2494 | 2494 | )), |
@@ -2501,12 +2501,12 @@ discard block |
||
2501 | 2501 | )); |
2502 | 2502 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
2503 | 2503 | new EE_Question_Form_Input( |
2504 | - EE_Question::new_instance( array( |
|
2504 | + EE_Question::new_instance(array( |
|
2505 | 2505 | 'QST_ID' => 0, |
2506 | 2506 | 'QST_display_text' => __('Country', 'event_espresso'), |
2507 | 2507 | 'QST_system' => 'admin-country' |
2508 | 2508 | )), |
2509 | - EE_Answer::new_instance( array( |
|
2509 | + EE_Answer::new_instance(array( |
|
2510 | 2510 | 'ANS_ID' => 0, |
2511 | 2511 | 'ANS_value' => $this->_cpt_model_obj->country_ID() |
2512 | 2512 | )), |
@@ -2517,8 +2517,8 @@ discard block |
||
2517 | 2517 | 'append_qstn_id' => FALSE |
2518 | 2518 | ) |
2519 | 2519 | )); |
2520 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
2521 | - EEH_Template::display_template($template, $this->_template_args ); |
|
2520 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php'; |
|
2521 | + EEH_Template::display_template($template, $this->_template_args); |
|
2522 | 2522 | |
2523 | 2523 | } |
2524 | 2524 | |
@@ -2528,11 +2528,11 @@ discard block |
||
2528 | 2528 | * @access protected |
2529 | 2529 | * @return void |
2530 | 2530 | */ |
2531 | - public function attendee_registrations_meta_box( $post ) { |
|
2531 | + public function attendee_registrations_meta_box($post) { |
|
2532 | 2532 | |
2533 | 2533 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2534 | 2534 | $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
2535 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
2535 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php'; |
|
2536 | 2536 | EEH_Template::display_template($template, $this->_template_args); |
2537 | 2537 | |
2538 | 2538 | } |
@@ -2546,8 +2546,8 @@ discard block |
||
2546 | 2546 | * @return string html for new form. |
2547 | 2547 | */ |
2548 | 2548 | public function after_title_form_fields($post) { |
2549 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
2550 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
2549 | + if ($post->post_type == 'espresso_attendees') { |
|
2550 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php'; |
|
2551 | 2551 | $template_args['attendee'] = $this->_cpt_model_obj; |
2552 | 2552 | EEH_Template::display_template($template, $template_args); |
2553 | 2553 | } |
@@ -2564,21 +2564,21 @@ discard block |
||
2564 | 2564 | * @access protected |
2565 | 2565 | * @return void |
2566 | 2566 | */ |
2567 | - protected function _trash_or_restore_attendees( $trash = TRUE ) { |
|
2567 | + protected function _trash_or_restore_attendees($trash = TRUE) { |
|
2568 | 2568 | |
2569 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2569 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2570 | 2570 | |
2571 | 2571 | $ATT_MDL = EEM_Attendee::instance(); |
2572 | 2572 | |
2573 | 2573 | $success = 1; |
2574 | 2574 | //Checkboxes |
2575 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2575 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2576 | 2576 | // if array has more than one element than success message should be plural |
2577 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2577 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2578 | 2578 | // cycle thru checkboxes |
2579 | - while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
2580 | - $updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); |
|
2581 | - if ( !$updated ) { |
|
2579 | + while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2580 | + $updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); |
|
2581 | + if ( ! $updated) { |
|
2582 | 2582 | $success = 0; |
2583 | 2583 | } |
2584 | 2584 | } |
@@ -2587,18 +2587,18 @@ discard block |
||
2587 | 2587 | // grab single id and delete |
2588 | 2588 | $ATT_ID = absint($this->_req_data['ATT_ID']); |
2589 | 2589 | //get attendee |
2590 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID ); |
|
2590 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID); |
|
2591 | 2591 | $updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); |
2592 | 2592 | $updated = $att->save(); |
2593 | - if ( ! $updated ) { |
|
2593 | + if ( ! $updated) { |
|
2594 | 2594 | $success = 0; |
2595 | 2595 | } |
2596 | 2596 | |
2597 | 2597 | } |
2598 | 2598 | |
2599 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' ); |
|
2600 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2601 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) ); |
|
2599 | + $what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); |
|
2600 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2601 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); |
|
2602 | 2602 | |
2603 | 2603 | } |
2604 | 2604 |
@@ -1,15 +1,15 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * Class EE_Psr4AutoloaderInit |
|
4 | - * |
|
5 | - * Loads the Psr4Autoloader class and registers namespaces |
|
6 | - * |
|
7 | - * @package Event Espresso |
|
8 | - * @subpackage core |
|
9 | - * @author Brent Christensen |
|
10 | - * @since 4.8 |
|
11 | - * |
|
12 | - */ |
|
3 | + * Class EE_Psr4AutoloaderInit |
|
4 | + * |
|
5 | + * Loads the Psr4Autoloader class and registers namespaces |
|
6 | + * |
|
7 | + * @package Event Espresso |
|
8 | + * @subpackage core |
|
9 | + * @author Brent Christensen |
|
10 | + * @since 4.8 |
|
11 | + * |
|
12 | + */ |
|
13 | 13 | |
14 | 14 | class EE_Psr4AutoloaderInit { |
15 | 15 |
@@ -24,14 +24,14 @@ |
||
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | 26 | static $initialized = false; |
27 | - if ( ! $initialized ) { |
|
27 | + if ( ! $initialized) { |
|
28 | 28 | // instantiate PSR4 autoloader |
29 | - espresso_load_required( 'Psr4Autoloader', EE_CORE . 'Psr4Autoloader.php' ); |
|
29 | + espresso_load_required('Psr4Autoloader', EE_CORE.'Psr4Autoloader.php'); |
|
30 | 30 | EE_Psr4AutoloaderInit::$psr4_loader = new \EventEspresso\Core\Psr4Autoloader(); |
31 | 31 | // register the autoloader |
32 | 32 | EE_Psr4AutoloaderInit::$psr4_loader->register(); |
33 | 33 | // register the base directories for the namespace prefix |
34 | - EE_Psr4AutoloaderInit::$psr4_loader->addNamespace( 'EventEspresso', EE_PLUGIN_DIR_PATH ); |
|
34 | + EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspresso', EE_PLUGIN_DIR_PATH); |
|
35 | 35 | $initialized = true; |
36 | 36 | } |
37 | 37 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_PMT_Aim extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Aim extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | |
31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | require_once($this->file_folder().'EEG_Aim.gateway.php'); |
38 | 38 | $this->_gateway = new EEG_AIM(); |
39 | 39 | $this->_pretty_name = __("Authorize.net AIM", 'event_espresso'); |
40 | - $this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' ); |
|
40 | + $this->_default_description = __('Please provide the following billing information.', 'event_espresso'); |
|
41 | 41 | $this->_requires_https = true; |
42 | 42 | parent::__construct($pm_instance); |
43 | 43 | } |
@@ -47,60 +47,60 @@ discard block |
||
47 | 47 | * @param \EE_Transaction $transaction |
48 | 48 | * @return EE_Billing_Info_Form |
49 | 49 | */ |
50 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
51 | - $billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance,array( |
|
50 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
51 | + $billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance, array( |
|
52 | 52 | 'name'=>'AIM_Form', |
53 | 53 | 'subsections'=>array( |
54 | 54 | 'credit_card'=>new EE_Credit_Card_Input(array( |
55 | 55 | 'required'=>true, |
56 | - 'html_label_text' => __( 'Card Number', 'event_espresso' ) |
|
56 | + 'html_label_text' => __('Card Number', 'event_espresso') |
|
57 | 57 | )), |
58 | 58 | 'exp_month'=>new EE_Credit_Card_Month_Input(true, array( |
59 | 59 | 'required'=>true, |
60 | - 'html_label_text' => __( 'Expiry Month', 'event_espresso' ) |
|
60 | + 'html_label_text' => __('Expiry Month', 'event_espresso') |
|
61 | 61 | )), |
62 | - 'exp_year'=>new EE_Credit_Card_Year_Input( array( |
|
62 | + 'exp_year'=>new EE_Credit_Card_Year_Input(array( |
|
63 | 63 | 'required'=>true, |
64 | - 'html_label_text' => __( 'Expiry Year', 'event_espresso' ) |
|
64 | + 'html_label_text' => __('Expiry Year', 'event_espresso') |
|
65 | 65 | )), |
66 | - 'cvv'=>new EE_CVV_Input( array( |
|
66 | + 'cvv'=>new EE_CVV_Input(array( |
|
67 | 67 | 'required'=>true, |
68 | - 'html_label_text' => __( 'CVV', 'event_espresso' ) ) ), |
|
68 | + 'html_label_text' => __('CVV', 'event_espresso') )), |
|
69 | 69 | ) |
70 | 70 | )); |
71 | - $billing_form->add_subsections( array( |
|
72 | - 'company' => new EE_Text_Input( array( |
|
71 | + $billing_form->add_subsections(array( |
|
72 | + 'company' => new EE_Text_Input(array( |
|
73 | 73 | 'html_label_text' => __('Company', 'event_espresso') |
74 | 74 | )) |
75 | - ), 'email', false ); |
|
75 | + ), 'email', false); |
|
76 | 76 | $billing_form->add_subsections( |
77 | 77 | array( |
78 | - 'fax' => new EE_Text_Input( array( |
|
78 | + 'fax' => new EE_Text_Input(array( |
|
79 | 79 | 'html_label_text' => __('Fax', 'event_espresso') |
80 | 80 | )) |
81 | 81 | ), |
82 | 82 | 'phone', |
83 | 83 | false ); |
84 | 84 | $settings_form = $this->settings_form(); |
85 | - if( $settings_form->get_input( 'excluded_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) { |
|
86 | - $billing_form->exclude( $settings_form->get_input( 'excluded_billing_inputs' )->normalized_value() ); |
|
85 | + if ($settings_form->get_input('excluded_billing_inputs') instanceof EE_Checkbox_Multi_Input) { |
|
86 | + $billing_form->exclude($settings_form->get_input('excluded_billing_inputs')->normalized_value()); |
|
87 | 87 | } |
88 | - if( $settings_form->get_input( 'required_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) { |
|
88 | + if ($settings_form->get_input('required_billing_inputs') instanceof EE_Checkbox_Multi_Input) { |
|
89 | 89 | $required_inputs = array_merge( |
90 | 90 | array( |
91 | 91 | 'credit_card', |
92 | 92 | 'exp_month', |
93 | 93 | 'exp_year' ), |
94 | - $settings_form->get_input( 'required_billing_inputs' )->normalized_value() ); |
|
95 | - foreach( $billing_form->inputs() as $input_name => $input ) { |
|
96 | - if( in_array( $input_name, $required_inputs ) ) { |
|
97 | - $input->set_required( true ); |
|
94 | + $settings_form->get_input('required_billing_inputs')->normalized_value() ); |
|
95 | + foreach ($billing_form->inputs() as $input_name => $input) { |
|
96 | + if (in_array($input_name, $required_inputs)) { |
|
97 | + $input->set_required(true); |
|
98 | 98 | } else { |
99 | - $input->set_required( false ); |
|
99 | + $input->set_required(false); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
103 | - return $this->apply_billing_form_debug_settings( $billing_form ); |
|
103 | + return $this->apply_billing_form_debug_settings($billing_form); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -112,19 +112,19 @@ discard block |
||
112 | 112 | * @param \EE_Billing_Info_Form $billing_form |
113 | 113 | * @return \EE_Billing_Info_Form |
114 | 114 | */ |
115 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
116 | - if ( $this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta( 'test_transactions', TRUE, FALSE )) { |
|
117 | - $billing_form->get_input( 'credit_card' )->set_default( '4007000000027' ); |
|
118 | - $billing_form->get_input( 'exp_year' )->set_default( '2020' ); |
|
119 | - if( $billing_form->get_subsection( 'cvv' ) instanceof EE_Form_Input_Base ) { |
|
120 | - $billing_form->get_input( 'cvv' )->set_default(( '123' )); |
|
115 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
116 | + if ($this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta('test_transactions', TRUE, FALSE)) { |
|
117 | + $billing_form->get_input('credit_card')->set_default('4007000000027'); |
|
118 | + $billing_form->get_input('exp_year')->set_default('2020'); |
|
119 | + if ($billing_form->get_subsection('cvv') instanceof EE_Form_Input_Base) { |
|
120 | + $billing_form->get_input('cvv')->set_default(('123')); |
|
121 | 121 | } |
122 | 122 | $billing_form->add_subsections( |
123 | - array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ), |
|
123 | + array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()), |
|
124 | 124 | 'credit_card' |
125 | 125 | ); |
126 | 126 | $billing_form->add_subsections( |
127 | - array( 'debug_content' => new EE_Form_Section_HTML_From_Template( dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php' )), |
|
127 | + array('debug_content' => new EE_Form_Section_HTML_From_Template(dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php')), |
|
128 | 128 | 'first_name' |
129 | 129 | ); |
130 | 130 | } |
@@ -144,17 +144,17 @@ discard block |
||
144 | 144 | 'extra_meta_inputs'=>array( |
145 | 145 | 'login_id'=>new EE_Text_Input( |
146 | 146 | array( |
147 | - 'html_label_text'=> sprintf( __("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link() ), |
|
147 | + 'html_label_text'=> sprintf(__("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link()), |
|
148 | 148 | 'required' => true ) |
149 | 149 | ), |
150 | 150 | 'transaction_key'=>new EE_Text_Input( |
151 | 151 | array( |
152 | - 'html_label_text'=> sprintf( __("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link() ), |
|
152 | + 'html_label_text'=> sprintf(__("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link()), |
|
153 | 153 | 'required' => true ) |
154 | 154 | ), |
155 | 155 | 'test_transactions'=>new EE_Yes_No_Input( |
156 | 156 | array( |
157 | - 'html_label_text'=> sprintf( __("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
157 | + 'html_label_text'=> sprintf(__("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link()), |
|
158 | 158 | 'html_help_text'=> __("Send test transactions, even to live server", 'event_espresso'), |
159 | 159 | 'default' => false, |
160 | 160 | 'required' => true |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | 'excluded_billing_inputs' => new EE_Checkbox_Multi_Input( |
164 | 164 | $billing_input_names, |
165 | 165 | array( |
166 | - 'html_label_text' => sprintf( __("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
166 | + 'html_label_text' => sprintf(__("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), |
|
167 | 167 | 'default' => array( |
168 | 168 | 'company', |
169 | 169 | 'fax', |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | 'required_billing_inputs' => new EE_Checkbox_Multi_Input( |
173 | 173 | $billing_input_names, |
174 | 174 | array( |
175 | - 'html_label_text' => sprintf( __("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
175 | + 'html_label_text' => sprintf(__("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), |
|
176 | 176 | 'default' => array_diff( |
177 | - array_keys( $billing_input_names ), |
|
178 | - array( 'address2', 'phone', 'company', 'fax' ) |
|
177 | + array_keys($billing_input_names), |
|
178 | + array('address2', 'phone', 'company', 'fax') |
|
179 | 179 | ), |
180 | 180 | 'html_help_text' => __('Note: if fields are excluded they cannot be required.', 'event_espresso') |
181 | 181 | )), |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function billing_input_names() { |
193 | 193 | return array( |
194 | - 'first_name' => __( 'First Name', 'event_espresso' ), |
|
194 | + 'first_name' => __('First Name', 'event_espresso'), |
|
195 | 195 | 'last_name' => __('Last Name', 'event_espresso'), |
196 | - 'email' => __( 'Email', 'event_espresso' ), |
|
197 | - 'company' => __( 'Company', 'event_espresso' ), |
|
196 | + 'email' => __('Email', 'event_espresso'), |
|
197 | + 'company' => __('Company', 'event_espresso'), |
|
198 | 198 | 'address' => __('Address', 'event_espresso'), |
199 | 199 | 'address2' => __('Address2', 'event_espresso'), |
200 | 200 | 'city' => __('City', 'event_espresso'), |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | 'country' => __('Country', 'event_espresso'), |
203 | 203 | 'zip' => __('Zip', 'event_espresso'), |
204 | 204 | 'phone' => __('Phone', 'event_espresso'), |
205 | - 'fax' => __( 'Fax', 'event_espresso' ), |
|
205 | + 'fax' => __('Fax', 'event_espresso'), |
|
206 | 206 | 'cvv' => __('CVV', 'event_espresso') |
207 | 207 | ); |
208 | 208 | } |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | * @param type $billing_form |
214 | 214 | * @return array |
215 | 215 | */ |
216 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
216 | + protected function _get_billing_values_from_form($billing_form) { |
|
217 | 217 | $all_billing_values_empty = array(); |
218 | - foreach( array_keys( $this->billing_input_names() ) as $input_name ) { |
|
219 | - $all_billing_values_empty[ $input_name ] = ''; |
|
218 | + foreach (array_keys($this->billing_input_names()) as $input_name) { |
|
219 | + $all_billing_values_empty[$input_name] = ''; |
|
220 | 220 | } |
221 | 221 | return array_merge( |
222 | 222 | $all_billing_values_empty, |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @see EE_PMT_Base::help_tabs_config() |
232 | 232 | * @return array |
233 | 233 | */ |
234 | - public function help_tabs_config(){ |
|
234 | + public function help_tabs_config() { |
|
235 | 235 | return array( |
236 | 236 | $this->get_help_tab_name() => array( |
237 | 237 | 'title' => __('Authorize.net AIM Settings', 'event_espresso'), |
@@ -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 Event Espresso |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * EE_System |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage core/ |
|
20 | - * @author Brent Christensen, Michael Nelson |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Event Espresso |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * EE_System |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage core/ |
|
20 | + * @author Brent Christensen, Michael Nelson |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | final class EE_System { |
25 | 25 | |
26 | 26 | |
@@ -203,14 +203,14 @@ discard block |
||
203 | 203 | |
204 | 204 | |
205 | 205 | /** |
206 | - * detect_if_activation_or_upgrade |
|
207 | - * |
|
208 | - * Takes care of detecting whether this is a brand new install or code upgrade, |
|
209 | - * and either setting up the DB or setting up maintenance mode etc. |
|
210 | - * |
|
211 | - * @access public |
|
212 | - * @return void |
|
213 | - */ |
|
206 | + * detect_if_activation_or_upgrade |
|
207 | + * |
|
208 | + * Takes care of detecting whether this is a brand new install or code upgrade, |
|
209 | + * and either setting up the DB or setting up maintenance mode etc. |
|
210 | + * |
|
211 | + * @access public |
|
212 | + * @return void |
|
213 | + */ |
|
214 | 214 | public function detect_if_activation_or_upgrade() { |
215 | 215 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
216 | 216 | |
@@ -514,11 +514,11 @@ discard block |
||
514 | 514 | $query_params = array( 'page' => 'espresso_about' ); |
515 | 515 | |
516 | 516 | if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
517 | - $query_params['new_activation'] = TRUE; |
|
517 | + $query_params['new_activation'] = TRUE; |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
521 | - $query_params['reactivation'] = TRUE; |
|
521 | + $query_params['reactivation'] = TRUE; |
|
522 | 522 | } |
523 | 523 | $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
524 | 524 | wp_safe_redirect( $url ); |
@@ -621,11 +621,11 @@ discard block |
||
621 | 621 | |
622 | 622 | |
623 | 623 | /** |
624 | - * _incompatible_addon_error |
|
625 | - * |
|
626 | - * @access public |
|
627 | - * @return void |
|
628 | - */ |
|
624 | + * _incompatible_addon_error |
|
625 | + * |
|
626 | + * @access public |
|
627 | + * @return void |
|
628 | + */ |
|
629 | 629 | private function _incompatible_addon_error() { |
630 | 630 | // get array of classes hooking into here |
631 | 631 | $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
@@ -747,14 +747,14 @@ discard block |
||
747 | 747 | |
748 | 748 | |
749 | 749 | /** |
750 | - * load_controllers |
|
751 | - * |
|
752 | - * this is the best place to load any additional controllers that needs access to EE core. |
|
753 | - * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time |
|
754 | - * |
|
755 | - * @access public |
|
756 | - * @return void |
|
757 | - */ |
|
750 | + * load_controllers |
|
751 | + * |
|
752 | + * this is the best place to load any additional controllers that needs access to EE core. |
|
753 | + * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time |
|
754 | + * |
|
755 | + * @access public |
|
756 | + * @return void |
|
757 | + */ |
|
758 | 758 | public function load_controllers() { |
759 | 759 | do_action( 'AHEE__EE_System__load_controllers__start' ); |
760 | 760 | // let's get it started |
@@ -771,13 +771,13 @@ discard block |
||
771 | 771 | |
772 | 772 | |
773 | 773 | /** |
774 | - * core_loaded_and_ready |
|
775 | - * |
|
776 | - * all of the basic EE core should be loaded at this point and available regardless of M-Mode |
|
777 | - * |
|
778 | - * @access public |
|
779 | - * @return void |
|
780 | - */ |
|
774 | + * core_loaded_and_ready |
|
775 | + * |
|
776 | + * all of the basic EE core should be loaded at this point and available regardless of M-Mode |
|
777 | + * |
|
778 | + * @access public |
|
779 | + * @return void |
|
780 | + */ |
|
781 | 781 | public function core_loaded_and_ready() { |
782 | 782 | do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
783 | 783 | do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
@@ -788,13 +788,13 @@ discard block |
||
788 | 788 | |
789 | 789 | |
790 | 790 | /** |
791 | - * initialize |
|
792 | - * |
|
793 | - * this is the best place to begin initializing client code |
|
794 | - * |
|
795 | - * @access public |
|
796 | - * @return void |
|
797 | - */ |
|
791 | + * initialize |
|
792 | + * |
|
793 | + * this is the best place to begin initializing client code |
|
794 | + * |
|
795 | + * @access public |
|
796 | + * @return void |
|
797 | + */ |
|
798 | 798 | public function initialize() { |
799 | 799 | do_action( 'AHEE__EE_System__initialize' ); |
800 | 800 | } |
@@ -802,13 +802,13 @@ discard block |
||
802 | 802 | |
803 | 803 | |
804 | 804 | /** |
805 | - * initialize_last |
|
806 | - * |
|
807 | - * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so |
|
808 | - * |
|
809 | - * @access public |
|
810 | - * @return void |
|
811 | - */ |
|
805 | + * initialize_last |
|
806 | + * |
|
807 | + * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so |
|
808 | + * |
|
809 | + * @access public |
|
810 | + * @return void |
|
811 | + */ |
|
812 | 812 | public function initialize_last() { |
813 | 813 | do_action( 'AHEE__EE_System__initialize_last' ); |
814 | 814 | } |
@@ -817,14 +817,14 @@ discard block |
||
817 | 817 | |
818 | 818 | |
819 | 819 | /** |
820 | - * set_hooks_for_shortcodes_modules_and_addons |
|
821 | - * |
|
822 | - * this is the best place for other systems to set callbacks for hooking into other parts of EE |
|
823 | - * this happens at the very beginning of the wp_loaded hookpoint |
|
824 | - * |
|
825 | - * @access public |
|
826 | - * @return void |
|
827 | - */ |
|
820 | + * set_hooks_for_shortcodes_modules_and_addons |
|
821 | + * |
|
822 | + * this is the best place for other systems to set callbacks for hooking into other parts of EE |
|
823 | + * this happens at the very beginning of the wp_loaded hookpoint |
|
824 | + * |
|
825 | + * @access public |
|
826 | + * @return void |
|
827 | + */ |
|
828 | 828 | public function set_hooks_for_shortcodes_modules_and_addons() { |
829 | 829 | // do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
830 | 830 | } |
@@ -833,13 +833,13 @@ discard block |
||
833 | 833 | |
834 | 834 | |
835 | 835 | /** |
836 | - * do_not_cache |
|
837 | - * |
|
838 | - * sets no cache headers and defines no cache constants for WP plugins |
|
839 | - * |
|
840 | - * @access public |
|
841 | - * @return void |
|
842 | - */ |
|
836 | + * do_not_cache |
|
837 | + * |
|
838 | + * sets no cache headers and defines no cache constants for WP plugins |
|
839 | + * |
|
840 | + * @access public |
|
841 | + * @return void |
|
842 | + */ |
|
843 | 843 | public static function do_not_cache() { |
844 | 844 | // set no cache constants |
845 | 845 | if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | //Current post |
959 | 959 | global $post; |
960 | 960 | |
961 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
961 | + if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
962 | 962 | //Events Edit Current Event |
963 | 963 | $admin_bar->add_menu(array( |
964 | 964 | 'id' => 'espresso-toolbar-events-edit', |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public static function instance() { |
104 | 104 | // check if class object is instantiated |
105 | - if ( ! self::$_instance instanceof EE_System ) { |
|
105 | + if ( ! self::$_instance instanceof EE_System) { |
|
106 | 106 | self::$_instance = new self(); |
107 | 107 | } |
108 | 108 | return self::$_instance; |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | * resets the instance and returns it |
114 | 114 | * @return EE_System |
115 | 115 | */ |
116 | - public static function reset(){ |
|
116 | + public static function reset() { |
|
117 | 117 | self::$_instance->_req_type = NULL; |
118 | 118 | //we need to reset the migration manager in order for it to detect DMSs properly |
119 | 119 | EE_Data_Migration_Manager::reset(); |
120 | 120 | //make sure none of the old hooks are left hanging around |
121 | - remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
121 | + remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
122 | 122 | self::instance()->detect_activations_or_upgrades(); |
123 | 123 | self::instance()->perform_activations_upgrades_and_migrations(); |
124 | 124 | return self::instance(); |
@@ -134,26 +134,26 @@ discard block |
||
134 | 134 | * @access private |
135 | 135 | */ |
136 | 136 | private function __construct() { |
137 | - do_action( 'AHEE__EE_System__construct__begin', $this ); |
|
137 | + do_action('AHEE__EE_System__construct__begin', $this); |
|
138 | 138 | // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc |
139 | - add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) ); |
|
139 | + add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons')); |
|
140 | 140 | // when an ee addon is activated, we want to call the core hook(s) again |
141 | 141 | // because the newly-activated addon didn't get a chance to run at all |
142 | - add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 ); |
|
142 | + add_action('activate_plugin', array($this, 'load_espresso_addons'), 1); |
|
143 | 143 | // detect whether install or upgrade |
144 | - add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 ); |
|
144 | + add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3); |
|
145 | 145 | // load EE_Config, EE_Textdomain, etc |
146 | - add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 ); |
|
146 | + add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5); |
|
147 | 147 | // load EE_Config, EE_Textdomain, etc |
148 | - add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
148 | + add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7); |
|
149 | 149 | // you wanna get going? I wanna get going... let's get going! |
150 | - add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 ); |
|
150 | + add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9); |
|
151 | 151 | //other housekeeping |
152 | 152 | //exclude EE critical pages from wp_list_pages |
153 | - add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 ); |
|
153 | + add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10); |
|
154 | 154 | // ALL EE Addons should use the following hook point to attach their initial setup too |
155 | 155 | // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads |
156 | - do_action( 'AHEE__EE_System__construct__complete', $this ); |
|
156 | + do_action('AHEE__EE_System__construct__complete', $this); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | public function load_espresso_addons() { |
174 | 174 | // set autoloaders for all of the classes implementing EEI_Plugin_API |
175 | 175 | // which provide helpers for EE plugin authors to more easily register certain components with EE. |
176 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' ); |
|
176 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api'); |
|
177 | 177 | //load and setup EE_Capabilities |
178 | - EE_Registry::instance()->load_core( 'Capabilities' ); |
|
179 | - do_action( 'AHEE__EE_System__load_espresso_addons' ); |
|
178 | + EE_Registry::instance()->load_core('Capabilities'); |
|
179 | + do_action('AHEE__EE_System__load_espresso_addons'); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | * @access public |
192 | 192 | * @return void |
193 | 193 | */ |
194 | - public function detect_activations_or_upgrades(){ |
|
194 | + public function detect_activations_or_upgrades() { |
|
195 | 195 | //first off: let's make sure to handle core |
196 | 196 | $this->detect_if_activation_or_upgrade(); |
197 | - foreach(EE_Registry::instance()->addons as $addon){ |
|
197 | + foreach (EE_Registry::instance()->addons as $addon) { |
|
198 | 198 | //detect teh request type for that addon |
199 | 199 | $addon->detect_activation_or_upgrade(); |
200 | 200 | } |
@@ -215,44 +215,44 @@ discard block |
||
215 | 215 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
216 | 216 | |
217 | 217 | // load M-Mode class |
218 | - EE_Registry::instance()->load_core( 'Maintenance_Mode' ); |
|
218 | + EE_Registry::instance()->load_core('Maintenance_Mode'); |
|
219 | 219 | // check if db has been updated, or if its a brand-new installation |
220 | 220 | |
221 | 221 | $espresso_db_update = $this->fix_espresso_db_upgrade_option(); |
222 | - $request_type = $this->detect_req_type($espresso_db_update); |
|
222 | + $request_type = $this->detect_req_type($espresso_db_update); |
|
223 | 223 | //EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ ); |
224 | - if( $request_type != EE_System::req_type_normal){ |
|
224 | + if ($request_type != EE_System::req_type_normal) { |
|
225 | 225 | EE_Registry::instance()->load_helper('Activation'); |
226 | 226 | } |
227 | 227 | |
228 | - switch($request_type){ |
|
228 | + switch ($request_type) { |
|
229 | 229 | case EE_System::req_type_new_activation: |
230 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' ); |
|
231 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
230 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); |
|
231 | + $this->_handle_core_version_change($espresso_db_update); |
|
232 | 232 | break; |
233 | 233 | case EE_System::req_type_reactivation: |
234 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' ); |
|
235 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
234 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); |
|
235 | + $this->_handle_core_version_change($espresso_db_update); |
|
236 | 236 | break; |
237 | 237 | case EE_System::req_type_upgrade: |
238 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' ); |
|
238 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); |
|
239 | 239 | //migrations may be required now that we've upgraded |
240 | 240 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
241 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
241 | + $this->_handle_core_version_change($espresso_db_update); |
|
242 | 242 | // echo "done upgrade";die; |
243 | 243 | break; |
244 | 244 | case EE_System::req_type_downgrade: |
245 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' ); |
|
245 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); |
|
246 | 246 | //its possible migrations are no longer required |
247 | 247 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
248 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
248 | + $this->_handle_core_version_change($espresso_db_update); |
|
249 | 249 | break; |
250 | 250 | case EE_System::req_type_normal: |
251 | 251 | default: |
252 | 252 | // $this->_maybe_redirect_to_ee_about(); |
253 | 253 | break; |
254 | 254 | } |
255 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' ); |
|
255 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | * initializing the database later during the request |
261 | 261 | * @param array $espresso_db_update |
262 | 262 | */ |
263 | - protected function _handle_core_version_change( $espresso_db_update ){ |
|
264 | - $this->update_list_of_installed_versions( $espresso_db_update ); |
|
263 | + protected function _handle_core_version_change($espresso_db_update) { |
|
264 | + $this->update_list_of_installed_versions($espresso_db_update); |
|
265 | 265 | //get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) |
266 | - add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' )); |
|
266 | + add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required')); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -278,44 +278,44 @@ discard block |
||
278 | 278 | * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table |
279 | 279 | * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction |
280 | 280 | */ |
281 | - private function fix_espresso_db_upgrade_option($espresso_db_update = null){ |
|
282 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update ); |
|
283 | - if( ! $espresso_db_update){ |
|
284 | - $espresso_db_update = get_option( 'espresso_db_update' ); |
|
281 | + private function fix_espresso_db_upgrade_option($espresso_db_update = null) { |
|
282 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); |
|
283 | + if ( ! $espresso_db_update) { |
|
284 | + $espresso_db_update = get_option('espresso_db_update'); |
|
285 | 285 | } |
286 | 286 | // check that option is an array |
287 | - if( ! is_array( $espresso_db_update )) { |
|
287 | + if ( ! is_array($espresso_db_update)) { |
|
288 | 288 | // if option is FALSE, then it never existed |
289 | - if ( $espresso_db_update === FALSE ) { |
|
289 | + if ($espresso_db_update === FALSE) { |
|
290 | 290 | // make $espresso_db_update an array and save option with autoload OFF |
291 | - $espresso_db_update = array(); |
|
292 | - add_option( 'espresso_db_update', $espresso_db_update, '', 'no' ); |
|
291 | + $espresso_db_update = array(); |
|
292 | + add_option('espresso_db_update', $espresso_db_update, '', 'no'); |
|
293 | 293 | } else { |
294 | 294 | // option is NOT FALSE but also is NOT an array, so make it an array and save it |
295 | - $espresso_db_update = array( $espresso_db_update=>array() ); |
|
296 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
295 | + $espresso_db_update = array($espresso_db_update=>array()); |
|
296 | + update_option('espresso_db_update', $espresso_db_update); |
|
297 | 297 | } |
298 | - }else{ |
|
298 | + } else { |
|
299 | 299 | $corrected_db_update = array(); |
300 | 300 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
301 | - foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
|
302 | - if(is_int($should_be_version_string) && ! is_array($should_be_array)){ |
|
301 | + foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { |
|
302 | + if (is_int($should_be_version_string) && ! is_array($should_be_array)) { |
|
303 | 303 | //the key is an int, and the value IS NOT an array |
304 | 304 | //so it must be numerically-indexed, where values are versions installed... |
305 | 305 | //fix it! |
306 | 306 | $version_string = $should_be_array; |
307 | 307 | $corrected_db_update[$version_string] = array('unknown-date'); |
308 | - }else{ |
|
308 | + } else { |
|
309 | 309 | //ok it checks out |
310 | 310 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
311 | 311 | } |
312 | 312 | } |
313 | 313 | $espresso_db_update = $corrected_db_update; |
314 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
314 | + update_option('espresso_db_update', $espresso_db_update); |
|
315 | 315 | |
316 | 316 | } |
317 | 317 | |
318 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update ); |
|
318 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); |
|
319 | 319 | return $espresso_db_update; |
320 | 320 | } |
321 | 321 | |
@@ -334,33 +334,33 @@ discard block |
||
334 | 334 | * so we prefer to only do it when necessary |
335 | 335 | * @return void |
336 | 336 | */ |
337 | - public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){ |
|
337 | + public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) { |
|
338 | 338 | $request_type = $this->detect_req_type(); |
339 | 339 | //only initialize system if we're not in maintenance mode. |
340 | - if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
341 | - update_option( 'ee_flush_rewrite_rules', TRUE ); |
|
340 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
341 | + update_option('ee_flush_rewrite_rules', TRUE); |
|
342 | 342 | EEH_Activation::system_initialization(); |
343 | - if( $verify_schema ) { |
|
343 | + if ($verify_schema) { |
|
344 | 344 | EEH_Activation::initialize_db_and_folders(); |
345 | 345 | } |
346 | 346 | EEH_Activation::initialize_db_content(); |
347 | - if( $initialize_addons_too ) { |
|
347 | + if ($initialize_addons_too) { |
|
348 | 348 | $this->initialize_addons(); |
349 | 349 | } |
350 | - }else{ |
|
351 | - EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
|
350 | + } else { |
|
351 | + EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); |
|
352 | 352 | } |
353 | - if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
|
354 | - add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 ); |
|
353 | + if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) { |
|
354 | + add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9); |
|
355 | 355 | } |
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
359 | 359 | * Initializes the db for all registered addons |
360 | 360 | */ |
361 | - public function initialize_addons(){ |
|
361 | + public function initialize_addons() { |
|
362 | 362 | //foreach registered addon, make sure its db is up-to-date too |
363 | - foreach(EE_Registry::instance()->addons as $addon){ |
|
363 | + foreach (EE_Registry::instance()->addons as $addon) { |
|
364 | 364 | $addon->initialize_db_if_no_migrations_required(); |
365 | 365 | } |
366 | 366 | } |
@@ -372,16 +372,16 @@ discard block |
||
372 | 372 | * @param string $current_version_to_add version to be added to the version history |
373 | 373 | * @return boolean success as to whether or not this option was changed |
374 | 374 | */ |
375 | - public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) { |
|
376 | - if( ! $version_history ) { |
|
375 | + public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) { |
|
376 | + if ( ! $version_history) { |
|
377 | 377 | $version_history = $this->fix_espresso_db_upgrade_option($version_history); |
378 | 378 | } |
379 | - if( $current_version_to_add == NULL){ |
|
379 | + if ($current_version_to_add == NULL) { |
|
380 | 380 | $current_version_to_add = espresso_version(); |
381 | 381 | } |
382 | - $version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() ); |
|
382 | + $version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time()); |
|
383 | 383 | // re-save |
384 | - return update_option( 'espresso_db_update', $version_history ); |
|
384 | + return update_option('espresso_db_update', $version_history); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | |
@@ -398,10 +398,10 @@ discard block |
||
398 | 398 | * but still know if this is a new install or not |
399 | 399 | * @return int one of the constants on EE_System::req_type_ |
400 | 400 | */ |
401 | - public function detect_req_type( $espresso_db_update = NULL ){ |
|
402 | - if ( $this->_req_type === NULL ){ |
|
403 | - $espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
404 | - $this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() ); |
|
401 | + public function detect_req_type($espresso_db_update = NULL) { |
|
402 | + if ($this->_req_type === NULL) { |
|
403 | + $espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
404 | + $this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version()); |
|
405 | 405 | } |
406 | 406 | return $this->_req_type; |
407 | 407 | } |
@@ -417,39 +417,39 @@ discard block |
||
417 | 417 | * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version()) |
418 | 418 | * @return int one of the constants on EE_System::req_type_* |
419 | 419 | */ |
420 | - public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){ |
|
421 | - $version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ); |
|
422 | - if( $activation_history_for_addon ){ |
|
420 | + public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) { |
|
421 | + $version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to); |
|
422 | + if ($activation_history_for_addon) { |
|
423 | 423 | //it exists, so this isn't a completely new install |
424 | 424 | //check if this version already in that list of previously installed versions |
425 | - if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) { |
|
425 | + if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) { |
|
426 | 426 | //it a version we haven't seen before |
427 | - if( $version_is_higher === 1 ){ |
|
427 | + if ($version_is_higher === 1) { |
|
428 | 428 | $req_type = EE_System::req_type_upgrade; |
429 | - }else{ |
|
429 | + } else { |
|
430 | 430 | $req_type = EE_System::req_type_downgrade; |
431 | 431 | } |
432 | - delete_option( $activation_indicator_option_name ); |
|
432 | + delete_option($activation_indicator_option_name); |
|
433 | 433 | } else { |
434 | 434 | // its not an update. maybe a reactivation? |
435 | - if( get_option( $activation_indicator_option_name, FALSE ) ){ |
|
436 | - if ( $version_is_higher === -1 ){ |
|
435 | + if (get_option($activation_indicator_option_name, FALSE)) { |
|
436 | + if ($version_is_higher === -1) { |
|
437 | 437 | $req_type = EE_System::req_type_downgrade; |
438 | - }elseif( $version_is_higher === 0 ){ |
|
438 | + }elseif ($version_is_higher === 0) { |
|
439 | 439 | //we've seen this version before, but it's an activation. must be a reactivation |
440 | 440 | $req_type = EE_System::req_type_reactivation; |
441 | - }else{//$version_is_higher === 1 |
|
441 | + } else {//$version_is_higher === 1 |
|
442 | 442 | $req_type = EE_System::req_type_upgrade; |
443 | 443 | } |
444 | - delete_option( $activation_indicator_option_name ); |
|
444 | + delete_option($activation_indicator_option_name); |
|
445 | 445 | } else { |
446 | 446 | //we've seen this version before and the activation indicate doesn't show it was just activated |
447 | - if ( $version_is_higher === -1 ){ |
|
447 | + if ($version_is_higher === -1) { |
|
448 | 448 | $req_type = EE_System::req_type_downgrade; |
449 | - }elseif( $version_is_higher === 0 ){ |
|
449 | + }elseif ($version_is_higher === 0) { |
|
450 | 450 | //we've seen this version before and it's not an activation. its normal request |
451 | 451 | $req_type = EE_System::req_type_normal; |
452 | - }else{//$version_is_higher === 1 |
|
452 | + } else {//$version_is_higher === 1 |
|
453 | 453 | $req_type = EE_System::req_type_upgrade; |
454 | 454 | } |
455 | 455 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | } else { |
458 | 458 | //brand new install |
459 | 459 | $req_type = EE_System::req_type_new_activation; |
460 | - delete_option( $activation_indicator_option_name ); |
|
460 | + delete_option($activation_indicator_option_name); |
|
461 | 461 | } |
462 | 462 | return $req_type; |
463 | 463 | } |
@@ -475,30 +475,30 @@ discard block |
||
475 | 475 | * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); |
476 | 476 | * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; |
477 | 477 | */ |
478 | - protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){ |
|
478 | + protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) { |
|
479 | 479 | //find the most recently-activated version |
480 | 480 | $most_recently_active_version_activation = '1970-01-01 00:00:00'; |
481 | 481 | $most_recently_active_version = '0.0.0.dev.000'; |
482 | - if( is_array( $activation_history_for_addon ) ){ |
|
483 | - foreach( $activation_history_for_addon as $version => $times_activated ){ |
|
482 | + if (is_array($activation_history_for_addon)) { |
|
483 | + foreach ($activation_history_for_addon as $version => $times_activated) { |
|
484 | 484 | //check there is a record of when this version was activated. Otherwise, |
485 | 485 | //mark it as unknown |
486 | - if( ! $times_activated ){ |
|
487 | - $times_activated = array( 'unknown-date'); |
|
486 | + if ( ! $times_activated) { |
|
487 | + $times_activated = array('unknown-date'); |
|
488 | 488 | } |
489 | - if( is_string( $times_activated ) ){ |
|
490 | - $times_activated = array( $times_activated ); |
|
489 | + if (is_string($times_activated)) { |
|
490 | + $times_activated = array($times_activated); |
|
491 | 491 | } |
492 | - foreach( $times_activated as $an_activation ){ |
|
493 | - if( $an_activation != 'unknown-date' && |
|
494 | - $an_activation > $most_recently_active_version_activation ){ |
|
492 | + foreach ($times_activated as $an_activation) { |
|
493 | + if ($an_activation != 'unknown-date' && |
|
494 | + $an_activation > $most_recently_active_version_activation) { |
|
495 | 495 | $most_recently_active_version = $version; |
496 | 496 | $most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation; |
497 | 497 | } |
498 | 498 | } |
499 | 499 | } |
500 | 500 | } |
501 | - return version_compare( $version_to_upgrade_to, $most_recently_active_version ); |
|
501 | + return version_compare($version_to_upgrade_to, $most_recently_active_version); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | |
@@ -508,20 +508,20 @@ discard block |
||
508 | 508 | * @return void |
509 | 509 | */ |
510 | 510 | public function redirect_to_about_ee() { |
511 | - $notices = EE_Error::get_notices( FALSE ); |
|
511 | + $notices = EE_Error::get_notices(FALSE); |
|
512 | 512 | //if current user is an admin and it's not an ajax request |
513 | - if(EE_Registry::instance()->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) && ! ( defined('DOING_AJAX') && DOING_AJAX ) && ! isset( $notices[ 'errors' ] ) ){ |
|
514 | - $query_params = array( 'page' => 'espresso_about' ); |
|
513 | + if (EE_Registry::instance()->CAP->current_user_can('manage_options', 'espresso_about_default') && ! (defined('DOING_AJAX') && DOING_AJAX) && ! isset($notices['errors'])) { |
|
514 | + $query_params = array('page' => 'espresso_about'); |
|
515 | 515 | |
516 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
|
516 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) { |
|
517 | 517 | $query_params['new_activation'] = TRUE; |
518 | 518 | } |
519 | 519 | |
520 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
|
520 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) { |
|
521 | 521 | $query_params['reactivation'] = TRUE; |
522 | 522 | } |
523 | - $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
|
524 | - wp_safe_redirect( $url ); |
|
523 | + $url = add_query_arg($query_params, admin_url('admin.php')); |
|
524 | + wp_safe_redirect($url); |
|
525 | 525 | exit(); |
526 | 526 | } |
527 | 527 | } |
@@ -535,31 +535,31 @@ discard block |
||
535 | 535 | * |
536 | 536 | * @return void |
537 | 537 | */ |
538 | - public function load_core_configuration(){ |
|
539 | - do_action( 'AHEE__EE_System__load_core_configuration__begin', $this ); |
|
540 | - EE_Registry::instance()->load_core( 'EE_Load_Textdomain' ); |
|
538 | + public function load_core_configuration() { |
|
539 | + do_action('AHEE__EE_System__load_core_configuration__begin', $this); |
|
540 | + EE_Registry::instance()->load_core('EE_Load_Textdomain'); |
|
541 | 541 | //load textdomain |
542 | 542 | EE_Load_Textdomain::load_textdomain(); |
543 | 543 | // load and setup EE_Config and EE_Network_Config |
544 | - EE_Registry::instance()->load_core( 'Config' ); |
|
545 | - EE_Registry::instance()->load_core( 'Network_Config' ); |
|
544 | + EE_Registry::instance()->load_core('Config'); |
|
545 | + EE_Registry::instance()->load_core('Network_Config'); |
|
546 | 546 | // setup autoloaders |
547 | 547 | // enable logging? |
548 | - if ( EE_Registry::instance()->CFG->admin->use_full_logging ) { |
|
549 | - EE_Registry::instance()->load_core( 'Log' ); |
|
548 | + if (EE_Registry::instance()->CFG->admin->use_full_logging) { |
|
549 | + EE_Registry::instance()->load_core('Log'); |
|
550 | 550 | } |
551 | 551 | // check for activation errors |
552 | - $activation_errors = get_option( 'ee_plugin_activation_errors', FALSE ); |
|
553 | - if ( $activation_errors ) { |
|
554 | - EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
555 | - update_option( 'ee_plugin_activation_errors', FALSE ); |
|
552 | + $activation_errors = get_option('ee_plugin_activation_errors', FALSE); |
|
553 | + if ($activation_errors) { |
|
554 | + EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); |
|
555 | + update_option('ee_plugin_activation_errors', FALSE); |
|
556 | 556 | } |
557 | 557 | // get model names |
558 | 558 | $this->_parse_model_names(); |
559 | 559 | |
560 | 560 | //load caf stuff a chance to play during the activation process too. |
561 | 561 | $this->_maybe_brew_regular(); |
562 | - do_action( 'AHEE__EE_System__load_core_configuration__complete', $this ); |
|
562 | + do_action('AHEE__EE_System__load_core_configuration__complete', $this); |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | |
@@ -568,23 +568,23 @@ discard block |
||
568 | 568 | * |
569 | 569 | * @return void |
570 | 570 | */ |
571 | - private function _parse_model_names(){ |
|
571 | + private function _parse_model_names() { |
|
572 | 572 | //get all the files in the EE_MODELS folder that end in .model.php |
573 | - $models = glob( EE_MODELS.'*.model.php'); |
|
573 | + $models = glob(EE_MODELS.'*.model.php'); |
|
574 | 574 | $model_names = array(); |
575 | 575 | $non_abstract_db_models = array(); |
576 | - foreach( $models as $model ){ |
|
576 | + foreach ($models as $model) { |
|
577 | 577 | // get model classname |
578 | - $classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model ); |
|
579 | - $shortname = str_replace( 'EEM_', '', $classname ); |
|
578 | + $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); |
|
579 | + $shortname = str_replace('EEM_', '', $classname); |
|
580 | 580 | $reflectionClass = new ReflectionClass($classname); |
581 | - if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){ |
|
581 | + if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { |
|
582 | 582 | $non_abstract_db_models[$shortname] = $classname; |
583 | 583 | } |
584 | - $model_names[ $shortname ] = $classname; |
|
584 | + $model_names[$shortname] = $classname; |
|
585 | 585 | } |
586 | - EE_Registry::instance()->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names ); |
|
587 | - EE_Registry::instance()->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models ); |
|
586 | + EE_Registry::instance()->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names); |
|
587 | + EE_Registry::instance()->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models); |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | |
@@ -594,8 +594,8 @@ discard block |
||
594 | 594 | * @return void |
595 | 595 | */ |
596 | 596 | private function _maybe_brew_regular() { |
597 | - if (( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) { |
|
598 | - require_once EE_CAFF_PATH . 'brewing_regular.php'; |
|
597 | + if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) { |
|
598 | + require_once EE_CAFF_PATH.'brewing_regular.php'; |
|
599 | 599 | } |
600 | 600 | } |
601 | 601 | |
@@ -612,9 +612,9 @@ discard block |
||
612 | 612 | * @return void |
613 | 613 | */ |
614 | 614 | public function register_shortcodes_modules_and_widgets() { |
615 | - do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' ); |
|
615 | + do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); |
|
616 | 616 | // check for addons using old hookpoint |
617 | - if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) { |
|
617 | + if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { |
|
618 | 618 | $this->_incompatible_addon_error(); |
619 | 619 | } |
620 | 620 | } |
@@ -628,19 +628,19 @@ discard block |
||
628 | 628 | */ |
629 | 629 | private function _incompatible_addon_error() { |
630 | 630 | // get array of classes hooking into here |
631 | - $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
|
632 | - if ( ! empty( $class_names )) { |
|
633 | - $msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' ); |
|
631 | + $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons'); |
|
632 | + if ( ! empty($class_names)) { |
|
633 | + $msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso'); |
|
634 | 634 | $msg .= '<ul>'; |
635 | - foreach ( $class_names as $class_name ) { |
|
636 | - $msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>'; |
|
635 | + foreach ($class_names as $class_name) { |
|
636 | + $msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>'; |
|
637 | 637 | } |
638 | 638 | $msg .= '</ul>'; |
639 | - $msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' ); |
|
639 | + $msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso'); |
|
640 | 640 | // save list of incompatible addons to wp-options for later use |
641 | - add_option( 'ee_incompatible_addons', $class_names, '', 'no' ); |
|
642 | - if ( is_admin() ) { |
|
643 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
641 | + add_option('ee_incompatible_addons', $class_names, '', 'no'); |
|
642 | + if (is_admin()) { |
|
643 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
644 | 644 | } |
645 | 645 | } |
646 | 646 | } |
@@ -657,25 +657,25 @@ discard block |
||
657 | 657 | * |
658 | 658 | * @return void |
659 | 659 | */ |
660 | - public function brew_espresso(){ |
|
661 | - do_action( 'AHEE__EE_System__brew_espresso__begin', $this ); |
|
660 | + public function brew_espresso() { |
|
661 | + do_action('AHEE__EE_System__brew_espresso__begin', $this); |
|
662 | 662 | // load some final core systems |
663 | - add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 ); |
|
664 | - add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 ); |
|
665 | - add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 ); |
|
666 | - add_action( 'init', array( $this, 'load_controllers' ), 7 ); |
|
667 | - add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 ); |
|
668 | - add_action( 'init', array( $this, 'initialize' ), 10 ); |
|
669 | - add_action( 'init', array( $this, 'initialize_last' ), 100 ); |
|
670 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
671 | - add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 ); |
|
672 | - |
|
673 | - if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE ) ) { |
|
663 | + add_action('init', array($this, 'set_hooks_for_core'), 1); |
|
664 | + add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3); |
|
665 | + add_action('init', array($this, 'load_CPTs_and_session'), 5); |
|
666 | + add_action('init', array($this, 'load_controllers'), 7); |
|
667 | + add_action('init', array($this, 'core_loaded_and_ready'), 9); |
|
668 | + add_action('init', array($this, 'initialize'), 10); |
|
669 | + add_action('init', array($this, 'initialize_last'), 100); |
|
670 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
671 | + add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100); |
|
672 | + |
|
673 | + if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) { |
|
674 | 674 | // pew pew pew |
675 | - EE_Registry::instance()->load_core( 'PUE' ); |
|
676 | - do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' ); |
|
675 | + EE_Registry::instance()->load_core('PUE'); |
|
676 | + do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
677 | 677 | } |
678 | - do_action( 'AHEE__EE_System__brew_espresso__complete', $this ); |
|
678 | + do_action('AHEE__EE_System__brew_espresso__complete', $this); |
|
679 | 679 | } |
680 | 680 | |
681 | 681 | |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | */ |
690 | 690 | public function set_hooks_for_core() { |
691 | 691 | $this->_deactivate_incompatible_addons(); |
692 | - do_action( 'AHEE__EE_System__set_hooks_for_core' ); |
|
692 | + do_action('AHEE__EE_System__set_hooks_for_core'); |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | |
@@ -698,15 +698,15 @@ discard block |
||
698 | 698 | * Using the information gathered in EE_System::_incompatible_addon_error, |
699 | 699 | * deactivates any addons considered incompatible with the current version of EE |
700 | 700 | */ |
701 | - private function _deactivate_incompatible_addons(){ |
|
702 | - $incompatible_addons = get_option( 'ee_incompatible_addons', array() ); |
|
703 | - if ( ! empty( $incompatible_addons )) { |
|
704 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
705 | - foreach ( $active_plugins as $active_plugin ) { |
|
706 | - foreach ( $incompatible_addons as $incompatible_addon ) { |
|
707 | - if ( strpos( $active_plugin, $incompatible_addon ) !== FALSE ) { |
|
708 | - unset( $_GET['activate'] ); |
|
709 | - espresso_deactivate_plugin( $active_plugin ); |
|
701 | + private function _deactivate_incompatible_addons() { |
|
702 | + $incompatible_addons = get_option('ee_incompatible_addons', array()); |
|
703 | + if ( ! empty($incompatible_addons)) { |
|
704 | + $active_plugins = get_option('active_plugins', array()); |
|
705 | + foreach ($active_plugins as $active_plugin) { |
|
706 | + foreach ($incompatible_addons as $incompatible_addon) { |
|
707 | + if (strpos($active_plugin, $incompatible_addon) !== FALSE) { |
|
708 | + unset($_GET['activate']); |
|
709 | + espresso_deactivate_plugin($active_plugin); |
|
710 | 710 | } |
711 | 711 | } |
712 | 712 | } |
@@ -723,10 +723,10 @@ discard block |
||
723 | 723 | */ |
724 | 724 | public function perform_activations_upgrades_and_migrations() { |
725 | 725 | //first check if we had previously attempted to setup EE's directories but failed |
726 | - if( EEH_Activation::upload_directories_incomplete() ) { |
|
726 | + if (EEH_Activation::upload_directories_incomplete()) { |
|
727 | 727 | EEH_Activation::create_upload_directories(); |
728 | 728 | } |
729 | - do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
729 | + do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
730 | 730 | } |
731 | 731 | |
732 | 732 | |
@@ -738,10 +738,10 @@ discard block |
||
738 | 738 | * @return void |
739 | 739 | */ |
740 | 740 | public function load_CPTs_and_session() { |
741 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__start' ); |
|
741 | + do_action('AHEE__EE_System__load_CPTs_and_session__start'); |
|
742 | 742 | // register Custom Post Types |
743 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
744 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' ); |
|
743 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
744 | + do_action('AHEE__EE_System__load_CPTs_and_session__complete'); |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | |
@@ -756,16 +756,16 @@ discard block |
||
756 | 756 | * @return void |
757 | 757 | */ |
758 | 758 | public function load_controllers() { |
759 | - do_action( 'AHEE__EE_System__load_controllers__start' ); |
|
759 | + do_action('AHEE__EE_System__load_controllers__start'); |
|
760 | 760 | // let's get it started |
761 | - if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) { |
|
762 | - do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' ); |
|
763 | - EE_Registry::instance()->load_core( 'Front_Controller' ); |
|
764 | - } else if ( ! EE_FRONT_AJAX ) { |
|
765 | - do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' ); |
|
766 | - EE_Registry::instance()->load_core( 'Admin' ); |
|
761 | + if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) { |
|
762 | + do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
763 | + EE_Registry::instance()->load_core('Front_Controller'); |
|
764 | + } else if ( ! EE_FRONT_AJAX) { |
|
765 | + do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
766 | + EE_Registry::instance()->load_core('Admin'); |
|
767 | 767 | } |
768 | - do_action( 'AHEE__EE_System__load_controllers__complete' ); |
|
768 | + do_action('AHEE__EE_System__load_controllers__complete'); |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | |
@@ -779,10 +779,10 @@ discard block |
||
779 | 779 | * @return void |
780 | 780 | */ |
781 | 781 | public function core_loaded_and_ready() { |
782 | - do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
|
783 | - do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
|
782 | + do_action('AHEE__EE_System__core_loaded_and_ready'); |
|
783 | + do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); |
|
784 | 784 | // add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 ); |
785 | - EE_Registry::instance()->load_core( 'Session' ); |
|
785 | + EE_Registry::instance()->load_core('Session'); |
|
786 | 786 | } |
787 | 787 | |
788 | 788 | |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | * @return void |
797 | 797 | */ |
798 | 798 | public function initialize() { |
799 | - do_action( 'AHEE__EE_System__initialize' ); |
|
799 | + do_action('AHEE__EE_System__initialize'); |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | * @return void |
811 | 811 | */ |
812 | 812 | public function initialize_last() { |
813 | - do_action( 'AHEE__EE_System__initialize_last' ); |
|
813 | + do_action('AHEE__EE_System__initialize_last'); |
|
814 | 814 | } |
815 | 815 | |
816 | 816 | |
@@ -842,21 +842,21 @@ discard block |
||
842 | 842 | */ |
843 | 843 | public static function do_not_cache() { |
844 | 844 | // set no cache constants |
845 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
846 | - define( 'DONOTCACHEPAGE', true ); |
|
845 | + if ( ! defined('DONOTCACHEPAGE')) { |
|
846 | + define('DONOTCACHEPAGE', true); |
|
847 | 847 | } |
848 | - if ( ! defined( 'DONOTCACHCEOBJECT' ) ) { |
|
849 | - define( 'DONOTCACHCEOBJECT', true ); |
|
848 | + if ( ! defined('DONOTCACHCEOBJECT')) { |
|
849 | + define('DONOTCACHCEOBJECT', true); |
|
850 | 850 | } |
851 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
852 | - define( 'DONOTCACHEDB', true ); |
|
851 | + if ( ! defined('DONOTCACHEDB')) { |
|
852 | + define('DONOTCACHEDB', true); |
|
853 | 853 | } |
854 | 854 | // add no cache headers |
855 | - add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 ); |
|
855 | + add_action('send_headers', array('EE_System', 'nocache_headers'), 10); |
|
856 | 856 | // plus a little extra for nginx |
857 | - add_filter( 'nocache_headers', array( 'EE_System', 'nocache_headers_nginx' ), 10, 1 ); |
|
857 | + add_filter('nocache_headers', array('EE_System', 'nocache_headers_nginx'), 10, 1); |
|
858 | 858 | // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process |
859 | - remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' ); |
|
859 | + remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); |
|
860 | 860 | } |
861 | 861 | |
862 | 862 | |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | * @param $headers |
869 | 869 | * @return array |
870 | 870 | */ |
871 | - public static function nocache_headers_nginx ( $headers ) { |
|
871 | + public static function nocache_headers_nginx($headers) { |
|
872 | 872 | $headers['X-Accel-Expires'] = 0; |
873 | 873 | return $headers; |
874 | 874 | } |
@@ -894,15 +894,15 @@ discard block |
||
894 | 894 | * @param $admin_bar |
895 | 895 | * @return void |
896 | 896 | */ |
897 | - public function espresso_toolbar_items( $admin_bar ) { |
|
897 | + public function espresso_toolbar_items($admin_bar) { |
|
898 | 898 | |
899 | 899 | // if in full M-Mode, or its an AJAX request, or user is NOT an admin |
900 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) { |
|
900 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) { |
|
901 | 901 | return; |
902 | 902 | } |
903 | 903 | |
904 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
905 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
904 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
905 | + EE_Registry::instance()->load_helper('URL'); |
|
906 | 906 | $menu_class = 'espresso_menu_item_class'; |
907 | 907 | //we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL |
908 | 908 | //because they're only defined in each of their respective constructors |
@@ -914,20 +914,20 @@ discard block |
||
914 | 914 | //Top Level |
915 | 915 | $admin_bar->add_menu(array( |
916 | 916 | 'id' => 'espresso-toolbar', |
917 | - 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>', |
|
917 | + 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>', |
|
918 | 918 | 'href' => $events_admin_url, |
919 | 919 | 'meta' => array( |
920 | 920 | 'title' => __('Event Espresso', 'event_espresso'), |
921 | - 'class' => $menu_class . 'first' |
|
921 | + 'class' => $menu_class.'first' |
|
922 | 922 | ), |
923 | 923 | )); |
924 | 924 | |
925 | 925 | //Events |
926 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) { |
|
926 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) { |
|
927 | 927 | $admin_bar->add_menu(array( |
928 | 928 | 'id' => 'espresso-toolbar-events', |
929 | 929 | 'parent' => 'espresso-toolbar', |
930 | - 'title' => __( 'Events', 'event_espresso' ), |
|
930 | + 'title' => __('Events', 'event_espresso'), |
|
931 | 931 | 'href' => $events_admin_url, |
932 | 932 | 'meta' => array( |
933 | 933 | 'title' => __('Events', 'event_espresso'), |
@@ -938,13 +938,13 @@ discard block |
||
938 | 938 | } |
939 | 939 | |
940 | 940 | |
941 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) { |
|
941 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) { |
|
942 | 942 | //Events Add New |
943 | 943 | $admin_bar->add_menu(array( |
944 | 944 | 'id' => 'espresso-toolbar-events-new', |
945 | 945 | 'parent' => 'espresso-toolbar-events', |
946 | 946 | 'title' => __('Add New', 'event_espresso'), |
947 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ), |
|
947 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url), |
|
948 | 948 | 'meta' => array( |
949 | 949 | 'title' => __('Add New', 'event_espresso'), |
950 | 950 | 'target' => '', |
@@ -953,18 +953,18 @@ discard block |
||
953 | 953 | )); |
954 | 954 | } |
955 | 955 | |
956 | - if ( is_single() && ( get_post_type() == 'espresso_events' ) ) { |
|
956 | + if (is_single() && (get_post_type() == 'espresso_events')) { |
|
957 | 957 | |
958 | 958 | //Current post |
959 | 959 | global $post; |
960 | 960 | |
961 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
961 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) { |
|
962 | 962 | //Events Edit Current Event |
963 | 963 | $admin_bar->add_menu(array( |
964 | 964 | 'id' => 'espresso-toolbar-events-edit', |
965 | 965 | 'parent' => 'espresso-toolbar-events', |
966 | 966 | 'title' => __('Edit Event', 'event_espresso'), |
967 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ), |
|
967 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url), |
|
968 | 968 | 'meta' => array( |
969 | 969 | 'title' => __('Edit Event', 'event_espresso'), |
970 | 970 | 'target' => '', |
@@ -976,11 +976,11 @@ discard block |
||
976 | 976 | } |
977 | 977 | |
978 | 978 | //Events View |
979 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) { |
|
979 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) { |
|
980 | 980 | $admin_bar->add_menu(array( |
981 | 981 | 'id' => 'espresso-toolbar-events-view', |
982 | 982 | 'parent' => 'espresso-toolbar-events', |
983 | - 'title' => __( 'View', 'event_espresso' ), |
|
983 | + 'title' => __('View', 'event_espresso'), |
|
984 | 984 | 'href' => $events_admin_url, |
985 | 985 | 'meta' => array( |
986 | 986 | 'title' => __('View', 'event_espresso'), |
@@ -990,12 +990,12 @@ discard block |
||
990 | 990 | )); |
991 | 991 | } |
992 | 992 | |
993 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) { |
|
993 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) { |
|
994 | 994 | //Events View All |
995 | 995 | $admin_bar->add_menu(array( |
996 | 996 | 'id' => 'espresso-toolbar-events-all', |
997 | 997 | 'parent' => 'espresso-toolbar-events-view', |
998 | - 'title' => __( 'All', 'event_espresso' ), |
|
998 | + 'title' => __('All', 'event_espresso'), |
|
999 | 999 | 'href' => $events_admin_url, |
1000 | 1000 | 'meta' => array( |
1001 | 1001 | 'title' => __('All', 'event_espresso'), |
@@ -1006,13 +1006,13 @@ discard block |
||
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | |
1009 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) { |
|
1009 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) { |
|
1010 | 1010 | //Events View Today |
1011 | 1011 | $admin_bar->add_menu(array( |
1012 | 1012 | 'id' => 'espresso-toolbar-events-today', |
1013 | 1013 | 'parent' => 'espresso-toolbar-events-view', |
1014 | 1014 | 'title' => __('Today', 'event_espresso'), |
1015 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ), |
|
1015 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url), |
|
1016 | 1016 | 'meta' => array( |
1017 | 1017 | 'title' => __('Today', 'event_espresso'), |
1018 | 1018 | 'target' => '', |
@@ -1022,13 +1022,13 @@ discard block |
||
1022 | 1022 | } |
1023 | 1023 | |
1024 | 1024 | |
1025 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) { |
|
1025 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) { |
|
1026 | 1026 | //Events View This Month |
1027 | 1027 | $admin_bar->add_menu(array( |
1028 | 1028 | 'id' => 'espresso-toolbar-events-month', |
1029 | 1029 | 'parent' => 'espresso-toolbar-events-view', |
1030 | - 'title' => __( 'This Month', 'event_espresso'), |
|
1031 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ), |
|
1030 | + 'title' => __('This Month', 'event_espresso'), |
|
1031 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url), |
|
1032 | 1032 | 'meta' => array( |
1033 | 1033 | 'title' => __('This Month', 'event_espresso'), |
1034 | 1034 | 'target' => '', |
@@ -1038,11 +1038,11 @@ discard block |
||
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | //Registration Overview |
1041 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) { |
|
1041 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) { |
|
1042 | 1042 | $admin_bar->add_menu(array( |
1043 | 1043 | 'id' => 'espresso-toolbar-registrations', |
1044 | 1044 | 'parent' => 'espresso-toolbar', |
1045 | - 'title' => __( 'Registrations', 'event_espresso' ), |
|
1045 | + 'title' => __('Registrations', 'event_espresso'), |
|
1046 | 1046 | 'href' => $reg_admin_url, |
1047 | 1047 | 'meta' => array( |
1048 | 1048 | 'title' => __('Registrations', 'event_espresso'), |
@@ -1053,12 +1053,12 @@ discard block |
||
1053 | 1053 | } |
1054 | 1054 | |
1055 | 1055 | //Registration Overview Today |
1056 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) { |
|
1056 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) { |
|
1057 | 1057 | $admin_bar->add_menu(array( |
1058 | 1058 | 'id' => 'espresso-toolbar-registrations-today', |
1059 | 1059 | 'parent' => 'espresso-toolbar-registrations', |
1060 | - 'title' => __( 'Today', 'event_espresso'), |
|
1061 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ), |
|
1060 | + 'title' => __('Today', 'event_espresso'), |
|
1061 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url), |
|
1062 | 1062 | 'meta' => array( |
1063 | 1063 | 'title' => __('Today', 'event_espresso'), |
1064 | 1064 | 'target' => '', |
@@ -1068,14 +1068,14 @@ discard block |
||
1068 | 1068 | } |
1069 | 1069 | |
1070 | 1070 | //Registration Overview Today Completed |
1071 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) { |
|
1071 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) { |
|
1072 | 1072 | $admin_bar->add_menu(array( |
1073 | 1073 | 'id' => 'espresso-toolbar-registrations-today-approved', |
1074 | 1074 | 'parent' => 'espresso-toolbar-registrations-today', |
1075 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1076 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1075 | + 'title' => __('Approved', 'event_espresso'), |
|
1076 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1077 | 1077 | 'meta' => array( |
1078 | - 'title' => __('Approved', 'event_espresso' ), |
|
1078 | + 'title' => __('Approved', 'event_espresso'), |
|
1079 | 1079 | 'target' => '', |
1080 | 1080 | 'class' => $menu_class |
1081 | 1081 | ), |
@@ -1083,14 +1083,14 @@ discard block |
||
1083 | 1083 | } |
1084 | 1084 | |
1085 | 1085 | //Registration Overview Today Pending\ |
1086 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) { |
|
1086 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) { |
|
1087 | 1087 | $admin_bar->add_menu(array( |
1088 | 1088 | 'id' => 'espresso-toolbar-registrations-today-pending', |
1089 | 1089 | 'parent' => 'espresso-toolbar-registrations-today', |
1090 | - 'title' => __( 'Pending', 'event_espresso' ), |
|
1091 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1090 | + 'title' => __('Pending', 'event_espresso'), |
|
1091 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1092 | 1092 | 'meta' => array( |
1093 | - 'title' => __('Pending Payment', 'event_espresso' ), |
|
1093 | + 'title' => __('Pending Payment', 'event_espresso'), |
|
1094 | 1094 | 'target' => '', |
1095 | 1095 | 'class' => $menu_class |
1096 | 1096 | ), |
@@ -1098,14 +1098,14 @@ discard block |
||
1098 | 1098 | } |
1099 | 1099 | |
1100 | 1100 | //Registration Overview Today Incomplete |
1101 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) { |
|
1101 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) { |
|
1102 | 1102 | $admin_bar->add_menu(array( |
1103 | 1103 | 'id' => 'espresso-toolbar-registrations-today-not-approved', |
1104 | 1104 | 'parent' => 'espresso-toolbar-registrations-today', |
1105 | - 'title' => __( 'Not Approved', 'event_espresso' ), |
|
1106 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1105 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1106 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1107 | 1107 | 'meta' => array( |
1108 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1108 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1109 | 1109 | 'target' => '', |
1110 | 1110 | 'class' => $menu_class |
1111 | 1111 | ), |
@@ -1113,12 +1113,12 @@ discard block |
||
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | //Registration Overview Today Incomplete |
1116 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) { |
|
1116 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) { |
|
1117 | 1117 | $admin_bar->add_menu(array( |
1118 | 1118 | 'id' => 'espresso-toolbar-registrations-today-cancelled', |
1119 | 1119 | 'parent' => 'espresso-toolbar-registrations-today', |
1120 | - 'title' => __( 'Cancelled', 'event_espresso'), |
|
1121 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1120 | + 'title' => __('Cancelled', 'event_espresso'), |
|
1121 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1122 | 1122 | 'meta' => array( |
1123 | 1123 | 'title' => __('Cancelled', 'event_espresso'), |
1124 | 1124 | 'target' => '', |
@@ -1128,12 +1128,12 @@ discard block |
||
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | //Registration Overview This Month |
1131 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) { |
|
1131 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) { |
|
1132 | 1132 | $admin_bar->add_menu(array( |
1133 | 1133 | 'id' => 'espresso-toolbar-registrations-month', |
1134 | 1134 | 'parent' => 'espresso-toolbar-registrations', |
1135 | - 'title' => __( 'This Month', 'event_espresso' ), |
|
1136 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ), |
|
1135 | + 'title' => __('This Month', 'event_espresso'), |
|
1136 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url), |
|
1137 | 1137 | 'meta' => array( |
1138 | 1138 | 'title' => __('This Month', 'event_espresso'), |
1139 | 1139 | 'target' => '', |
@@ -1143,12 +1143,12 @@ discard block |
||
1143 | 1143 | } |
1144 | 1144 | |
1145 | 1145 | //Registration Overview This Month Approved |
1146 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) { |
|
1146 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) { |
|
1147 | 1147 | $admin_bar->add_menu(array( |
1148 | 1148 | 'id' => 'espresso-toolbar-registrations-month-approved', |
1149 | 1149 | 'parent' => 'espresso-toolbar-registrations-month', |
1150 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1151 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1150 | + 'title' => __('Approved', 'event_espresso'), |
|
1151 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1152 | 1152 | 'meta' => array( |
1153 | 1153 | 'title' => __('Approved', 'event_espresso'), |
1154 | 1154 | 'target' => '', |
@@ -1158,12 +1158,12 @@ discard block |
||
1158 | 1158 | } |
1159 | 1159 | |
1160 | 1160 | //Registration Overview This Month Pending |
1161 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) { |
|
1161 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) { |
|
1162 | 1162 | $admin_bar->add_menu(array( |
1163 | 1163 | 'id' => 'espresso-toolbar-registrations-month-pending', |
1164 | 1164 | 'parent' => 'espresso-toolbar-registrations-month', |
1165 | - 'title' => __( 'Pending', 'event_espresso'), |
|
1166 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1165 | + 'title' => __('Pending', 'event_espresso'), |
|
1166 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1167 | 1167 | 'meta' => array( |
1168 | 1168 | 'title' => __('Pending', 'event_espresso'), |
1169 | 1169 | 'target' => '', |
@@ -1173,14 +1173,14 @@ discard block |
||
1173 | 1173 | } |
1174 | 1174 | |
1175 | 1175 | //Registration Overview This Month Not Approved |
1176 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) { |
|
1176 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) { |
|
1177 | 1177 | $admin_bar->add_menu(array( |
1178 | 1178 | 'id' => 'espresso-toolbar-registrations-month-not-approved', |
1179 | 1179 | 'parent' => 'espresso-toolbar-registrations-month', |
1180 | - 'title' => __( 'Not Approved', 'event_espresso'), |
|
1181 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1180 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1181 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1182 | 1182 | 'meta' => array( |
1183 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1183 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1184 | 1184 | 'target' => '', |
1185 | 1185 | 'class' => $menu_class |
1186 | 1186 | ), |
@@ -1189,12 +1189,12 @@ discard block |
||
1189 | 1189 | |
1190 | 1190 | |
1191 | 1191 | //Registration Overview This Month Cancelled |
1192 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) { |
|
1192 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) { |
|
1193 | 1193 | $admin_bar->add_menu(array( |
1194 | 1194 | 'id' => 'espresso-toolbar-registrations-month-cancelled', |
1195 | 1195 | 'parent' => 'espresso-toolbar-registrations-month', |
1196 | 1196 | 'title' => __('Cancelled', 'event_espresso'), |
1197 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1197 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1198 | 1198 | 'meta' => array( |
1199 | 1199 | 'title' => __('Cancelled', 'event_espresso'), |
1200 | 1200 | 'target' => '', |
@@ -1204,11 +1204,11 @@ discard block |
||
1204 | 1204 | } |
1205 | 1205 | |
1206 | 1206 | //Extensions & Services |
1207 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) { |
|
1207 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) { |
|
1208 | 1208 | $admin_bar->add_menu(array( |
1209 | 1209 | 'id' => 'espresso-toolbar-extensions-and-services', |
1210 | 1210 | 'parent' => 'espresso-toolbar', |
1211 | - 'title' => __( 'Extensions & Services', 'event_espresso' ), |
|
1211 | + 'title' => __('Extensions & Services', 'event_espresso'), |
|
1212 | 1212 | 'href' => $extensions_admin_url, |
1213 | 1213 | 'meta' => array( |
1214 | 1214 | 'title' => __('Extensions & Services', 'event_espresso'), |
@@ -1230,8 +1230,8 @@ discard block |
||
1230 | 1230 | * @param array $exclude_array any existing pages being excluded are in this array. |
1231 | 1231 | * @return array |
1232 | 1232 | */ |
1233 | - public function remove_pages_from_wp_list_pages( $exclude_array ) { |
|
1234 | - return array_merge( $exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array() ); |
|
1233 | + public function remove_pages_from_wp_list_pages($exclude_array) { |
|
1234 | + return array_merge($exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array()); |
|
1235 | 1235 | } |
1236 | 1236 | |
1237 | 1237 | |
@@ -1251,11 +1251,11 @@ discard block |
||
1251 | 1251 | */ |
1252 | 1252 | public function wp_enqueue_scripts() { |
1253 | 1253 | // unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' ); |
1254 | - if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) { |
|
1254 | + if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) { |
|
1255 | 1255 | // jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
1256 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
1256 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
1257 | 1257 | // register jQuery Validate |
1258 | - wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE ); |
|
1258 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
1259 | 1259 | } |
1260 | 1260 | } |
1261 | 1261 | } |
@@ -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,25 +30,25 @@ discard block |
||
30 | 30 | class Extend_Events_Admin_Page extends Events_Admin_Page { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( $routing = TRUE ) { |
|
34 | - parent::__construct( $routing ); |
|
35 | - define( 'EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/'); |
|
36 | - define( 'EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/'); |
|
37 | - define( 'EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/'); |
|
33 | + public function __construct($routing = TRUE) { |
|
34 | + parent::__construct($routing); |
|
35 | + define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'events/templates/'); |
|
36 | + define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'events/assets/'); |
|
37 | + define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'events/assets/'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
41 | 41 | protected function _extend_page_config() { |
42 | 42 | |
43 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events'; |
|
43 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'events'; |
|
44 | 44 | $default_espresso_boxes = $this->_default_espresso_metaboxes; |
45 | 45 | |
46 | 46 | //is there a evt_id in the request? |
47 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0; |
|
48 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
47 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0; |
|
48 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
49 | 49 | |
50 | 50 | //tkt_id? |
51 | - $tkt_id = !empty( $this->_req_data['TKT_ID'] ) && ! is_array( $this->_req_data['TKT_ID'] ) ? $this->_req_data['TKT_ID'] : 0; |
|
51 | + $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) ? $this->_req_data['TKT_ID'] : 0; |
|
52 | 52 | |
53 | 53 | $new_page_routes = array( |
54 | 54 | 'duplicate_event' => array( |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | 'capability' => 'ee_delete_default_ticket', |
67 | 67 | 'obj_id' => $tkt_id, |
68 | 68 | 'noheader' => TRUE, |
69 | - 'args' => array( 'trash' => TRUE ) |
|
69 | + 'args' => array('trash' => TRUE) |
|
70 | 70 | ), |
71 | 71 | 'trash_tickets' => array( |
72 | 72 | 'func' => '_trash_or_restore_ticket', |
73 | 73 | 'capability' => 'ee_delete_default_tickets', |
74 | 74 | 'noheader' => TRUE, |
75 | - 'args' => array( 'trash' => TRUE ) |
|
75 | + 'args' => array('trash' => TRUE) |
|
76 | 76 | ), |
77 | 77 | 'restore_ticket' => array( |
78 | 78 | 'func' => '_trash_or_restore_ticket', |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | ) |
133 | 133 | ); |
134 | 134 | |
135 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
135 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
136 | 136 | |
137 | 137 | |
138 | 138 | //partial route/config override |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | $this->_page_config['default']['list_table'] = 'Extend_Events_Admin_List_Table'; |
145 | 145 | |
146 | 146 | //add tickets tab but only if there are more than one default ticket! |
147 | - $tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(array( array('TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ); |
|
148 | - if ( $tkt_count > 1 ) { |
|
147 | + $tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(array(array('TKT_is_default' => 1)), 'TKT_ID', TRUE); |
|
148 | + if ($tkt_count > 1) { |
|
149 | 149 | $new_page_config = array( |
150 | 150 | 'ticket_list_table' => array( |
151 | 151 | 'nav' => array( |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | 'label' => __('Templates'), |
165 | 165 | 'order' => 30 |
166 | 166 | ), |
167 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
167 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
168 | 168 | 'help_tabs' => array( |
169 | 169 | 'general_settings_templates_help_tab' => array( |
170 | 170 | 'title' => __('Templates', 'event_espresso'), |
171 | 171 | 'filename' => 'general_settings_templates' |
172 | 172 | ) |
173 | 173 | ), |
174 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
174 | + 'help_tour' => array('Templates_Help_Tour'), |
|
175 | 175 | 'require_nonce' => FALSE |
176 | 176 | ); |
177 | 177 | |
@@ -190,26 +190,26 @@ discard block |
||
190 | 190 | // 'metaboxes' => $default_espresso_boxes, |
191 | 191 | // 'require_nonce' => FALSE |
192 | 192 | // ); |
193 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
193 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
194 | 194 | |
195 | 195 | //add filters and actions |
196 | 196 | //modifying _views |
197 | - add_filter('FHEE_event_datetime_metabox_add_additional_date_time_template', array( $this, 'add_additional_datetime_button' ), 10, 2 ); |
|
198 | - add_filter('FHEE_event_datetime_metabox_clone_button_template', array( $this, 'add_datetime_clone_button' ), 10, 2 ); |
|
199 | - add_filter('FHEE_event_datetime_metabox_timezones_template', array( $this, 'datetime_timezones_template'), 10, 2 ); |
|
197 | + add_filter('FHEE_event_datetime_metabox_add_additional_date_time_template', array($this, 'add_additional_datetime_button'), 10, 2); |
|
198 | + add_filter('FHEE_event_datetime_metabox_clone_button_template', array($this, 'add_datetime_clone_button'), 10, 2); |
|
199 | + add_filter('FHEE_event_datetime_metabox_timezones_template', array($this, 'datetime_timezones_template'), 10, 2); |
|
200 | 200 | |
201 | 201 | |
202 | 202 | //filters for event list table |
203 | - add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array( $this, 'list_table_filters'), 10, 2); |
|
204 | - add_filter('FHEE__Extend_Events_Admin_List_Table__column_actions__action_links', array( $this, 'extra_list_table_actions'), 10, 2 ); |
|
203 | + add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array($this, 'list_table_filters'), 10, 2); |
|
204 | + add_filter('FHEE__Extend_Events_Admin_List_Table__column_actions__action_links', array($this, 'extra_list_table_actions'), 10, 2); |
|
205 | 205 | |
206 | 206 | //legend item |
207 | - add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array( $this, 'additional_legend_items') ); |
|
207 | + add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array($this, 'additional_legend_items')); |
|
208 | 208 | |
209 | - add_action('admin_init', array( $this, 'admin_init') ); |
|
209 | + add_action('admin_init', array($this, 'admin_init')); |
|
210 | 210 | |
211 | 211 | //heartbeat stuff |
212 | - add_filter( 'heartbeat_received', array( $this, 'heartbeat_response' ), 10, 2 ); |
|
212 | + add_filter('heartbeat_received', array($this, 'heartbeat_response'), 10, 2); |
|
213 | 213 | |
214 | 214 | } |
215 | 215 | |
@@ -222,12 +222,12 @@ discard block |
||
222 | 222 | EE_Registry::$i18n_js_strings = array_merge( |
223 | 223 | EE_Registry::$i18n_js_strings, |
224 | 224 | array( |
225 | - 'image_confirm' => __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' ), |
|
226 | - 'event_starts_on' => __( 'Event Starts on', 'event_espresso' ), |
|
227 | - 'event_ends_on' => __( 'Event Ends on', 'event_espresso' ), |
|
228 | - 'event_datetime_actions' => __( 'Actions', 'event_espresso' ), |
|
229 | - 'event_clone_dt_msg' => __( 'Clone this Event Date and Time', 'event_espresso' ), |
|
230 | - 'remove_event_dt_msg' => __( 'Remove this Event Time', 'event_espresso' ) |
|
225 | + 'image_confirm' => __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso'), |
|
226 | + 'event_starts_on' => __('Event Starts on', 'event_espresso'), |
|
227 | + 'event_ends_on' => __('Event Ends on', 'event_espresso'), |
|
228 | + 'event_datetime_actions' => __('Actions', 'event_espresso'), |
|
229 | + 'event_clone_dt_msg' => __('Clone this Event Date and Time', 'event_espresso'), |
|
230 | + 'remove_event_dt_msg' => __('Remove this Event Time', 'event_espresso') |
|
231 | 231 | ) |
232 | 232 | ); |
233 | 233 | } |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @return array possibly appended response. |
244 | 244 | */ |
245 | - public function heartbeat_response( $response, $data ) { |
|
245 | + public function heartbeat_response($response, $data) { |
|
246 | 246 | /** |
247 | 247 | * check whether count of tickets is approaching the potential |
248 | 248 | * limits for the server. |
249 | 249 | */ |
250 | - if ( ! empty( $data['input_count'] ) ) { |
|
250 | + if ( ! empty($data['input_count'])) { |
|
251 | 251 | $response['max_input_vars_check'] = EE_Registry::instance()->CFG->environment->max_input_vars_limit_check($data['input_count']); |
252 | 252 | } |
253 | 253 | |
@@ -262,13 +262,13 @@ discard block |
||
262 | 262 | |
263 | 263 | |
264 | 264 | |
265 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
266 | - $return = parent::extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ); |
|
265 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
266 | + $return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug); |
|
267 | 267 | //make sure this is only when editing |
268 | - if ( !empty( $id ) ) { |
|
269 | - $href = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'duplicate_event', 'EVT_ID' => $id), $this->_admin_base_url ); |
|
268 | + if ( ! empty($id)) { |
|
269 | + $href = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_event', 'EVT_ID' => $id), $this->_admin_base_url); |
|
270 | 270 | $title = esc_attr__('Duplicate Event', 'event_espresso'); |
271 | - $return .= '<a href="' . $href . '" title="' . $title . '" id="ee-duplicate-event-button" class="button button-small" value="duplicate_event">' . $title . '</button>'; |
|
271 | + $return .= '<a href="'.$href.'" title="'.$title.'" id="ee-duplicate-event-button" class="button button-small" value="duplicate_event">'.$title.'</button>'; |
|
272 | 272 | } |
273 | 273 | return $return; |
274 | 274 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | 'label' => __('Trash', 'event_espresso'), |
292 | 292 | 'count' => 0, |
293 | 293 | 'bulk_action' => array( |
294 | - 'restore_tickets' => __('Restore from Trash' , 'event_espresso'), |
|
294 | + 'restore_tickets' => __('Restore from Trash', 'event_espresso'), |
|
295 | 295 | 'delete_tickets' => __('Delete Permanently', 'event_espresso') |
296 | 296 | ) |
297 | 297 | ) |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | |
303 | 303 | public function load_scripts_styles_edit() { |
304 | - wp_register_script( 'ee-event-editor-heartbeat', EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js', array( 'ee_admin_js', 'heartbeat' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
304 | + wp_register_script('ee-event-editor-heartbeat', EVENTS_CAF_ASSETS_URL.'event-editor-heartbeat.js', array('ee_admin_js', 'heartbeat'), EVENT_ESPRESSO_VERSION, TRUE); |
|
305 | 305 | |
306 | 306 | /** |
307 | 307 | * load accounting js. |
@@ -320,20 +320,20 @@ discard block |
||
320 | 320 | |
321 | 321 | |
322 | 322 | |
323 | - public function add_additional_datetime_button( $template, $template_args ) { |
|
324 | - return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php', $template_args, TRUE); |
|
323 | + public function add_additional_datetime_button($template, $template_args) { |
|
324 | + return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_add_additional_time.template.php', $template_args, TRUE); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | |
328 | 328 | |
329 | - public function add_datetime_clone_button( $template, $template_args ) { |
|
330 | - return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php', $template_args, TRUE ); |
|
329 | + public function add_datetime_clone_button($template, $template_args) { |
|
330 | + return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_metabox_clone_button.template.php', $template_args, TRUE); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
334 | 334 | |
335 | - public function datetime_timezones_template( $template, $template_args ) { |
|
336 | - return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php', $template_args, TRUE ); |
|
335 | + public function datetime_timezones_template($template, $template_args) { |
|
336 | + return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_timezones.template.php', $template_args, TRUE); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | protected function _set_list_table_views_default() { |
343 | 343 | parent::_set_list_table_views_default(); |
344 | 344 | $export_label = __('Export Events', 'event_espresso'); |
345 | - if ( EE_Registry::instance()->CAP->current_user_can( 'export', 'espresso_events_export' ) ) { |
|
345 | + if (EE_Registry::instance()->CAP->current_user_can('export', 'espresso_events_export')) { |
|
346 | 346 | // $this->_views['all']['bulk_action']['export_events'] = $export_label; |
347 | 347 | // $this->_views['draft']['bulk_action']['export_events'] = $export_label; |
348 | 348 | |
349 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
349 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
350 | 350 | // $this->_views['trash']['bulk_action']['export_events'] = $export_label; |
351 | 351 | } |
352 | 352 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | ) |
373 | 373 | ); |
374 | 374 | |
375 | - $this->_views = array_merge( $this->_views, $new_views); |
|
375 | + $this->_views = array_merge($this->_views, $new_views); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -386,14 +386,14 @@ discard block |
||
386 | 386 | |
387 | 387 | |
388 | 388 | |
389 | - public function extra_list_table_actions( $actionlinks, $event ) { |
|
390 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_reports', $event->ID() ) ) { |
|
389 | + public function extra_list_table_actions($actionlinks, $event) { |
|
390 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_reports', $event->ID())) { |
|
391 | 391 | $reports_query_args = array( |
392 | 392 | 'action' => 'reports', |
393 | 393 | 'EVT_ID' => $event->ID() |
394 | 394 | ); |
395 | - $reports_link = EE_Admin_Page::add_query_args_and_nonce( $reports_query_args, REG_ADMIN_URL ); |
|
396 | - $actionlinks[] = '<a href="' . $reports_link . '" title="' . esc_attr__('View Report', 'event_espresso') . '"><div class="dashicons dashicons-chart-bar"></div></a>' . "\n\t"; |
|
395 | + $reports_link = EE_Admin_Page::add_query_args_and_nonce($reports_query_args, REG_ADMIN_URL); |
|
396 | + $actionlinks[] = '<a href="'.$reports_link.'" title="'.esc_attr__('View Report', 'event_espresso').'"><div class="dashicons dashicons-chart-bar"></div></a>'."\n\t"; |
|
397 | 397 | } |
398 | 398 | return $actionlinks; |
399 | 399 | } |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | |
402 | 402 | |
403 | 403 | public function additional_legend_items($items) { |
404 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_reports' ) ) { |
|
404 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_reports')) { |
|
405 | 405 | $items['reports'] = array( |
406 | 406 | 'class' => 'dashicons dashicons-chart-bar', |
407 | 407 | 'desc' => __('Event Reports', 'event_espresso') |
@@ -426,17 +426,17 @@ discard block |
||
426 | 426 | */ |
427 | 427 | protected function _duplicate_event() { |
428 | 428 | //first make sure the ID for the event is in the request. If it isnt' then we need to bail and redirect back to overview list table (cause how did we get here?) |
429 | - if ( !isset( $this->_req_data['EVT_ID'] ) ) { |
|
430 | - EE_Error::add_error( __('In order to duplicate an event an Event ID is required. None was given.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
431 | - $this->_redirect_after_action( FALSE, '', '', array(), TRUE ); |
|
429 | + if ( ! isset($this->_req_data['EVT_ID'])) { |
|
430 | + EE_Error::add_error(__('In order to duplicate an event an Event ID is required. None was given.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
431 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
432 | 432 | return; |
433 | 433 | } |
434 | 434 | |
435 | 435 | //k we've got EVT_ID so let's use that to get the event we'll duplicate |
436 | - $orig_event = EEM_Event::instance()->get_one_by_ID( $this->_req_data['EVT_ID'] ); |
|
436 | + $orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']); |
|
437 | 437 | |
438 | - if ( ! $orig_event instanceof EE_Event ) |
|
439 | - throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso '), $this->_req_data['EVT_ID'] ) ); |
|
438 | + if ( ! $orig_event instanceof EE_Event) |
|
439 | + throw new EE_Error(sprintf(__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso '), $this->_req_data['EVT_ID'])); |
|
440 | 440 | |
441 | 441 | //k now let's clone the $orig_event before getting relations |
442 | 442 | $new_event = clone $orig_event; |
@@ -449,43 +449,43 @@ discard block |
||
449 | 449 | |
450 | 450 | |
451 | 451 | //reset the ID and modify other details to make it clear this is a dupe |
452 | - $new_event->set( 'EVT_ID', 0 ); |
|
453 | - $new_name = $new_event->name() . ' ' . __('**DUPLICATE**', 'event_espresso'); |
|
454 | - $new_event->set( 'EVT_name', $new_name ); |
|
455 | - $new_event->set( 'EVT_slug', wp_unique_post_slug( sanitize_title( $orig_event->name() ), 0, 'publish', 'espresso_events', 0 ) ); |
|
456 | - $new_event->set( 'status', 'draft' ); |
|
452 | + $new_event->set('EVT_ID', 0); |
|
453 | + $new_name = $new_event->name().' '.__('**DUPLICATE**', 'event_espresso'); |
|
454 | + $new_event->set('EVT_name', $new_name); |
|
455 | + $new_event->set('EVT_slug', wp_unique_post_slug(sanitize_title($orig_event->name()), 0, 'publish', 'espresso_events', 0)); |
|
456 | + $new_event->set('status', 'draft'); |
|
457 | 457 | |
458 | 458 | //duplicate discussion settings |
459 | - $new_event->set( 'comment_status', $orig_event->get('comment_status') ); |
|
460 | - $new_event->set( 'ping_status', $orig_event->get( 'ping_status' ) ); |
|
459 | + $new_event->set('comment_status', $orig_event->get('comment_status')); |
|
460 | + $new_event->set('ping_status', $orig_event->get('ping_status')); |
|
461 | 461 | |
462 | 462 | //save the new event |
463 | 463 | $new_event->save(); |
464 | 464 | |
465 | 465 | //venues |
466 | - foreach( $orig_ven as $ven ) { |
|
467 | - $new_event->_add_relation_to( $ven, 'Venue' ); |
|
466 | + foreach ($orig_ven as $ven) { |
|
467 | + $new_event->_add_relation_to($ven, 'Venue'); |
|
468 | 468 | } |
469 | 469 | $new_event->save(); |
470 | 470 | |
471 | 471 | |
472 | 472 | //now we need to get the question group relations and handle that |
473 | 473 | //first primary question groups |
474 | - $orig_primary_qgs = $orig_event->get_many_related('Question_Group', array( array('Event_Question_Group.EQG_primary' => 1 ) ) ); |
|
475 | - if ( !empty( $orig_primary_qgs ) ) { |
|
476 | - foreach ( $orig_primary_qgs as $id => $obj ) { |
|
477 | - if ( $obj instanceof EE_Question_Group ) { |
|
478 | - $new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 1 ) ); |
|
474 | + $orig_primary_qgs = $orig_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 1))); |
|
475 | + if ( ! empty($orig_primary_qgs)) { |
|
476 | + foreach ($orig_primary_qgs as $id => $obj) { |
|
477 | + if ($obj instanceof EE_Question_Group) { |
|
478 | + $new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 1)); |
|
479 | 479 | } |
480 | 480 | } |
481 | 481 | } |
482 | 482 | |
483 | 483 | //next additional attendee question groups |
484 | - $orig_additional_qgs = $orig_event->get_many_related('Question_Group', array( array('Event_Question_Group.EQG_primary' => 0 ) ) ); |
|
485 | - if ( !empty( $orig_additional_qgs ) ) { |
|
486 | - foreach ( $orig_additional_qgs as $id => $obj ) { |
|
487 | - if ( $obj instanceof EE_Question_Group ) { |
|
488 | - $new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 0 ) ); |
|
484 | + $orig_additional_qgs = $orig_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0))); |
|
485 | + if ( ! empty($orig_additional_qgs)) { |
|
486 | + foreach ($orig_additional_qgs as $id => $obj) { |
|
487 | + if ($obj instanceof EE_Question_Group) { |
|
488 | + $new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 0)); |
|
489 | 489 | } |
490 | 490 | } |
491 | 491 | } |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | |
497 | 497 | //k now that we have the new event saved we can loop through the datetimes and start adding relations. |
498 | 498 | $cloned_tickets = array(); |
499 | - foreach ( $orig_datetimes as $orig_dtt ) { |
|
499 | + foreach ($orig_datetimes as $orig_dtt) { |
|
500 | 500 | $new_dtt = clone $orig_dtt; |
501 | 501 | $orig_tkts = $orig_dtt->tickets(); |
502 | 502 | |
@@ -504,22 +504,22 @@ discard block |
||
504 | 504 | $new_dtt->set('DTT_ID', 0); |
505 | 505 | $new_dtt->set('DTT_sold', 0); |
506 | 506 | $new_dtt->save(); |
507 | - $new_event->_add_relation_to( $new_dtt, 'Datetime'); |
|
507 | + $new_event->_add_relation_to($new_dtt, 'Datetime'); |
|
508 | 508 | $new_event->save(); |
509 | 509 | |
510 | 510 | //now let's get the ticket relations setup. |
511 | - foreach ( (array) $orig_tkts as $orig_tkt ) { |
|
511 | + foreach ((array) $orig_tkts as $orig_tkt) { |
|
512 | 512 | //it's possible a datetime will have no tickets so let's verify we HAVE a ticket first. |
513 | - if ( ! $orig_tkt instanceof EE_Ticket ) |
|
513 | + if ( ! $orig_tkt instanceof EE_Ticket) |
|
514 | 514 | continue; |
515 | 515 | |
516 | 516 | //is this ticket archived? If it is then let's skip |
517 | - if ( $orig_tkt->get( 'TKT_deleted' ) ) { |
|
517 | + if ($orig_tkt->get('TKT_deleted')) { |
|
518 | 518 | continue; |
519 | 519 | } |
520 | 520 | |
521 | 521 | //does this original ticket already exist in the clone_tickets cache? If so we'll just use the new ticket from it. |
522 | - if ( isset( $cloned_tickets[$orig_tkt->ID()] ) ) { |
|
522 | + if (isset($cloned_tickets[$orig_tkt->ID()])) { |
|
523 | 523 | $new_tkt = $cloned_tickets[$orig_tkt->ID()]; |
524 | 524 | } else { |
525 | 525 | $new_tkt = clone $orig_tkt; |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | $new_tkt->save(); //make sure new ticket has ID. |
532 | 532 | |
533 | 533 | //price relations on new ticket need to be setup. |
534 | - foreach ( $orig_prices as $orig_price ) { |
|
534 | + foreach ($orig_prices as $orig_price) { |
|
535 | 535 | $new_price = clone $orig_price; |
536 | 536 | $new_price->set('PRC_ID', 0); |
537 | 537 | $new_price->save(); |
@@ -548,39 +548,39 @@ discard block |
||
548 | 548 | } |
549 | 549 | |
550 | 550 | //clone taxonomy information |
551 | - $taxonomies_to_clone_with = apply_filters( 'FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', array( 'espresso_event_categories', 'espresso_event_type', 'post_tag' ) ); |
|
551 | + $taxonomies_to_clone_with = apply_filters('FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', array('espresso_event_categories', 'espresso_event_type', 'post_tag')); |
|
552 | 552 | |
553 | 553 | //get terms for original event (notice) |
554 | - $orig_terms = wp_get_object_terms( $orig_event->ID(), $taxonomies_to_clone_with ); |
|
554 | + $orig_terms = wp_get_object_terms($orig_event->ID(), $taxonomies_to_clone_with); |
|
555 | 555 | |
556 | 556 | //loop through terms and add them to new event. |
557 | - foreach ( $orig_terms as $term ) { |
|
558 | - wp_set_object_terms( $new_event->ID(), $term->term_id, $term->taxonomy, true ); |
|
557 | + foreach ($orig_terms as $term) { |
|
558 | + wp_set_object_terms($new_event->ID(), $term->term_id, $term->taxonomy, true); |
|
559 | 559 | } |
560 | 560 | |
561 | 561 | |
562 | - do_action( 'AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event ); |
|
562 | + do_action('AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event); |
|
563 | 563 | |
564 | 564 | //now let's redirect to the edit page for this duplicated event if we have a new event id. |
565 | - if ( $new_event->ID() ) { |
|
565 | + if ($new_event->ID()) { |
|
566 | 566 | $redirect_args = array( |
567 | 567 | 'post' => $new_event->ID(), |
568 | 568 | 'action' => 'edit' |
569 | 569 | ); |
570 | - EE_Error::add_success( __('Event successfully duplicated. Please review the details below and make any necessary edits', 'event_espresso') ); |
|
570 | + EE_Error::add_success(__('Event successfully duplicated. Please review the details below and make any necessary edits', 'event_espresso')); |
|
571 | 571 | } else { |
572 | 572 | $redirect_args = array( |
573 | 573 | 'action' => 'default' |
574 | 574 | ); |
575 | - EE_Error::add_error( __('Not able to duplicate event. Something went wrong.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
575 | + EE_Error::add_error(__('Not able to duplicate event. Something went wrong.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
576 | 576 | } |
577 | 577 | |
578 | - $this->_redirect_after_action(FALSE, '', '', $redirect_args, TRUE ); |
|
578 | + $this->_redirect_after_action(FALSE, '', '', $redirect_args, TRUE); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | |
582 | 582 | |
583 | - protected function _import_page(){ |
|
583 | + protected function _import_page() { |
|
584 | 584 | |
585 | 585 | $title = __('Import', 'event_espresso'); |
586 | 586 | $intro = __('If you have a previously exported Event Espresso 4 information in a Comma Separated Value (CSV) file format, you can upload the file here: ', 'event_espresso'); |
@@ -588,8 +588,8 @@ discard block |
||
588 | 588 | $action = 'import_events'; |
589 | 589 | $type = 'csv'; |
590 | 590 | $this->_template_args['form'] = EE_Import::instance()->upload_form($title, $intro, $form_url, $action, $type); |
591 | - $this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'sample_export_file'),$this->_admin_base_url); |
|
592 | - $content = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php',$this->_template_args,true); |
|
591 | + $this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'sample_export_file'), $this->_admin_base_url); |
|
592 | + $content = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'import_page.template.php', $this->_template_args, true); |
|
593 | 593 | |
594 | 594 | |
595 | 595 | $this->_template_args['admin_page_content'] = $content; |
@@ -602,9 +602,9 @@ discard block |
||
602 | 602 | * @return string html |
603 | 603 | */ |
604 | 604 | protected function _import_events() { |
605 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
605 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
606 | 606 | $success = EE_Import::instance()->import(); |
607 | - $this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'),true); |
|
607 | + $this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'), true); |
|
608 | 608 | |
609 | 609 | } |
610 | 610 | |
@@ -618,24 +618,24 @@ discard block |
||
618 | 618 | * @return file |
619 | 619 | */ |
620 | 620 | protected function _events_export() { |
621 | - if(isset($this->_req_data['EVT_ID'])){ |
|
621 | + if (isset($this->_req_data['EVT_ID'])) { |
|
622 | 622 | $event_ids = $this->_req_data['EVT_ID']; |
623 | - }elseif(isset($this->_req_data['EVT_IDs'])){ |
|
623 | + }elseif (isset($this->_req_data['EVT_IDs'])) { |
|
624 | 624 | $event_ids = $this->_req_data['EVT_IDs']; |
625 | - }else{ |
|
625 | + } else { |
|
626 | 626 | $event_ids = NULL; |
627 | 627 | } |
628 | 628 | //todo: I don't like doing this but it'll do until we modify EE_Export Class. |
629 | 629 | $new_request_args = array( |
630 | 630 | 'export' => 'report', |
631 | 631 | 'action' => 'all_event_data', |
632 | - 'EVT_ID' => $event_ids , |
|
632 | + 'EVT_ID' => $event_ids, |
|
633 | 633 | ); |
634 | 634 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
635 | 635 | |
636 | - EE_Registry::instance()->load_helper( 'File' ); |
|
637 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
638 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
636 | + EE_Registry::instance()->load_helper('File'); |
|
637 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
638 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
639 | 639 | $EE_Export = EE_Export::instance($this->_req_data); |
640 | 640 | $EE_Export->export(); |
641 | 641 | } |
@@ -657,12 +657,12 @@ discard block |
||
657 | 657 | 'category_ids' => $this->_req_data['EVT_CAT_ID'] |
658 | 658 | ); |
659 | 659 | |
660 | - $this->_req_data = array_merge( $this->_req_data, $new_request_args ); |
|
660 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
661 | 661 | |
662 | - EE_Registry::instance()->load_helper( 'File' ); |
|
663 | - if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) { |
|
664 | - require_once( EE_CLASSES . 'EE_Export.class.php'); |
|
665 | - $EE_Export = EE_Export::instance( $this->_req_data ); |
|
662 | + EE_Registry::instance()->load_helper('File'); |
|
663 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
664 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
665 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
666 | 666 | $EE_Export->export(); |
667 | 667 | } |
668 | 668 | |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | /** |
674 | 674 | * Creates a sample CSV file for importing |
675 | 675 | */ |
676 | - protected function _sample_export_file(){ |
|
676 | + protected function _sample_export_file() { |
|
677 | 677 | // require_once(EE_CLASSES . 'EE_Export.class.php'); |
678 | 678 | EE_Export::instance()->export_sample(); |
679 | 679 | } |
@@ -690,10 +690,10 @@ discard block |
||
690 | 690 | * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
691 | 691 | * from General_Settings_Admin_Page to here. |
692 | 692 | */ |
693 | - $this->_template_args = apply_filters( 'FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args ); |
|
694 | - $this->_set_add_edit_form_tags( 'update_template_settings' ); |
|
695 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
696 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php', $this->_template_args, TRUE ); |
|
693 | + $this->_template_args = apply_filters('FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args); |
|
694 | + $this->_set_add_edit_form_tags('update_template_settings'); |
|
695 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
696 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'template_settings.template.php', $this->_template_args, TRUE); |
|
697 | 697 | $this->display_admin_page_with_sidebar(); |
698 | 698 | } |
699 | 699 | |
@@ -705,24 +705,24 @@ discard block |
||
705 | 705 | * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
706 | 706 | * from General_Settings_Admin_Page to here. |
707 | 707 | */ |
708 | - EE_Registry::instance()->CFG->template_settings = apply_filters( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data ); |
|
708 | + EE_Registry::instance()->CFG->template_settings = apply_filters('FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data); |
|
709 | 709 | |
710 | 710 | |
711 | 711 | //update custom post type slugs and detect if we need to flush rewrite rules |
712 | 712 | $old_slug = EE_Registry::instance()->CFG->core->event_cpt_slug; |
713 | - EE_Registry::instance()->CFG->core->event_cpt_slug = empty( $this->_req_data['event_cpt_slug'] ) ? EE_Registry::instance()->CFG->core->event_cpt_slug : sanitize_title_with_dashes( $this->_req_data['event_cpt_slug'] ); |
|
713 | + EE_Registry::instance()->CFG->core->event_cpt_slug = empty($this->_req_data['event_cpt_slug']) ? EE_Registry::instance()->CFG->core->event_cpt_slug : sanitize_title_with_dashes($this->_req_data['event_cpt_slug']); |
|
714 | 714 | |
715 | 715 | |
716 | 716 | $what = 'Template Settings'; |
717 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__ ); |
|
717 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__); |
|
718 | 718 | |
719 | 719 | |
720 | - if ( EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug ) { |
|
721 | - update_option( 'ee_flush_rewrite_rules', true ); |
|
720 | + if (EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug) { |
|
721 | + update_option('ee_flush_rewrite_rules', true); |
|
722 | 722 | } |
723 | 723 | |
724 | 724 | |
725 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'template_settings' ) ); |
|
725 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'template_settings')); |
|
726 | 726 | |
727 | 727 | } |
728 | 728 | |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | |
741 | 741 | $this->verify_cpt_object(); |
742 | 742 | |
743 | - add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array( $this, 'registration_options_meta_box' ), $this->page_slug, 'side', 'core'); |
|
743 | + add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array($this, 'registration_options_meta_box'), $this->page_slug, 'side', 'core'); |
|
744 | 744 | //add_meta_box('espresso_event_types', __('Event Type', 'event_espresso'), array( $this, 'event_type_meta_box' ), $this->page_slug, 'side', 'default' ); //add this back in when the feature is ready. |
745 | 745 | |
746 | 746 | //todo feature in progress |
@@ -764,16 +764,16 @@ discard block |
||
764 | 764 | array('id' => true, 'text' => __('Yes', 'event_espresso')), |
765 | 765 | array('id' => false, 'text' => __('No', 'event_espresso')) |
766 | 766 | ); |
767 | - $default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete ), TRUE); |
|
767 | + $default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete), TRUE); |
|
768 | 768 | $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(FALSE); |
769 | 769 | $template_args['_event'] = $this->_cpt_model_obj; |
770 | 770 | $template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit(); |
771 | 771 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
772 | 772 | $template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description()); |
773 | 773 | $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false); |
774 | - $template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input('EVT_default_registration_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status() ); |
|
775 | - $template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values ); |
|
776 | - $templatepath = EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php'; |
|
774 | + $template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input('EVT_default_registration_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
|
775 | + $template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values); |
|
776 | + $templatepath = EVENTS_CAF_TEMPLATE_PATH.'event_registration_options.template.php'; |
|
777 | 777 | EEH_Template::display_template($templatepath, $template_args); |
778 | 778 | } |
779 | 779 | |
@@ -786,9 +786,9 @@ discard block |
||
786 | 786 | * @param array $box metabox args |
787 | 787 | * @return string metabox contents |
788 | 788 | */ |
789 | - public function event_type_meta_box( $post, $box ) { |
|
790 | - $template_args['radio_list'] = $this->wp_terms_radio($post->ID, array( 'taxonomy' => 'espresso_event_type' ) ); |
|
791 | - $template = EVENTS_CAF_TEMPLATE_PATH . 'event_type_metabox_contents.template.php'; |
|
789 | + public function event_type_meta_box($post, $box) { |
|
790 | + $template_args['radio_list'] = $this->wp_terms_radio($post->ID, array('taxonomy' => 'espresso_event_type')); |
|
791 | + $template = EVENTS_CAF_TEMPLATE_PATH.'event_type_metabox_contents.template.php'; |
|
792 | 792 | EEH_Template::display_template($template, $template_args); |
793 | 793 | } |
794 | 794 | |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | |
799 | 799 | |
800 | 800 | |
801 | - public function wp_terms_radio( $post_id = 0, $args = array() ) { |
|
801 | + public function wp_terms_radio($post_id = 0, $args = array()) { |
|
802 | 802 | $defaults = array( |
803 | 803 | 'descendants_and_self' => 0, |
804 | 804 | 'selected_cats' => false, |
@@ -807,11 +807,11 @@ discard block |
||
807 | 807 | 'taxonomy' => 'category', |
808 | 808 | 'checked_ontop' => true |
809 | 809 | ); |
810 | - $args = apply_filters( 'wp_terms_checklist_args', $args, $post_id ); |
|
810 | + $args = apply_filters('wp_terms_checklist_args', $args, $post_id); |
|
811 | 811 | |
812 | - extract( wp_parse_args($args, $defaults), EXTR_SKIP ); |
|
812 | + extract(wp_parse_args($args, $defaults), EXTR_SKIP); |
|
813 | 813 | |
814 | - if ( empty($walker) || !is_a($walker, 'Walker') ) |
|
814 | + if (empty($walker) || ! is_a($walker, 'Walker')) |
|
815 | 815 | $walker = new Walker_Radio_Checklist; |
816 | 816 | |
817 | 817 | $descendants_and_self = (int) $descendants_and_self; |
@@ -819,37 +819,37 @@ discard block |
||
819 | 819 | $args = array('taxonomy' => $taxonomy); |
820 | 820 | |
821 | 821 | $tax = get_taxonomy($taxonomy); |
822 | - $args['disabled'] = !current_user_can($tax->cap->assign_terms); |
|
822 | + $args['disabled'] = ! current_user_can($tax->cap->assign_terms); |
|
823 | 823 | |
824 | - if ( is_array( $selected_cats ) ) |
|
824 | + if (is_array($selected_cats)) |
|
825 | 825 | $args['selected_cats'] = $selected_cats; |
826 | - elseif ( $post_id ) |
|
826 | + elseif ($post_id) |
|
827 | 827 | $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); |
828 | 828 | else |
829 | 829 | $args['selected_cats'] = array(); |
830 | 830 | |
831 | - if ( is_array( $popular_cats ) ) |
|
831 | + if (is_array($popular_cats)) |
|
832 | 832 | $args['popular_cats'] = $popular_cats; |
833 | 833 | else |
834 | - $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); |
|
834 | + $args['popular_cats'] = get_terms($taxonomy, array('fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false)); |
|
835 | 835 | |
836 | - if ( $descendants_and_self ) { |
|
837 | - $categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) ); |
|
838 | - $self = get_term( $descendants_and_self, $taxonomy ); |
|
839 | - array_unshift( $categories, $self ); |
|
836 | + if ($descendants_and_self) { |
|
837 | + $categories = (array) get_terms($taxonomy, array('child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0)); |
|
838 | + $self = get_term($descendants_and_self, $taxonomy); |
|
839 | + array_unshift($categories, $self); |
|
840 | 840 | } else { |
841 | 841 | $categories = (array) get_terms($taxonomy, array('get' => 'all')); |
842 | 842 | } |
843 | 843 | |
844 | - if ( $checked_ontop ) { |
|
844 | + if ($checked_ontop) { |
|
845 | 845 | // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache) |
846 | 846 | $checked_categories = array(); |
847 | - $keys = array_keys( $categories ); |
|
847 | + $keys = array_keys($categories); |
|
848 | 848 | |
849 | - foreach( $keys as $k ) { |
|
850 | - if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) { |
|
849 | + foreach ($keys as $k) { |
|
850 | + if (in_array($categories[$k]->term_id, $args['selected_cats'])) { |
|
851 | 851 | $checked_categories[] = $categories[$k]; |
852 | - unset( $categories[$k] ); |
|
852 | + unset($categories[$k]); |
|
853 | 853 | } |
854 | 854 | } |
855 | 855 | |
@@ -874,18 +874,18 @@ discard block |
||
874 | 874 | * @param array $list_table_obj the list table object |
875 | 875 | * @return array new filters |
876 | 876 | */ |
877 | - public function list_table_filters( $oldfilters, $list_table_obj ) { |
|
877 | + public function list_table_filters($oldfilters, $list_table_obj) { |
|
878 | 878 | $filters = array(); |
879 | 879 | |
880 | 880 | //first month/year filters |
881 | 881 | $filters[] = $this->espresso_event_months_dropdown(); |
882 | 882 | |
883 | 883 | |
884 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
884 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
885 | 885 | |
886 | 886 | //active status dropdown |
887 | - if ( $status !== 'draft' ) |
|
888 | - $filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' ); |
|
887 | + if ($status !== 'draft') |
|
888 | + $filter[] = $this->active_status_dropdown(isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : ''); |
|
889 | 889 | |
890 | 890 | //category filter |
891 | 891 | $filters[] = $this->category_dropdown(); |
@@ -907,17 +907,17 @@ discard block |
||
907 | 907 | */ |
908 | 908 | public function espresso_event_months_dropdown() { |
909 | 909 | //what we need to do is get all PRIMARY datetimes for all events to filter on. Note we need to include any other filters that are set! |
910 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
910 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
911 | 911 | |
912 | 912 | //categories? |
913 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
913 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
914 | 914 | |
915 | 915 | //active status? |
916 | - $active_status = isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : NULL; |
|
916 | + $active_status = isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : NULL; |
|
917 | 917 | |
918 | 918 | $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
919 | 919 | |
920 | - return EEH_Form_Fields::generate_event_months_dropdown( $cur_date, $status, $category, $active_status ); |
|
920 | + return EEH_Form_Fields::generate_event_months_dropdown($cur_date, $status, $category, $active_status); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | |
@@ -928,12 +928,12 @@ discard block |
||
928 | 928 | * @param string $current_value whatever the ucrrent active status is |
929 | 929 | * @return string html dropdown. |
930 | 930 | */ |
931 | - public function active_status_dropdown( $current_value = '' ) { |
|
931 | + public function active_status_dropdown($current_value = '') { |
|
932 | 932 | $select_name = 'active_status'; |
933 | - $values = array('none' => __('Show Active/Inactive', 'event_espresso'), 'active' => __('Active', 'event_espresso'), 'upcoming' => __('Upcoming', 'event_espresso'), 'expired' => __('Expired', 'event_espresso'), 'inactive' => __('Inactive', 'event_espresso') ); |
|
933 | + $values = array('none' => __('Show Active/Inactive', 'event_espresso'), 'active' => __('Active', 'event_espresso'), 'upcoming' => __('Upcoming', 'event_espresso'), 'expired' => __('Expired', 'event_espresso'), 'inactive' => __('Inactive', 'event_espresso')); |
|
934 | 934 | $id = 'id="espresso-active-status-dropdown-filter"'; |
935 | 935 | $class = 'wide'; |
936 | - echo EEH_Form_Fields::select_input( $select_name, $values, $current_value, $id, $class ); |
|
936 | + echo EEH_Form_Fields::select_input($select_name, $values, $current_value, $id, $class); |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | |
@@ -945,9 +945,9 @@ discard block |
||
945 | 945 | * @return string html |
946 | 946 | */ |
947 | 947 | public function category_dropdown() { |
948 | - $cur_cat = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1; |
|
948 | + $cur_cat = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
949 | 949 | |
950 | - return EEH_Form_Fields::generate_event_category_dropdown( $cur_cat ); |
|
950 | + return EEH_Form_Fields::generate_event_category_dropdown($cur_cat); |
|
951 | 951 | } |
952 | 952 | |
953 | 953 | |
@@ -959,14 +959,14 @@ discard block |
||
959 | 959 | * @return int |
960 | 960 | */ |
961 | 961 | public function total_events_today() { |
962 | - $start = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', date('Y-m-d' ) . ' 00:00:00', 'Y-m-d H:i:s', 'UTC' ); |
|
963 | - $end = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', date('Y-m-d' ) . ' 23:59:59', 'Y-m-d H:i:s', 'UTC' ); |
|
962 | + $start = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', date('Y-m-d').' 00:00:00', 'Y-m-d H:i:s', 'UTC'); |
|
963 | + $end = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', date('Y-m-d').' 23:59:59', 'Y-m-d H:i:s', 'UTC'); |
|
964 | 964 | |
965 | 965 | $where = array( |
966 | - 'Datetime.DTT_EVT_start' => array( 'BETWEEN', array($start, $end ) ) |
|
966 | + 'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)) |
|
967 | 967 | ); |
968 | 968 | |
969 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
969 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
970 | 970 | return $count; |
971 | 971 | } |
972 | 972 | |
@@ -981,14 +981,14 @@ discard block |
||
981 | 981 | $this_year_r = date('Y'); |
982 | 982 | $this_month_r = date('m'); |
983 | 983 | $days_this_month = date('t'); |
984 | - $start = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $this_year_r . '-' . $this_month_r . '-01 00:00:00', 'Y-m-d H:i:s', 'UTC' ); |
|
985 | - $end = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59', 'Y-m-d H:i:s', 'UTC' ); |
|
984 | + $start = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', $this_year_r.'-'.$this_month_r.'-01 00:00:00', 'Y-m-d H:i:s', 'UTC'); |
|
985 | + $end = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' 23:59:59', 'Y-m-d H:i:s', 'UTC'); |
|
986 | 986 | |
987 | 987 | $where = array( |
988 | - 'Datetime.DTT_EVT_start' => array( 'BETWEEN', array($start, $end ) ) |
|
988 | + 'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)) |
|
989 | 989 | ); |
990 | 990 | |
991 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
991 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
992 | 992 | return $count; |
993 | 993 | } |
994 | 994 | |
@@ -1005,53 +1005,53 @@ discard block |
||
1005 | 1005 | |
1006 | 1006 | |
1007 | 1007 | |
1008 | - public function get_default_tickets( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
1008 | + public function get_default_tickets($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
1009 | 1009 | |
1010 | - $orderby= empty( $this->_req_data['orderby'] ) ? 'TKT_name' : $this->_req_data['orderby']; |
|
1011 | - $order = empty( $this->_req_data['order'] ) ? 'ASC' : $this->_req_data['order']; |
|
1010 | + $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby']; |
|
1011 | + $order = empty($this->_req_data['order']) ? 'ASC' : $this->_req_data['order']; |
|
1012 | 1012 | |
1013 | - switch ( $orderby ) { |
|
1013 | + switch ($orderby) { |
|
1014 | 1014 | case 'TKT_name' : |
1015 | - $orderby = array( 'TKT_name' => $order ); |
|
1015 | + $orderby = array('TKT_name' => $order); |
|
1016 | 1016 | break; |
1017 | 1017 | |
1018 | 1018 | case 'TKT_price' : |
1019 | - $orderby = array( 'TKT_price' => $order ); |
|
1019 | + $orderby = array('TKT_price' => $order); |
|
1020 | 1020 | break; |
1021 | 1021 | |
1022 | 1022 | case 'TKT_uses' : |
1023 | - $orderby = array( 'TKT_uses' => $order ); |
|
1023 | + $orderby = array('TKT_uses' => $order); |
|
1024 | 1024 | break; |
1025 | 1025 | |
1026 | 1026 | case 'TKT_min' : |
1027 | - $orderby = array( 'TKT_min' => $order ); |
|
1027 | + $orderby = array('TKT_min' => $order); |
|
1028 | 1028 | break; |
1029 | 1029 | |
1030 | 1030 | case 'TKT_max' : |
1031 | - $orderby = array( 'TKT_max' => $order ); |
|
1031 | + $orderby = array('TKT_max' => $order); |
|
1032 | 1032 | break; |
1033 | 1033 | |
1034 | 1034 | case 'TKT_qty' : |
1035 | - $orderby = array( 'TKT_qty' => $order ); |
|
1035 | + $orderby = array('TKT_qty' => $order); |
|
1036 | 1036 | break; |
1037 | 1037 | } |
1038 | 1038 | |
1039 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1040 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1039 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1040 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1041 | 1041 | |
1042 | 1042 | $_where = array( |
1043 | 1043 | 'TKT_is_default' => 1, |
1044 | 1044 | 'TKT_deleted' => $trashed |
1045 | 1045 | ); |
1046 | 1046 | |
1047 | - $offset = ($current_page-1)*$per_page; |
|
1048 | - $limit = array( $offset, $per_page ); |
|
1047 | + $offset = ($current_page - 1) * $per_page; |
|
1048 | + $limit = array($offset, $per_page); |
|
1049 | 1049 | |
1050 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1051 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1050 | + if (isset($this->_req_data['s'])) { |
|
1051 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1052 | 1052 | $_where['OR'] = array( |
1053 | - 'TKT_name' => array('LIKE',$sstr ), |
|
1054 | - 'TKT_description' => array('LIKE',$sstr ) |
|
1053 | + 'TKT_name' => array('LIKE', $sstr), |
|
1054 | + 'TKT_description' => array('LIKE', $sstr) |
|
1055 | 1055 | ); |
1056 | 1056 | } |
1057 | 1057 | |
@@ -1062,9 +1062,9 @@ discard block |
||
1062 | 1062 | 'group_by'=>'TKT_ID' |
1063 | 1063 | ); |
1064 | 1064 | |
1065 | - if($count){ |
|
1065 | + if ($count) { |
|
1066 | 1066 | return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
1067 | - }else{ |
|
1067 | + } else { |
|
1068 | 1068 | return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
1069 | 1069 | } |
1070 | 1070 | |
@@ -1074,35 +1074,35 @@ discard block |
||
1074 | 1074 | |
1075 | 1075 | |
1076 | 1076 | |
1077 | - protected function _trash_or_restore_ticket( $trash = FALSE ) { |
|
1077 | + protected function _trash_or_restore_ticket($trash = FALSE) { |
|
1078 | 1078 | $success = 1; |
1079 | 1079 | |
1080 | 1080 | $TKT = EEM_Ticket::instance(); |
1081 | 1081 | |
1082 | 1082 | //checkboxes? |
1083 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
1083 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1084 | 1084 | //if array has more than one element then success message should be plural |
1085 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1085 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1086 | 1086 | |
1087 | 1087 | //cycle thru the boxes |
1088 | - while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
1089 | - if ( $trash ) { |
|
1090 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1088 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1089 | + if ($trash) { |
|
1090 | + if ( ! $TKT->delete_by_ID($TKT_ID)) |
|
1091 | 1091 | $success = 0; |
1092 | 1092 | } else { |
1093 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1093 | + if ( ! $TKT->restore_by_ID($TKT_ID)) |
|
1094 | 1094 | $success = 0; |
1095 | 1095 | } |
1096 | 1096 | } |
1097 | 1097 | } else { |
1098 | 1098 | //grab single id and trash |
1099 | - $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
1099 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
1100 | 1100 | |
1101 | - if ( $trash ) { |
|
1102 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1101 | + if ($trash) { |
|
1102 | + if ( ! $TKT->delete_by_ID($TKT_ID)) |
|
1103 | 1103 | $success = 0; |
1104 | 1104 | } else { |
1105 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1105 | + if ( ! $TKT->restore_by_ID($TKT_ID)) |
|
1106 | 1106 | $success = 0; |
1107 | 1107 | } |
1108 | 1108 | } |
@@ -1112,7 +1112,7 @@ discard block |
||
1112 | 1112 | 'action' => 'ticket_list_table', |
1113 | 1113 | 'status' => $trash ? '' : 'trashed' |
1114 | 1114 | ); |
1115 | - $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
|
1115 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
1116 | 1116 | } |
1117 | 1117 | |
1118 | 1118 | |
@@ -1125,21 +1125,21 @@ discard block |
||
1125 | 1125 | $TKT = EEM_Ticket::instance(); |
1126 | 1126 | |
1127 | 1127 | //checkboxes? |
1128 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
1128 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1129 | 1129 | //if array has more than one element then success message should be plural |
1130 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1130 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1131 | 1131 | |
1132 | 1132 | //cycle thru the boxes |
1133 | - while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
1133 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1134 | 1134 | //delete |
1135 | - if ( ! $this->_delete_the_ticket( $TKT_ID ) ) { |
|
1135 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
1136 | 1136 | $success = 0; |
1137 | 1137 | } |
1138 | 1138 | } |
1139 | 1139 | } else { |
1140 | 1140 | //grab single id and trash |
1141 | - $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
1142 | - if ( ! $this->_delete_the_ticket( $TKT_ID ) ) { |
|
1141 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
1142 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
1143 | 1143 | $success = 0; |
1144 | 1144 | } |
1145 | 1145 | } |
@@ -1151,16 +1151,16 @@ discard block |
||
1151 | 1151 | ); |
1152 | 1152 | |
1153 | 1153 | //failsafe. If the default ticket count === 1 then we need to redirect to event overview. |
1154 | - if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) ) |
|
1154 | + if (EEM_Ticket::instance()->count_deleted_and_undeleted(array(array('TKT_is_default' => 1)), 'TKT_ID', TRUE)) |
|
1155 | 1155 | $query_args = array(); |
1156 | - $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
|
1156 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
1157 | 1157 | } |
1158 | 1158 | |
1159 | 1159 | |
1160 | 1160 | |
1161 | 1161 | |
1162 | - protected function _delete_the_ticket( $TKT_ID ) { |
|
1163 | - $tkt = EEM_Ticket::instance()->get_one_by_ID( $TKT_ID ); |
|
1162 | + protected function _delete_the_ticket($TKT_ID) { |
|
1163 | + $tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID); |
|
1164 | 1164 | $tkt->_remove_relations('Datetime'); |
1165 | 1165 | //delete all related prices first |
1166 | 1166 | $tkt->delete_related_permanently('Price'); |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -435,8 +436,9 @@ discard block |
||
435 | 436 | //k we've got EVT_ID so let's use that to get the event we'll duplicate |
436 | 437 | $orig_event = EEM_Event::instance()->get_one_by_ID( $this->_req_data['EVT_ID'] ); |
437 | 438 | |
438 | - if ( ! $orig_event instanceof EE_Event ) |
|
439 | - throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso '), $this->_req_data['EVT_ID'] ) ); |
|
439 | + if ( ! $orig_event instanceof EE_Event ) { |
|
440 | + throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso '), $this->_req_data['EVT_ID'] ) ); |
|
441 | + } |
|
440 | 442 | |
441 | 443 | //k now let's clone the $orig_event before getting relations |
442 | 444 | $new_event = clone $orig_event; |
@@ -510,8 +512,9 @@ discard block |
||
510 | 512 | //now let's get the ticket relations setup. |
511 | 513 | foreach ( (array) $orig_tkts as $orig_tkt ) { |
512 | 514 | //it's possible a datetime will have no tickets so let's verify we HAVE a ticket first. |
513 | - if ( ! $orig_tkt instanceof EE_Ticket ) |
|
514 | - continue; |
|
515 | + if ( ! $orig_tkt instanceof EE_Ticket ) { |
|
516 | + continue; |
|
517 | + } |
|
515 | 518 | |
516 | 519 | //is this ticket archived? If it is then let's skip |
517 | 520 | if ( $orig_tkt->get( 'TKT_deleted' ) ) { |
@@ -620,9 +623,9 @@ discard block |
||
620 | 623 | protected function _events_export() { |
621 | 624 | if(isset($this->_req_data['EVT_ID'])){ |
622 | 625 | $event_ids = $this->_req_data['EVT_ID']; |
623 | - }elseif(isset($this->_req_data['EVT_IDs'])){ |
|
626 | + } elseif(isset($this->_req_data['EVT_IDs'])){ |
|
624 | 627 | $event_ids = $this->_req_data['EVT_IDs']; |
625 | - }else{ |
|
628 | + } else{ |
|
626 | 629 | $event_ids = NULL; |
627 | 630 | } |
628 | 631 | //todo: I don't like doing this but it'll do until we modify EE_Export Class. |
@@ -811,8 +814,9 @@ discard block |
||
811 | 814 | |
812 | 815 | extract( wp_parse_args($args, $defaults), EXTR_SKIP ); |
813 | 816 | |
814 | - if ( empty($walker) || !is_a($walker, 'Walker') ) |
|
815 | - $walker = new Walker_Radio_Checklist; |
|
817 | + if ( empty($walker) || !is_a($walker, 'Walker') ) { |
|
818 | + $walker = new Walker_Radio_Checklist; |
|
819 | + } |
|
816 | 820 | |
817 | 821 | $descendants_and_self = (int) $descendants_and_self; |
818 | 822 | |
@@ -821,17 +825,19 @@ discard block |
||
821 | 825 | $tax = get_taxonomy($taxonomy); |
822 | 826 | $args['disabled'] = !current_user_can($tax->cap->assign_terms); |
823 | 827 | |
824 | - if ( is_array( $selected_cats ) ) |
|
825 | - $args['selected_cats'] = $selected_cats; |
|
826 | - elseif ( $post_id ) |
|
827 | - $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); |
|
828 | - else |
|
829 | - $args['selected_cats'] = array(); |
|
828 | + if ( is_array( $selected_cats ) ) { |
|
829 | + $args['selected_cats'] = $selected_cats; |
|
830 | + } elseif ( $post_id ) { |
|
831 | + $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); |
|
832 | + } else { |
|
833 | + $args['selected_cats'] = array(); |
|
834 | + } |
|
830 | 835 | |
831 | - if ( is_array( $popular_cats ) ) |
|
832 | - $args['popular_cats'] = $popular_cats; |
|
833 | - else |
|
834 | - $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); |
|
836 | + if ( is_array( $popular_cats ) ) { |
|
837 | + $args['popular_cats'] = $popular_cats; |
|
838 | + } else { |
|
839 | + $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); |
|
840 | + } |
|
835 | 841 | |
836 | 842 | if ( $descendants_and_self ) { |
837 | 843 | $categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) ); |
@@ -884,8 +890,9 @@ discard block |
||
884 | 890 | $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
885 | 891 | |
886 | 892 | //active status dropdown |
887 | - if ( $status !== 'draft' ) |
|
888 | - $filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' ); |
|
893 | + if ( $status !== 'draft' ) { |
|
894 | + $filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' ); |
|
895 | + } |
|
889 | 896 | |
890 | 897 | //category filter |
891 | 898 | $filters[] = $this->category_dropdown(); |
@@ -1064,7 +1071,7 @@ discard block |
||
1064 | 1071 | |
1065 | 1072 | if($count){ |
1066 | 1073 | return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
1067 | - }else{ |
|
1074 | + } else{ |
|
1068 | 1075 | return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
1069 | 1076 | } |
1070 | 1077 | |
@@ -1087,11 +1094,13 @@ discard block |
||
1087 | 1094 | //cycle thru the boxes |
1088 | 1095 | while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
1089 | 1096 | if ( $trash ) { |
1090 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1091 | - $success = 0; |
|
1097 | + if ( ! $TKT->delete_by_ID( $TKT_ID ) ) { |
|
1098 | + $success = 0; |
|
1099 | + } |
|
1092 | 1100 | } else { |
1093 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1094 | - $success = 0; |
|
1101 | + if ( ! $TKT->restore_by_ID( $TKT_ID ) ) { |
|
1102 | + $success = 0; |
|
1103 | + } |
|
1095 | 1104 | } |
1096 | 1105 | } |
1097 | 1106 | } else { |
@@ -1099,11 +1108,13 @@ discard block |
||
1099 | 1108 | $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
1100 | 1109 | |
1101 | 1110 | if ( $trash ) { |
1102 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1103 | - $success = 0; |
|
1111 | + if ( ! $TKT->delete_by_ID( $TKT_ID ) ) { |
|
1112 | + $success = 0; |
|
1113 | + } |
|
1104 | 1114 | } else { |
1105 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1106 | - $success = 0; |
|
1115 | + if ( ! $TKT->restore_by_ID( $TKT_ID ) ) { |
|
1116 | + $success = 0; |
|
1117 | + } |
|
1107 | 1118 | } |
1108 | 1119 | } |
1109 | 1120 | |
@@ -1151,8 +1162,9 @@ discard block |
||
1151 | 1162 | ); |
1152 | 1163 | |
1153 | 1164 | //failsafe. If the default ticket count === 1 then we need to redirect to event overview. |
1154 | - if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) ) |
|
1155 | - $query_args = array(); |
|
1165 | + if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) ) { |
|
1166 | + $query_args = array(); |
|
1167 | + } |
|
1156 | 1168 | $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
1157 | 1169 | } |
1158 | 1170 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | * date_format and the second value is the time format |
67 | 67 | * @return EE_Ticket |
68 | 68 | */ |
69 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
70 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
71 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
69 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
70 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
71 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | * the website will be used. |
80 | 80 | * @return EE_Ticket |
81 | 81 | */ |
82 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
83 | - return new self( $props_n_values, TRUE, $timezone ); |
|
82 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
83 | + return new self($props_n_values, TRUE, $timezone); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return bool |
90 | 90 | */ |
91 | 91 | public function parent() { |
92 | - return $this->get( 'TKT_parent' ); |
|
92 | + return $this->get('TKT_parent'); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | * @param int $DTT_ID the primary key for a particular datetime |
100 | 100 | * @return boolean |
101 | 101 | */ |
102 | - public function available( $DTT_ID = 0 ) { |
|
102 | + public function available($DTT_ID = 0) { |
|
103 | 103 | // are we checking availability for a particular datetime ? |
104 | - if ( $DTT_ID ) { |
|
104 | + if ($DTT_ID) { |
|
105 | 105 | // get that datetime object |
106 | - $datetime = $this->get_first_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) ); |
|
106 | + $datetime = $this->get_first_related('Datetime', array(array('DTT_ID' => $DTT_ID))); |
|
107 | 107 | // if ticket sales for this datetime have exceeded the reg limit... |
108 | - if ( $datetime instanceof EE_Datetime && $datetime->sold_out() ) { |
|
108 | + if ($datetime instanceof EE_Datetime && $datetime->sold_out()) { |
|
109 | 109 | return FALSE; |
110 | 110 | } |
111 | 111 | } |
@@ -121,22 +121,22 @@ discard block |
||
121 | 121 | * @param bool | null $remaining if it is already known that tickets are available, then simply pass a bool to save further processing |
122 | 122 | * @return mixed status int if the display string isn't requested |
123 | 123 | */ |
124 | - public function ticket_status( $display = FALSE, $remaining = null ) { |
|
125 | - $remaining = is_bool( $remaining ) ? $remaining : $this->is_remaining(); |
|
126 | - if ( ! $remaining ) { |
|
127 | - return $display ? EEH_Template::pretty_status( EE_Ticket::sold_out, FALSE, 'sentence' ) : EE_Ticket::sold_out; |
|
124 | + public function ticket_status($display = FALSE, $remaining = null) { |
|
125 | + $remaining = is_bool($remaining) ? $remaining : $this->is_remaining(); |
|
126 | + if ( ! $remaining) { |
|
127 | + return $display ? EEH_Template::pretty_status(EE_Ticket::sold_out, FALSE, 'sentence') : EE_Ticket::sold_out; |
|
128 | 128 | } |
129 | - if ( $this->get( 'TKT_deleted' ) ) { |
|
130 | - return $display ? EEH_Template::pretty_status( EE_Ticket::archived, FALSE, 'sentence' ) : EE_Ticket::archived; |
|
129 | + if ($this->get('TKT_deleted')) { |
|
130 | + return $display ? EEH_Template::pretty_status(EE_Ticket::archived, FALSE, 'sentence') : EE_Ticket::archived; |
|
131 | 131 | } |
132 | - if ( $this->is_expired() ) { |
|
133 | - return $display ? EEH_Template::pretty_status( EE_Ticket::expired, FALSE, 'sentence' ) : EE_Ticket::expired; |
|
132 | + if ($this->is_expired()) { |
|
133 | + return $display ? EEH_Template::pretty_status(EE_Ticket::expired, FALSE, 'sentence') : EE_Ticket::expired; |
|
134 | 134 | } |
135 | - if ( $this->is_pending() ) { |
|
136 | - return $display ? EEH_Template::pretty_status( EE_Ticket::pending, FALSE, 'sentence' ) : EE_Ticket::pending; |
|
135 | + if ($this->is_pending()) { |
|
136 | + return $display ? EEH_Template::pretty_status(EE_Ticket::pending, FALSE, 'sentence') : EE_Ticket::pending; |
|
137 | 137 | } |
138 | - if ( $this->is_on_sale() ) { |
|
139 | - return $display ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence' ) : EE_Ticket::onsale; |
|
138 | + if ($this->is_on_sale()) { |
|
139 | + return $display ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : EE_Ticket::onsale; |
|
140 | 140 | } |
141 | 141 | return ''; |
142 | 142 | } |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | * @param int $DTT_ID if an int above 0 is included here then we get a specific dtt. |
151 | 151 | * @return boolean true = tickets remaining, false not. |
152 | 152 | */ |
153 | - public function is_remaining( $DTT_ID = 0 ) { |
|
154 | - $num_remaining = $this->remaining( $DTT_ID ); |
|
155 | - if ( $num_remaining === 0 ) { |
|
153 | + public function is_remaining($DTT_ID = 0) { |
|
154 | + $num_remaining = $this->remaining($DTT_ID); |
|
155 | + if ($num_remaining === 0) { |
|
156 | 156 | return FALSE; |
157 | 157 | } |
158 | - if ( $num_remaining > 0 && $num_remaining < $this->min() ) { |
|
158 | + if ($num_remaining > 0 && $num_remaining < $this->min()) { |
|
159 | 159 | return FALSE; |
160 | 160 | } |
161 | 161 | return TRUE; |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | * set to 0 for all related datetimes |
171 | 171 | * @return int |
172 | 172 | */ |
173 | - public function remaining( $DTT_ID = 0 ) { |
|
174 | - return $this->real_quantity_on_ticket('saleable', $DTT_ID ); |
|
173 | + public function remaining($DTT_ID = 0) { |
|
174 | + return $this->real_quantity_on_ticket('saleable', $DTT_ID); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @return int |
182 | 182 | */ |
183 | 183 | function min() { |
184 | - return $this->get( 'TKT_min' ); |
|
184 | + return $this->get('TKT_min'); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * @return boolean |
192 | 192 | */ |
193 | 193 | public function is_expired() { |
194 | - return ( $this->get_raw( 'TKT_end_date' ) < time() ); |
|
194 | + return ($this->get_raw('TKT_end_date') < time()); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @return boolean |
202 | 202 | */ |
203 | 203 | public function is_pending() { |
204 | - return ( $this->get_raw( 'TKT_start_date' ) > time() ); |
|
204 | + return ($this->get_raw('TKT_start_date') > time()); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * @return boolean |
212 | 212 | */ |
213 | 213 | public function is_on_sale() { |
214 | - return ( $this->get_raw( 'TKT_start_date' ) < time() && $this->get_raw( 'TKT_end_date' ) > time() ); |
|
214 | + return ($this->get_raw('TKT_start_date') < time() && $this->get_raw('TKT_end_date') > time()); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31 |
223 | 223 | * @return array |
224 | 224 | */ |
225 | - public function date_range( $dt_frmt = '', $conjunction = ' - ' ) { |
|
226 | - $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : ''; |
|
227 | - $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date( $dt_frmt ) : ''; |
|
225 | + public function date_range($dt_frmt = '', $conjunction = ' - ') { |
|
226 | + $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date($dt_frmt) : ''; |
|
227 | + $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date($dt_frmt) : ''; |
|
228 | 228 | |
229 | - return $first_date && $last_date ? $first_date . $conjunction . $last_date : ''; |
|
229 | + return $first_date && $last_date ? $first_date.$conjunction.$last_date : ''; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | * @return EE_Datetime |
237 | 237 | */ |
238 | 238 | public function first_datetime() { |
239 | - $datetimes = $this->datetimes( array( 'limit' => 1 ) ); |
|
240 | - return reset( $datetimes ); |
|
239 | + $datetimes = $this->datetimes(array('limit' => 1)); |
|
240 | + return reset($datetimes); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
@@ -248,11 +248,11 @@ discard block |
||
248 | 248 | * @param array $query_params see EEM_Base::get_all() |
249 | 249 | * @return EE_Datetime[] |
250 | 250 | */ |
251 | - public function datetimes( $query_params = array() ) { |
|
252 | - if ( ! isset( $query_params[ 'order_by' ] ) ) { |
|
253 | - $query_params[ 'order_by' ][ 'DTT_order' ] = 'ASC'; |
|
251 | + public function datetimes($query_params = array()) { |
|
252 | + if ( ! isset($query_params['order_by'])) { |
|
253 | + $query_params['order_by']['DTT_order'] = 'ASC'; |
|
254 | 254 | } |
255 | - return $this->get_many_related( 'Datetime', $query_params ); |
|
255 | + return $this->get_many_related('Datetime', $query_params); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | * @return EE_Datetime |
263 | 263 | */ |
264 | 264 | public function last_datetime() { |
265 | - $datetimes = $this->datetimes( array( 'limit' => 1, 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) ) ); |
|
266 | - return end( $datetimes ); |
|
265 | + $datetimes = $this->datetimes(array('limit' => 1, 'order_by' => array('DTT_EVT_start' => 'DESC'))); |
|
266 | + return end($datetimes); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -277,22 +277,22 @@ discard block |
||
277 | 277 | * @param int $dtt_id [optional] include the dtt_id with $what = 'datetime'. |
278 | 278 | * @return mixed (array|int) how many tickets have sold |
279 | 279 | */ |
280 | - public function tickets_sold( $what = 'ticket', $dtt_id = NULL ) { |
|
280 | + public function tickets_sold($what = 'ticket', $dtt_id = NULL) { |
|
281 | 281 | $total = 0; |
282 | 282 | $tickets_sold = $this->_all_tickets_sold(); |
283 | - switch ( $what ) { |
|
283 | + switch ($what) { |
|
284 | 284 | case 'ticket' : |
285 | - return $tickets_sold[ 'ticket' ]; |
|
285 | + return $tickets_sold['ticket']; |
|
286 | 286 | break; |
287 | 287 | case 'datetime' : |
288 | - if ( empty( $tickets_sold[ 'datetime' ] ) ) { |
|
288 | + if (empty($tickets_sold['datetime'])) { |
|
289 | 289 | return $total; |
290 | 290 | } |
291 | - if ( ! empty( $dtt_id ) && ! isset( $tickets_sold[ 'datetime' ][ $dtt_id ] ) ) { |
|
292 | - EE_Error::add_error( __( "You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included. Are you SURE that is a datetime related to this ticket?", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
291 | + if ( ! empty($dtt_id) && ! isset($tickets_sold['datetime'][$dtt_id])) { |
|
292 | + EE_Error::add_error(__("You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included. Are you SURE that is a datetime related to this ticket?", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
293 | 293 | return $total; |
294 | 294 | } |
295 | - return empty( $dtt_id ) ? $tickets_sold[ 'datetime' ] : $tickets_sold[ 'datetime' ][ $dtt_id ]; |
|
295 | + return empty($dtt_id) ? $tickets_sold['datetime'] : $tickets_sold['datetime'][$dtt_id]; |
|
296 | 296 | break; |
297 | 297 | default: |
298 | 298 | return $total; |
@@ -306,15 +306,15 @@ discard block |
||
306 | 306 | * @return EE_Ticket[] |
307 | 307 | */ |
308 | 308 | protected function _all_tickets_sold() { |
309 | - $datetimes = $this->get_many_related( 'Datetime' ); |
|
309 | + $datetimes = $this->get_many_related('Datetime'); |
|
310 | 310 | $tickets_sold = array(); |
311 | - if ( ! empty( $datetimes ) ) { |
|
312 | - foreach ( $datetimes as $datetime ) { |
|
313 | - $tickets_sold[ 'datetime' ][ $datetime->ID() ] = $datetime->get( 'DTT_sold' ); |
|
311 | + if ( ! empty($datetimes)) { |
|
312 | + foreach ($datetimes as $datetime) { |
|
313 | + $tickets_sold['datetime'][$datetime->ID()] = $datetime->get('DTT_sold'); |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | //Tickets sold |
317 | - $tickets_sold[ 'ticket' ] = $this->sold(); |
|
317 | + $tickets_sold['ticket'] = $this->sold(); |
|
318 | 318 | return $tickets_sold; |
319 | 319 | } |
320 | 320 | |
@@ -327,9 +327,9 @@ discard block |
||
327 | 327 | * @param bool $return_array whether to return as an array indexed by price id or just the object. |
328 | 328 | * @return EE_Price |
329 | 329 | */ |
330 | - public function base_price( $return_array = FALSE ) { |
|
331 | - $_where = array( 'Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price ); |
|
332 | - return $return_array ? $this->get_many_related( 'Price', array( $_where ) ) : $this->get_first_related( 'Price', array( $_where ) ); |
|
330 | + public function base_price($return_array = FALSE) { |
|
331 | + $_where = array('Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price); |
|
332 | + return $return_array ? $this->get_many_related('Price', array($_where)) : $this->get_first_related('Price', array($_where)); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | * @return EE_Price[] |
342 | 342 | */ |
343 | 343 | public function price_modifiers() { |
344 | - $query_params = array( 0 => array( 'Price_Type.PBT_ID' => array( 'NOT IN', array( EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax ) ) ) ); |
|
345 | - return $this->prices( $query_params ); |
|
344 | + $query_params = array(0 => array('Price_Type.PBT_ID' => array('NOT IN', array(EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax)))); |
|
345 | + return $this->prices($query_params); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | |
@@ -352,8 +352,8 @@ discard block |
||
352 | 352 | * @param array $query_params like EEM_Base::get_all |
353 | 353 | * @return EE_Price[] |
354 | 354 | */ |
355 | - public function prices( $query_params = array() ) { |
|
356 | - return $this->get_many_related( 'Price', $query_params ); |
|
355 | + public function prices($query_params = array()) { |
|
356 | + return $this->get_many_related('Price', $query_params); |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | |
@@ -363,8 +363,8 @@ discard block |
||
363 | 363 | * @param array $query_params see EEM_Base::get_all() |
364 | 364 | * @return EE_Datetime_Ticket |
365 | 365 | */ |
366 | - public function datetime_tickets( $query_params = array() ) { |
|
367 | - return $this->get_many_related( 'Datetime_Ticket', $query_params ); |
|
366 | + public function datetime_tickets($query_params = array()) { |
|
367 | + return $this->get_many_related('Datetime_Ticket', $query_params); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | |
@@ -375,8 +375,8 @@ discard block |
||
375 | 375 | * @param boolean $show_deleted |
376 | 376 | * @return EE_Datetime[] |
377 | 377 | */ |
378 | - public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE ) { |
|
379 | - return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_ticket_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted ); |
|
378 | + public function datetimes_ordered($show_expired = TRUE, $show_deleted = FALSE) { |
|
379 | + return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_ticket_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | * @return string |
387 | 387 | */ |
388 | 388 | function ID() { |
389 | - return $this->get( 'TKT_ID' ); |
|
389 | + return $this->get('TKT_ID'); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * @return EE_Ticket_Template |
411 | 411 | */ |
412 | 412 | public function template() { |
413 | - return $this->get_first_related( 'Ticket_Template' ); |
|
413 | + return $this->get_first_related('Ticket_Template'); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @return bool |
430 | 430 | */ |
431 | 431 | public function ticket_price() { |
432 | - return $this->get( 'TKT_price' ); |
|
432 | + return $this->get('TKT_price'); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | * @return mixed |
439 | 439 | */ |
440 | 440 | public function pretty_price() { |
441 | - return $this->get_pretty( 'TKT_price' ); |
|
441 | + return $this->get_pretty('TKT_price'); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | |
@@ -457,17 +457,17 @@ discard block |
||
457 | 457 | * @param bool $no_cache |
458 | 458 | * @return float |
459 | 459 | */ |
460 | - public function get_ticket_total_with_taxes( $no_cache = FALSE ) { |
|
461 | - if ( ! isset( $this->_ticket_total_with_taxes ) || $no_cache ) { |
|
460 | + public function get_ticket_total_with_taxes($no_cache = FALSE) { |
|
461 | + if ( ! isset($this->_ticket_total_with_taxes) || $no_cache) { |
|
462 | 462 | $this->_ticket_total_with_taxes = $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin(); |
463 | 463 | } |
464 | - return (float)$this->_ticket_total_with_taxes; |
|
464 | + return (float) $this->_ticket_total_with_taxes; |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | |
468 | 468 | |
469 | 469 | public function ensure_TKT_Price_correct() { |
470 | - $this->set( 'TKT_price', EE_Taxes::get_subtotal_for_admin( $this ) ); |
|
470 | + $this->set('TKT_price', EE_Taxes::get_subtotal_for_admin($this)); |
|
471 | 471 | $this->save(); |
472 | 472 | } |
473 | 473 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @return float |
478 | 478 | */ |
479 | 479 | public function get_ticket_subtotal() { |
480 | - return EE_Taxes::get_subtotal_for_admin( $this ); |
|
480 | + return EE_Taxes::get_subtotal_for_admin($this); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | * @return float |
488 | 488 | */ |
489 | 489 | public function get_ticket_taxes_total_for_admin() { |
490 | - return EE_Taxes::get_total_taxes_for_admin( $this ); |
|
490 | + return EE_Taxes::get_total_taxes_for_admin($this); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | |
@@ -497,8 +497,8 @@ discard block |
||
497 | 497 | * @param string $name |
498 | 498 | * @return boolean |
499 | 499 | */ |
500 | - function set_name( $name ) { |
|
501 | - $this->set( 'TKT_name', $name ); |
|
500 | + function set_name($name) { |
|
501 | + $this->set('TKT_name', $name); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | * @return string |
509 | 509 | */ |
510 | 510 | function description() { |
511 | - return $this->get( 'TKT_description' ); |
|
511 | + return $this->get('TKT_description'); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | |
@@ -518,8 +518,8 @@ discard block |
||
518 | 518 | * @param string $description |
519 | 519 | * @return boolean |
520 | 520 | */ |
521 | - function set_description( $description ) { |
|
522 | - $this->set( 'TKT_description', $description ); |
|
521 | + function set_description($description) { |
|
522 | + $this->set('TKT_description', $description); |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | |
@@ -530,8 +530,8 @@ discard block |
||
530 | 530 | * @param string $tm_frmt |
531 | 531 | * @return string |
532 | 532 | */ |
533 | - function start_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
534 | - return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt ); |
|
533 | + function start_date($dt_frmt = '', $tm_frmt = '') { |
|
534 | + return $this->_get_datetime('TKT_start_date', $dt_frmt, $tm_frmt); |
|
535 | 535 | } |
536 | 536 | |
537 | 537 | |
@@ -541,8 +541,8 @@ discard block |
||
541 | 541 | * @param string $start_date |
542 | 542 | * @return void |
543 | 543 | */ |
544 | - function set_start_date( $start_date ) { |
|
545 | - $this->_set_date_time( 'B', $start_date, 'TKT_start_date' ); |
|
544 | + function set_start_date($start_date) { |
|
545 | + $this->_set_date_time('B', $start_date, 'TKT_start_date'); |
|
546 | 546 | } |
547 | 547 | |
548 | 548 | |
@@ -553,8 +553,8 @@ discard block |
||
553 | 553 | * @param string $tm_frmt |
554 | 554 | * @return string |
555 | 555 | */ |
556 | - function end_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
557 | - return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt ); |
|
556 | + function end_date($dt_frmt = '', $tm_frmt = '') { |
|
557 | + return $this->_get_datetime('TKT_end_date', $dt_frmt, $tm_frmt); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | |
@@ -564,8 +564,8 @@ discard block |
||
564 | 564 | * @param string $end_date |
565 | 565 | * @return void |
566 | 566 | */ |
567 | - function set_end_date( $end_date ) { |
|
568 | - $this->_set_date_time( 'B', $end_date, 'TKT_end_date' ); |
|
567 | + function set_end_date($end_date) { |
|
568 | + $this->_set_date_time('B', $end_date, 'TKT_end_date'); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | |
@@ -577,8 +577,8 @@ discard block |
||
577 | 577 | * |
578 | 578 | * @param string $time a string representation of the sell until time (ex 9am or 7:30pm) |
579 | 579 | */ |
580 | - function set_end_time( $time ) { |
|
581 | - $this->_set_time_for( $time, 'TKT_end_date' ); |
|
580 | + function set_end_time($time) { |
|
581 | + $this->_set_time_for($time, 'TKT_end_date'); |
|
582 | 582 | } |
583 | 583 | |
584 | 584 | |
@@ -588,8 +588,8 @@ discard block |
||
588 | 588 | * @param int $min |
589 | 589 | * @return boolean |
590 | 590 | */ |
591 | - function set_min( $min ) { |
|
592 | - $this->set( 'TKT_min', $min ); |
|
591 | + function set_min($min) { |
|
592 | + $this->set('TKT_min', $min); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | * @return int |
600 | 600 | */ |
601 | 601 | function max() { |
602 | - return $this->get( 'TKT_max' ); |
|
602 | + return $this->get('TKT_max'); |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | |
@@ -609,8 +609,8 @@ discard block |
||
609 | 609 | * @param int $max |
610 | 610 | * @return boolean |
611 | 611 | */ |
612 | - function set_max( $max ) { |
|
613 | - $this->set( 'TKT_max', $max ); |
|
612 | + function set_max($max) { |
|
613 | + $this->set('TKT_max', $max); |
|
614 | 614 | } |
615 | 615 | |
616 | 616 | |
@@ -620,8 +620,8 @@ discard block |
||
620 | 620 | * @param float $price |
621 | 621 | * @return boolean |
622 | 622 | */ |
623 | - function set_price( $price ) { |
|
624 | - $this->set( 'TKT_price', $price ); |
|
623 | + function set_price($price) { |
|
624 | + $this->set('TKT_price', $price); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | * @return int |
632 | 632 | */ |
633 | 633 | function sold() { |
634 | - return $this->get_raw( 'TKT_sold' ); |
|
634 | + return $this->get_raw('TKT_sold'); |
|
635 | 635 | } |
636 | 636 | |
637 | 637 | |
@@ -641,10 +641,10 @@ discard block |
||
641 | 641 | * @param int $sold |
642 | 642 | * @return boolean |
643 | 643 | */ |
644 | - function set_sold( $sold ) { |
|
644 | + function set_sold($sold) { |
|
645 | 645 | // sold can not go below zero |
646 | - $sold = max( 0, $sold ); |
|
647 | - $this->set( 'TKT_sold', $sold ); |
|
646 | + $sold = max(0, $sold); |
|
647 | + $this->set('TKT_sold', $sold); |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | |
@@ -654,12 +654,12 @@ discard block |
||
654 | 654 | * @param int $qty |
655 | 655 | * @return boolean |
656 | 656 | */ |
657 | - function increase_sold( $qty = 1 ) { |
|
657 | + function increase_sold($qty = 1) { |
|
658 | 658 | $sold = $this->sold() + $qty; |
659 | 659 | // remove ticket reservation |
660 | - $this->decrease_reserved( $qty ); |
|
661 | - $this->_increase_sold_for_datetimes( $qty ); |
|
662 | - return $this->set_sold( $sold ); |
|
660 | + $this->decrease_reserved($qty); |
|
661 | + $this->_increase_sold_for_datetimes($qty); |
|
662 | + return $this->set_sold($sold); |
|
663 | 663 | } |
664 | 664 | |
665 | 665 | |
@@ -669,12 +669,12 @@ discard block |
||
669 | 669 | * @param int $qty |
670 | 670 | * @return boolean |
671 | 671 | */ |
672 | - protected function _increase_sold_for_datetimes( $qty = 1 ) { |
|
672 | + protected function _increase_sold_for_datetimes($qty = 1) { |
|
673 | 673 | $datetimes = $this->datetimes(); |
674 | - if ( is_array( $datetimes ) ) { |
|
675 | - foreach ( $datetimes as $datetime ) { |
|
676 | - if ( $datetime instanceof EE_Datetime ) { |
|
677 | - $datetime->increase_sold( $qty ); |
|
674 | + if (is_array($datetimes)) { |
|
675 | + foreach ($datetimes as $datetime) { |
|
676 | + if ($datetime instanceof EE_Datetime) { |
|
677 | + $datetime->increase_sold($qty); |
|
678 | 678 | $datetime->save(); |
679 | 679 | } |
680 | 680 | } |
@@ -688,10 +688,10 @@ discard block |
||
688 | 688 | * @param int $qty |
689 | 689 | * @return boolean |
690 | 690 | */ |
691 | - function decrease_sold( $qty = 1 ) { |
|
691 | + function decrease_sold($qty = 1) { |
|
692 | 692 | $sold = $this->sold() - $qty; |
693 | - $this->_decrease_sold_for_datetimes( $qty ); |
|
694 | - return $this->set_sold( $sold ); |
|
693 | + $this->_decrease_sold_for_datetimes($qty); |
|
694 | + return $this->set_sold($sold); |
|
695 | 695 | } |
696 | 696 | |
697 | 697 | |
@@ -702,12 +702,12 @@ discard block |
||
702 | 702 | * @param int $qty |
703 | 703 | * @return boolean |
704 | 704 | */ |
705 | - protected function _decrease_sold_for_datetimes( $qty = 1 ) { |
|
705 | + protected function _decrease_sold_for_datetimes($qty = 1) { |
|
706 | 706 | $datetimes = $this->datetimes(); |
707 | - if ( is_array( $datetimes ) ) { |
|
708 | - foreach ( $datetimes as $datetime ) { |
|
709 | - if ( $datetime instanceof EE_Datetime ) { |
|
710 | - $datetime->decrease_sold( $qty ); |
|
707 | + if (is_array($datetimes)) { |
|
708 | + foreach ($datetimes as $datetime) { |
|
709 | + if ($datetime instanceof EE_Datetime) { |
|
710 | + $datetime->decrease_sold($qty); |
|
711 | 711 | $datetime->save(); |
712 | 712 | } |
713 | 713 | } |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | * @return int |
722 | 722 | */ |
723 | 723 | function reserved() { |
724 | - return $this->get_raw( 'TKT_reserved' ); |
|
724 | + return $this->get_raw('TKT_reserved'); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | |
@@ -731,10 +731,10 @@ discard block |
||
731 | 731 | * @param int $reserved |
732 | 732 | * @return boolean |
733 | 733 | */ |
734 | - function set_reserved( $reserved ) { |
|
734 | + function set_reserved($reserved) { |
|
735 | 735 | // reserved can not go below zero |
736 | - $reserved = max( 0, intval( $reserved ) ); |
|
737 | - $this->set( 'TKT_reserved', $reserved ); |
|
736 | + $reserved = max(0, intval($reserved)); |
|
737 | + $this->set('TKT_reserved', $reserved); |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | |
@@ -744,9 +744,9 @@ discard block |
||
744 | 744 | * @param int $qty |
745 | 745 | * @return boolean |
746 | 746 | */ |
747 | - function increase_reserved( $qty = 1 ) { |
|
748 | - $reserved = $this->reserved() + absint( $qty ); |
|
749 | - return $this->set_reserved( $reserved ); |
|
747 | + function increase_reserved($qty = 1) { |
|
748 | + $reserved = $this->reserved() + absint($qty); |
|
749 | + return $this->set_reserved($reserved); |
|
750 | 750 | } |
751 | 751 | |
752 | 752 | |
@@ -756,9 +756,9 @@ discard block |
||
756 | 756 | * @param int $qty |
757 | 757 | * @return boolean |
758 | 758 | */ |
759 | - function decrease_reserved( $qty = 1 ) { |
|
760 | - $reserved = $this->reserved() - absint( $qty ); |
|
761 | - return $this->set_reserved( $reserved ); |
|
759 | + function decrease_reserved($qty = 1) { |
|
760 | + $reserved = $this->reserved() - absint($qty); |
|
761 | + return $this->set_reserved($reserved); |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | |
@@ -775,14 +775,14 @@ discard block |
||
775 | 775 | * |
776 | 776 | * @return int |
777 | 777 | */ |
778 | - function qty( $context = '' ) { |
|
779 | - switch ( $context ) { |
|
778 | + function qty($context = '') { |
|
779 | + switch ($context) { |
|
780 | 780 | case 'reg_limit' : |
781 | 781 | return $this->real_quantity_on_ticket(); |
782 | 782 | case 'saleable' : |
783 | - return $this->real_quantity_on_ticket( 'saleable' ); |
|
783 | + return $this->real_quantity_on_ticket('saleable'); |
|
784 | 784 | default: |
785 | - return $this->get_raw( 'TKT_qty' ); |
|
785 | + return $this->get_raw('TKT_qty'); |
|
786 | 786 | } |
787 | 787 | } |
788 | 788 | |
@@ -801,15 +801,15 @@ discard block |
||
801 | 801 | * |
802 | 802 | * @return int |
803 | 803 | */ |
804 | - function real_quantity_on_ticket( $context = 'reg_limit', $DTT_ID = 0 ) { |
|
805 | - $raw = $this->get_raw( 'TKT_qty' ); |
|
804 | + function real_quantity_on_ticket($context = 'reg_limit', $DTT_ID = 0) { |
|
805 | + $raw = $this->get_raw('TKT_qty'); |
|
806 | 806 | // return immediately if it's zero |
807 | - if ( $raw === 0 ) { |
|
807 | + if ($raw === 0) { |
|
808 | 808 | return $raw; |
809 | 809 | } |
810 | 810 | //echo "\nTicket: " . $this->name() . "\n"; |
811 | 811 | // ensure qty doesn't exceed raw value for THIS ticket |
812 | - $qty = min( EE_INF, $raw ); |
|
812 | + $qty = min(EE_INF, $raw); |
|
813 | 813 | //echo "\n qty: " . $qty . "\n"; |
814 | 814 | // calculate this ticket's total sales and reservations |
815 | 815 | $sold_and_reserved_for_this_ticket = $this->sold() + $this->reserved(); |
@@ -818,36 +818,36 @@ discard block |
||
818 | 818 | //echo "\n sold_and_reserved_for_this_ticket: " . $sold_and_reserved_for_this_ticket . "\n"; |
819 | 819 | // first we need to calculate the maximum number of tickets available for the datetime |
820 | 820 | // do we want data for one datetime or all of them ? |
821 | - $query_params = $DTT_ID ? array( array( 'DTT_ID' => $DTT_ID ) ) : array(); |
|
822 | - $datetimes = $this->datetimes( $query_params ); |
|
823 | - if ( is_array( $datetimes ) && ! empty( $datetimes ) ) { |
|
824 | - foreach ( $datetimes as $datetime ) { |
|
825 | - if ( $datetime instanceof EE_Datetime ) { |
|
821 | + $query_params = $DTT_ID ? array(array('DTT_ID' => $DTT_ID)) : array(); |
|
822 | + $datetimes = $this->datetimes($query_params); |
|
823 | + if (is_array($datetimes) && ! empty($datetimes)) { |
|
824 | + foreach ($datetimes as $datetime) { |
|
825 | + if ($datetime instanceof EE_Datetime) { |
|
826 | 826 | //echo "\n datetime name: " . $datetime->name() . "\n"; |
827 | 827 | // initialize with no restrictions for each datetime |
828 | 828 | // but adjust datetime qty based on datetime reg limit |
829 | - $datetime_qty = min( EE_INF, $datetime->reg_limit() ); |
|
829 | + $datetime_qty = min(EE_INF, $datetime->reg_limit()); |
|
830 | 830 | //echo "\n datetime reg_limit: " . $datetime->reg_limit() . "\n"; |
831 | 831 | //echo "\n datetime_qty: " . $datetime_qty . "\n"; |
832 | 832 | // if we want the actual saleable amount, then we need to consider OTHER ticket sales |
833 | 833 | // for this datetime, that do NOT include sales for this ticket (so we add $this->sold() back in) |
834 | - if ( $context == 'saleable' ) { |
|
835 | - $datetime_qty = max( $datetime_qty - $datetime->sold() + $this->sold(), 0 ); |
|
834 | + if ($context == 'saleable') { |
|
835 | + $datetime_qty = max($datetime_qty - $datetime->sold() + $this->sold(), 0); |
|
836 | 836 | //echo "\n datetime sold: " . $datetime->sold() . "\n"; |
837 | 837 | //echo "\n datetime_qty: " . $datetime_qty . "\n"; |
838 | 838 | $datetime_qty = ! $datetime->sold_out() ? $datetime_qty : 0; |
839 | 839 | //echo "\n datetime_qty: " . $datetime_qty . "\n"; |
840 | 840 | } |
841 | - $qty = min( $datetime_qty, $qty ); |
|
841 | + $qty = min($datetime_qty, $qty); |
|
842 | 842 | //echo "\n qty: " . $qty . "\n"; |
843 | 843 | } |
844 | 844 | } |
845 | 845 | } |
846 | 846 | // NOW that we know the maximum number of tickets available for the datetime |
847 | 847 | // we can finally factor in the details for this specific ticket |
848 | - if ( $qty > 0 && $context == 'saleable' ) { |
|
848 | + if ($qty > 0 && $context == 'saleable') { |
|
849 | 849 | // and subtract the sales for THIS ticket |
850 | - $qty = max( $qty - $sold_and_reserved_for_this_ticket, 0 ); |
|
850 | + $qty = max($qty - $sold_and_reserved_for_this_ticket, 0); |
|
851 | 851 | //echo "\n qty: " . $qty . "\n"; |
852 | 852 | } |
853 | 853 | //echo "\nFINAL QTY: " . $qty . "\n"; |
@@ -863,14 +863,14 @@ discard block |
||
863 | 863 | * @return bool |
864 | 864 | * @throws \EE_Error |
865 | 865 | */ |
866 | - function set_qty( $qty ) { |
|
866 | + function set_qty($qty) { |
|
867 | 867 | $datetimes = $this->datetimes(); |
868 | - foreach ( $datetimes as $datetime ) { |
|
869 | - if ( $datetime instanceof EE_Datetime ) { |
|
870 | - $qty = min( $qty, $datetime->reg_limit() ); |
|
868 | + foreach ($datetimes as $datetime) { |
|
869 | + if ($datetime instanceof EE_Datetime) { |
|
870 | + $qty = min($qty, $datetime->reg_limit()); |
|
871 | 871 | } |
872 | 872 | } |
873 | - $this->set( 'TKT_qty', $qty ); |
|
873 | + $this->set('TKT_qty', $qty); |
|
874 | 874 | } |
875 | 875 | |
876 | 876 | |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | * @return int |
881 | 881 | */ |
882 | 882 | function uses() { |
883 | - return $this->get( 'TKT_uses' ); |
|
883 | + return $this->get('TKT_uses'); |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | |
@@ -890,8 +890,8 @@ discard block |
||
890 | 890 | * @param int $uses |
891 | 891 | * @return boolean |
892 | 892 | */ |
893 | - function set_uses( $uses ) { |
|
894 | - $this->set( 'TKT_uses', $uses ); |
|
893 | + function set_uses($uses) { |
|
894 | + $this->set('TKT_uses', $uses); |
|
895 | 895 | } |
896 | 896 | |
897 | 897 | |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | * @return boolean |
902 | 902 | */ |
903 | 903 | public function required() { |
904 | - return $this->get( 'TKT_required' ); |
|
904 | + return $this->get('TKT_required'); |
|
905 | 905 | } |
906 | 906 | |
907 | 907 | |
@@ -911,8 +911,8 @@ discard block |
||
911 | 911 | * @param boolean $required |
912 | 912 | * @return boolean |
913 | 913 | */ |
914 | - public function set_required( $required ) { |
|
915 | - $this->set( 'TKT_required', $required ); |
|
914 | + public function set_required($required) { |
|
915 | + $this->set('TKT_required', $required); |
|
916 | 916 | } |
917 | 917 | |
918 | 918 | |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | * @return boolean |
923 | 923 | */ |
924 | 924 | function taxable() { |
925 | - return $this->get( 'TKT_taxable' ); |
|
925 | + return $this->get('TKT_taxable'); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | |
@@ -932,8 +932,8 @@ discard block |
||
932 | 932 | * @param boolean $taxable |
933 | 933 | * @return boolean |
934 | 934 | */ |
935 | - function set_taxable( $taxable ) { |
|
936 | - $this->set( 'TKT_taxable', $taxable ); |
|
935 | + function set_taxable($taxable) { |
|
936 | + $this->set('TKT_taxable', $taxable); |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | |
@@ -943,7 +943,7 @@ discard block |
||
943 | 943 | * @return boolean |
944 | 944 | */ |
945 | 945 | function is_default() { |
946 | - return $this->get( 'TKT_is_default' ); |
|
946 | + return $this->get('TKT_is_default'); |
|
947 | 947 | } |
948 | 948 | |
949 | 949 | |
@@ -953,8 +953,8 @@ discard block |
||
953 | 953 | * @param boolean $is_default |
954 | 954 | * @return boolean |
955 | 955 | */ |
956 | - function set_is_default( $is_default ) { |
|
957 | - $this->set( 'TKT_is_default', $is_default ); |
|
956 | + function set_is_default($is_default) { |
|
957 | + $this->set('TKT_is_default', $is_default); |
|
958 | 958 | } |
959 | 959 | |
960 | 960 | |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | * @return int |
965 | 965 | */ |
966 | 966 | function order() { |
967 | - return $this->get( 'TKT_order' ); |
|
967 | + return $this->get('TKT_order'); |
|
968 | 968 | } |
969 | 969 | |
970 | 970 | |
@@ -974,8 +974,8 @@ discard block |
||
974 | 974 | * @param int $order |
975 | 975 | * @return boolean |
976 | 976 | */ |
977 | - function set_order( $order ) { |
|
978 | - $this->set( 'TKT_order', $order ); |
|
977 | + function set_order($order) { |
|
978 | + $this->set('TKT_order', $order); |
|
979 | 979 | } |
980 | 980 | |
981 | 981 | |
@@ -985,7 +985,7 @@ discard block |
||
985 | 985 | * @return int |
986 | 986 | */ |
987 | 987 | function row() { |
988 | - return $this->get( 'TKT_row' ); |
|
988 | + return $this->get('TKT_row'); |
|
989 | 989 | } |
990 | 990 | |
991 | 991 | |
@@ -995,8 +995,8 @@ discard block |
||
995 | 995 | * @param int $row |
996 | 996 | * @return boolean |
997 | 997 | */ |
998 | - function set_row( $row ) { |
|
999 | - $this->set( 'TKT_row', $row ); |
|
998 | + function set_row($row) { |
|
999 | + $this->set('TKT_row', $row); |
|
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | * @return boolean |
1007 | 1007 | */ |
1008 | 1008 | function deleted() { |
1009 | - return $this->get( 'TKT_deleted' ); |
|
1009 | + return $this->get('TKT_deleted'); |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | |
@@ -1016,8 +1016,8 @@ discard block |
||
1016 | 1016 | * @param boolean $deleted |
1017 | 1017 | * @return boolean |
1018 | 1018 | */ |
1019 | - function set_deleted( $deleted ) { |
|
1020 | - $this->set( 'TKT_deleted', $deleted ); |
|
1019 | + function set_deleted($deleted) { |
|
1020 | + $this->set('TKT_deleted', $deleted); |
|
1021 | 1021 | } |
1022 | 1022 | |
1023 | 1023 | |
@@ -1027,7 +1027,7 @@ discard block |
||
1027 | 1027 | * @return int |
1028 | 1028 | */ |
1029 | 1029 | function parent_ID() { |
1030 | - return $this->get( 'TKT_parent' ); |
|
1030 | + return $this->get('TKT_parent'); |
|
1031 | 1031 | } |
1032 | 1032 | |
1033 | 1033 | |
@@ -1037,8 +1037,8 @@ discard block |
||
1037 | 1037 | * @param int $parent |
1038 | 1038 | * @return boolean |
1039 | 1039 | */ |
1040 | - function set_parent_ID( $parent ) { |
|
1041 | - $this->set( 'TKT_parent', $parent ); |
|
1040 | + function set_parent_ID($parent) { |
|
1041 | + $this->set('TKT_parent', $parent); |
|
1042 | 1042 | } |
1043 | 1043 | |
1044 | 1044 | |
@@ -1049,10 +1049,10 @@ discard block |
||
1049 | 1049 | */ |
1050 | 1050 | function name_and_info() { |
1051 | 1051 | $times = array(); |
1052 | - foreach ( $this->datetimes() as $datetime ) { |
|
1052 | + foreach ($this->datetimes() as $datetime) { |
|
1053 | 1053 | $times[] = $datetime->start_date_and_time(); |
1054 | 1054 | } |
1055 | - return $this->name() . " @ " . implode( ", ", $times ) . " for " . $this->price(); |
|
1055 | + return $this->name()." @ ".implode(", ", $times)." for ".$this->price(); |
|
1056 | 1056 | } |
1057 | 1057 | |
1058 | 1058 | |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | * @return string |
1063 | 1063 | */ |
1064 | 1064 | function name() { |
1065 | - return $this->get( 'TKT_name' ); |
|
1065 | + return $this->get('TKT_name'); |
|
1066 | 1066 | } |
1067 | 1067 | |
1068 | 1068 | |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | * @return float |
1073 | 1073 | */ |
1074 | 1074 | function price() { |
1075 | - return $this->get( 'TKT_price' ); |
|
1075 | + return $this->get('TKT_price'); |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | |
@@ -1082,8 +1082,8 @@ discard block |
||
1082 | 1082 | * @param array $query_params like EEM_Base::get_all's |
1083 | 1083 | * @return EE_Registration[] |
1084 | 1084 | */ |
1085 | - public function registrations( $query_params = array() ) { |
|
1086 | - return $this->get_many_related( 'Registration', $query_params ); |
|
1085 | + public function registrations($query_params = array()) { |
|
1086 | + return $this->get_many_related('Registration', $query_params); |
|
1087 | 1087 | } |
1088 | 1088 | |
1089 | 1089 | |
@@ -1094,8 +1094,8 @@ discard block |
||
1094 | 1094 | * @return int |
1095 | 1095 | */ |
1096 | 1096 | public function update_tickets_sold() { |
1097 | - $count_regs_for_this_ticket = $this->count_registrations( array( array( 'STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0 ) ) ); |
|
1098 | - $this->set_sold( $count_regs_for_this_ticket ); |
|
1097 | + $count_regs_for_this_ticket = $this->count_registrations(array(array('STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0))); |
|
1098 | + $this->set_sold($count_regs_for_this_ticket); |
|
1099 | 1099 | $this->save(); |
1100 | 1100 | return $count_regs_for_this_ticket; |
1101 | 1101 | } |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | * @param array $query_params like EEM_Base::get_all's |
1108 | 1108 | * @return int |
1109 | 1109 | */ |
1110 | - public function count_registrations( $query_params = array() ) { |
|
1110 | + public function count_registrations($query_params = array()) { |
|
1111 | 1111 | return $this->count_related('Registration', $query_params); |
1112 | 1112 | } |
1113 | 1113 | |
@@ -1132,7 +1132,7 @@ discard block |
||
1132 | 1132 | public function get_related_event() { |
1133 | 1133 | //get one datetime to use for getting the event |
1134 | 1134 | $datetime = $this->first_datetime(); |
1135 | - if ( $datetime instanceof EE_Datetime ) { |
|
1135 | + if ($datetime instanceof EE_Datetime) { |
|
1136 | 1136 | return $datetime->event(); |
1137 | 1137 | } |
1138 | 1138 | return null; |