@@ -43,10 +43,10 @@ |
||
43 | 43 | * @param string $update_text |
44 | 44 | * @param array $extra_data |
45 | 45 | */ |
46 | - public function __construct(JobParameters $job_parameters, $update_text, $extra_data = array() ) { |
|
47 | - $this->_job_parameters = $job_parameters; |
|
46 | + public function __construct(JobParameters $job_parameters, $update_text, $extra_data = array()) { |
|
47 | + $this->_job_parameters = $job_parameters; |
|
48 | 48 | $this->_update_text = $update_text; |
49 | - $this->_extra_data = (array)$extra_data; |
|
49 | + $this->_extra_data = (array) $extra_data; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | use EventEspressoBatchRequest\Helpers\JobParameters; |
21 | 21 | use EventEspressoBatchRequest\Helpers\JobStepResponse; |
22 | 22 | |
23 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
24 | - exit( 'No direct script access allowed' ); |
|
23 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
24 | + exit('No direct script access allowed'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @throws BatchRequestException |
36 | 36 | * @return JobStepResponse |
37 | 37 | */ |
38 | - public function create_job( JobParameters $job_parameters ); |
|
38 | + public function create_job(JobParameters $job_parameters); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Performs another step of the job |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @return JobStepResponse |
45 | 45 | * @throws BatchRequestException |
46 | 46 | */ |
47 | - public function continue_job( JobParameters $job_parameters, $batch_size = 50 ); |
|
47 | + public function continue_job(JobParameters $job_parameters, $batch_size = 50); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Performs any clean-up logic when we know the job is completed |
@@ -52,5 +52,5 @@ discard block |
||
52 | 52 | * @return JobStepResponse |
53 | 53 | * @throws BatchRequestException |
54 | 54 | */ |
55 | - public function cleanup_job( JobParameters $job_parameters ); |
|
55 | + public function cleanup_job(JobParameters $job_parameters); |
|
56 | 56 | } |
@@ -99,10 +99,10 @@ |
||
99 | 99 | if( $field_name == 'STA_ID' ){ |
100 | 100 | $state_name_field = \EEM_State::instance()->field_settings_for( 'STA_name' ); |
101 | 101 | $csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ]; |
102 | - }elseif( $field_name == 'CNT_ISO' ){ |
|
102 | + } elseif( $field_name == 'CNT_ISO' ){ |
|
103 | 103 | $country_name_field = \EEM_Country::instance()->field_settings_for( 'CNT_name' ); |
104 | 104 | $csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ]; |
105 | - }else{ |
|
105 | + } else{ |
|
106 | 106 | $csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ]; |
107 | 107 | } |
108 | 108 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use EventEspressoBatchRequest\Helpers\JobParameters; |
19 | 19 | use EventEspressoBatchRequest\Helpers\JobStepResponse; |
20 | 20 | |
21 | -if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
21 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
22 | 22 | exit('No direct script access allowed'); |
23 | 23 | } |
24 | 24 | |
@@ -27,84 +27,84 @@ discard block |
||
27 | 27 | |
28 | 28 | |
29 | 29 | public function create_job(JobParameters $job_parameters) { |
30 | - if( ! \EE_Capabilities::instance()->current_user_can( 'ee_read_contacts', 'generating_report' ) ) { |
|
30 | + if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_contacts', 'generating_report')) { |
|
31 | 31 | throw new BatchRequestException( |
32 | - __( 'You do not have permission to view contacts', 'event_espresso') |
|
32 | + __('You do not have permission to view contacts', 'event_espresso') |
|
33 | 33 | ); |
34 | 34 | } |
35 | 35 | $filepath = $this->create_file_from_job_with_name( |
36 | 36 | $job_parameters->job_id(), |
37 | 37 | __('contact-list-report.csv', 'event_espresso') |
38 | 38 | ); |
39 | - $job_parameters->add_extra_data( 'filepath', $filepath ); |
|
40 | - $job_parameters->set_job_size( $this->count_units_to_process() ); |
|
39 | + $job_parameters->add_extra_data('filepath', $filepath); |
|
40 | + $job_parameters->set_job_size($this->count_units_to_process()); |
|
41 | 41 | //we should also set the header columns |
42 | - $csv_data_for_row = $this->get_csv_data( 0, 1 ); |
|
43 | - \EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true ); |
|
42 | + $csv_data_for_row = $this->get_csv_data(0, 1); |
|
43 | + \EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true); |
|
44 | 44 | //if we actually processed a row there, record it |
45 | - if( $job_parameters->job_size() ) { |
|
46 | - $job_parameters->mark_processed( 1 ); |
|
45 | + if ($job_parameters->job_size()) { |
|
46 | + $job_parameters->mark_processed(1); |
|
47 | 47 | } |
48 | 48 | return new JobStepResponse( |
49 | 49 | $job_parameters, |
50 | - __( 'Contacts report started successfully...', 'event_espresso' ) |
|
50 | + __('Contacts report started successfully...', 'event_espresso') |
|
51 | 51 | ); |
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | public function continue_job(JobParameters $job_parameters, $batch_size = 50) { |
56 | - $csv_data = $this->get_csv_data( $job_parameters->units_processed(), $batch_size ); |
|
57 | - \EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false ); |
|
58 | - $units_processed = count( $csv_data ); |
|
59 | - $job_parameters->mark_processed( $units_processed ); |
|
56 | + $csv_data = $this->get_csv_data($job_parameters->units_processed(), $batch_size); |
|
57 | + \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false); |
|
58 | + $units_processed = count($csv_data); |
|
59 | + $job_parameters->mark_processed($units_processed); |
|
60 | 60 | $extra_response_data = array( |
61 | 61 | 'file_url' => '' |
62 | 62 | ); |
63 | - if( $units_processed < $batch_size ) { |
|
64 | - $job_parameters->set_status( JobParameters::status_complete ); |
|
65 | - $extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) ); |
|
63 | + if ($units_processed < $batch_size) { |
|
64 | + $job_parameters->set_status(JobParameters::status_complete); |
|
65 | + $extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath')); |
|
66 | 66 | } |
67 | 67 | return new JobStepResponse( |
68 | 68 | $job_parameters, |
69 | 69 | sprintf( |
70 | - __( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ), |
|
71 | - count( $csv_data ) ), |
|
70 | + __('Wrote %1$s rows to report CSV file...', 'event_espresso'), |
|
71 | + count($csv_data) ), |
|
72 | 72 | $extra_response_data ); |
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | 76 | public function cleanup_job(JobParameters $job_parameters) { |
77 | 77 | $this->_file_helper->delete( |
78 | - \EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ), |
|
78 | + \EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')), |
|
79 | 79 | true, |
80 | 80 | 'd' |
81 | 81 | ); |
82 | - return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) ); |
|
82 | + return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso')); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | public function count_units_to_process() { |
86 | - return \EEM_Attendee::instance()->count( array( 'caps' => \EEM_Base::caps_read_admin )); |
|
86 | + return \EEM_Attendee::instance()->count(array('caps' => \EEM_Base::caps_read_admin)); |
|
87 | 87 | } |
88 | - public function get_csv_data( $offset, $limit ) { |
|
88 | + public function get_csv_data($offset, $limit) { |
|
89 | 89 | $attendee_rows = \EEM_Attendee::instance()->get_all_wpdb_results( |
90 | 90 | array( |
91 | - 'limit' => array( $offset, $limit ), |
|
92 | - 'force_join' => array( 'State', 'Country' ), |
|
91 | + 'limit' => array($offset, $limit), |
|
92 | + 'force_join' => array('State', 'Country'), |
|
93 | 93 | 'caps' => \EEM_Base::caps_read_admin |
94 | 94 | ) |
95 | 95 | ); |
96 | 96 | $csv_data = array(); |
97 | - foreach( $attendee_rows as $attendee_row ){ |
|
97 | + foreach ($attendee_rows as $attendee_row) { |
|
98 | 98 | $csv_row = array(); |
99 | - foreach( \EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){ |
|
100 | - if( $field_name == 'STA_ID' ){ |
|
101 | - $state_name_field = \EEM_State::instance()->field_settings_for( 'STA_name' ); |
|
102 | - $csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ]; |
|
103 | - }elseif( $field_name == 'CNT_ISO' ){ |
|
104 | - $country_name_field = \EEM_Country::instance()->field_settings_for( 'CNT_name' ); |
|
105 | - $csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ]; |
|
106 | - }else{ |
|
107 | - $csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ]; |
|
99 | + foreach (\EEM_Attendee::instance()->field_settings() as $field_name => $field_obj) { |
|
100 | + if ($field_name == 'STA_ID') { |
|
101 | + $state_name_field = \EEM_State::instance()->field_settings_for('STA_name'); |
|
102 | + $csv_row[__('State', 'event_espresso')] = $attendee_row[$state_name_field->get_qualified_column()]; |
|
103 | + }elseif ($field_name == 'CNT_ISO') { |
|
104 | + $country_name_field = \EEM_Country::instance()->field_settings_for('CNT_name'); |
|
105 | + $csv_row[__('Country', 'event_espresso')] = $attendee_row[$country_name_field->get_qualified_column()]; |
|
106 | + } else { |
|
107 | + $csv_row[$field_obj->get_nicename()] = $attendee_row[$field_obj->get_qualified_column()]; |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | $csv_data[] = $csv_row; |
@@ -85,6 +85,11 @@ |
||
85 | 85 | public function count_units_to_process() { |
86 | 86 | return \EEM_Attendee::instance()->count( array( 'caps' => \EEM_Base::caps_read_admin )); |
87 | 87 | } |
88 | + |
|
89 | + /** |
|
90 | + * @param integer $offset |
|
91 | + * @param integer $limit |
|
92 | + */ |
|
88 | 93 | public function get_csv_data( $offset, $limit ) { |
89 | 94 | $attendee_rows = \EEM_Attendee::instance()->get_all_wpdb_results( |
90 | 95 | array( |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | if( ! $event_slug ) { |
76 | 76 | $event_slug = __( 'unknown', 'event_espresso' ); |
77 | 77 | } |
78 | - }else{ |
|
78 | + } else{ |
|
79 | 79 | $event_slug = __( 'all', 'event_espresso' ); |
80 | 80 | } |
81 | 81 | return sprintf( "registrations-for-%s.csv", $event_slug ); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | ); |
163 | 163 | if( $event_id ){ |
164 | 164 | $query_params[0]['EVT_ID'] = $event_id; |
165 | - }else{ |
|
165 | + } else{ |
|
166 | 166 | $query_params[ 'force_join' ][] = 'Event'; |
167 | 167 | } |
168 | 168 | $registration_rows = $reg_model->get_all_wpdb_results( $query_params ); |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | $field = $reg_model->field_settings_for($field_name); |
192 | 192 | if($field_name == 'REG_final_price'){ |
193 | 193 | $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' ); |
194 | - }elseif( $field_name == 'REG_count' ){ |
|
194 | + } elseif( $field_name == 'REG_count' ){ |
|
195 | 195 | $value = sprintf( __( '%s of %s', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_count', $reg_row['Registration.REG_count'] ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size' ] ) ); |
196 | - }elseif( $field_name == 'REG_date' ) { |
|
196 | + } elseif( $field_name == 'REG_date' ) { |
|
197 | 197 | $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' ); |
198 | - }else{ |
|
198 | + } else{ |
|
199 | 199 | $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] ); |
200 | 200 | } |
201 | 201 | $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value; |
@@ -267,12 +267,12 @@ discard block |
||
267 | 267 | if( $reg_row[ 'Attendee_CPT.ID' ]){ |
268 | 268 | if($att_field_name == 'STA_ID'){ |
269 | 269 | $value = \EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' ); |
270 | - }elseif($att_field_name == 'CNT_ISO'){ |
|
270 | + } elseif($att_field_name == 'CNT_ISO'){ |
|
271 | 271 | $value = \EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' ); |
272 | - }else{ |
|
272 | + } else{ |
|
273 | 273 | $value = \EEH_Export::prepare_value_from_db_for_display( \EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] ); |
274 | 274 | } |
275 | - }else{ |
|
275 | + } else{ |
|
276 | 276 | $value = ''; |
277 | 277 | } |
278 | 278 |
@@ -410,7 +410,7 @@ |
||
410 | 410 | * Performs any clean-up logic when we know the job is completed. |
411 | 411 | * In this case, we delete the temporary file |
412 | 412 | * @param JobParameters $job_parameters |
413 | - * @return boolean |
|
413 | + * @return JobStepResponse |
|
414 | 414 | */ |
415 | 415 | public function cleanup_job( JobParameters $job_parameters ){ |
416 | 416 | $this->_file_helper->delete( |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | use EventEspressoBatchRequest\Helpers\JobParameters; |
20 | 20 | use EventEspressoBatchRequest\Helpers\JobStepResponse; |
21 | 21 | |
22 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
23 | - exit( 'No direct script access allowed' ); |
|
22 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
23 | + exit('No direct script access allowed'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -35,35 +35,35 @@ discard block |
||
35 | 35 | * @throws BatchRequestException |
36 | 36 | * @return JobStepResponse |
37 | 37 | */ |
38 | - public function create_job( JobParameters $job_parameters ) { |
|
39 | - $event_id = intval( $job_parameters->request_datum( 'EVT_ID', '0' ) ); |
|
40 | - if( ! \EE_Capabilities::instance()->current_user_can( 'ee_read_registrations', 'generating_report' ) ) { |
|
38 | + public function create_job(JobParameters $job_parameters) { |
|
39 | + $event_id = intval($job_parameters->request_datum('EVT_ID', '0')); |
|
40 | + if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_registrations', 'generating_report')) { |
|
41 | 41 | throw new BatchRequestException( |
42 | - __( 'You do not have permission to view registrations', 'event_espresso') |
|
42 | + __('You do not have permission to view registrations', 'event_espresso') |
|
43 | 43 | ); |
44 | 44 | } |
45 | 45 | $filepath = $this->create_file_from_job_with_name( |
46 | 46 | $job_parameters->job_id(), |
47 | - $this->get_filename_from_event( $event_id ) |
|
47 | + $this->get_filename_from_event($event_id) |
|
48 | 48 | ); |
49 | - $job_parameters->add_extra_data( 'filepath', $filepath ); |
|
50 | - $question_data_for_columns = $this->_get_questions_for_report( $event_id ); |
|
51 | - $job_parameters->add_extra_data( 'questions_data', $question_data_for_columns ); |
|
52 | - $job_parameters->set_job_size( $this->count_units_to_process( $event_id ) ); |
|
49 | + $job_parameters->add_extra_data('filepath', $filepath); |
|
50 | + $question_data_for_columns = $this->_get_questions_for_report($event_id); |
|
51 | + $job_parameters->add_extra_data('questions_data', $question_data_for_columns); |
|
52 | + $job_parameters->set_job_size($this->count_units_to_process($event_id)); |
|
53 | 53 | //we should also set the header columns |
54 | 54 | $csv_data_for_row = $this->get_csv_data_for( |
55 | 55 | $event_id, |
56 | 56 | 0, |
57 | 57 | 1, |
58 | - $job_parameters->extra_datum( 'questions_data' ) ); |
|
59 | - \EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true ); |
|
58 | + $job_parameters->extra_datum('questions_data') ); |
|
59 | + \EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true); |
|
60 | 60 | //if we actually processed a row there, record it |
61 | - if( $job_parameters->job_size() ) { |
|
62 | - $job_parameters->mark_processed( 1 ); |
|
61 | + if ($job_parameters->job_size()) { |
|
62 | + $job_parameters->mark_processed(1); |
|
63 | 63 | } |
64 | 64 | return new JobStepResponse( |
65 | 65 | $job_parameters, |
66 | - __( 'Registrations report started successfully...', 'event_espresso' ) |
|
66 | + __('Registrations report started successfully...', 'event_espresso') |
|
67 | 67 | ); |
68 | 68 | } |
69 | 69 | |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | * @param int $event_id |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - protected function get_filename_from_event( $event_id ) { |
|
78 | - if( $event_id ){ |
|
79 | - $event_slug = \EEM_Event::instance()->get_var( array( array( 'EVT_ID' => $event_id ) ), 'EVT_slug' ); |
|
80 | - if( ! $event_slug ) { |
|
81 | - $event_slug = __( 'unknown', 'event_espresso' ); |
|
77 | + protected function get_filename_from_event($event_id) { |
|
78 | + if ($event_id) { |
|
79 | + $event_slug = \EEM_Event::instance()->get_var(array(array('EVT_ID' => $event_id)), 'EVT_slug'); |
|
80 | + if ( ! $event_slug) { |
|
81 | + $event_slug = __('unknown', 'event_espresso'); |
|
82 | 82 | } |
83 | - }else{ |
|
84 | - $event_slug = __( 'all', 'event_espresso' ); |
|
83 | + } else { |
|
84 | + $event_slug = __('all', 'event_espresso'); |
|
85 | 85 | } |
86 | - return sprintf( "registrations-for-%s.csv", $event_slug ); |
|
86 | + return sprintf("registrations-for-%s.csv", $event_slug); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -92,17 +92,17 @@ discard block |
||
92 | 92 | * @param int|null $event_id |
93 | 93 | * @return array of wpdb results for questions which are to be used for this report |
94 | 94 | */ |
95 | - protected function _get_questions_for_report( $event_id ) { |
|
95 | + protected function _get_questions_for_report($event_id) { |
|
96 | 96 | $question_query_params = array( |
97 | 97 | array( |
98 | - 'Answer.ANS_ID' => array( 'IS_NOT_NULL' ), |
|
98 | + 'Answer.ANS_ID' => array('IS_NOT_NULL'), |
|
99 | 99 | ), |
100 | - 'group_by' => array( 'QST_ID' ) |
|
100 | + 'group_by' => array('QST_ID') |
|
101 | 101 | ); |
102 | - if( $event_id ) { |
|
102 | + if ($event_id) { |
|
103 | 103 | $question_query_params[0]['Answer.Registration.EVT_ID'] = $event_id; |
104 | 104 | } |
105 | - return \EEM_Question::instance()->get_all_wpdb_results( $question_query_params ); |
|
105 | + return \EEM_Question::instance()->get_all_wpdb_results($question_query_params); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -115,27 +115,27 @@ discard block |
||
115 | 115 | * @return JobStepResponse |
116 | 116 | * @throws \EE_Error |
117 | 117 | */ |
118 | - public function continue_job( JobParameters $job_parameters, $batch_size = 50 ) { |
|
118 | + public function continue_job(JobParameters $job_parameters, $batch_size = 50) { |
|
119 | 119 | $csv_data = $this->get_csv_data_for( |
120 | - $job_parameters->request_datum( 'EVT_ID', '0'), |
|
120 | + $job_parameters->request_datum('EVT_ID', '0'), |
|
121 | 121 | $job_parameters->units_processed(), |
122 | 122 | $batch_size, |
123 | - $job_parameters->extra_datum( 'questions_data' ) ); |
|
124 | - \EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false ); |
|
125 | - $units_processed = count( $csv_data ); |
|
126 | - $job_parameters->mark_processed( $units_processed ); |
|
123 | + $job_parameters->extra_datum('questions_data') ); |
|
124 | + \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false); |
|
125 | + $units_processed = count($csv_data); |
|
126 | + $job_parameters->mark_processed($units_processed); |
|
127 | 127 | $extra_response_data = array( |
128 | 128 | 'file_url' => '' |
129 | 129 | ); |
130 | - if( $units_processed < $batch_size ) { |
|
131 | - $job_parameters->set_status( JobParameters::status_complete ); |
|
132 | - $extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) ); |
|
130 | + if ($units_processed < $batch_size) { |
|
131 | + $job_parameters->set_status(JobParameters::status_complete); |
|
132 | + $extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath')); |
|
133 | 133 | } |
134 | 134 | return new JobStepResponse( |
135 | 135 | $job_parameters, |
136 | 136 | sprintf( |
137 | - __( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ), |
|
138 | - count( $csv_data ) ), |
|
137 | + __('Wrote %1$s rows to report CSV file...', 'event_espresso'), |
|
138 | + count($csv_data) ), |
|
139 | 139 | $extra_response_data ); |
140 | 140 | } |
141 | 141 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @return array top-level keys are numeric, next-level keys are column headers |
149 | 149 | * |
150 | 150 | */ |
151 | - function get_csv_data_for( $event_id, $offset, $limit, $questions_for_these_regs_rows ) { |
|
151 | + function get_csv_data_for($event_id, $offset, $limit, $questions_for_these_regs_rows) { |
|
152 | 152 | $reg_fields_to_include = array( |
153 | 153 | 'TXN_ID', |
154 | 154 | 'ATT_ID', |
@@ -179,166 +179,166 @@ discard block |
||
179 | 179 | array( |
180 | 180 | 'OR' => array( |
181 | 181 | //don't include registrations from failed or abandoned transactions... |
182 | - 'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ), |
|
182 | + 'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)), |
|
183 | 183 | //unless the registration is approved, in which case include it regardless of transaction status |
184 | 184 | 'STS_ID' => \EEM_Registration::status_id_approved |
185 | 185 | ), |
186 | - 'Ticket.TKT_deleted' => array( 'IN', array( true, false ) ) |
|
186 | + 'Ticket.TKT_deleted' => array('IN', array(true, false)) |
|
187 | 187 | ), |
188 | - 'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'), |
|
189 | - 'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ), |
|
190 | - 'limit' => array( $offset, $limit ), |
|
188 | + 'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'), |
|
189 | + 'force_join' => array('Transaction', 'Ticket', 'Attendee'), |
|
190 | + 'limit' => array($offset, $limit), |
|
191 | 191 | 'caps' => \EEM_Base::caps_read_admin |
192 | 192 | ), |
193 | 193 | $event_id |
194 | 194 | ); |
195 | - if( $event_id ){ |
|
196 | - $query_params[0]['EVT_ID'] = $event_id; |
|
197 | - }else{ |
|
198 | - $query_params[ 'force_join' ][] = 'Event'; |
|
195 | + if ($event_id) { |
|
196 | + $query_params[0]['EVT_ID'] = $event_id; |
|
197 | + } else { |
|
198 | + $query_params['force_join'][] = 'Event'; |
|
199 | 199 | } |
200 | - $registration_rows = $reg_model->get_all_wpdb_results( $query_params ); |
|
200 | + $registration_rows = $reg_model->get_all_wpdb_results($query_params); |
|
201 | 201 | //get all questions which relate to someone in this group |
202 | 202 | $registration_ids = array(); |
203 | - foreach( $registration_rows as $reg_row ) { |
|
204 | - $registration_ids[] = intval( $reg_row[ 'Registration.REG_ID'] ); |
|
203 | + foreach ($registration_rows as $reg_row) { |
|
204 | + $registration_ids[] = intval($reg_row['Registration.REG_ID']); |
|
205 | 205 | } |
206 | 206 | |
207 | - foreach($registration_rows as $reg_row){ |
|
208 | - if ( is_array( $reg_row ) ) { |
|
207 | + foreach ($registration_rows as $reg_row) { |
|
208 | + if (is_array($reg_row)) { |
|
209 | 209 | $reg_csv_array = array(); |
210 | - if( ! $event_id ){ |
|
210 | + if ( ! $event_id) { |
|
211 | 211 | //get the event's name and Id |
212 | - $reg_csv_array[ __( 'Event', 'event_espresso' ) ] = sprintf( __( '%1$s (%2$s)', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( \EEM_Event::instance(), 'EVT_name', $reg_row[ 'Event_CPT.post_title'] ), $reg_row[ 'Event_CPT.ID' ] ); |
|
212 | + $reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'), \EEH_Export::prepare_value_from_db_for_display(\EEM_Event::instance(), 'EVT_name', $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']); |
|
213 | 213 | } |
214 | - $is_primary_reg = $reg_row[ 'Registration.REG_count' ] == '1' ? true : false; |
|
214 | + $is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false; |
|
215 | 215 | /*@var $reg_row EE_Registration */ |
216 | - foreach($reg_fields_to_include as $field_name){ |
|
216 | + foreach ($reg_fields_to_include as $field_name) { |
|
217 | 217 | $field = $reg_model->field_settings_for($field_name); |
218 | - if($field_name == 'REG_final_price'){ |
|
219 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' ); |
|
220 | - }elseif( $field_name == 'REG_count' ){ |
|
221 | - $value = sprintf( __( '%s of %s', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_count', $reg_row['Registration.REG_count'] ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size' ] ) ); |
|
222 | - }elseif( $field_name == 'REG_date' ) { |
|
223 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' ); |
|
224 | - }else{ |
|
225 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] ); |
|
218 | + if ($field_name == 'REG_final_price') { |
|
219 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_final_price'], 'localized_float'); |
|
220 | + }elseif ($field_name == 'REG_count') { |
|
221 | + $value = sprintf(__('%s of %s', 'event_espresso'), \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_count', $reg_row['Registration.REG_count']), \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size'])); |
|
222 | + }elseif ($field_name == 'REG_date') { |
|
223 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_date'], 'no_html'); |
|
224 | + } else { |
|
225 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row[$field->get_qualified_column()]); |
|
226 | 226 | } |
227 | 227 | $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value; |
228 | - if($field_name == 'REG_final_price'){ |
|
228 | + if ($field_name == 'REG_final_price') { |
|
229 | 229 | //add a column named Currency after the final price |
230 | 230 | $reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code; |
231 | 231 | } |
232 | 232 | } |
233 | 233 | //get pretty status |
234 | - $stati = \EEM_Status::instance()->localized_status( array( |
|
235 | - $reg_row[ 'Registration.STS_ID' ] => __( 'unknown', 'event_espresso' ), |
|
236 | - $reg_row[ 'TransactionTable.STS_ID' ] => __( 'unknown', 'event_espresso' ) ), |
|
234 | + $stati = \EEM_Status::instance()->localized_status(array( |
|
235 | + $reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'), |
|
236 | + $reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso') ), |
|
237 | 237 | FALSE, |
238 | - 'sentence' ); |
|
239 | - $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[ $reg_row[ 'Registration.STS_ID' ] ]; |
|
238 | + 'sentence'); |
|
239 | + $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']]; |
|
240 | 240 | //get pretty transaction status |
241 | - $reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[ $reg_row[ 'TransactionTable.STS_ID' ] ]; |
|
242 | - $reg_csv_array[ __( 'Transaction Amount Due', 'event_espresso' ) ] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display( \EEM_Transaction::instance(), 'TXN_total', $reg_row[ 'TransactionTable.TXN_total' ], 'localized_float' ) : '0.00'; |
|
243 | - $reg_csv_array[ __( 'Amount Paid', 'event_espresso' )] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display( \EEM_Transaction::instance(), 'TXN_paid', $reg_row[ 'TransactionTable.TXN_paid' ], 'localized_float' ) : '0.00'; |
|
241 | + $reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']]; |
|
242 | + $reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total', $reg_row['TransactionTable.TXN_total'], 'localized_float') : '0.00'; |
|
243 | + $reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid', $reg_row['TransactionTable.TXN_paid'], 'localized_float') : '0.00'; |
|
244 | 244 | $payment_methods = array(); |
245 | 245 | $gateway_txn_ids_etc = array(); |
246 | 246 | $payment_times = array(); |
247 | - if( $is_primary_reg && $reg_row[ 'TransactionTable.TXN_ID' ] ){ |
|
247 | + if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) { |
|
248 | 248 | $payments_info = \EEM_Payment::instance()->get_all_wpdb_results( |
249 | 249 | array( |
250 | 250 | array( |
251 | - 'TXN_ID' => $reg_row[ 'TransactionTable.TXN_ID' ], |
|
251 | + 'TXN_ID' => $reg_row['TransactionTable.TXN_ID'], |
|
252 | 252 | 'STS_ID' => \EEM_Payment::status_id_approved |
253 | 253 | ), |
254 | - 'force_join' => array( 'Payment_Method' ), |
|
254 | + 'force_join' => array('Payment_Method'), |
|
255 | 255 | |
256 | 256 | ), |
257 | 257 | ARRAY_A, |
258 | 258 | 'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' ); |
259 | 259 | |
260 | - foreach( $payments_info as $payment_method_and_gateway_txn_id ){ |
|
261 | - $payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' ); |
|
262 | - $gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : ''; |
|
263 | - $payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : ''; |
|
260 | + foreach ($payments_info as $payment_method_and_gateway_txn_id) { |
|
261 | + $payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso'); |
|
262 | + $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : ''; |
|
263 | + $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) ? $payment_method_and_gateway_txn_id['payment_time'] : ''; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | } |
267 | - $reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times ); |
|
268 | - $reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods ); |
|
269 | - $reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc ); |
|
267 | + $reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times); |
|
268 | + $reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods); |
|
269 | + $reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc); |
|
270 | 270 | |
271 | 271 | //get whether or not the user has checked in |
272 | - $reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related( $reg_row[ 'Registration.REG_ID'] , 'Checkin' ); |
|
272 | + $reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin'); |
|
273 | 273 | //get ticket of registration and its price |
274 | 274 | $ticket_model = \EE_Registry::instance()->load_model('Ticket'); |
275 | - if( $reg_row[ 'Ticket.TKT_ID'] ) { |
|
276 | - $ticket_name = \EEH_Export::prepare_value_from_db_for_display( $ticket_model, 'TKT_name', $reg_row[ 'Ticket.TKT_name' ] ); |
|
275 | + if ($reg_row['Ticket.TKT_ID']) { |
|
276 | + $ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name', $reg_row['Ticket.TKT_name']); |
|
277 | 277 | $datetimes_strings = array(); |
278 | - foreach( \EEM_Datetime::instance()->get_all_wpdb_results( array( array( 'Ticket.TKT_ID' => $reg_row[ 'Ticket.TKT_ID' ] ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ), 'default_where_conditions' => 'none' ) ) as $datetime){ |
|
279 | - $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display( \EEM_Datetime::instance(), 'DTT_EVT_start', $datetime[ 'Datetime.DTT_EVT_start'] ); |
|
278 | + foreach (\EEM_Datetime::instance()->get_all_wpdb_results(array(array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']), 'order_by' => array('DTT_EVT_start' => 'ASC'), 'default_where_conditions' => 'none')) as $datetime) { |
|
279 | + $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(), 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | } else { |
283 | - $ticket_name = __( 'Unknown', 'event_espresso' ); |
|
284 | - $datetimes_strings = array( __( 'Unknown', 'event_espresso' ) ); |
|
283 | + $ticket_name = __('Unknown', 'event_espresso'); |
|
284 | + $datetimes_strings = array(__('Unknown', 'event_espresso')); |
|
285 | 285 | } |
286 | 286 | $reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name; |
287 | 287 | $reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings); |
288 | 288 | //get datetime(s) of registration |
289 | 289 | |
290 | 290 | //add attendee columns |
291 | - foreach($att_fields_to_include as $att_field_name){ |
|
291 | + foreach ($att_fields_to_include as $att_field_name) { |
|
292 | 292 | $field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name); |
293 | - if( $reg_row[ 'Attendee_CPT.ID' ]){ |
|
294 | - if($att_field_name == 'STA_ID'){ |
|
295 | - $value = \EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' ); |
|
296 | - }elseif($att_field_name == 'CNT_ISO'){ |
|
297 | - $value = \EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' ); |
|
298 | - }else{ |
|
299 | - $value = \EEH_Export::prepare_value_from_db_for_display( \EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] ); |
|
293 | + if ($reg_row['Attendee_CPT.ID']) { |
|
294 | + if ($att_field_name == 'STA_ID') { |
|
295 | + $value = \EEM_State::instance()->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), 'STA_name'); |
|
296 | + }elseif ($att_field_name == 'CNT_ISO') { |
|
297 | + $value = \EEM_Country::instance()->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), 'CNT_name'); |
|
298 | + } else { |
|
299 | + $value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(), $att_field_name, $reg_row[$field_obj->get_qualified_column()]); |
|
300 | 300 | } |
301 | - }else{ |
|
301 | + } else { |
|
302 | 302 | $value = ''; |
303 | 303 | } |
304 | 304 | |
305 | - $reg_csv_array[ \EEH_Export::get_column_name_for_field($field_obj) ] = $value; |
|
305 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value; |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | //make sure each registration has the same questions in the same order |
309 | - foreach($questions_for_these_regs_rows as $question_row){ |
|
310 | - if( ! isset($reg_csv_array[$question_row[ 'Question.QST_admin_label']])){ |
|
311 | - $reg_csv_array[$question_row[ 'Question.QST_admin_label' ] ] = null; |
|
309 | + foreach ($questions_for_these_regs_rows as $question_row) { |
|
310 | + if ( ! isset($reg_csv_array[$question_row['Question.QST_admin_label']])) { |
|
311 | + $reg_csv_array[$question_row['Question.QST_admin_label']] = null; |
|
312 | 312 | } |
313 | 313 | } |
314 | 314 | $answers = \EEM_Answer::instance()->get_all_wpdb_results( |
315 | 315 | array( |
316 | - array( 'REG_ID' => $reg_row[ 'Registration.REG_ID' ] ), |
|
317 | - 'force_join' => array( 'Question' ) |
|
316 | + array('REG_ID' => $reg_row['Registration.REG_ID']), |
|
317 | + 'force_join' => array('Question') |
|
318 | 318 | ) |
319 | 319 | ); |
320 | 320 | //now fill out the questions THEY answered |
321 | - foreach( $answers as $answer_row ){ |
|
322 | - if( $answer_row[ 'Question.QST_ID' ] ){ |
|
321 | + foreach ($answers as $answer_row) { |
|
322 | + if ($answer_row['Question.QST_ID']) { |
|
323 | 323 | $question_label = \EEH_Export::prepare_value_from_db_for_display( |
324 | 324 | \EEM_Question::instance(), |
325 | 325 | 'QST_admin_label', |
326 | - $answer_row[ 'Question.QST_admin_label' ] |
|
326 | + $answer_row['Question.QST_admin_label'] |
|
327 | 327 | ); |
328 | 328 | } else { |
329 | - $question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] ); |
|
329 | + $question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']); |
|
330 | 330 | } |
331 | - if ( isset( $answer_row[ 'Question.QST_type' ] ) |
|
332 | - && $answer_row[ 'Question.QST_type' ] == \EEM_Question::QST_type_state |
|
331 | + if (isset($answer_row['Question.QST_type']) |
|
332 | + && $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state |
|
333 | 333 | ) { |
334 | - $reg_csv_array[ $question_label ] = \EEM_State::instance()->get_state_name_by_ID( |
|
335 | - $answer_row[ 'Answer.ANS_value' ] |
|
334 | + $reg_csv_array[$question_label] = \EEM_State::instance()->get_state_name_by_ID( |
|
335 | + $answer_row['Answer.ANS_value'] |
|
336 | 336 | ); |
337 | 337 | } else { |
338 | - $reg_csv_array[ $question_label ] = \EEH_Export::prepare_value_from_db_for_display( |
|
338 | + $reg_csv_array[$question_label] = \EEH_Export::prepare_value_from_db_for_display( |
|
339 | 339 | \EEM_Answer::instance(), |
340 | 340 | 'ANS_value', |
341 | - $answer_row[ 'Answer.ANS_value' ] |
|
341 | + $answer_row['Answer.ANS_value'] |
|
342 | 342 | ); |
343 | 343 | } |
344 | 344 | } |
@@ -349,17 +349,17 @@ discard block |
||
349 | 349 | } |
350 | 350 | } |
351 | 351 | //if we couldn't export anything, we want to at least show the column headers |
352 | - if ( empty( $registrations_csv_ready_array ) ) { |
|
352 | + if (empty($registrations_csv_ready_array)) { |
|
353 | 353 | $reg_csv_array = array(); |
354 | 354 | $model_and_fields_to_include = array( |
355 | 355 | 'Registration' => $reg_fields_to_include, |
356 | 356 | 'Attendee' => $att_fields_to_include |
357 | 357 | ); |
358 | - foreach ( $model_and_fields_to_include as $model_name => $field_list ) { |
|
359 | - $model = \EE_Registry::instance()->load_model( $model_name ); |
|
360 | - foreach ( $field_list as $field_name ) { |
|
361 | - $field = $model->field_settings_for( $field_name ); |
|
362 | - $reg_csv_array[ \EEH_Export::get_column_name_for_field( $field ) ] = null; |
|
358 | + foreach ($model_and_fields_to_include as $model_name => $field_list) { |
|
359 | + $model = \EE_Registry::instance()->load_model($model_name); |
|
360 | + foreach ($field_list as $field_name) { |
|
361 | + $field = $model->field_settings_for($field_name); |
|
362 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null; |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 | $registrations_csv_ready_array[] = $reg_csv_array; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * @param int $event_id |
376 | 376 | * @return int |
377 | 377 | */ |
378 | - public function count_units_to_process( $event_id ) { |
|
378 | + public function count_units_to_process($event_id) { |
|
379 | 379 | //use the legacy filter |
380 | 380 | $query_params = apply_filters( |
381 | 381 | 'FHEE__EE_Export__report_registration_for_event', |
@@ -383,24 +383,24 @@ discard block |
||
383 | 383 | array( |
384 | 384 | 'OR' => array( |
385 | 385 | //don't include registrations from failed or abandoned transactions... |
386 | - 'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ), |
|
386 | + 'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)), |
|
387 | 387 | //unless the registration is approved, in which case include it regardless of transaction status |
388 | 388 | 'STS_ID' => \EEM_Registration::status_id_approved |
389 | 389 | ), |
390 | - 'Ticket.TKT_deleted' => array( 'IN', array( true, false ) ) |
|
390 | + 'Ticket.TKT_deleted' => array('IN', array(true, false)) |
|
391 | 391 | ), |
392 | - 'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'), |
|
393 | - 'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ), |
|
392 | + 'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'), |
|
393 | + 'force_join' => array('Transaction', 'Ticket', 'Attendee'), |
|
394 | 394 | 'caps' => \EEM_Base::caps_read_admin |
395 | 395 | ), |
396 | 396 | $event_id |
397 | 397 | ); |
398 | - if( $event_id ){ |
|
399 | - $query_params[0]['EVT_ID'] = $event_id; |
|
398 | + if ($event_id) { |
|
399 | + $query_params[0]['EVT_ID'] = $event_id; |
|
400 | 400 | } else { |
401 | - $query_params[ 'force_join' ][] = 'Event'; |
|
401 | + $query_params['force_join'][] = 'Event'; |
|
402 | 402 | } |
403 | - return \EEM_Registration::instance()->count( $query_params ); |
|
403 | + return \EEM_Registration::instance()->count($query_params); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | |
@@ -411,13 +411,13 @@ discard block |
||
411 | 411 | * @param JobParameters $job_parameters |
412 | 412 | * @return boolean |
413 | 413 | */ |
414 | - public function cleanup_job( JobParameters $job_parameters ){ |
|
414 | + public function cleanup_job(JobParameters $job_parameters) { |
|
415 | 415 | $this->_file_helper->delete( |
416 | - \EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ), |
|
416 | + \EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')), |
|
417 | 417 | true, |
418 | 418 | 'd' |
419 | 419 | ); |
420 | - return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) ); |
|
420 | + return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso')); |
|
421 | 421 | } |
422 | 422 | } |
423 | 423 |
@@ -649,8 +649,9 @@ |
||
649 | 649 | * @return EE_Registration |
650 | 650 | */ |
651 | 651 | public function get_primary_registration() { |
652 | - if ( $this->is_primary_registrant() ) |
|
653 | - return $this; |
|
652 | + if ( $this->is_primary_registrant() ) { |
|
653 | + return $this; |
|
654 | + } |
|
654 | 655 | |
655 | 656 | //k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1 |
656 | 657 | $primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) ); |
@@ -618,9 +618,9 @@ |
||
618 | 618 | |
619 | 619 | |
620 | 620 | /** |
621 | - * get Attendee Number |
|
622 | - * @access public |
|
623 | - */ |
|
621 | + * get Attendee Number |
|
622 | + * @access public |
|
623 | + */ |
|
624 | 624 | public function count() { |
625 | 625 | return $this->get( 'REG_count' ); |
626 | 626 | } |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | /** |
951 | 951 | * Sets deleted |
952 | 952 | * @param boolean $deleted |
953 | - * @return boolean |
|
953 | + * @return boolean|null |
|
954 | 954 | */ |
955 | 955 | public function set_deleted($deleted) { |
956 | 956 | $this->set( 'REG_deleted', $deleted ); |
@@ -994,6 +994,7 @@ discard block |
||
994 | 994 | * |
995 | 995 | * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against |
996 | 996 | * @param bool $check_approved This is used to indicate whether the caller wants can_checkin to also consider registration status as well as datetime access. |
997 | + * @param integer $DTT_OR_ID |
|
997 | 998 | * |
998 | 999 | * @return bool |
999 | 1000 | */ |
@@ -1369,7 +1370,7 @@ discard block |
||
1369 | 1370 | * This grabs the payment method corresponding to the last payment made for the amount owing on the registration. |
1370 | 1371 | * Note: if there are no payments on the registration there will be no payment method returned. |
1371 | 1372 | * |
1372 | - * @return EE_Payment_Method|null |
|
1373 | + * @return null|EE_Base_Class |
|
1373 | 1374 | */ |
1374 | 1375 | public function payment_method() { |
1375 | 1376 | return EEM_Payment_Method::instance()->get_last_used_for_registration( $this ); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\exceptions\EntityNotFoundException; |
2 | 2 | |
3 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
4 | - exit( 'No direct script access allowed' ); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | + exit('No direct script access allowed'); |
|
5 | 5 | } |
6 | 6 | /** |
7 | 7 | * EE_Registration class |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | * date_format and the second value is the time format |
44 | 44 | * @return EE_Registration |
45 | 45 | */ |
46 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
47 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
48 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
46 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
47 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
48 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * the website will be used. |
57 | 57 | * @return EE_Registration |
58 | 58 | */ |
59 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
60 | - return new self( $props_n_values, TRUE, $timezone ); |
|
59 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
60 | + return new self($props_n_values, TRUE, $timezone); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * @access public |
69 | 69 | * @param int $EVT_ID Event ID |
70 | 70 | */ |
71 | - public function set_event( $EVT_ID = 0 ) { |
|
72 | - $this->set( 'EVT_ID', $EVT_ID ); |
|
71 | + public function set_event($EVT_ID = 0) { |
|
72 | + $this->set('EVT_ID', $EVT_ID); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -80,18 +80,18 @@ discard block |
||
80 | 80 | * @param mixed $field_value |
81 | 81 | * @param bool $use_default |
82 | 82 | */ |
83 | - public function set( $field_name, $field_value, $use_default = FALSE ) { |
|
84 | - switch( $field_name ) { |
|
83 | + public function set($field_name, $field_value, $use_default = FALSE) { |
|
84 | + switch ($field_name) { |
|
85 | 85 | case 'REG_code' : |
86 | - if ( ! empty( $field_value ) && $this->reg_code() == '' ) { |
|
87 | - $this->set_reg_code( $field_value, $use_default ); |
|
86 | + if ( ! empty($field_value) && $this->reg_code() == '') { |
|
87 | + $this->set_reg_code($field_value, $use_default); |
|
88 | 88 | } |
89 | 89 | break; |
90 | 90 | case 'STS_ID' : |
91 | - $this->set_status( $field_value, $use_default ); |
|
91 | + $this->set_status($field_value, $use_default); |
|
92 | 92 | break; |
93 | 93 | default : |
94 | - parent::set( $field_name, $field_value, $use_default ); |
|
94 | + parent::set($field_name, $field_value, $use_default); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
@@ -109,42 +109,42 @@ discard block |
||
109 | 109 | * @return bool |
110 | 110 | * @throws \EE_Error |
111 | 111 | */ |
112 | - public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) { |
|
112 | + public function set_status($new_STS_ID = NULL, $use_default = FALSE) { |
|
113 | 113 | // get current REG_Status |
114 | 114 | $old_STS_ID = $this->status_ID(); |
115 | 115 | // if status has changed |
116 | 116 | if ( |
117 | 117 | $this->ID() // ensure registration is in the db |
118 | 118 | && $old_STS_ID != $new_STS_ID // and that status has actually changed |
119 | - && ! empty( $old_STS_ID ) // and that old status is actually set |
|
120 | - && ! empty( $new_STS_ID ) // as well as the new status |
|
119 | + && ! empty($old_STS_ID) // and that old status is actually set |
|
120 | + && ! empty($new_STS_ID) // as well as the new status |
|
121 | 121 | ) { |
122 | 122 | // TO approved |
123 | - if ( $new_STS_ID === EEM_Registration::status_id_approved ) { |
|
123 | + if ($new_STS_ID === EEM_Registration::status_id_approved) { |
|
124 | 124 | // reserve a space by incrementing ticket and datetime sold values |
125 | 125 | $this->_reserve_registration_space(); |
126 | - do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
126 | + do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID); |
|
127 | 127 | // OR FROM approved |
128 | - } else if ( $old_STS_ID === EEM_Registration::status_id_approved ) { |
|
128 | + } else if ($old_STS_ID === EEM_Registration::status_id_approved) { |
|
129 | 129 | // release a space by decrementing ticket and datetime sold values |
130 | 130 | $this->_release_registration_space(); |
131 | - do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
131 | + do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID); |
|
132 | 132 | } |
133 | 133 | // update status |
134 | - parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
134 | + parent::set('STS_ID', $new_STS_ID, $use_default); |
|
135 | 135 | /** @type EE_Registration_Processor $registration_processor */ |
136 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
136 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
137 | 137 | /** @type EE_Transaction_Processor $transaction_processor */ |
138 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
138 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
139 | 139 | /** @type EE_Transaction_Payments $transaction_payments */ |
140 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
140 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
141 | 141 | // these reg statuses should not be considered in any calculations involving monies owing |
142 | - $closed_reg_statuses = ! empty( $closed_reg_statuses ) |
|
142 | + $closed_reg_statuses = ! empty($closed_reg_statuses) |
|
143 | 143 | ? $closed_reg_statuses |
144 | 144 | : EEM_Registration::closed_reg_statuses(); |
145 | 145 | if ( |
146 | - in_array( $new_STS_ID, $closed_reg_statuses ) |
|
147 | - && ! in_array( $old_STS_ID, $closed_reg_statuses ) |
|
146 | + in_array($new_STS_ID, $closed_reg_statuses) |
|
147 | + && ! in_array($old_STS_ID, $closed_reg_statuses) |
|
148 | 148 | ) { |
149 | 149 | // cancelled or declined registration |
150 | 150 | $registration_processor->update_registration_after_being_canceled_or_declined( |
@@ -157,24 +157,24 @@ discard block |
||
157 | 157 | false |
158 | 158 | ); |
159 | 159 | } else if ( |
160 | - in_array( $old_STS_ID, $closed_reg_statuses ) |
|
161 | - && ! in_array( $new_STS_ID, $closed_reg_statuses ) |
|
160 | + in_array($old_STS_ID, $closed_reg_statuses) |
|
161 | + && ! in_array($new_STS_ID, $closed_reg_statuses) |
|
162 | 162 | ) { |
163 | 163 | // reinstating cancelled or declined registration |
164 | 164 | $registration_processor->update_canceled_or_declined_registration_after_being_reinstated( |
165 | 165 | $this, |
166 | 166 | $closed_reg_statuses |
167 | 167 | ); |
168 | - $transaction_processor->update_transaction_after_reinstating_canceled_registration( $this ); |
|
168 | + $transaction_processor->update_transaction_after_reinstating_canceled_registration($this); |
|
169 | 169 | } |
170 | - $transaction_payments->recalculate_transaction_total( $this->transaction(), false ); |
|
171 | - $this->transaction()->update_status_based_on_total_paid( true ); |
|
172 | - do_action( 'AHEE__EE_Registration__set_status__after_update', $this ); |
|
170 | + $transaction_payments->recalculate_transaction_total($this->transaction(), false); |
|
171 | + $this->transaction()->update_status_based_on_total_paid(true); |
|
172 | + do_action('AHEE__EE_Registration__set_status__after_update', $this); |
|
173 | 173 | return TRUE; |
174 | 174 | } else { |
175 | 175 | //even though the old value matches the new value, it's still good to |
176 | 176 | //allow the parent set method to have a say |
177 | - parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
177 | + parent::set('STS_ID', $new_STS_ID, $use_default); |
|
178 | 178 | return TRUE; |
179 | 179 | } |
180 | 180 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @access public |
187 | 187 | */ |
188 | 188 | public function status_ID() { |
189 | - return $this->get( 'STS_ID' ); |
|
189 | + return $this->get('STS_ID'); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | |
@@ -211,12 +211,12 @@ discard block |
||
211 | 211 | * @param boolean $include_archived whether to include archived tickets or not. |
212 | 212 | * @return EE_Ticket |
213 | 213 | */ |
214 | - public function ticket( $include_archived = TRUE ) { |
|
214 | + public function ticket($include_archived = TRUE) { |
|
215 | 215 | $query_params = array(); |
216 | - if ( $include_archived ) { |
|
217 | - $query_params[ 'default_where_conditions' ] = 'none'; |
|
216 | + if ($include_archived) { |
|
217 | + $query_params['default_where_conditions'] = 'none'; |
|
218 | 218 | } |
219 | - return $this->get_first_related( 'Ticket', $query_params ); |
|
219 | + return $this->get_first_related('Ticket', $query_params); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function wp_user() { |
246 | 246 | $event = $this->event(); |
247 | - if ( $event instanceof EE_Event ) { |
|
247 | + if ($event instanceof EE_Event) { |
|
248 | 248 | return $event->wp_user(); |
249 | 249 | } |
250 | 250 | return 0; |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | * @access public |
271 | 271 | * @param int $ATT_ID Attendee ID |
272 | 272 | */ |
273 | - public function set_attendee_id( $ATT_ID = 0 ) { |
|
274 | - $this->set( 'ATT_ID', $ATT_ID ); |
|
273 | + public function set_attendee_id($ATT_ID = 0) { |
|
274 | + $this->set('ATT_ID', $ATT_ID); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | |
@@ -282,8 +282,8 @@ discard block |
||
282 | 282 | * @access public |
283 | 283 | * @param int $TXN_ID Transaction ID |
284 | 284 | */ |
285 | - public function set_transaction_id( $TXN_ID = 0 ) { |
|
286 | - $this->set( 'TXN_ID', $TXN_ID ); |
|
285 | + public function set_transaction_id($TXN_ID = 0) { |
|
286 | + $this->set('TXN_ID', $TXN_ID); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | |
@@ -294,8 +294,8 @@ discard block |
||
294 | 294 | * @access public |
295 | 295 | * @param string $REG_session PHP Session ID |
296 | 296 | */ |
297 | - public function set_session( $REG_session = '' ) { |
|
298 | - $this->set( 'REG_session', $REG_session ); |
|
297 | + public function set_session($REG_session = '') { |
|
298 | + $this->set('REG_session', $REG_session); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | |
@@ -306,8 +306,8 @@ discard block |
||
306 | 306 | * @access public |
307 | 307 | * @param string $REG_url_link Registration URL Link |
308 | 308 | */ |
309 | - public function set_reg_url_link( $REG_url_link = '' ) { |
|
310 | - $this->set( 'REG_url_link', $REG_url_link ); |
|
309 | + public function set_reg_url_link($REG_url_link = '') { |
|
310 | + $this->set('REG_url_link', $REG_url_link); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | |
@@ -318,8 +318,8 @@ discard block |
||
318 | 318 | * @access public |
319 | 319 | * @param int $REG_count Primary Attendee |
320 | 320 | */ |
321 | - public function set_count( $REG_count = 1 ) { |
|
322 | - $this->set( 'REG_count', $REG_count ); |
|
321 | + public function set_count($REG_count = 1) { |
|
322 | + $this->set('REG_count', $REG_count); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -330,8 +330,8 @@ discard block |
||
330 | 330 | * @access public |
331 | 331 | * @param boolean $REG_group_size Group Registration |
332 | 332 | */ |
333 | - public function set_group_size( $REG_group_size = FALSE ) { |
|
334 | - $this->set( 'REG_group_size', $REG_group_size ); |
|
333 | + public function set_group_size($REG_group_size = FALSE) { |
|
334 | + $this->set('REG_group_size', $REG_group_size); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | |
@@ -414,8 +414,8 @@ discard block |
||
414 | 414 | * @access public |
415 | 415 | * @param mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date |
416 | 416 | */ |
417 | - public function set_reg_date( $REG_date = FALSE ) { |
|
418 | - $this->set( 'REG_date', $REG_date ); |
|
417 | + public function set_reg_date($REG_date = FALSE) { |
|
418 | + $this->set('REG_date', $REG_date); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | |
@@ -426,8 +426,8 @@ discard block |
||
426 | 426 | * @access public |
427 | 427 | * @param float $REG_final_price |
428 | 428 | */ |
429 | - public function set_final_price( $REG_final_price = 0.00 ) { |
|
430 | - $this->set( 'REG_final_price', $REG_final_price ); |
|
429 | + public function set_final_price($REG_final_price = 0.00) { |
|
430 | + $this->set('REG_final_price', $REG_final_price); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | * @access public |
439 | 439 | * @param float $REG_paid |
440 | 440 | */ |
441 | - public function set_paid( $REG_paid = 0.00 ) { |
|
442 | - $this->set( 'REG_paid', $REG_paid ); |
|
441 | + public function set_paid($REG_paid = 0.00) { |
|
442 | + $this->set('REG_paid', $REG_paid); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | |
@@ -450,8 +450,8 @@ discard block |
||
450 | 450 | * @access public |
451 | 451 | * @param boolean $REG_att_is_going Attendee Is Going |
452 | 452 | */ |
453 | - public function set_att_is_going( $REG_att_is_going = FALSE ) { |
|
454 | - $this->set( 'REG_att_is_going', $REG_att_is_going ); |
|
453 | + public function set_att_is_going($REG_att_is_going = FALSE) { |
|
454 | + $this->set('REG_att_is_going', $REG_att_is_going); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | * @return EE_Attendee |
462 | 462 | */ |
463 | 463 | public function attendee() { |
464 | - return $this->get_first_related( 'Attendee' ); |
|
464 | + return $this->get_first_related('Attendee'); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | * @access public |
472 | 472 | */ |
473 | 473 | public function event_ID() { |
474 | - return $this->get( 'EVT_ID' ); |
|
474 | + return $this->get('EVT_ID'); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | */ |
483 | 483 | public function event_name() { |
484 | 484 | $event = $this->event_obj(); |
485 | - if ( $event ) { |
|
485 | + if ($event) { |
|
486 | 486 | return $event->name(); |
487 | 487 | } else { |
488 | 488 | return NULL; |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | * @return EE_Event |
497 | 497 | */ |
498 | 498 | public function event_obj() { |
499 | - return $this->get_first_related( 'Event' ); |
|
499 | + return $this->get_first_related('Event'); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * @access public |
507 | 507 | */ |
508 | 508 | public function attendee_ID() { |
509 | - return $this->get( 'ATT_ID' ); |
|
509 | + return $this->get('ATT_ID'); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | * @access public |
517 | 517 | */ |
518 | 518 | public function session_ID() { |
519 | - return $this->get( 'REG_session' ); |
|
519 | + return $this->get('REG_session'); |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
527 | 527 | * @return string |
528 | 528 | */ |
529 | - public function receipt_url( $messenger = 'html' ) { |
|
529 | + public function receipt_url($messenger = 'html') { |
|
530 | 530 | |
531 | 531 | /** |
532 | 532 | * The below will be deprecated one version after this. We check first if there is a custom receipt template already in use on old system. If there is then we just return the standard url for it. |
@@ -534,12 +534,12 @@ discard block |
||
534 | 534 | * @since 4.5.0 |
535 | 535 | */ |
536 | 536 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php'; |
537 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
537 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
538 | 538 | |
539 | - if ( $has_custom ) { |
|
540 | - return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) ); |
|
539 | + if ($has_custom) { |
|
540 | + return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch')); |
|
541 | 541 | } |
542 | - return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' ); |
|
542 | + return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt'); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | |
@@ -550,28 +550,28 @@ discard block |
||
550 | 550 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
551 | 551 | * @return string |
552 | 552 | */ |
553 | - public function invoice_url( $messenger = 'html' ) { |
|
553 | + public function invoice_url($messenger = 'html') { |
|
554 | 554 | /** |
555 | 555 | * The below will be deprecated one version after this. We check first if there is a custom invoice template already in use on old system. If there is then we just return the standard url for it. |
556 | 556 | * |
557 | 557 | * @since 4.5.0 |
558 | 558 | */ |
559 | 559 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php'; |
560 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
560 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
561 | 561 | |
562 | - if ( $has_custom ) { |
|
563 | - if ( $messenger == 'html' ) { |
|
564 | - return $this->invoice_url( 'launch' ); |
|
562 | + if ($has_custom) { |
|
563 | + if ($messenger == 'html') { |
|
564 | + return $this->invoice_url('launch'); |
|
565 | 565 | } |
566 | 566 | $route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice'; |
567 | 567 | |
568 | - $query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() ); |
|
569 | - if ( $messenger == 'html' ) { |
|
568 | + $query_args = array('ee' => $route, 'id' => $this->reg_url_link()); |
|
569 | + if ($messenger == 'html') { |
|
570 | 570 | $query_args['html'] = TRUE; |
571 | 571 | } |
572 | - return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) ); |
|
572 | + return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id)); |
|
573 | 573 | } |
574 | - return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' ); |
|
574 | + return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice'); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | * @throws \EE_Error |
585 | 585 | */ |
586 | 586 | public function reg_url_link() { |
587 | - return (string)$this->get( 'REG_url_link' ); |
|
587 | + return (string) $this->get('REG_url_link'); |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | |
@@ -594,8 +594,8 @@ discard block |
||
594 | 594 | * @param string $type 'download','launch', or 'html' (default is 'launch') |
595 | 595 | * @return void |
596 | 596 | */ |
597 | - public function e_invoice_url( $type = 'launch' ) { |
|
598 | - echo $this->invoice_url( $type ); |
|
597 | + public function e_invoice_url($type = 'launch') { |
|
598 | + echo $this->invoice_url($type); |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | * @return string |
616 | 616 | */ |
617 | 617 | public function payment_overview_url() { |
618 | - return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() ); |
|
618 | + return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url()); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | * @return string |
627 | 627 | */ |
628 | 628 | public function edit_attendee_information_url() { |
629 | - return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() ); |
|
629 | + return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url()); |
|
630 | 630 | } |
631 | 631 | |
632 | 632 | |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | * @return string |
637 | 637 | */ |
638 | 638 | public function get_admin_edit_url() { |
639 | - return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) ); |
|
639 | + return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php')); |
|
640 | 640 | } |
641 | 641 | |
642 | 642 | |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | * @access public |
647 | 647 | */ |
648 | 648 | public function is_primary_registrant() { |
649 | - return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE; |
|
649 | + return $this->get('REG_count') == 1 ? TRUE : FALSE; |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | |
@@ -655,12 +655,12 @@ discard block |
||
655 | 655 | * This returns the primary registration object for this registration group (which may be this object). |
656 | 656 | * @return EE_Registration |
657 | 657 | */ |
658 | - public function get_primary_registration() { |
|
659 | - if ( $this->is_primary_registrant() ) |
|
658 | + public function get_primary_registration() { |
|
659 | + if ($this->is_primary_registrant()) |
|
660 | 660 | return $this; |
661 | 661 | |
662 | 662 | //k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1 |
663 | - $primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) ); |
|
663 | + $primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1))); |
|
664 | 664 | return $primary_registrant; |
665 | 665 | } |
666 | 666 | |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | * @access public |
672 | 672 | */ |
673 | 673 | public function count() { |
674 | - return $this->get( 'REG_count' ); |
|
674 | + return $this->get('REG_count'); |
|
675 | 675 | } |
676 | 676 | |
677 | 677 | |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | * @access public |
682 | 682 | */ |
683 | 683 | public function group_size() { |
684 | - return $this->get( 'REG_group_size' ); |
|
684 | + return $this->get('REG_group_size'); |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | * @access public |
692 | 692 | */ |
693 | 693 | public function date() { |
694 | - return $this->get( 'REG_date' ); |
|
694 | + return $this->get('REG_date'); |
|
695 | 695 | } |
696 | 696 | |
697 | 697 | |
@@ -702,8 +702,8 @@ discard block |
||
702 | 702 | * @param string $time_format |
703 | 703 | * @return string |
704 | 704 | */ |
705 | - public function pretty_date( $date_format = NULL, $time_format = NULL ) { |
|
706 | - return $this->get_datetime( 'REG_date', $date_format, $time_format ); |
|
705 | + public function pretty_date($date_format = NULL, $time_format = NULL) { |
|
706 | + return $this->get_datetime('REG_date', $date_format, $time_format); |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | * @return float |
717 | 717 | */ |
718 | 718 | public function final_price() { |
719 | - return $this->get( 'REG_final_price' ); |
|
719 | + return $this->get('REG_final_price'); |
|
720 | 720 | } |
721 | 721 | |
722 | 722 | |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | * @return string |
728 | 728 | */ |
729 | 729 | public function pretty_final_price() { |
730 | - return $this->get_pretty( 'REG_final_price' ); |
|
730 | + return $this->get_pretty('REG_final_price'); |
|
731 | 731 | } |
732 | 732 | |
733 | 733 | |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | * @return float |
739 | 739 | */ |
740 | 740 | public function paid() { |
741 | - return $this->get( 'REG_paid' ); |
|
741 | + return $this->get('REG_paid'); |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | * @return float |
750 | 750 | */ |
751 | 751 | public function pretty_paid() { |
752 | - return $this->get_pretty( 'REG_paid' ); |
|
752 | + return $this->get_pretty('REG_paid'); |
|
753 | 753 | } |
754 | 754 | |
755 | 755 | |
@@ -761,11 +761,11 @@ discard block |
||
761 | 761 | * @param array $requires_payment |
762 | 762 | * @return bool |
763 | 763 | */ |
764 | - public function owes_monies_and_can_pay( $requires_payment = array()) { |
|
764 | + public function owes_monies_and_can_pay($requires_payment = array()) { |
|
765 | 765 | // these reg statuses require payment (if event is not free) |
766 | - $requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment(); |
|
766 | + $requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment(); |
|
767 | 767 | if ( |
768 | - in_array( $this->status_ID(), $requires_payment ) && |
|
768 | + in_array($this->status_ID(), $requires_payment) && |
|
769 | 769 | $this->final_price() != 0 && |
770 | 770 | $this->final_price() != $this->paid() |
771 | 771 | ) { |
@@ -782,8 +782,8 @@ discard block |
||
782 | 782 | * @param bool $show_icons |
783 | 783 | * @return void |
784 | 784 | */ |
785 | - public function e_pretty_status( $show_icons = FALSE ) { |
|
786 | - echo $this->pretty_status( $show_icons ); |
|
785 | + public function e_pretty_status($show_icons = FALSE) { |
|
786 | + echo $this->pretty_status($show_icons); |
|
787 | 787 | } |
788 | 788 | |
789 | 789 | |
@@ -794,10 +794,10 @@ discard block |
||
794 | 794 | * @param bool $show_icons |
795 | 795 | * @return string |
796 | 796 | */ |
797 | - public function pretty_status( $show_icons = FALSE ) { |
|
798 | - $status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' ); |
|
797 | + public function pretty_status($show_icons = FALSE) { |
|
798 | + $status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence'); |
|
799 | 799 | $icon = ''; |
800 | - switch ( $this->status_ID() ) { |
|
800 | + switch ($this->status_ID()) { |
|
801 | 801 | case EEM_Registration::status_id_approved: |
802 | 802 | $icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : ''; |
803 | 803 | break; |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | $icon = $show_icons ? '<span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>' : ''; |
821 | 821 | break; |
822 | 822 | } |
823 | - return $icon . $status[ $this->status_ID() ]; |
|
823 | + return $icon.$status[$this->status_ID()]; |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | * @access public |
831 | 831 | */ |
832 | 832 | public function att_is_going() { |
833 | - return $this->get( 'REG_att_is_going' ); |
|
833 | + return $this->get('REG_att_is_going'); |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | |
@@ -840,8 +840,8 @@ discard block |
||
840 | 840 | * @param array $query_params like EEM_Base::get_all |
841 | 841 | * @return EE_Answer[] |
842 | 842 | */ |
843 | - public function answers( $query_params = NULL ) { |
|
844 | - return $this->get_many_related( 'Answer', $query_params ); |
|
843 | + public function answers($query_params = NULL) { |
|
844 | + return $this->get_many_related('Answer', $query_params); |
|
845 | 845 | } |
846 | 846 | |
847 | 847 | |
@@ -855,9 +855,9 @@ discard block |
||
855 | 855 | * (because the answer might be an array of answer values, so passing pretty_value=true |
856 | 856 | * will convert it into some kind of string) |
857 | 857 | */ |
858 | - public function answer_value_to_question( $question, $pretty_value=true ) { |
|
858 | + public function answer_value_to_question($question, $pretty_value = true) { |
|
859 | 859 | $question_id = EEM_Question::instance()->ensure_is_ID($question); |
860 | - return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value); |
|
860 | + return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value); |
|
861 | 861 | } |
862 | 862 | |
863 | 863 | |
@@ -870,13 +870,13 @@ discard block |
||
870 | 870 | */ |
871 | 871 | public function question_groups() { |
872 | 872 | $question_groups = array(); |
873 | - if ( $this->event() instanceof EE_Event ) { |
|
873 | + if ($this->event() instanceof EE_Event) { |
|
874 | 874 | $question_groups = $this->event()->question_groups( |
875 | 875 | array( |
876 | 876 | array( |
877 | 877 | 'Event_Question_Group.EQG_primary' => $this->count() == 1 ? true : false |
878 | 878 | ), |
879 | - 'order_by' => array( 'QSG_order' => 'ASC' ) |
|
879 | + 'order_by' => array('QSG_order' => 'ASC') |
|
880 | 880 | ) |
881 | 881 | ); |
882 | 882 | } |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | */ |
894 | 894 | public function count_question_groups() { |
895 | 895 | $qg_count = 0; |
896 | - if ( $this->event() instanceof EE_Event ) { |
|
896 | + if ($this->event() instanceof EE_Event) { |
|
897 | 897 | $qg_count = $this->event()->count_related( |
898 | 898 | 'Question_Group', |
899 | 899 | array( |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | * @return string |
915 | 915 | */ |
916 | 916 | public function reg_date() { |
917 | - return $this->get_datetime( 'REG_date' ); |
|
917 | + return $this->get_datetime('REG_date'); |
|
918 | 918 | } |
919 | 919 | |
920 | 920 | |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | * @return EE_Datetime_Ticket |
927 | 927 | */ |
928 | 928 | public function datetime_ticket() { |
929 | - return $this->get_first_related( 'Datetime_Ticket' ); |
|
929 | + return $this->get_first_related('Datetime_Ticket'); |
|
930 | 930 | } |
931 | 931 | |
932 | 932 | |
@@ -936,15 +936,15 @@ discard block |
||
936 | 936 | * @param EE_Datetime_Ticket $datetime_ticket |
937 | 937 | * @return EE_Datetime_Ticket |
938 | 938 | */ |
939 | - public function set_datetime_ticket( $datetime_ticket ) { |
|
940 | - return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' ); |
|
939 | + public function set_datetime_ticket($datetime_ticket) { |
|
940 | + return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket'); |
|
941 | 941 | } |
942 | 942 | /** |
943 | 943 | * Gets deleted |
944 | 944 | * @return boolean |
945 | 945 | */ |
946 | 946 | public function deleted() { |
947 | - return $this->get( 'REG_deleted' ); |
|
947 | + return $this->get('REG_deleted'); |
|
948 | 948 | } |
949 | 949 | |
950 | 950 | /** |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | * @return boolean |
954 | 954 | */ |
955 | 955 | public function set_deleted($deleted) { |
956 | - $this->set( 'REG_deleted', $deleted ); |
|
956 | + $this->set('REG_deleted', $deleted); |
|
957 | 957 | } |
958 | 958 | |
959 | 959 | |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | * @return EE_Status |
964 | 964 | */ |
965 | 965 | public function status_obj() { |
966 | - return $this->get_first_related( 'Status' ); |
|
966 | + return $this->get_first_related('Status'); |
|
967 | 967 | } |
968 | 968 | |
969 | 969 | |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | * @return int |
975 | 975 | */ |
976 | 976 | public function count_checkins() { |
977 | - return $this->get_model()->count_related( $this, 'Checkin' ); |
|
977 | + return $this->get_model()->count_related($this, 'Checkin'); |
|
978 | 978 | } |
979 | 979 | |
980 | 980 | |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | * @return int |
985 | 985 | */ |
986 | 986 | public function count_checkins_not_checkedout() { |
987 | - return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) ); |
|
987 | + return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1))); |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | |
@@ -997,20 +997,20 @@ discard block |
||
997 | 997 | * |
998 | 998 | * @return bool |
999 | 999 | */ |
1000 | - public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) { |
|
1001 | - $DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID ); |
|
1000 | + public function can_checkin($DTT_OR_ID, $check_approved = TRUE) { |
|
1001 | + $DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID); |
|
1002 | 1002 | |
1003 | 1003 | //first check registration status |
1004 | - if ( ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) { |
|
1004 | + if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) { |
|
1005 | 1005 | return false; |
1006 | 1006 | } |
1007 | 1007 | //is there a datetime ticket that matches this dtt_ID? |
1008 | - if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) { |
|
1008 | + if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) { |
|
1009 | 1009 | return false; |
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | //final check is against TKT_uses |
1013 | - return $this->verify_can_checkin_against_TKT_uses( $DTT_ID ); |
|
1013 | + return $this->verify_can_checkin_against_TKT_uses($DTT_ID); |
|
1014 | 1014 | } |
1015 | 1015 | |
1016 | 1016 | |
@@ -1023,10 +1023,10 @@ discard block |
||
1023 | 1023 | * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against |
1024 | 1024 | * @return bool true means can checkin. false means cannot checkin. |
1025 | 1025 | */ |
1026 | - public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) { |
|
1027 | - $DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID ); |
|
1026 | + public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) { |
|
1027 | + $DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID); |
|
1028 | 1028 | |
1029 | - if ( ! $DTT_ID ) { |
|
1029 | + if ( ! $DTT_ID) { |
|
1030 | 1030 | return false; |
1031 | 1031 | } |
1032 | 1032 | |
@@ -1034,23 +1034,23 @@ discard block |
||
1034 | 1034 | |
1035 | 1035 | // if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in |
1036 | 1036 | // or not. |
1037 | - if ( ! $max_uses || $max_uses === EE_INF ) { |
|
1037 | + if ( ! $max_uses || $max_uses === EE_INF) { |
|
1038 | 1038 | return true; |
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | //does this datetime have a checkin record? If so, then the dtt count has already been verified so we can just |
1042 | 1042 | //go ahead and toggle. |
1043 | - if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) { |
|
1043 | + if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) { |
|
1044 | 1044 | return true; |
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | //made it here so the last check is whether the number of checkins per unique datetime on this registration |
1048 | 1048 | //disallows further check-ins. |
1049 | - $count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true ); |
|
1049 | + $count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true); |
|
1050 | 1050 | // checkins have already reached their max number of uses |
1051 | 1051 | // so registrant can NOT checkin |
1052 | - if ( $count_unique_dtt_checkins >= $max_uses ) { |
|
1053 | - EE_Error::add_error( __( 'Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1052 | + if ($count_unique_dtt_checkins >= $max_uses) { |
|
1053 | + EE_Error::add_error(__('Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1054 | 1054 | return false; |
1055 | 1055 | } |
1056 | 1056 | return true; |
@@ -1071,15 +1071,15 @@ discard block |
||
1071 | 1071 | * @param bool $verify If true then can_checkin() is used to verify whether the person can be checked in or not. Otherwise this forces change in checkin status. |
1072 | 1072 | * @return int|BOOL the chk_in status toggled to OR false if nothing got changed. |
1073 | 1073 | */ |
1074 | - public function toggle_checkin_status( $DTT_ID = null, $verify = false ) { |
|
1075 | - if ( empty( $DTT_ID ) ) { |
|
1074 | + public function toggle_checkin_status($DTT_ID = null, $verify = false) { |
|
1075 | + if (empty($DTT_ID)) { |
|
1076 | 1076 | $datetime = $this->get_related_primary_datetime(); |
1077 | 1077 | $DTT_ID = $datetime->ID(); |
1078 | 1078 | // verify the registration can checkin for the given DTT_ID |
1079 | - } elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) { |
|
1079 | + } elseif ( ! $this->can_checkin($DTT_ID, $verify)) { |
|
1080 | 1080 | EE_Error::add_error( |
1081 | 1081 | sprintf( |
1082 | - __( 'The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'), |
|
1082 | + __('The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'), |
|
1083 | 1083 | $this->ID(), |
1084 | 1084 | $DTT_ID |
1085 | 1085 | ), |
@@ -1093,8 +1093,8 @@ discard block |
||
1093 | 1093 | EE_Registration::checkin_status_out => EE_Registration::checkin_status_in |
1094 | 1094 | ); |
1095 | 1095 | //start by getting the current status so we know what status we'll be changing to. |
1096 | - $cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL ); |
|
1097 | - $status_to = $status_paths[ $cur_status ]; |
|
1096 | + $cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL); |
|
1097 | + $status_to = $status_paths[$cur_status]; |
|
1098 | 1098 | // database only records true for checked IN or false for checked OUT |
1099 | 1099 | // no record ( null ) means checked in NEVER, but we obviously don't save that |
1100 | 1100 | $new_status = $status_to == EE_Registration::checkin_status_in ? true : false; |
@@ -1102,24 +1102,24 @@ discard block |
||
1102 | 1102 | // because we are keeping track of Check-ins over time. |
1103 | 1103 | // Eventually we'll probably want to show a list table |
1104 | 1104 | // for the individual Check-ins so that they can be managed. |
1105 | - $checkin = EE_Checkin::new_instance( array( |
|
1105 | + $checkin = EE_Checkin::new_instance(array( |
|
1106 | 1106 | 'REG_ID' => $this->ID(), |
1107 | 1107 | 'DTT_ID' => $DTT_ID, |
1108 | 1108 | 'CHK_in' => $new_status |
1109 | - ) ); |
|
1109 | + )); |
|
1110 | 1110 | // if the record could not be saved then return false |
1111 | - if ( $checkin->save() === 0 ) { |
|
1112 | - if ( WP_DEBUG ) { |
|
1111 | + if ($checkin->save() === 0) { |
|
1112 | + if (WP_DEBUG) { |
|
1113 | 1113 | global $wpdb; |
1114 | 1114 | $error = sprintf( |
1115 | - __( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ), |
|
1115 | + __('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'), |
|
1116 | 1116 | '<br />', |
1117 | 1117 | $wpdb->last_error |
1118 | 1118 | ); |
1119 | 1119 | } else { |
1120 | - $error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' ); |
|
1120 | + $error = __('Registration check in update failed because of an unknown database error', 'event_espresso'); |
|
1121 | 1121 | } |
1122 | - EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ ); |
|
1122 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
1123 | 1123 | return false; |
1124 | 1124 | } |
1125 | 1125 | return $status_to; |
@@ -1143,19 +1143,19 @@ discard block |
||
1143 | 1143 | * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id. |
1144 | 1144 | * @return int Integer representing Check-in status. |
1145 | 1145 | */ |
1146 | - public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) { |
|
1147 | - if ( empty( $DTT_ID ) && ! $checkin instanceof EE_Checkin ) { |
|
1146 | + public function check_in_status_for_datetime($DTT_ID = 0, $checkin = NULL) { |
|
1147 | + if (empty($DTT_ID) && ! $checkin instanceof EE_Checkin) { |
|
1148 | 1148 | $datetime = $this->get_related_primary_datetime(); |
1149 | - if ( ! $datetime instanceof EE_Datetime ) { |
|
1149 | + if ( ! $datetime instanceof EE_Datetime) { |
|
1150 | 1150 | return 0; |
1151 | 1151 | } |
1152 | 1152 | $DTT_ID = $datetime->ID(); |
1153 | 1153 | //verify the registration can checkin for the given DTT_ID |
1154 | 1154 | } |
1155 | 1155 | //get checkin object (if exists) |
1156 | - $checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ), 'order_by' => array( 'CHK_timestamp' => 'DESC' ) ) ); |
|
1157 | - if ( $checkin instanceof EE_Checkin ) { |
|
1158 | - if ( $checkin->get( 'CHK_in' ) ) { |
|
1156 | + $checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related('Checkin', array(array('DTT_ID' => $DTT_ID), 'order_by' => array('CHK_timestamp' => 'DESC'))); |
|
1157 | + if ($checkin instanceof EE_Checkin) { |
|
1158 | + if ($checkin->get('CHK_in')) { |
|
1159 | 1159 | return EE_Registration::checkin_status_in; //checked in |
1160 | 1160 | } else { |
1161 | 1161 | return EE_Registration::checkin_status_out; //had checked in but is now checked out. |
@@ -1173,28 +1173,28 @@ discard block |
||
1173 | 1173 | * @param bool $error This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name. |
1174 | 1174 | * @return string internationalized message |
1175 | 1175 | */ |
1176 | - public function get_checkin_msg( $DTT_ID, $error = FALSE ) { |
|
1176 | + public function get_checkin_msg($DTT_ID, $error = FALSE) { |
|
1177 | 1177 | //let's get the attendee first so we can include the name of the attendee |
1178 | - $attendee = $this->get_first_related( 'Attendee' ); |
|
1179 | - if ( $attendee instanceof EE_Attendee ) { |
|
1180 | - if ( $error ) { |
|
1181 | - return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() ); |
|
1178 | + $attendee = $this->get_first_related('Attendee'); |
|
1179 | + if ($attendee instanceof EE_Attendee) { |
|
1180 | + if ($error) { |
|
1181 | + return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name()); |
|
1182 | 1182 | } |
1183 | - $cur_status = $this->check_in_status_for_datetime( $DTT_ID ); |
|
1183 | + $cur_status = $this->check_in_status_for_datetime($DTT_ID); |
|
1184 | 1184 | //what is the status message going to be? |
1185 | - switch ( $cur_status ) { |
|
1185 | + switch ($cur_status) { |
|
1186 | 1186 | case EE_Registration::checkin_status_never : |
1187 | - return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() ); |
|
1187 | + return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name()); |
|
1188 | 1188 | break; |
1189 | 1189 | case EE_Registration::checkin_status_in : |
1190 | - return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() ); |
|
1190 | + return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name()); |
|
1191 | 1191 | break; |
1192 | 1192 | case EE_Registration::checkin_status_out : |
1193 | - return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() ); |
|
1193 | + return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name()); |
|
1194 | 1194 | break; |
1195 | 1195 | } |
1196 | 1196 | } |
1197 | - return __( "The check-in status could not be determined.", "event_espresso" ); |
|
1197 | + return __("The check-in status could not be determined.", "event_espresso"); |
|
1198 | 1198 | } |
1199 | 1199 | |
1200 | 1200 | |
@@ -1219,7 +1219,7 @@ discard block |
||
1219 | 1219 | * @access public |
1220 | 1220 | */ |
1221 | 1221 | public function reg_code() { |
1222 | - return $this->get( 'REG_code' ); |
|
1222 | + return $this->get('REG_code'); |
|
1223 | 1223 | } |
1224 | 1224 | |
1225 | 1225 | |
@@ -1229,7 +1229,7 @@ discard block |
||
1229 | 1229 | * @access public |
1230 | 1230 | */ |
1231 | 1231 | public function transaction_ID() { |
1232 | - return $this->get( 'TXN_ID' ); |
|
1232 | + return $this->get('TXN_ID'); |
|
1233 | 1233 | } |
1234 | 1234 | |
1235 | 1235 | |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | * @return int |
1239 | 1239 | */ |
1240 | 1240 | public function ticket_ID() { |
1241 | - return $this->get( 'TKT_ID' ); |
|
1241 | + return $this->get('TKT_ID'); |
|
1242 | 1242 | } |
1243 | 1243 | |
1244 | 1244 | |
@@ -1250,17 +1250,17 @@ discard block |
||
1250 | 1250 | * @param string $REG_code Registration Code |
1251 | 1251 | * @param boolean $use_default |
1252 | 1252 | */ |
1253 | - public function set_reg_code( $REG_code, $use_default = FALSE ) { |
|
1254 | - if ( empty( $REG_code )) { |
|
1255 | - EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1253 | + public function set_reg_code($REG_code, $use_default = FALSE) { |
|
1254 | + if (empty($REG_code)) { |
|
1255 | + EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1256 | 1256 | return; |
1257 | 1257 | } |
1258 | - if ( ! $this->reg_code() ) { |
|
1259 | - parent::set( 'REG_code', $REG_code, $use_default ); |
|
1258 | + if ( ! $this->reg_code()) { |
|
1259 | + parent::set('REG_code', $REG_code, $use_default); |
|
1260 | 1260 | } else { |
1261 | 1261 | EE_Error::doing_it_wrong( |
1262 | - __CLASS__ . '::' . __FUNCTION__, |
|
1263 | - __( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ), |
|
1262 | + __CLASS__.'::'.__FUNCTION__, |
|
1263 | + __('Can not change a registration REG_code once it has been set.', 'event_espresso'), |
|
1264 | 1264 | '4.6.0' |
1265 | 1265 | ); |
1266 | 1266 | } |
@@ -1280,17 +1280,17 @@ discard block |
||
1280 | 1280 | * @return EE_Registration[] or empty array if this isn't a group registration. |
1281 | 1281 | */ |
1282 | 1282 | public function get_all_other_registrations_in_group() { |
1283 | - if ( $this->group_size() < 2 ) { |
|
1283 | + if ($this->group_size() < 2) { |
|
1284 | 1284 | return array(); |
1285 | 1285 | } |
1286 | 1286 | |
1287 | 1287 | $query[0] = array( |
1288 | 1288 | 'TXN_ID' => $this->transaction_ID(), |
1289 | - 'REG_ID' => array( '!=', $this->ID() ), |
|
1289 | + 'REG_ID' => array('!=', $this->ID()), |
|
1290 | 1290 | 'TKT_ID' => $this->ticket_ID() |
1291 | 1291 | ); |
1292 | 1292 | |
1293 | - $registrations = $this->get_model()->get_all( $query ); |
|
1293 | + $registrations = $this->get_model()->get_all($query); |
|
1294 | 1294 | return $registrations; |
1295 | 1295 | } |
1296 | 1296 | |
@@ -1299,14 +1299,14 @@ discard block |
||
1299 | 1299 | * @return string |
1300 | 1300 | */ |
1301 | 1301 | public function get_admin_details_link() { |
1302 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
1302 | + EE_Registry::instance()->load_helper('URL'); |
|
1303 | 1303 | return EEH_URL::add_query_args_and_nonce( |
1304 | 1304 | array( |
1305 | 1305 | 'page' => 'espresso_registrations', |
1306 | 1306 | 'action' => 'view_registration', |
1307 | 1307 | '_REG_ID' => $this->ID() |
1308 | 1308 | ), |
1309 | - admin_url( 'admin.php' ) |
|
1309 | + admin_url('admin.php') |
|
1310 | 1310 | ); |
1311 | 1311 | } |
1312 | 1312 | |
@@ -1331,12 +1331,12 @@ discard block |
||
1331 | 1331 | * @return string |
1332 | 1332 | */ |
1333 | 1333 | public function get_admin_overview_link() { |
1334 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
1334 | + EE_Registry::instance()->load_helper('URL'); |
|
1335 | 1335 | return EEH_URL::add_query_args_and_nonce( |
1336 | 1336 | array( |
1337 | 1337 | 'page' => 'espresso_registrations' |
1338 | 1338 | ), |
1339 | - admin_url( 'admin.php' ) |
|
1339 | + admin_url('admin.php') |
|
1340 | 1340 | ); |
1341 | 1341 | } |
1342 | 1342 | |
@@ -1347,8 +1347,8 @@ discard block |
||
1347 | 1347 | * @return \EE_Registration[] |
1348 | 1348 | * @throws \EE_Error |
1349 | 1349 | */ |
1350 | - public function payments( $query_params = array() ) { |
|
1351 | - return $this->get_many_related( 'Payment', $query_params ); |
|
1350 | + public function payments($query_params = array()) { |
|
1351 | + return $this->get_many_related('Payment', $query_params); |
|
1352 | 1352 | } |
1353 | 1353 | |
1354 | 1354 | |
@@ -1358,8 +1358,8 @@ discard block |
||
1358 | 1358 | * @return \EE_Registration_Payment[] |
1359 | 1359 | * @throws \EE_Error |
1360 | 1360 | */ |
1361 | - public function registration_payments( $query_params = array() ) { |
|
1362 | - return $this->get_many_related( 'Registration_Payment', $query_params ); |
|
1361 | + public function registration_payments($query_params = array()) { |
|
1362 | + return $this->get_many_related('Registration_Payment', $query_params); |
|
1363 | 1363 | } |
1364 | 1364 | |
1365 | 1365 | |
@@ -1372,7 +1372,7 @@ discard block |
||
1372 | 1372 | * @return EE_Payment_Method|null |
1373 | 1373 | */ |
1374 | 1374 | public function payment_method() { |
1375 | - return EEM_Payment_Method::instance()->get_last_used_for_registration( $this ); |
|
1375 | + return EEM_Payment_Method::instance()->get_last_used_for_registration($this); |
|
1376 | 1376 | } |
1377 | 1377 | |
1378 | 1378 |
@@ -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 | /** |
@@ -46,22 +46,22 @@ discard block |
||
46 | 46 | * @return string the assembled html string containing the tabbed content for display. |
47 | 47 | * @throws \EE_Error |
48 | 48 | */ |
49 | - public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE ) { |
|
49 | + public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE) { |
|
50 | 50 | |
51 | 51 | //first check if $tabs_names is not empty then the count must match the count of $tabs_content otherwise we've got a problem houston |
52 | - if ( !empty( $tabs_names) && ( count( (array) $tabs_names) != count( (array) $tabs_content) ) ) { |
|
53 | - throw new EE_Error( __('The count for $tabs_names and $tabs_content does not match.', 'event_espresso') ); |
|
52 | + if ( ! empty($tabs_names) && (count((array) $tabs_names) != count((array) $tabs_content))) { |
|
53 | + throw new EE_Error(__('The count for $tabs_names and $tabs_content does not match.', 'event_espresso')); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | //make sure we've got incoming data setup properly |
57 | - $tabs = !empty( $tabs_names ) ? (array) $tabs_names : array_keys( (array) $tabs_contents ); |
|
58 | - $tabs_content = !empty( $tabs_names ) ? array_combine( (array) $tabs_names, (array) $tabs_content ) : $tabs_contents; |
|
57 | + $tabs = ! empty($tabs_names) ? (array) $tabs_names : array_keys((array) $tabs_contents); |
|
58 | + $tabs_content = ! empty($tabs_names) ? array_combine((array) $tabs_names, (array) $tabs_content) : $tabs_contents; |
|
59 | 59 | |
60 | - $all_tabs = '<h2 class="nav-tab-wrapper">' . "\n"; |
|
60 | + $all_tabs = '<h2 class="nav-tab-wrapper">'."\n"; |
|
61 | 61 | $all_tabs_content = ''; |
62 | 62 | |
63 | 63 | $index = 0; |
64 | - foreach ( $tabs as $tab ) { |
|
64 | + foreach ($tabs as $tab) { |
|
65 | 65 | $active = $index === 0 ? true : false; |
66 | 66 | $all_tabs .= self::tab($tab, $active); |
67 | 67 | $all_tabs_content .= self::tab_content($tab, $tabs_content[$tab], $active); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $tab_container_class = $small_tabs ? 'ee-nav-tabs ee-nav-tabs-small' : 'ee-nav-tabs'; |
80 | 80 | |
81 | - return '<div class="'. $tab_container_class . '">' . "\n\t" . $all_tabs . $all_tabs_content . "\n" . '</div>'; |
|
81 | + return '<div class="'.$tab_container_class.'">'."\n\t".$all_tabs.$all_tabs_content."\n".'</div>'; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | * @throws \EE_Error |
103 | 103 | */ |
104 | 104 | public static function display_admin_nav_tabs($nav_tabs = array()) { |
105 | - if ( empty($nav_tabs) ) |
|
106 | - throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) ); |
|
105 | + if (empty($nav_tabs)) |
|
106 | + throw new EE_Error(__('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso')); |
|
107 | 107 | |
108 | - $all_tabs = '<h2 class="nav-tab-wrapper">' . "\n"; |
|
109 | - foreach ( $nav_tabs as $slug => $tab ) { |
|
108 | + $all_tabs = '<h2 class="nav-tab-wrapper">'."\n"; |
|
109 | + foreach ($nav_tabs as $slug => $tab) { |
|
110 | 110 | $all_tabs .= self::tab($slug, false, $tab['link_text'], $tab['url'], $tab['css_class']); |
111 | 111 | } |
112 | 112 | $all_tabs .= '</h2>'; |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | * @param bool|string $css If string given then the generated tab will include that as the class. |
123 | 123 | * @return string html for tab |
124 | 124 | */ |
125 | - private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE ) { |
|
125 | + private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE) { |
|
126 | 126 | $name = str_replace(' ', '-', $name); |
127 | 127 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
128 | - $class = $css ? $class . ' ' . $css : $class; |
|
129 | - $nice_name = $nice_name ? $nice_name : ucwords( preg_replace('/(-|_)/', ' ', $name) ); |
|
130 | - $url = $url ? $url : '#' . $name; |
|
131 | - $tab = '<a class="' . $class . '" rel="ee-tab-' . $name . '" href="' . $url . '">' . $nice_name . '</a>' . "\n\t"; |
|
128 | + $class = $css ? $class.' '.$css : $class; |
|
129 | + $nice_name = $nice_name ? $nice_name : ucwords(preg_replace('/(-|_)/', ' ', $name)); |
|
130 | + $url = $url ? $url : '#'.$name; |
|
131 | + $tab = '<a class="'.$class.'" rel="ee-tab-'.$name.'" href="'.$url.'">'.$nice_name.'</a>'."\n\t"; |
|
132 | 132 | return $tab; |
133 | 133 | } |
134 | 134 | |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | */ |
145 | 145 | private static function tab_content($name, $tab_content, $active = false) { |
146 | 146 | $class = $active ? 'nav-tab-content' : 'nav-tab-content hidden'; |
147 | - $name = str_replace( ' ', '-', $name); |
|
148 | - $content = "\t" . '<div class="'. $class . '" id="ee-tab-' . $name . '">' . "\n"; |
|
149 | - $content .= "\t" . $tab_content . "\n"; |
|
147 | + $name = str_replace(' ', '-', $name); |
|
148 | + $content = "\t".'<div class="'.$class.'" id="ee-tab-'.$name.'">'."\n"; |
|
149 | + $content .= "\t".$tab_content."\n"; |
|
150 | 150 | $content .= '<div style="clear:both"></div></div>'; |
151 | 151 | return $content; |
152 | 152 | } |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | * @param string $default You can include a string for the item that will receive the "item_display" class for the js. |
173 | 173 | * @return string a html snippet of of all the formatted link elements. |
174 | 174 | */ |
175 | - public static function tab_text_links( $item_array, $container_class = '', $sep = '|', $default = '' ) { |
|
176 | - $item_array = apply_filters( 'FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class ); |
|
177 | - if ( !is_array($item_array) || empty( $item_array ) ) |
|
175 | + public static function tab_text_links($item_array, $container_class = '', $sep = '|', $default = '') { |
|
176 | + $item_array = apply_filters('FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class); |
|
177 | + if ( ! is_array($item_array) || empty($item_array)) |
|
178 | 178 | return false; //get out we don't have even the basic thing we need! |
179 | 179 | |
180 | 180 | |
@@ -185,15 +185,15 @@ discard block |
||
185 | 185 | 'title' => esc_attr__('Link for Item', 'event_espresso'), |
186 | 186 | 'slug' => 'item_slug' |
187 | 187 | ); |
188 | - $container_class = !empty($container_class) ? 'ee-text-links ' . $container_class : 'ee-text-links'; |
|
189 | - $list = '<ul class="' . $container_class . '">'; |
|
188 | + $container_class = ! empty($container_class) ? 'ee-text-links '.$container_class : 'ee-text-links'; |
|
189 | + $list = '<ul class="'.$container_class.'">'; |
|
190 | 190 | |
191 | 191 | $ci = 1; |
192 | - foreach ( $item_array as $item ) { |
|
193 | - $item = wp_parse_args( $item, $defaults ); |
|
194 | - $item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class']; |
|
192 | + foreach ($item_array as $item) { |
|
193 | + $item = wp_parse_args($item, $defaults); |
|
194 | + $item['class'] = ! empty($default) && $default == $item['slug'] ? 'item_display '.$item['class'] : $item['class']; |
|
195 | 195 | $list .= self::_text_link_item($item); |
196 | - if ( !empty($sep) && $ci != count($item_array) ) |
|
196 | + if ( ! empty($sep) && $ci != count($item_array)) |
|
197 | 197 | $list .= self::_text_link_item($sep); |
198 | 198 | $ci++; |
199 | 199 | } |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | |
205 | 205 | |
206 | 206 | |
207 | - private static function _text_link_item( $item ) { |
|
207 | + private static function _text_link_item($item) { |
|
208 | 208 | //if this isn't an array then we're doing a separator |
209 | - if ( !is_array( $item ) ) { |
|
209 | + if ( ! is_array($item)) { |
|
210 | 210 | $label = $item; |
211 | 211 | $class = 'ee-text-link-sep'; |
212 | 212 | $href = ''; |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | extract($item); |
216 | 216 | } |
217 | 217 | |
218 | - $class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li ' . $class . '"' : 'class="ee-text-link-sep"'; |
|
218 | + $class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li '.$class.'"' : 'class="ee-text-link-sep"'; |
|
219 | 219 | |
220 | - $content = '<li ' . $class . '>'; |
|
221 | - $content .= !empty($href) ? '<a class="ee-text-link" href="#' . $href . '" title="' . $title . '">' : ''; |
|
220 | + $content = '<li '.$class.'>'; |
|
221 | + $content .= ! empty($href) ? '<a class="ee-text-link" href="#'.$href.'" title="'.$title.'">' : ''; |
|
222 | 222 | $content .= $label; |
223 | - $content .= !empty($href) ? '</a>' : ''; |
|
223 | + $content .= ! empty($href) ? '</a>' : ''; |
|
224 | 224 | $content .= '</li>'; |
225 | 225 | return $content; |
226 | 226 | } |
@@ -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 |
@@ -102,8 +103,9 @@ discard block |
||
102 | 103 | * @throws \EE_Error |
103 | 104 | */ |
104 | 105 | public static function display_admin_nav_tabs($nav_tabs = array()) { |
105 | - if ( empty($nav_tabs) ) |
|
106 | - throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) ); |
|
106 | + if ( empty($nav_tabs) ) { |
|
107 | + throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) ); |
|
108 | + } |
|
107 | 109 | |
108 | 110 | $all_tabs = '<h2 class="nav-tab-wrapper">' . "\n"; |
109 | 111 | foreach ( $nav_tabs as $slug => $tab ) { |
@@ -174,8 +176,10 @@ discard block |
||
174 | 176 | */ |
175 | 177 | public static function tab_text_links( $item_array, $container_class = '', $sep = '|', $default = '' ) { |
176 | 178 | $item_array = apply_filters( 'FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class ); |
177 | - if ( !is_array($item_array) || empty( $item_array ) ) |
|
178 | - return false; //get out we don't have even the basic thing we need! |
|
179 | + if ( !is_array($item_array) || empty( $item_array ) ) { |
|
180 | + return false; |
|
181 | + } |
|
182 | + //get out we don't have even the basic thing we need! |
|
179 | 183 | |
180 | 184 | |
181 | 185 | $defaults = array( |
@@ -193,8 +197,9 @@ discard block |
||
193 | 197 | $item = wp_parse_args( $item, $defaults ); |
194 | 198 | $item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class']; |
195 | 199 | $list .= self::_text_link_item($item); |
196 | - if ( !empty($sep) && $ci != count($item_array) ) |
|
197 | - $list .= self::_text_link_item($sep); |
|
200 | + if ( !empty($sep) && $ci != count($item_array) ) { |
|
201 | + $list .= self::_text_link_item($sep); |
|
202 | + } |
|
198 | 203 | $ci++; |
199 | 204 | } |
200 | 205 |
@@ -715,7 +715,7 @@ |
||
715 | 715 | } |
716 | 716 | } |
717 | 717 | } |
718 | - } |
|
718 | + } |
|
719 | 719 | /** |
720 | 720 | * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731 |
721 | 721 | * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | //(all other times it gets resurrected from a wordpress option) |
17 | 17 | $stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*'); |
18 | 18 | $class_to_filepath = array(); |
19 | -foreach($stages as $filepath){ |
|
19 | +foreach ($stages as $filepath) { |
|
20 | 20 | $matches = array(); |
21 | - preg_match('~4_8_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
21 | + preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
22 | 22 | $class_to_filepath[$matches[1]] = $filepath; |
23 | 23 | } |
24 | 24 | //give addons a chance to autoload their stages too |
25 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages',$class_to_filepath); |
|
25 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath); |
|
26 | 26 | EEH_Autoloader::register_autoloader($class_to_filepath); |
27 | 27 | |
28 | 28 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @since 4.6.0 |
39 | 39 | * |
40 | 40 | */ |
41 | -class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base{ |
|
41 | +class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base { |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * return EE_DMS_Core_4_8_0 |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | * @param TableManager $table_manager |
47 | 47 | * @param TableAnalysis $table_analysis |
48 | 48 | */ |
49 | - public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) { |
|
49 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) { |
|
50 | 50 | $this->_pretty_name = __("Data Migration to Event Espresso 4.8.0.P (for promotions)", "event_espresso"); |
51 | 51 | $this->_priority = 10; |
52 | 52 | $this->_migration_stages = array( |
53 | 53 | new EE_DMS_4_8_0_pretax_totals(), |
54 | 54 | new EE_DMS_4_8_0_event_subtotals(), |
55 | 55 | ); |
56 | - parent::__construct( $table_manager, $table_analysis ); |
|
56 | + parent::__construct($table_manager, $table_analysis); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function can_migrate_from_version($version_array) { |
70 | 70 | $version_string = $version_array['Core']; |
71 | - if ( version_compare( $version_string, '4.8.0', '<=' ) && version_compare( $version_string, '4.7.0', '>=' ) ) { |
|
71 | + if (version_compare($version_string, '4.8.0', '<=') && version_compare($version_string, '4.7.0', '>=')) { |
|
72 | 72 | // echo "$version_string can be migrated from"; |
73 | 73 | return true; |
74 | - }elseif( ! $version_string ){ |
|
74 | + }elseif ( ! $version_string) { |
|
75 | 75 | // echo "no version string provided: $version_string"; |
76 | 76 | //no version string provided... this must be pre 4.3 |
77 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
78 | - }else{ |
|
77 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
78 | + } else { |
|
79 | 79 | // echo "$version_string doesnt apply"; |
80 | 80 | return false; |
81 | 81 | } |
@@ -96,19 +96,19 @@ discard block |
||
96 | 96 | * @return bool |
97 | 97 | */ |
98 | 98 | public function schema_changes_before_migration() { |
99 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
100 | - $now_in_mysql = current_time( 'mysql', true ); |
|
99 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
100 | + $now_in_mysql = current_time('mysql', true); |
|
101 | 101 | |
102 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
103 | - $table_name='esp_answer'; |
|
104 | - $sql=" ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
102 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
103 | + $table_name = 'esp_answer'; |
|
104 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
105 | 105 | REG_ID int(10) unsigned NOT NULL, |
106 | 106 | QST_ID int(10) unsigned NOT NULL, |
107 | 107 | ANS_value text NOT NULL, |
108 | 108 | PRIMARY KEY (ANS_ID), |
109 | 109 | KEY REG_ID (REG_ID), |
110 | 110 | KEY QST_ID (QST_ID)"; |
111 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
111 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
112 | 112 | |
113 | 113 | $table_name = 'esp_attendee_meta'; |
114 | 114 | $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | CNT_is_EU tinyint(1) DEFAULT '0', |
149 | 149 | CNT_active tinyint(1) DEFAULT '0', |
150 | 150 | PRIMARY KEY (CNT_ISO)"; |
151 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
151 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
152 | 152 | |
153 | 153 | $table_name = 'esp_currency'; |
154 | 154 | $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2', |
159 | 159 | CUR_active tinyint(1) DEFAULT '0', |
160 | 160 | PRIMARY KEY (CUR_code)"; |
161 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
161 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
162 | 162 | |
163 | 163 | |
164 | 164 | $table_name = 'esp_currency_payment_method'; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | KEY EVT_ID (EVT_ID), |
189 | 189 | KEY DTT_is_primary (DTT_is_primary)"; |
190 | 190 | |
191 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
191 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
192 | 192 | |
193 | 193 | $table_name = 'esp_event_meta'; |
194 | 194 | $sql = " |
@@ -207,41 +207,41 @@ discard block |
||
207 | 207 | EVT_donations tinyint(1) NULL, |
208 | 208 | PRIMARY KEY (EVTM_ID), |
209 | 209 | KEY EVT_ID (EVT_ID)"; |
210 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
210 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
211 | 211 | |
212 | 212 | |
213 | 213 | |
214 | - $table_name='esp_event_question_group'; |
|
215 | - $sql="EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
214 | + $table_name = 'esp_event_question_group'; |
|
215 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
216 | 216 | EVT_ID bigint(20) unsigned NOT NULL, |
217 | 217 | QSG_ID int(10) unsigned NOT NULL, |
218 | 218 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
219 | 219 | PRIMARY KEY (EQG_ID), |
220 | 220 | KEY EVT_ID (EVT_ID), |
221 | 221 | KEY QSG_ID (QSG_ID)"; |
222 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
222 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
223 | 223 | |
224 | 224 | |
225 | 225 | |
226 | - $table_name='esp_event_venue'; |
|
227 | - $sql="EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
226 | + $table_name = 'esp_event_venue'; |
|
227 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
228 | 228 | EVT_ID bigint(20) unsigned NOT NULL, |
229 | 229 | VNU_ID bigint(20) unsigned NOT NULL, |
230 | 230 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
231 | 231 | PRIMARY KEY (EVV_ID)"; |
232 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
232 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
233 | 233 | |
234 | 234 | |
235 | 235 | |
236 | - $table_name='esp_extra_meta'; |
|
237 | - $sql="EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
236 | + $table_name = 'esp_extra_meta'; |
|
237 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
238 | 238 | OBJ_ID int(11) DEFAULT NULL, |
239 | 239 | EXM_type varchar(45) DEFAULT NULL, |
240 | 240 | EXM_key varchar(45) DEFAULT NULL, |
241 | 241 | EXM_value text, |
242 | 242 | PRIMARY KEY (EXM_ID), |
243 | 243 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
244 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
244 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
245 | 245 | |
246 | 246 | $table_name = 'esp_extra_join'; |
247 | 247 | $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
@@ -254,8 +254,8 @@ discard block |
||
254 | 254 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
255 | 255 | $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
256 | 256 | |
257 | - $table_name='esp_line_item'; |
|
258 | - $sql="LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
257 | + $table_name = 'esp_line_item'; |
|
258 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
259 | 259 | LIN_code varchar(245) NOT NULL DEFAULT '', |
260 | 260 | TXN_ID int(11) DEFAULT NULL, |
261 | 261 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | PRIMARY KEY (LIN_ID), |
275 | 275 | KEY LIN_code (LIN_code(191)), |
276 | 276 | KEY TXN_ID (TXN_ID)"; |
277 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' ); |
|
277 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
278 | 278 | |
279 | 279 | $table_name = 'esp_log'; |
280 | 280 | $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
314 | 314 | PRIMARY KEY (GRP_ID), |
315 | 315 | KEY MTP_user_id (MTP_user_id)"; |
316 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
316 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
317 | 317 | |
318 | 318 | $table_name = 'esp_event_message_template'; |
319 | 319 | $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | PRIMARY KEY (EMT_ID), |
323 | 323 | KEY EVT_ID (EVT_ID), |
324 | 324 | KEY GRP_ID (GRP_ID)"; |
325 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
325 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
326 | 326 | |
327 | 327 | |
328 | 328 | $table_name = 'esp_payment'; |
@@ -395,8 +395,8 @@ discard block |
||
395 | 395 | PRIMARY KEY (TTM_ID)"; |
396 | 396 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
397 | 397 | |
398 | - $table_name='esp_question'; |
|
399 | - $sql='QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
398 | + $table_name = 'esp_question'; |
|
399 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
400 | 400 | QST_display_text text NOT NULL, |
401 | 401 | QST_admin_label varchar(255) NOT NULL, |
402 | 402 | QST_system varchar(25) NOT NULL DEFAULT "", |
@@ -410,22 +410,22 @@ discard block |
||
410 | 410 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
411 | 411 | PRIMARY KEY (QST_ID), |
412 | 412 | KEY QST_order (QST_order)'; |
413 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
413 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
414 | 414 | |
415 | - $table_name='esp_question_group_question'; |
|
416 | - $sql="QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
415 | + $table_name = 'esp_question_group_question'; |
|
416 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
417 | 417 | QSG_ID int(10) unsigned NOT NULL, |
418 | 418 | QST_ID int(10) unsigned NOT NULL, |
419 | 419 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
420 | 420 | PRIMARY KEY (QGQ_ID), |
421 | 421 | KEY QST_ID (QST_ID), |
422 | 422 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
423 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
423 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
424 | 424 | |
425 | 425 | |
426 | 426 | |
427 | - $table_name='esp_question_option'; |
|
428 | - $sql="QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
427 | + $table_name = 'esp_question_option'; |
|
428 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
429 | 429 | QSO_value varchar(255) NOT NULL, |
430 | 430 | QSO_desc text NOT NULL, |
431 | 431 | QST_ID int(10) unsigned NOT NULL, |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | PRIMARY KEY (QSO_ID), |
436 | 436 | KEY QST_ID (QST_ID), |
437 | 437 | KEY QSO_order (QSO_order)"; |
438 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
438 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
439 | 439 | |
440 | 440 | |
441 | 441 | |
@@ -481,8 +481,8 @@ discard block |
||
481 | 481 | |
482 | 482 | |
483 | 483 | |
484 | - $table_name='esp_checkin'; |
|
485 | - $sql="CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
484 | + $table_name = 'esp_checkin'; |
|
485 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
486 | 486 | REG_ID int(10) unsigned NOT NULL, |
487 | 487 | DTT_ID int(10) unsigned NOT NULL, |
488 | 488 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | PRC_parent int(10) unsigned DEFAULT 0, |
578 | 578 | PRIMARY KEY (PRC_ID), |
579 | 579 | KEY PRT_ID (PRT_ID)"; |
580 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
580 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
581 | 581 | |
582 | 582 | $table_name = "esp_price_type"; |
583 | 583 | $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
@@ -615,10 +615,10 @@ discard block |
||
615 | 615 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
616 | 616 | PRIMARY KEY (TKT_ID), |
617 | 617 | KEY TKT_start_date (TKT_start_date)"; |
618 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
618 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
619 | 619 | |
620 | 620 | $table_name = 'esp_question_group'; |
621 | - $sql='QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
621 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
622 | 622 | QSG_name varchar(255) NOT NULL, |
623 | 623 | QSG_identifier varchar(100) NOT NULL, |
624 | 624 | QSG_desc text NULL, |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | PRIMARY KEY (QSG_ID), |
632 | 632 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
633 | 633 | KEY QSG_order (QSG_order)'; |
634 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
634 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
635 | 635 | |
636 | 636 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
637 | 637 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | return $script_4_7_defaults->schema_changes_after_migration(); |
668 | 668 | } |
669 | 669 | |
670 | - public function migration_page_hooks(){ |
|
670 | + public function migration_page_hooks() { |
|
671 | 671 | |
672 | 672 | } |
673 | 673 | |
@@ -681,19 +681,19 @@ discard block |
||
681 | 681 | //CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active |
682 | 682 | //('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
683 | 683 | $newer_countries = array( |
684 | - array( 'AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0 ), |
|
685 | - array( 'BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
686 | - array( 'CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0 ), |
|
687 | - array( 'GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0 ), |
|
688 | - array( 'IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
689 | - array( 'JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
690 | - array( 'MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
691 | - array( 'ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0 ), |
|
692 | - array( 'RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0 ), |
|
693 | - array( 'SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0 ), |
|
694 | - array( 'SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0 ), |
|
695 | - array( 'XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0 ), |
|
696 | - array( 'YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0 ), |
|
684 | + array('AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
685 | + array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
686 | + array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
687 | + array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
688 | + array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
689 | + array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
690 | + array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
691 | + array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
692 | + array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0), |
|
693 | + array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
694 | + array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
695 | + array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0), |
|
696 | + array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
697 | 697 | ); |
698 | 698 | global $wpdb; |
699 | 699 | $country_table = $wpdb->prefix."esp_country"; |
@@ -712,14 +712,14 @@ discard block |
||
712 | 712 | "CNT_is_EU" => '%d', |
713 | 713 | "CNT_active" => '%d', |
714 | 714 | ); |
715 | - if ( $this->_get_table_analysis()->tableExists( $country_table ) ) { |
|
716 | - foreach( $newer_countries as $country ) { |
|
717 | - $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1" ; |
|
715 | + if ($this->_get_table_analysis()->tableExists($country_table)) { |
|
716 | + foreach ($newer_countries as $country) { |
|
717 | + $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
718 | 718 | $countries = $wpdb->get_var($SQL); |
719 | - if ( ! $countries ) { |
|
719 | + if ( ! $countries) { |
|
720 | 720 | |
721 | - $wpdb->insert( $country_table, |
|
722 | - array_combine( array_keys( $country_format), $country ), |
|
721 | + $wpdb->insert($country_table, |
|
722 | + array_combine(array_keys($country_format), $country), |
|
723 | 723 | $country_format |
724 | 724 | ); |
725 | 725 | } |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
738 | 738 | //( 'EUR', 'Euro', 'Euros', '€', 2,1), |
739 | 739 | $newer_currencies = array( |
740 | - array( 'RSD', 'Dinar', 'Dinars', '', 3, 1 ), |
|
740 | + array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
741 | 741 | ); |
742 | 742 | global $wpdb; |
743 | 743 | $currency_table = $wpdb->prefix."esp_currency"; |
@@ -749,14 +749,14 @@ discard block |
||
749 | 749 | "CUR_dec_plc" => '%d', |
750 | 750 | "CUR_active" => '%d', |
751 | 751 | ); |
752 | - if ( $this->_get_table_analysis()->tableExists( $currency_table ) ) { |
|
753 | - foreach( $newer_currencies as $currency ) { |
|
754 | - $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1" ; |
|
752 | + if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
753 | + foreach ($newer_currencies as $currency) { |
|
754 | + $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
755 | 755 | $countries = $wpdb->get_var($SQL); |
756 | - if ( ! $countries ) { |
|
756 | + if ( ! $countries) { |
|
757 | 757 | |
758 | - $wpdb->insert( $currency_table, |
|
759 | - array_combine( array_keys( $currency_format), $currency ), |
|
758 | + $wpdb->insert($currency_table, |
|
759 | + array_combine(array_keys($currency_format), $currency), |
|
760 | 760 | $currency_format |
761 | 761 | ); |
762 | 762 | } |
@@ -768,9 +768,9 @@ discard block |
||
768 | 768 | * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
769 | 769 | * we should be able to stop doing this in 4.9 |
770 | 770 | */ |
771 | - public function fix_non_default_taxes(){ |
|
771 | + public function fix_non_default_taxes() { |
|
772 | 772 | global $wpdb; |
773 | - $query = $wpdb->prepare( "UPDATE |
|
773 | + $query = $wpdb->prepare("UPDATE |
|
774 | 774 | {$wpdb->prefix}esp_price p INNER JOIN |
775 | 775 | {$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID |
776 | 776 | SET |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | WHERE |
779 | 779 | p.PRC_is_default = 0 AND |
780 | 780 | pt.PBT_ID = %d |
781 | - ", EEM_Price_Type::base_type_tax ); |
|
782 | - $wpdb->query( $query ); |
|
781 | + ", EEM_Price_Type::base_type_tax); |
|
782 | + $wpdb->query($query); |
|
783 | 783 | } |
784 | 784 | } |
@@ -71,11 +71,11 @@ |
||
71 | 71 | if ( version_compare( $version_string, '4.8.0', '<=' ) && version_compare( $version_string, '4.7.0', '>=' ) ) { |
72 | 72 | // echo "$version_string can be migrated from"; |
73 | 73 | return true; |
74 | - }elseif( ! $version_string ){ |
|
74 | + } elseif( ! $version_string ){ |
|
75 | 75 | // echo "no version string provided: $version_string"; |
76 | 76 | //no version string provided... this must be pre 4.3 |
77 | 77 | return false;//changed mind. dont want people thinking they should migrate yet because they cant |
78 | - }else{ |
|
78 | + } else{ |
|
79 | 79 | // echo "$version_string doesnt apply"; |
80 | 80 | return false; |
81 | 81 | } |
@@ -34,37 +34,37 @@ |
||
34 | 34 | */ |
35 | 35 | class Post implements RequestMethod |
36 | 36 | { |
37 | - /** |
|
38 | - * URL to which requests are POSTed. |
|
39 | - * @const string |
|
40 | - */ |
|
41 | - const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify'; |
|
37 | + /** |
|
38 | + * URL to which requests are POSTed. |
|
39 | + * @const string |
|
40 | + */ |
|
41 | + const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify'; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Submit the POST request with the specified parameters. |
|
45 | - * |
|
46 | - * @param RequestParameters $params Request parameters |
|
47 | - * @return string Body of the reCAPTCHA response |
|
48 | - */ |
|
49 | - public function submit(RequestParameters $params) |
|
50 | - { |
|
51 | - /** |
|
52 | - * PHP 5.6.0 changed the way you specify the peer name for SSL context options. |
|
53 | - * Using "CN_name" will still work, but it will raise deprecated errors. |
|
54 | - */ |
|
55 | - $peer_key = version_compare(PHP_VERSION, '5.6.0', '<') ? 'CN_name' : 'peer_name'; |
|
56 | - $options = array( |
|
57 | - 'http' => array( |
|
58 | - 'header' => "Content-type: application/x-www-form-urlencoded\r\n", |
|
59 | - 'method' => 'POST', |
|
60 | - 'content' => $params->toQueryString(), |
|
61 | - // Force the peer to validate (not needed in 5.6.0+, but still works |
|
62 | - 'verify_peer' => true, |
|
63 | - // Force the peer validation to use www.google.com |
|
64 | - $peer_key => 'www.google.com', |
|
65 | - ), |
|
66 | - ); |
|
67 | - $context = stream_context_create($options); |
|
68 | - return file_get_contents(self::SITE_VERIFY_URL, false, $context); |
|
69 | - } |
|
43 | + /** |
|
44 | + * Submit the POST request with the specified parameters. |
|
45 | + * |
|
46 | + * @param RequestParameters $params Request parameters |
|
47 | + * @return string Body of the reCAPTCHA response |
|
48 | + */ |
|
49 | + public function submit(RequestParameters $params) |
|
50 | + { |
|
51 | + /** |
|
52 | + * PHP 5.6.0 changed the way you specify the peer name for SSL context options. |
|
53 | + * Using "CN_name" will still work, but it will raise deprecated errors. |
|
54 | + */ |
|
55 | + $peer_key = version_compare(PHP_VERSION, '5.6.0', '<') ? 'CN_name' : 'peer_name'; |
|
56 | + $options = array( |
|
57 | + 'http' => array( |
|
58 | + 'header' => "Content-type: application/x-www-form-urlencoded\r\n", |
|
59 | + 'method' => 'POST', |
|
60 | + 'content' => $params->toQueryString(), |
|
61 | + // Force the peer to validate (not needed in 5.6.0+, but still works |
|
62 | + 'verify_peer' => true, |
|
63 | + // Force the peer validation to use www.google.com |
|
64 | + $peer_key => 'www.google.com', |
|
65 | + ), |
|
66 | + ); |
|
67 | + $context = stream_context_create($options); |
|
68 | + return file_get_contents(self::SITE_VERIFY_URL, false, $context); |
|
69 | + } |
|
70 | 70 | } |
@@ -5,42 +5,42 @@ |
||
5 | 5 | <table class="admin-primary-mbox-tbl"> |
6 | 6 | <thead> |
7 | 7 | <tr> |
8 | - <th class="jst-left"><?php esc_html_e( 'Event Name', 'event_espresso' );?></th> |
|
9 | - <th class="jst-left"><?php esc_html_e( 'REG ID', 'event_espresso' );?></th> |
|
10 | - <th class="jst-left"><?php esc_html_e( 'TXN ID', 'event_espresso' );?></th> |
|
11 | - <th class="jst-left"><?php esc_html_e( 'Reg Code', 'event_espresso' );?></th> |
|
12 | - <th class="jst-rght"><?php esc_html_e( 'Ticket Price', 'event_espresso' );?></th> |
|
8 | + <th class="jst-left"><?php esc_html_e('Event Name', 'event_espresso'); ?></th> |
|
9 | + <th class="jst-left"><?php esc_html_e('REG ID', 'event_espresso'); ?></th> |
|
10 | + <th class="jst-left"><?php esc_html_e('TXN ID', 'event_espresso'); ?></th> |
|
11 | + <th class="jst-left"><?php esc_html_e('Reg Code', 'event_espresso'); ?></th> |
|
12 | + <th class="jst-rght"><?php esc_html_e('Ticket Price', 'event_espresso'); ?></th> |
|
13 | 13 | </tr> |
14 | 14 | </thead> |
15 | 15 | <tbody> |
16 | - <?php foreach( $registrations as $registration ) : ?> |
|
16 | + <?php foreach ($registrations as $registration) : ?> |
|
17 | 17 | <tr> |
18 | 18 | <td class="jst-left"> |
19 | 19 | <?php |
20 | - $event_url = add_query_arg( array( 'action' => 'edit', 'post' => $registration->event_ID() ), admin_url( 'admin.php?page=espresso_events' )); |
|
21 | - echo EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $registration->event_ID() ) ? '<a href="'. $event_url .'" title="'. esc_attr__( 'Edit Event', 'event_espresso' ) .'">' . $registration->event_name() . '</a>' : $registration->event_name(); |
|
20 | + $event_url = add_query_arg(array('action' => 'edit', 'post' => $registration->event_ID()), admin_url('admin.php?page=espresso_events')); |
|
21 | + echo EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $registration->event_ID()) ? '<a href="'.$event_url.'" title="'.esc_attr__('Edit Event', 'event_espresso').'">'.$registration->event_name().'</a>' : $registration->event_name(); |
|
22 | 22 | ?> |
23 | 23 | </td> |
24 | 24 | <td class="jst-left"> |
25 | 25 | <?php |
26 | - $reg_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
|
27 | - echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? ' |
|
28 | - <a href="'.$reg_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . |
|
29 | - esc_html__( 'View Registration', 'event_espresso' ) . |
|
26 | + $reg_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL); |
|
27 | + echo EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? ' |
|
28 | + <a href="'.$reg_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'. |
|
29 | + esc_html__('View Registration', 'event_espresso'). |
|
30 | 30 | '</a>' : $registration->ID(); |
31 | 31 | ?> |
32 | 32 | </td> |
33 | 33 | <td class="jst-left"> |
34 | 34 | <?php |
35 | - $txn_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID() ), TXN_ADMIN_URL ); |
|
36 | - echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? ' |
|
37 | - <a href="'.$txn_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '">' . |
|
38 | - sprintf( esc_html__('View Transaction %d', 'event_espresso'), $registration->transaction_ID() ) . |
|
35 | + $txn_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID()), TXN_ADMIN_URL); |
|
36 | + echo EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? ' |
|
37 | + <a href="'.$txn_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'">'. |
|
38 | + sprintf(esc_html__('View Transaction %d', 'event_espresso'), $registration->transaction_ID()). |
|
39 | 39 | '</a>' : $registration->transaction_ID(); |
40 | 40 | ?> |
41 | 41 | </td> |
42 | - <td class="jst-left"><?php echo $registration->reg_code();?></td> |
|
43 | - <td class="jst-rght"><?php echo EEH_Template::format_currency( $registration->final_price() );?></td> |
|
42 | + <td class="jst-left"><?php echo $registration->reg_code(); ?></td> |
|
43 | + <td class="jst-rght"><?php echo EEH_Template::format_currency($registration->final_price()); ?></td> |
|
44 | 44 | </tr> |
45 | 45 | <?php endforeach; ?> |
46 | 46 | </tbody> |