@@ -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 | } |
@@ -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 |
@@ -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,36 +35,36 @@ 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 | - \EE_Registry::instance()->load_helper( 'Export' ); |
|
60 | - \EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true ); |
|
58 | + $job_parameters->extra_datum('questions_data') ); |
|
59 | + \EE_Registry::instance()->load_helper('Export'); |
|
60 | + \EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true); |
|
61 | 61 | //if we actually processed a row there, record it |
62 | - if( $job_parameters->job_size() ) { |
|
63 | - $job_parameters->mark_processed( 1 ); |
|
62 | + if ($job_parameters->job_size()) { |
|
63 | + $job_parameters->mark_processed(1); |
|
64 | 64 | } |
65 | 65 | return new JobStepResponse( |
66 | 66 | $job_parameters, |
67 | - __( 'Registrations report started successfully...', 'event_espresso' ) |
|
67 | + __('Registrations report started successfully...', 'event_espresso') |
|
68 | 68 | ); |
69 | 69 | } |
70 | 70 | |
@@ -75,16 +75,16 @@ discard block |
||
75 | 75 | * @param int $event_id |
76 | 76 | * @return string |
77 | 77 | */ |
78 | - protected function get_filename_from_event( $event_id ) { |
|
79 | - if( $event_id ){ |
|
80 | - $event_slug = \EEM_Event::instance()->get_var( array( array( 'EVT_ID' => $event_id ) ), 'EVT_slug' ); |
|
81 | - if( ! $event_slug ) { |
|
82 | - $event_slug = __( 'unknown', 'event_espresso' ); |
|
78 | + protected function get_filename_from_event($event_id) { |
|
79 | + if ($event_id) { |
|
80 | + $event_slug = \EEM_Event::instance()->get_var(array(array('EVT_ID' => $event_id)), 'EVT_slug'); |
|
81 | + if ( ! $event_slug) { |
|
82 | + $event_slug = __('unknown', 'event_espresso'); |
|
83 | 83 | } |
84 | - }else{ |
|
85 | - $event_slug = __( 'all', 'event_espresso' ); |
|
84 | + } else { |
|
85 | + $event_slug = __('all', 'event_espresso'); |
|
86 | 86 | } |
87 | - return sprintf( "registrations-for-%s.csv", $event_slug ); |
|
87 | + return sprintf("registrations-for-%s.csv", $event_slug); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | * @param int|null $event_id |
94 | 94 | * @return array of wpdb results for questions which are to be used for this report |
95 | 95 | */ |
96 | - protected function _get_questions_for_report( $event_id ) { |
|
96 | + protected function _get_questions_for_report($event_id) { |
|
97 | 97 | $question_query_params = array( |
98 | 98 | array( |
99 | - 'Answer.ANS_ID' => array( 'IS_NOT_NULL' ), |
|
99 | + 'Answer.ANS_ID' => array('IS_NOT_NULL'), |
|
100 | 100 | ), |
101 | - 'group_by' => array( 'QST_ID' ) |
|
101 | + 'group_by' => array('QST_ID') |
|
102 | 102 | ); |
103 | - if( $event_id ) { |
|
103 | + if ($event_id) { |
|
104 | 104 | $question_query_params[0]['Answer.Registration.EVT_ID'] = $event_id; |
105 | 105 | } |
106 | - return \EEM_Question::instance()->get_all_wpdb_results( $question_query_params ); |
|
106 | + return \EEM_Question::instance()->get_all_wpdb_results($question_query_params); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
@@ -116,28 +116,28 @@ discard block |
||
116 | 116 | * @return JobStepResponse |
117 | 117 | * @throws \EE_Error |
118 | 118 | */ |
119 | - public function continue_job( JobParameters $job_parameters, $batch_size = 50 ) { |
|
119 | + public function continue_job(JobParameters $job_parameters, $batch_size = 50) { |
|
120 | 120 | $csv_data = $this->get_csv_data_for( |
121 | - $job_parameters->request_datum( 'EVT_ID', '0'), |
|
121 | + $job_parameters->request_datum('EVT_ID', '0'), |
|
122 | 122 | $job_parameters->units_processed(), |
123 | 123 | $batch_size, |
124 | - $job_parameters->extra_datum( 'questions_data' ) ); |
|
125 | - \EE_Registry::instance()->load_helper( 'Export' ); |
|
126 | - \EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false ); |
|
127 | - $units_processed = count( $csv_data ); |
|
128 | - $job_parameters->mark_processed( $units_processed ); |
|
124 | + $job_parameters->extra_datum('questions_data') ); |
|
125 | + \EE_Registry::instance()->load_helper('Export'); |
|
126 | + \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false); |
|
127 | + $units_processed = count($csv_data); |
|
128 | + $job_parameters->mark_processed($units_processed); |
|
129 | 129 | $extra_response_data = array( |
130 | 130 | 'file_url' => '' |
131 | 131 | ); |
132 | - if( $units_processed < $batch_size ) { |
|
133 | - $job_parameters->set_status( JobParameters::status_complete ); |
|
134 | - $extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) ); |
|
132 | + if ($units_processed < $batch_size) { |
|
133 | + $job_parameters->set_status(JobParameters::status_complete); |
|
134 | + $extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath')); |
|
135 | 135 | } |
136 | 136 | return new JobStepResponse( |
137 | 137 | $job_parameters, |
138 | 138 | sprintf( |
139 | - __( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ), |
|
140 | - count( $csv_data ) ), |
|
139 | + __('Wrote %1$s rows to report CSV file...', 'event_espresso'), |
|
140 | + count($csv_data) ), |
|
141 | 141 | $extra_response_data ); |
142 | 142 | } |
143 | 143 | |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | * @return array top-level keys are numeric, next-level keys are column headers |
151 | 151 | * |
152 | 152 | */ |
153 | - function get_csv_data_for( $event_id, $offset, $limit, $questions_for_these_regs_rows ) { |
|
154 | - \EE_Registry::instance()->load_helper( 'Export' ); |
|
153 | + function get_csv_data_for($event_id, $offset, $limit, $questions_for_these_regs_rows) { |
|
154 | + \EE_Registry::instance()->load_helper('Export'); |
|
155 | 155 | $reg_fields_to_include = array( |
156 | 156 | 'TXN_ID', |
157 | 157 | 'ATT_ID', |
@@ -182,165 +182,165 @@ discard block |
||
182 | 182 | array( |
183 | 183 | 'OR' => array( |
184 | 184 | //don't include registrations from failed or abandoned transactions... |
185 | - 'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ), |
|
185 | + 'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)), |
|
186 | 186 | //unless the registration is approved, in which case include it regardless of transaction status |
187 | 187 | 'STS_ID' => \EEM_Registration::status_id_approved |
188 | 188 | ), |
189 | - 'Ticket.TKT_deleted' => array( 'IN', array( true, false ) ) |
|
189 | + 'Ticket.TKT_deleted' => array('IN', array(true, false)) |
|
190 | 190 | ), |
191 | - 'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'), |
|
192 | - 'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ), |
|
193 | - 'limit' => array( $offset, $limit ), |
|
191 | + 'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'), |
|
192 | + 'force_join' => array('Transaction', 'Ticket', 'Attendee'), |
|
193 | + 'limit' => array($offset, $limit), |
|
194 | 194 | ), |
195 | 195 | $event_id |
196 | 196 | ); |
197 | - if( $event_id ){ |
|
198 | - $query_params[0]['EVT_ID'] = $event_id; |
|
199 | - }else{ |
|
200 | - $query_params[ 'force_join' ][] = 'Event'; |
|
197 | + if ($event_id) { |
|
198 | + $query_params[0]['EVT_ID'] = $event_id; |
|
199 | + } else { |
|
200 | + $query_params['force_join'][] = 'Event'; |
|
201 | 201 | } |
202 | - $registration_rows = $reg_model->get_all_wpdb_results( $query_params ); |
|
202 | + $registration_rows = $reg_model->get_all_wpdb_results($query_params); |
|
203 | 203 | //get all questions which relate to someone in this group |
204 | 204 | $registration_ids = array(); |
205 | - foreach( $registration_rows as $reg_row ) { |
|
206 | - $registration_ids[] = intval( $reg_row[ 'Registration.REG_ID'] ); |
|
205 | + foreach ($registration_rows as $reg_row) { |
|
206 | + $registration_ids[] = intval($reg_row['Registration.REG_ID']); |
|
207 | 207 | } |
208 | 208 | |
209 | - foreach($registration_rows as $reg_row){ |
|
210 | - if ( is_array( $reg_row ) ) { |
|
209 | + foreach ($registration_rows as $reg_row) { |
|
210 | + if (is_array($reg_row)) { |
|
211 | 211 | $reg_csv_array = array(); |
212 | - if( ! $event_id ){ |
|
212 | + if ( ! $event_id) { |
|
213 | 213 | //get the event's name and Id |
214 | - $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' ] ); |
|
214 | + $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']); |
|
215 | 215 | } |
216 | - $is_primary_reg = $reg_row[ 'Registration.REG_count' ] == '1' ? true : false; |
|
216 | + $is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false; |
|
217 | 217 | /*@var $reg_row EE_Registration */ |
218 | - foreach($reg_fields_to_include as $field_name){ |
|
218 | + foreach ($reg_fields_to_include as $field_name) { |
|
219 | 219 | $field = $reg_model->field_settings_for($field_name); |
220 | - if($field_name == 'REG_final_price'){ |
|
221 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' ); |
|
222 | - }elseif( $field_name == 'REG_count' ){ |
|
223 | - $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' ] ) ); |
|
224 | - }elseif( $field_name == 'REG_date' ) { |
|
225 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' ); |
|
226 | - }else{ |
|
227 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] ); |
|
220 | + if ($field_name == 'REG_final_price') { |
|
221 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_final_price'], 'localized_float'); |
|
222 | + }elseif ($field_name == 'REG_count') { |
|
223 | + $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'])); |
|
224 | + }elseif ($field_name == 'REG_date') { |
|
225 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_date'], 'no_html'); |
|
226 | + } else { |
|
227 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row[$field->get_qualified_column()]); |
|
228 | 228 | } |
229 | 229 | $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value; |
230 | - if($field_name == 'REG_final_price'){ |
|
230 | + if ($field_name == 'REG_final_price') { |
|
231 | 231 | //add a column named Currency after the final price |
232 | 232 | $reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code; |
233 | 233 | } |
234 | 234 | } |
235 | 235 | //get pretty status |
236 | - $stati = \EEM_Status::instance()->localized_status( array( |
|
237 | - $reg_row[ 'Registration.STS_ID' ] => __( 'unknown', 'event_espresso' ), |
|
238 | - $reg_row[ 'Transaction.STS_ID' ] => __( 'unknown', 'event_espresso' ) ), |
|
236 | + $stati = \EEM_Status::instance()->localized_status(array( |
|
237 | + $reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'), |
|
238 | + $reg_row['Transaction.STS_ID'] => __('unknown', 'event_espresso') ), |
|
239 | 239 | FALSE, |
240 | - 'sentence' ); |
|
241 | - $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[ $reg_row[ 'Registration.STS_ID' ] ]; |
|
240 | + 'sentence'); |
|
241 | + $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']]; |
|
242 | 242 | //get pretty transaction status |
243 | - $reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[ $reg_row[ 'Transaction.STS_ID' ] ]; |
|
244 | - $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[ 'Transaction.TXN_total' ], 'localized_float' ) : '0.00'; |
|
245 | - $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[ 'Transaction.TXN_paid' ], 'localized_float' ) : '0.00'; |
|
243 | + $reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[$reg_row['Transaction.STS_ID']]; |
|
244 | + $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['Transaction.TXN_total'], 'localized_float') : '0.00'; |
|
245 | + $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['Transaction.TXN_paid'], 'localized_float') : '0.00'; |
|
246 | 246 | $payment_methods = array(); |
247 | 247 | $gateway_txn_ids_etc = array(); |
248 | 248 | $payment_times = array(); |
249 | - if( $is_primary_reg && $reg_row[ 'Transaction.TXN_ID' ] ){ |
|
249 | + if ($is_primary_reg && $reg_row['Transaction.TXN_ID']) { |
|
250 | 250 | $payments_info = \EEM_Payment::instance()->get_all_wpdb_results( |
251 | 251 | array( |
252 | 252 | array( |
253 | - 'TXN_ID' => $reg_row[ 'Transaction.TXN_ID' ], |
|
253 | + 'TXN_ID' => $reg_row['Transaction.TXN_ID'], |
|
254 | 254 | 'STS_ID' => \EEM_Payment::status_id_approved |
255 | 255 | ), |
256 | - 'force_join' => array( 'Payment_Method' ), |
|
256 | + 'force_join' => array('Payment_Method'), |
|
257 | 257 | |
258 | 258 | ), |
259 | 259 | ARRAY_A, |
260 | 260 | 'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' ); |
261 | 261 | |
262 | - foreach( $payments_info as $payment_method_and_gateway_txn_id ){ |
|
263 | - $payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' ); |
|
264 | - $gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : ''; |
|
265 | - $payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : ''; |
|
262 | + foreach ($payments_info as $payment_method_and_gateway_txn_id) { |
|
263 | + $payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso'); |
|
264 | + $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : ''; |
|
265 | + $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) ? $payment_method_and_gateway_txn_id['payment_time'] : ''; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | } |
269 | - $reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times ); |
|
270 | - $reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods ); |
|
271 | - $reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc ); |
|
269 | + $reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times); |
|
270 | + $reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods); |
|
271 | + $reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc); |
|
272 | 272 | |
273 | 273 | //get whether or not the user has checked in |
274 | - $reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related( $reg_row[ 'Registration.REG_ID'] , 'Checkin' ); |
|
274 | + $reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin'); |
|
275 | 275 | //get ticket of registration and its price |
276 | 276 | $ticket_model = \EE_Registry::instance()->load_model('Ticket'); |
277 | - if( $reg_row[ 'Ticket.TKT_ID'] ) { |
|
278 | - $ticket_name = \EEH_Export::prepare_value_from_db_for_display( $ticket_model, 'TKT_name', $reg_row[ 'Ticket.TKT_name' ] ); |
|
277 | + if ($reg_row['Ticket.TKT_ID']) { |
|
278 | + $ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name', $reg_row['Ticket.TKT_name']); |
|
279 | 279 | $datetimes_strings = array(); |
280 | - 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){ |
|
281 | - $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display( \EEM_Datetime::instance(), 'DTT_EVT_start', $datetime[ 'Datetime.DTT_EVT_start'] ); |
|
280 | + 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) { |
|
281 | + $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(), 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | } else { |
285 | - $ticket_name = __( 'Unknown', 'event_espresso' ); |
|
286 | - $datetimes_strings = array( __( 'Unknown', 'event_espresso' ) ); |
|
285 | + $ticket_name = __('Unknown', 'event_espresso'); |
|
286 | + $datetimes_strings = array(__('Unknown', 'event_espresso')); |
|
287 | 287 | } |
288 | 288 | $reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name; |
289 | 289 | $reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings); |
290 | 290 | //get datetime(s) of registration |
291 | 291 | |
292 | 292 | //add attendee columns |
293 | - foreach($att_fields_to_include as $att_field_name){ |
|
293 | + foreach ($att_fields_to_include as $att_field_name) { |
|
294 | 294 | $field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name); |
295 | - if( $reg_row[ 'Attendee_CPT.ID' ]){ |
|
296 | - if($att_field_name == 'STA_ID'){ |
|
297 | - $value = \EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' ); |
|
298 | - }elseif($att_field_name == 'CNT_ISO'){ |
|
299 | - $value = \EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' ); |
|
300 | - }else{ |
|
301 | - $value = \EEH_Export::prepare_value_from_db_for_display( \EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] ); |
|
295 | + if ($reg_row['Attendee_CPT.ID']) { |
|
296 | + if ($att_field_name == 'STA_ID') { |
|
297 | + $value = \EEM_State::instance()->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), 'STA_name'); |
|
298 | + }elseif ($att_field_name == 'CNT_ISO') { |
|
299 | + $value = \EEM_Country::instance()->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), 'CNT_name'); |
|
300 | + } else { |
|
301 | + $value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(), $att_field_name, $reg_row[$field_obj->get_qualified_column()]); |
|
302 | 302 | } |
303 | - }else{ |
|
303 | + } else { |
|
304 | 304 | $value = ''; |
305 | 305 | } |
306 | 306 | |
307 | - $reg_csv_array[ \EEH_Export::get_column_name_for_field($field_obj) ] = $value; |
|
307 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value; |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | //make sure each registration has the same questions in the same order |
311 | - foreach($questions_for_these_regs_rows as $question_row){ |
|
312 | - if( ! isset($reg_csv_array[$question_row[ 'Question.QST_admin_label']])){ |
|
313 | - $reg_csv_array[$question_row[ 'Question.QST_admin_label' ] ] = null; |
|
311 | + foreach ($questions_for_these_regs_rows as $question_row) { |
|
312 | + if ( ! isset($reg_csv_array[$question_row['Question.QST_admin_label']])) { |
|
313 | + $reg_csv_array[$question_row['Question.QST_admin_label']] = null; |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | $answers = \EEM_Answer::instance()->get_all_wpdb_results( |
317 | 317 | array( |
318 | - array( 'REG_ID' => $reg_row[ 'Registration.REG_ID' ] ), |
|
319 | - 'force_join' => array( 'Question' ) |
|
318 | + array('REG_ID' => $reg_row['Registration.REG_ID']), |
|
319 | + 'force_join' => array('Question') |
|
320 | 320 | ) |
321 | 321 | ); |
322 | 322 | //now fill out the questions THEY answered |
323 | - foreach( $answers as $answer_row ){ |
|
324 | - if( $answer_row[ 'Question.QST_ID' ] ){ |
|
323 | + foreach ($answers as $answer_row) { |
|
324 | + if ($answer_row['Question.QST_ID']) { |
|
325 | 325 | $question_label = \EEH_Export::prepare_value_from_db_for_display( |
326 | 326 | \EEM_Question::instance(), |
327 | 327 | 'QST_admin_label', |
328 | - $answer_row[ 'Question.QST_admin_label' ] |
|
328 | + $answer_row['Question.QST_admin_label'] |
|
329 | 329 | ); |
330 | 330 | } else { |
331 | - $question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] ); |
|
331 | + $question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']); |
|
332 | 332 | } |
333 | - if ( isset( $answer_row[ 'Question.QST_type' ] ) |
|
334 | - && $answer_row[ 'Question.QST_type' ] == \EEM_Question::QST_type_state |
|
333 | + if (isset($answer_row['Question.QST_type']) |
|
334 | + && $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state |
|
335 | 335 | ) { |
336 | - $reg_csv_array[ $question_label ] = \EEM_State::instance()->get_state_name_by_ID( |
|
337 | - $answer_row[ 'Answer.ANS_value' ] |
|
336 | + $reg_csv_array[$question_label] = \EEM_State::instance()->get_state_name_by_ID( |
|
337 | + $answer_row['Answer.ANS_value'] |
|
338 | 338 | ); |
339 | 339 | } else { |
340 | - $reg_csv_array[ $question_label ] = \EEH_Export::prepare_value_from_db_for_display( |
|
340 | + $reg_csv_array[$question_label] = \EEH_Export::prepare_value_from_db_for_display( |
|
341 | 341 | \EEM_Answer::instance(), |
342 | 342 | 'ANS_value', |
343 | - $answer_row[ 'Answer.ANS_value' ] |
|
343 | + $answer_row['Answer.ANS_value'] |
|
344 | 344 | ); |
345 | 345 | } |
346 | 346 | } |
@@ -351,17 +351,17 @@ discard block |
||
351 | 351 | } |
352 | 352 | } |
353 | 353 | //if we couldn't export anything, we want to at least show the column headers |
354 | - if ( empty( $registrations_csv_ready_array ) ) { |
|
354 | + if (empty($registrations_csv_ready_array)) { |
|
355 | 355 | $reg_csv_array = array(); |
356 | 356 | $model_and_fields_to_include = array( |
357 | 357 | 'Registration' => $reg_fields_to_include, |
358 | 358 | 'Attendee' => $att_fields_to_include |
359 | 359 | ); |
360 | - foreach ( $model_and_fields_to_include as $model_name => $field_list ) { |
|
361 | - $model = \EE_Registry::instance()->load_model( $model_name ); |
|
362 | - foreach ( $field_list as $field_name ) { |
|
363 | - $field = $model->field_settings_for( $field_name ); |
|
364 | - $reg_csv_array[ \EEH_Export::get_column_name_for_field( $field ) ] = null; |
|
360 | + foreach ($model_and_fields_to_include as $model_name => $field_list) { |
|
361 | + $model = \EE_Registry::instance()->load_model($model_name); |
|
362 | + foreach ($field_list as $field_name) { |
|
363 | + $field = $model->field_settings_for($field_name); |
|
364 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null; |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | $registrations_csv_ready_array[] = $reg_csv_array; |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | * @param int $event_id |
378 | 378 | * @return int |
379 | 379 | */ |
380 | - public function count_units_to_process( $event_id ) { |
|
380 | + public function count_units_to_process($event_id) { |
|
381 | 381 | //use the legacy filter |
382 | 382 | $query_params = apply_filters( |
383 | 383 | 'FHEE__EE_Export__report_registration_for_event', |
@@ -385,23 +385,23 @@ discard block |
||
385 | 385 | array( |
386 | 386 | 'OR' => array( |
387 | 387 | //don't include registrations from failed or abandoned transactions... |
388 | - 'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ), |
|
388 | + 'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)), |
|
389 | 389 | //unless the registration is approved, in which case include it regardless of transaction status |
390 | 390 | 'STS_ID' => \EEM_Registration::status_id_approved |
391 | 391 | ), |
392 | - 'Ticket.TKT_deleted' => array( 'IN', array( true, false ) ) |
|
392 | + 'Ticket.TKT_deleted' => array('IN', array(true, false)) |
|
393 | 393 | ), |
394 | - 'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'), |
|
395 | - 'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ) |
|
394 | + 'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'), |
|
395 | + 'force_join' => array('Transaction', 'Ticket', 'Attendee') |
|
396 | 396 | ), |
397 | 397 | $event_id |
398 | 398 | ); |
399 | - if( $event_id ){ |
|
400 | - $query_params[0]['EVT_ID'] = $event_id; |
|
399 | + if ($event_id) { |
|
400 | + $query_params[0]['EVT_ID'] = $event_id; |
|
401 | 401 | } else { |
402 | - $query_params[ 'force_join' ][] = 'Event'; |
|
402 | + $query_params['force_join'][] = 'Event'; |
|
403 | 403 | } |
404 | - return \EEM_Registration::instance()->count( $query_params ); |
|
404 | + return \EEM_Registration::instance()->count($query_params); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | |
@@ -412,13 +412,13 @@ discard block |
||
412 | 412 | * @param JobParameters $job_parameters |
413 | 413 | * @return boolean |
414 | 414 | */ |
415 | - public function cleanup_job( JobParameters $job_parameters ){ |
|
415 | + public function cleanup_job(JobParameters $job_parameters) { |
|
416 | 416 | $this->_file_helper->delete( |
417 | - \EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ), |
|
417 | + \EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')), |
|
418 | 418 | true, |
419 | 419 | 'd' |
420 | 420 | ); |
421 | - return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) ); |
|
421 | + return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso')); |
|
422 | 422 | } |
423 | 423 | } |
424 | 424 |
@@ -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( |
@@ -2,18 +2,18 @@ |
||
2 | 2 | <p> |
3 | 3 | <?php _e('The importer can be used to import event information into Event Espresso using a CSV file.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | -<h3><?php _e("Importing from other Event Espresso 4 Sites", 'event_espresso');?></h3> |
|
5 | +<h3><?php _e("Importing from other Event Espresso 4 Sites", 'event_espresso'); ?></h3> |
|
6 | 6 | <p> |
7 | 7 | <?php _e('To import Event Espresso data from another Event Espresso 4 install, export a CSV file from the admin Events overview page, or anywhere you can generate a CSV export file from. Then upload that file here (regardless of what type of information was exported).', 'event_espresso'); ?> |
8 | 8 | </p> |
9 | 9 | <p> |
10 | 10 | <?php _e('Note: its possible that data from the other site have the same IDs as data in this site. The importer recognizes that this data is from a different database and inserts new items for each item in the CSV file, regardless of whether its ID matches that of an item in this site\'s database or not. However, the importer also remembers the mapping from the old site\'s database to this site\'s database, and on subsequent CSV importers from that site, the data in this database will be updated instead of re-inserting new items.', 'event_espresso'); ?> |
11 | 11 | </p> |
12 | -<h3><?php _e("Importing from this Site", 'event_espresso');?></h3> |
|
13 | -<p><?php _e("You may want to export data from this site, modify it (or modify the database), and re-import it. When this is done, the importer recognizes that the data is from this site\'s database and updates the records (instead of inserting new items like it would have, had the CSV data been from a different site).", 'event_espresso');?></p> |
|
12 | +<h3><?php _e("Importing from this Site", 'event_espresso'); ?></h3> |
|
13 | +<p><?php _e("You may want to export data from this site, modify it (or modify the database), and re-import it. When this is done, the importer recognizes that the data is from this site\'s database and updates the records (instead of inserting new items like it would have, had the CSV data been from a different site).", 'event_espresso'); ?></p> |
|
14 | 14 | |
15 | - <h3><?php _e("Notes about Generating your own CSV Import Files", "event_espresso");?></h3> |
|
16 | - <p><?php _e("If you think you could save time entering data into a CSV file, you can use the sample import file below. Note that creating your own CSV file is more complicated than in Event Espresso 3.1 because of the more advanced data structure, and so we recommend creating/editing your events using the normal web-interface.", "event_espresso");?></p> |
|
17 | - <p><?php _e("The export file is just an export of an event, or if you do not have any events in your system, it will only contain column headers. Do not change those column headers. Add as many rows as you like. ", "event_espresso");?></p> |
|
18 | - <p><?php _e("In the ID columns (columns ending in '_ID'), you should enter 'temporary IDs', which are unique numbers/words that identify that item, which can be used later when you want to refer to that item. (For example, if you assign an event's EVT_ID to be a temporary id of 'my-event-1', then use that same phrase 'my-event-1' to refer to that event in the Datetime model's EVT_ID column)", "event_espresso");?></p> |
|
19 | - <p><?php _e("Also note, you do NOT have to enter info in for each model. (You can, for example, only enter in Term_Taxonomies and Term model data)", "event_espresso");?></p> |
|
20 | 15 | \ No newline at end of file |
16 | + <h3><?php _e("Notes about Generating your own CSV Import Files", "event_espresso"); ?></h3> |
|
17 | + <p><?php _e("If you think you could save time entering data into a CSV file, you can use the sample import file below. Note that creating your own CSV file is more complicated than in Event Espresso 3.1 because of the more advanced data structure, and so we recommend creating/editing your events using the normal web-interface.", "event_espresso"); ?></p> |
|
18 | + <p><?php _e("The export file is just an export of an event, or if you do not have any events in your system, it will only contain column headers. Do not change those column headers. Add as many rows as you like. ", "event_espresso"); ?></p> |
|
19 | + <p><?php _e("In the ID columns (columns ending in '_ID'), you should enter 'temporary IDs', which are unique numbers/words that identify that item, which can be used later when you want to refer to that item. (For example, if you assign an event's EVT_ID to be a temporary id of 'my-event-1', then use that same phrase 'my-event-1' to refer to that event in the Datetime model's EVT_ID column)", "event_espresso"); ?></p> |
|
20 | + <p><?php _e("Also note, you do NOT have to enter info in for each model. (You can, for example, only enter in Term_Taxonomies and Term model data)", "event_espresso"); ?></p> |
|
21 | 21 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * constructor |
210 | 210 | * @param EE_Admin_Page $admin_page the calling admin_page_object |
211 | 211 | */ |
212 | - public function __construct( EE_Admin_Page $adminpage ) { |
|
212 | + public function __construct(EE_Admin_Page $adminpage) { |
|
213 | 213 | |
214 | 214 | $this->_adminpage_obj = $adminpage; |
215 | 215 | $this->_req_data = array_merge($_GET, $_POST); |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | $this->_set_hooks_properties(); |
218 | 218 | |
219 | 219 | //first let's verify we're on the right page |
220 | - if ( !isset( $this->_req_data['page'] ) || ( isset( $this->_req_data['page'] ) && $this->_adminpage_obj->page_slug != $this->_req_data['page'] ) ) |
|
220 | + if ( ! isset($this->_req_data['page']) || (isset($this->_req_data['page']) && $this->_adminpage_obj->page_slug != $this->_req_data['page'])) |
|
221 | 221 | return; //get out nothing more to be done here. |
222 | 222 | |
223 | 223 | //allow for extends to modify properties |
224 | - if ( method_exists( $this, '_extend_properties' ) ) |
|
224 | + if (method_exists($this, '_extend_properties')) |
|
225 | 225 | $this->_extend_properties(); |
226 | 226 | |
227 | 227 | $this->_set_page_object(); |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | $this->_load_custom_methods(); |
230 | 230 | $this->_load_routed_hooks(); |
231 | 231 | |
232 | - add_action( 'admin_enqueue_scripts', array($this, 'enqueue_scripts_styles' ) ); |
|
233 | - add_action( 'admin_enqueue_scripts', array($this, 'add_metaboxes'), 20 ); |
|
234 | - add_action( 'admin_enqueue_scripts', array($this, 'remove_metaboxes'), 15 ); |
|
232 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
233 | + add_action('admin_enqueue_scripts', array($this, 'add_metaboxes'), 20); |
|
234 | + add_action('admin_enqueue_scripts', array($this, 'remove_metaboxes'), 15); |
|
235 | 235 | |
236 | 236 | $this->_ajax_hooks(); |
237 | 237 | |
@@ -272,15 +272,15 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public function enqueue_scripts_styles() { |
274 | 274 | |
275 | - if ( !empty( $this->_scripts_styles ) ) { |
|
275 | + if ( ! empty($this->_scripts_styles)) { |
|
276 | 276 | //first let's do all the registrations |
277 | - if ( !isset($this->_scripts_styles['registers'] ) ) { |
|
277 | + if ( ! isset($this->_scripts_styles['registers'])) { |
|
278 | 278 | $msg[] = __('There is no "registers" index in the <code>$this->_scripts_styles</code> property.', 'event_espresso'); |
279 | - $msg[] = sprintf ( __('Make sure you read the phpdoc comments above the definition of the $_scripts_styles property in the <code>EE_Admin_Hooks</code> class and modify according in the %s child', 'event_espresso'), '<strong>' . $this->caller . '</strong>' ); |
|
280 | - throw new EE_Error( implode( '||', $msg ) ); |
|
279 | + $msg[] = sprintf(__('Make sure you read the phpdoc comments above the definition of the $_scripts_styles property in the <code>EE_Admin_Hooks</code> class and modify according in the %s child', 'event_espresso'), '<strong>'.$this->caller.'</strong>'); |
|
280 | + throw new EE_Error(implode('||', $msg)); |
|
281 | 281 | } |
282 | 282 | |
283 | - foreach( $this->_scripts_styles['registers'] as $ref => $details ) { |
|
283 | + foreach ($this->_scripts_styles['registers'] as $ref => $details) { |
|
284 | 284 | $defaults = array( |
285 | 285 | 'type' => 'js', |
286 | 286 | 'url' => '', |
@@ -289,48 +289,48 @@ discard block |
||
289 | 289 | 'footer' => TRUE |
290 | 290 | ); |
291 | 291 | $details = wp_parse_args($details, $defaults); |
292 | - extract( $details ); |
|
292 | + extract($details); |
|
293 | 293 | |
294 | 294 | //let's make sure that we set the 'registers' type if it's not set! We need it later to determine whhich enqueu we do |
295 | 295 | $this->_scripts_styles['registers'][$ref]['type'] = $type; |
296 | 296 | |
297 | 297 | //let's make sure we're not missing any REQUIRED parameters |
298 | - if ( empty($url) ) { |
|
299 | - $msg[] = sprintf( __('Missing the url for the requested %s', 'event_espresso'), $type == 'js' ? 'script' : 'stylesheet' ); |
|
300 | - $msg[] = sprintf( __('Doublecheck your <code>$this->_scripts_styles</code> array in %s and make sure that there is a "url" set for the %s ref', 'event_espresso'), '<strong>' . $this->caller . '</strong>', $ref ); |
|
301 | - throw new EE_Error( implode( '||', $msg ) ); |
|
298 | + if (empty($url)) { |
|
299 | + $msg[] = sprintf(__('Missing the url for the requested %s', 'event_espresso'), $type == 'js' ? 'script' : 'stylesheet'); |
|
300 | + $msg[] = sprintf(__('Doublecheck your <code>$this->_scripts_styles</code> array in %s and make sure that there is a "url" set for the %s ref', 'event_espresso'), '<strong>'.$this->caller.'</strong>', $ref); |
|
301 | + throw new EE_Error(implode('||', $msg)); |
|
302 | 302 | } |
303 | 303 | //made it here so let's do the appropriate registration |
304 | - $type == 'js' ? wp_register_script( $ref, $url, $depends, $version, $footer ) : wp_register_style( $ref, $url, $depends, $version ); |
|
304 | + $type == 'js' ? wp_register_script($ref, $url, $depends, $version, $footer) : wp_register_style($ref, $url, $depends, $version); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | //k now lets do the enqueues |
308 | - if( !isset( $this->_scripts_styles['enqueues'] ) ) |
|
309 | - return; //not sure if we should throw an error here or not. |
|
310 | - foreach( $this->_scripts_styles['enqueues'] as $ref => $routes ) { |
|
308 | + if ( ! isset($this->_scripts_styles['enqueues'])) |
|
309 | + return; //not sure if we should throw an error here or not. |
|
310 | + foreach ($this->_scripts_styles['enqueues'] as $ref => $routes) { |
|
311 | 311 | //make sure $routes is an array |
312 | 312 | $routes = (array) $routes; |
313 | 313 | |
314 | - if ( in_array($this->_current_route, $routes ) ) { |
|
314 | + if (in_array($this->_current_route, $routes)) { |
|
315 | 315 | $this->_scripts_styles['registers'][$ref]['type'] == 'js' ? wp_enqueue_script($ref) : wp_enqueue_style($ref); |
316 | 316 | //if we have a localization for the script let's do that too. |
317 | - if ( isset( $this->_scripts_styles['localize'][$ref] ) ) { |
|
318 | - foreach ( $this->_scripts_styles['localize'][$ref] as $object_name => $indexes ) { |
|
319 | - wp_localize_script($ref, $object_name , $this->_scripts_styles['localize'][$ref][$object_name] ); |
|
317 | + if (isset($this->_scripts_styles['localize'][$ref])) { |
|
318 | + foreach ($this->_scripts_styles['localize'][$ref] as $object_name => $indexes) { |
|
319 | + wp_localize_script($ref, $object_name, $this->_scripts_styles['localize'][$ref][$object_name]); |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
325 | 325 | //let's do the deregisters |
326 | - if ( !isset( $this->_scripts_styles['deregisters'] ) ) |
|
326 | + if ( ! isset($this->_scripts_styles['deregisters'])) |
|
327 | 327 | return; |
328 | - foreach ( $this->_scripts_styles['deregisters'] as $ref => $details ) { |
|
328 | + foreach ($this->_scripts_styles['deregisters'] as $ref => $details) { |
|
329 | 329 | $defaults = array( |
330 | 330 | 'type' => 'js' |
331 | 331 | ); |
332 | - $details = wp_parse_args( $details, $defaults ); |
|
333 | - extract( $details ); |
|
332 | + $details = wp_parse_args($details, $defaults); |
|
333 | + extract($details); |
|
334 | 334 | |
335 | 335 | $type == 'js' ? wp_deregister_script($ref) : wp_deregister_style($ref); |
336 | 336 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | */ |
350 | 350 | private function _set_defaults() { |
351 | 351 | $this->_ajax_func = $this->_init_func = $this->_metaboxes = $this->_scripts = $this->_styles = $this->_wp_action_filters_priority = array(); |
352 | - $this->_current_route = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default'; |
|
352 | + $this->_current_route = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default'; |
|
353 | 353 | $this->caller = get_class($this); |
354 | 354 | $this->_extend = stripos($this->caller, 'Extend') ? TRUE : FALSE; |
355 | 355 | } |
@@ -364,34 +364,34 @@ discard block |
||
364 | 364 | */ |
365 | 365 | protected function _set_page_object() { |
366 | 366 | //first make sure $this->_name is set |
367 | - if ( empty( $this->_name ) ) { |
|
367 | + if (empty($this->_name)) { |
|
368 | 368 | $msg[] = __('We can\'t load the page object', 'event_espresso'); |
369 | - $msg[] = sprintf( __("This is because the %s child class has not set the '_name' property", 'event_espresso'), $this->caller ); |
|
370 | - throw new EE_Error( implode( '||', $msg ) ); |
|
369 | + $msg[] = sprintf(__("This is because the %s child class has not set the '_name' property", 'event_espresso'), $this->caller); |
|
370 | + throw new EE_Error(implode('||', $msg)); |
|
371 | 371 | } |
372 | 372 | |
373 | - $ref = str_replace('_' , ' ', $this->_name); //take the_message -> the message |
|
374 | - $ref = str_replace(' ', '_', ucwords($ref) ) . '_Admin_Page'; //take the message -> The_Message |
|
373 | + $ref = str_replace('_', ' ', $this->_name); //take the_message -> the message |
|
374 | + $ref = str_replace(' ', '_', ucwords($ref)).'_Admin_Page'; //take the message -> The_Message |
|
375 | 375 | |
376 | 376 | //first default file (if exists) |
377 | - $decaf_file = EE_ADMIN_PAGES . $this->_name . DS . $ref . '.core.php'; |
|
378 | - if ( is_readable( $decaf_file ) ) |
|
379 | - require_once( $decaf_file ); |
|
377 | + $decaf_file = EE_ADMIN_PAGES.$this->_name.DS.$ref.'.core.php'; |
|
378 | + if (is_readable($decaf_file)) |
|
379 | + require_once($decaf_file); |
|
380 | 380 | |
381 | 381 | //now we have to do require for extended file (if needed) |
382 | - if ( $this->_extend ) { |
|
383 | - require_once( EE_CORE_CAF_ADMIN_EXTEND . $this->_name . DS . 'Extend_' . $ref . '.core.php' ); |
|
382 | + if ($this->_extend) { |
|
383 | + require_once(EE_CORE_CAF_ADMIN_EXTEND.$this->_name.DS.'Extend_'.$ref.'.core.php'); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
387 | 387 | //if we've got an extended class we use that! |
388 | - $ref = $this->_extend ? 'Extend_' . $ref : $ref; |
|
388 | + $ref = $this->_extend ? 'Extend_'.$ref : $ref; |
|
389 | 389 | |
390 | 390 | //let's make sure the class exists |
391 | - if ( !class_exists( $ref ) ) { |
|
391 | + if ( ! class_exists($ref)) { |
|
392 | 392 | $msg[] = __('We can\'t load the page object', 'event_espresso'); |
393 | - $msg[] = sprintf( __('The class name that was given is %s. Check the spelling and make sure its correct, also there needs to be an autoloader setup for the class', 'event_espresso'), $ref ); |
|
394 | - throw new EE_Error( implode( '||', $msg ) ); |
|
393 | + $msg[] = sprintf(__('The class name that was given is %s. Check the spelling and make sure its correct, also there needs to be an autoloader setup for the class', 'event_espresso'), $ref); |
|
394 | + throw new EE_Error(implode('||', $msg)); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | $a = new ReflectionClass($ref); |
@@ -416,27 +416,27 @@ discard block |
||
416 | 416 | $method_callback = $this->_current_route == 'default' ? 'default_callback' : $this->_current_route; |
417 | 417 | |
418 | 418 | //these run before the Admin_Page route executes. |
419 | - if ( method_exists( $this, $method_callback ) ) { |
|
420 | - call_user_func( array( $this, $method_callback) ); |
|
419 | + if (method_exists($this, $method_callback)) { |
|
420 | + call_user_func(array($this, $method_callback)); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | |
424 | 424 | //these run via the _redirect_after_action method in EE_Admin_Page which usually happens after non_UI methods in EE_Admin_Page classes. There are two redirect actions, the first fires before $query_args might be manipulated by "save and close" actions and the seond fires right before the actual redirect happens. |
425 | 425 | //first the actions |
426 | 426 | //note that these action hooks will have the $query_args value available. |
427 | - $admin_class_name = get_class( $this->_adminpage_obj ); |
|
427 | + $admin_class_name = get_class($this->_adminpage_obj); |
|
428 | 428 | |
429 | - if ( method_exists( $this, '_redirect_action_early_' . $this->_current_route ) ) { |
|
430 | - add_action( 'AHEE__' . $admin_class_name . '___redirect_after_action__before_redirect_modification_' . $this->_current_route, array( $this, '_redirect_action_early_' . $this->_current_route ), 10 ); |
|
429 | + if (method_exists($this, '_redirect_action_early_'.$this->_current_route)) { |
|
430 | + add_action('AHEE__'.$admin_class_name.'___redirect_after_action__before_redirect_modification_'.$this->_current_route, array($this, '_redirect_action_early_'.$this->_current_route), 10); |
|
431 | 431 | } |
432 | 432 | |
433 | - if ( method_exists( $this, '_redirect_action_' . $this->_current_route ) ) { |
|
434 | - add_action( 'AHEE_redirect_' . $admin_class_name . $this->_current_route, array( $this, '_redirect_action_' . $this->_current_route ), 10 ); |
|
433 | + if (method_exists($this, '_redirect_action_'.$this->_current_route)) { |
|
434 | + add_action('AHEE_redirect_'.$admin_class_name.$this->_current_route, array($this, '_redirect_action_'.$this->_current_route), 10); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | //let's hook into the _redirect itself and allow for changing where the user goes after redirect. This will have $query_args and $redirect_url available. |
438 | - if ( method_exists( $this, '_redirect_filter_' . $this->_current_route ) ) { |
|
439 | - add_filter( 'FHEE_redirect_' . $admin_class_name . $this->_current_route, array( $this, '_redirect_filter_' . $this->_current_route ), 10, 2 ); |
|
438 | + if (method_exists($this, '_redirect_filter_'.$this->_current_route)) { |
|
439 | + add_filter('FHEE_redirect_'.$admin_class_name.$this->_current_route, array($this, '_redirect_filter_'.$this->_current_route), 10, 2); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | } |
@@ -459,12 +459,12 @@ discard block |
||
459 | 459 | 'argnum' => 1, |
460 | 460 | 'priority' => 10 |
461 | 461 | ), |
462 | - 'FHEE_list_table_views_' . $this->_adminpage_obj->page_slug . '_' . $this->_current_route => array( |
|
462 | + 'FHEE_list_table_views_'.$this->_adminpage_obj->page_slug.'_'.$this->_current_route => array( |
|
463 | 463 | 'type' => 'filter', |
464 | 464 | 'argnum' => 1, |
465 | 465 | 'priority' => 10 |
466 | 466 | ), |
467 | - 'FHEE_list_table_views_' . $this->_adminpage_obj->page_slug => array( |
|
467 | + 'FHEE_list_table_views_'.$this->_adminpage_obj->page_slug => array( |
|
468 | 468 | 'type' => 'filter', |
469 | 469 | 'argnum' => 1, |
470 | 470 | 'priority' => 10 |
@@ -483,14 +483,14 @@ discard block |
||
483 | 483 | |
484 | 484 | |
485 | 485 | |
486 | - foreach ( $hook_filter_array as $hook => $args ) { |
|
487 | - if ( method_exists( $this, $this->_current_route . '_' . $hook ) ) { |
|
488 | - if ( isset( $this->_wp_action_filters_priority[$hook] ) ) |
|
486 | + foreach ($hook_filter_array as $hook => $args) { |
|
487 | + if (method_exists($this, $this->_current_route.'_'.$hook)) { |
|
488 | + if (isset($this->_wp_action_filters_priority[$hook])) |
|
489 | 489 | $args['priority'] = $this->_wp_action_filters_priority[$hook]; |
490 | - if ( $args['type'] == 'action' ) |
|
491 | - add_action( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] ); |
|
490 | + if ($args['type'] == 'action') |
|
491 | + add_action($hook, array($this, $this->_current_route.'_'.$hook), $args['priority'], $args['argnum']); |
|
492 | 492 | else |
493 | - add_filter( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] ); |
|
493 | + add_filter($hook, array($this, $this->_current_route.'_'.$hook), $args['priority'], $args['argnum']); |
|
494 | 494 | } |
495 | 495 | } |
496 | 496 | |
@@ -503,18 +503,18 @@ discard block |
||
503 | 503 | */ |
504 | 504 | private function _ajax_hooks() { |
505 | 505 | |
506 | - if ( empty( $this->_ajax_func) ) |
|
506 | + if (empty($this->_ajax_func)) |
|
507 | 507 | return; //get out there's nothing to take care of. |
508 | 508 | |
509 | - foreach ( $this->_ajax_func as $action => $method ) { |
|
509 | + foreach ($this->_ajax_func as $action => $method) { |
|
510 | 510 | //make sure method exists |
511 | - if ( !method_exists($this, $method) ) { |
|
512 | - $msg[] = __('There is no corresponding method for the hook labeled in the _ajax_func array', 'event_espresso') . '<br />'; |
|
513 | - $msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller ); |
|
514 | - throw new EE_Error( implode('||', $msg ) ); |
|
511 | + if ( ! method_exists($this, $method)) { |
|
512 | + $msg[] = __('There is no corresponding method for the hook labeled in the _ajax_func array', 'event_espresso').'<br />'; |
|
513 | + $msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $method, $this->caller); |
|
514 | + throw new EE_Error(implode('||', $msg)); |
|
515 | 515 | } |
516 | 516 | |
517 | - add_action('wp_ajax_' . $action, array( $this, $method ) ); |
|
517 | + add_action('wp_ajax_'.$action, array($this, $method)); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | } |
@@ -527,21 +527,21 @@ discard block |
||
527 | 527 | * @return void |
528 | 528 | */ |
529 | 529 | protected function _init_hooks() { |
530 | - if ( empty( $this->_init_func) ) |
|
530 | + if (empty($this->_init_func)) |
|
531 | 531 | return; //get out there's nothing to take care of. |
532 | 532 | |
533 | 533 | //We need to determine what page_route we are on! |
534 | - $current_route = isset ( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default'; |
|
534 | + $current_route = isset ($_REQUEST['action']) ? $_REQUEST['action'] : 'default'; |
|
535 | 535 | |
536 | - foreach ( $this->_init_func as $route => $method ) { |
|
536 | + foreach ($this->_init_func as $route => $method) { |
|
537 | 537 | //make sure method exists |
538 | - if ( !method_exists($this, $method) ) { |
|
539 | - $msg[] = __('There is no corresponding method for the hook labeled in the _init_func array', 'event_espresso') . '<br />'; |
|
540 | - $msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller ); |
|
541 | - throw new EE_Error( implode('||', $msg ) ); |
|
538 | + if ( ! method_exists($this, $method)) { |
|
539 | + $msg[] = __('There is no corresponding method for the hook labeled in the _init_func array', 'event_espresso').'<br />'; |
|
540 | + $msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $method, $this->caller); |
|
541 | + throw new EE_Error(implode('||', $msg)); |
|
542 | 542 | } |
543 | - if ( $route == $this->_current_route ) |
|
544 | - add_action('admin_init', array( $this, $method ) ); |
|
543 | + if ($route == $this->_current_route) |
|
544 | + add_action('admin_init', array($this, $method)); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | } |
@@ -556,28 +556,28 @@ discard block |
||
556 | 556 | * @return void |
557 | 557 | */ |
558 | 558 | public function add_metaboxes() { |
559 | - if ( empty( $this->_metaboxes ) ) |
|
559 | + if (empty($this->_metaboxes)) |
|
560 | 560 | return; //get out we don't have any metaboxes to set for this connection |
561 | 561 | |
562 | - $this->_handle_metabox_array( $this->_metaboxes ); |
|
562 | + $this->_handle_metabox_array($this->_metaboxes); |
|
563 | 563 | |
564 | 564 | } |
565 | 565 | |
566 | 566 | |
567 | 567 | |
568 | - private function _handle_metabox_array( $boxes, $add = TRUE ) { |
|
568 | + private function _handle_metabox_array($boxes, $add = TRUE) { |
|
569 | 569 | |
570 | - foreach ( $boxes as $box ) { |
|
571 | - if ( !isset($box['page_route']) ) |
|
570 | + foreach ($boxes as $box) { |
|
571 | + if ( ! isset($box['page_route'])) |
|
572 | 572 | continue; //we dont' have a valid array |
573 | 573 | |
574 | 574 | //let's make sure $box['page_route'] is an array so the "foreach" will work. |
575 | 575 | $box['page_route'] = (array) $box['page_route']; |
576 | 576 | |
577 | - foreach ( $box['page_route'] as $route ) { |
|
578 | - if ( $route != $this->_current_route ) |
|
577 | + foreach ($box['page_route'] as $route) { |
|
578 | + if ($route != $this->_current_route) |
|
579 | 579 | continue; //get out we only add metaboxes for set route. |
580 | - if ( $add ) |
|
580 | + if ($add) |
|
581 | 581 | $this->_add_metabox($box); |
582 | 582 | else |
583 | 583 | $this->_remove_metabox($box); |
@@ -595,10 +595,10 @@ discard block |
||
595 | 595 | */ |
596 | 596 | public function remove_metaboxes() { |
597 | 597 | |
598 | - if ( empty( $this->_remove_metaboxes ) ) |
|
598 | + if (empty($this->_remove_metaboxes)) |
|
599 | 599 | return; //get out there are no metaboxes to remove |
600 | 600 | |
601 | - $this->_handle_metabox_array( $this->_remove_metaboxes, FALSE ); |
|
601 | + $this->_handle_metabox_array($this->_remove_metaboxes, FALSE); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | |
@@ -608,53 +608,53 @@ discard block |
||
608 | 608 | * @access private |
609 | 609 | * @param array $args an array of args that have been set for this metabox by the child class |
610 | 610 | */ |
611 | - private function _add_metabox( $args ) { |
|
611 | + private function _add_metabox($args) { |
|
612 | 612 | $current_screen = get_current_screen(); |
613 | - $screen_id = is_object( $current_screen ) ? $current_screen->id : NULL; |
|
614 | - $func = isset( $args['func'] ) ? $args['func'] : 'some_invalid_callback'; |
|
613 | + $screen_id = is_object($current_screen) ? $current_screen->id : NULL; |
|
614 | + $func = isset($args['func']) ? $args['func'] : 'some_invalid_callback'; |
|
615 | 615 | |
616 | 616 | //set defaults |
617 | 617 | $defaults = array( |
618 | 618 | 'func' => $func, |
619 | - 'id' => $this->caller . '_' . $func . '_metabox', |
|
619 | + 'id' => $this->caller.'_'.$func.'_metabox', |
|
620 | 620 | 'priority' => 'default', |
621 | 621 | 'label' => $this->caller, |
622 | 622 | 'context' => 'advanced', |
623 | 623 | 'callback_args' => array(), |
624 | - 'page' => isset( $args['page'] ) ? $args['page'] : $screen_id |
|
624 | + 'page' => isset($args['page']) ? $args['page'] : $screen_id |
|
625 | 625 | ); |
626 | 626 | |
627 | - $args = wp_parse_args( $args, $defaults ); |
|
627 | + $args = wp_parse_args($args, $defaults); |
|
628 | 628 | extract($args); |
629 | 629 | |
630 | 630 | |
631 | 631 | //make sure method exists |
632 | - if ( !method_exists($this, $func) ) { |
|
633 | - $msg[] = __('There is no corresponding method to display the metabox content', 'event_espresso') . '<br />'; |
|
634 | - $msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $func, $this->caller ); |
|
635 | - throw new EE_Error( implode('||', $msg ) ); |
|
632 | + if ( ! method_exists($this, $func)) { |
|
633 | + $msg[] = __('There is no corresponding method to display the metabox content', 'event_espresso').'<br />'; |
|
634 | + $msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $func, $this->caller); |
|
635 | + throw new EE_Error(implode('||', $msg)); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | //everything checks out so lets add the metabox |
639 | - add_meta_box( $id, $label, array( $this, $func ), $page, $context, $priority, $callback_args); |
|
639 | + add_meta_box($id, $label, array($this, $func), $page, $context, $priority, $callback_args); |
|
640 | 640 | } |
641 | 641 | |
642 | 642 | |
643 | 643 | |
644 | - private function _remove_metabox( $args ) { |
|
644 | + private function _remove_metabox($args) { |
|
645 | 645 | $current_screen = get_current_screen(); |
646 | - $screen_id = is_object( $current_screen ) ? $current_screen->id : NULL; |
|
647 | - $func = isset( $args['func'] ) ? $args['func'] : 'some_invalid_callback'; |
|
646 | + $screen_id = is_object($current_screen) ? $current_screen->id : NULL; |
|
647 | + $func = isset($args['func']) ? $args['func'] : 'some_invalid_callback'; |
|
648 | 648 | |
649 | 649 | //set defaults |
650 | 650 | $defaults = array( |
651 | - 'id' => isset( $args['id'] ) ? $args['id'] : $this->_current_route . '_' . $this->caller . '_' . $func . '_metabox', |
|
651 | + 'id' => isset($args['id']) ? $args['id'] : $this->_current_route.'_'.$this->caller.'_'.$func.'_metabox', |
|
652 | 652 | 'context' => 'default', |
653 | - 'screen' => isset( $args['screen'] ) ? $args['screen'] : $screen_id |
|
653 | + 'screen' => isset($args['screen']) ? $args['screen'] : $screen_id |
|
654 | 654 | ); |
655 | 655 | |
656 | - $args = wp_parse_args( $args, $defaults ); |
|
657 | - extract( $args ); |
|
656 | + $args = wp_parse_args($args, $defaults); |
|
657 | + extract($args); |
|
658 | 658 | |
659 | 659 | //everything checks out so lets remove the box! |
660 | 660 | remove_meta_box($id, $screen, $context); |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | * @return EED_Ticket_Selector |
58 | 58 | */ |
59 | 59 | public static function instance() { |
60 | - return parent::get_instance( __CLASS__ ); |
|
60 | + return parent::get_instance(__CLASS__); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | |
65 | - protected function set_config(){ |
|
66 | - $this->set_config_section( 'template_settings' ); |
|
67 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
68 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
65 | + protected function set_config() { |
|
66 | + $this->set_config_section('template_settings'); |
|
67 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
68 | + $this->set_config_name('EED_Ticket_Selector'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public static function set_hooks() { |
82 | 82 | // routing |
83 | - EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' ); |
|
84 | - EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' ); |
|
85 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
83 | + EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector'); |
|
84 | + EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections'); |
|
85 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
86 | 86 | //add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 ); |
87 | - add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 ); |
|
87 | + add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1); |
|
88 | 88 | //add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 ); |
89 | 89 | //add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 ); |
90 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
90 | + add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | * @return void |
100 | 100 | */ |
101 | 101 | public static function set_hooks_admin() { |
102 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
102 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
103 | 103 | //add button for iframe code to event editor. |
104 | - add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 ); |
|
105 | - add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 ); |
|
104 | + add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4); |
|
105 | + add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | * @return void |
115 | 115 | */ |
116 | 116 | public static function set_definitions() { |
117 | - define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
118 | - define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
117 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
118 | + define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
119 | 119 | |
120 | 120 | //if config is not set, initialize |
121 | 121 | //If config is not set, set it. |
122 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) { |
|
122 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) { |
|
123 | 123 | EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
124 | 124 | } |
125 | - EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' ); |
|
125 | + EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso'); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param object $WP |
134 | 134 | * @return void |
135 | 135 | */ |
136 | - public function run( $WP ) {} |
|
136 | + public function run($WP) {} |
|
137 | 137 | |
138 | 138 | |
139 | 139 | /** |
@@ -145,23 +145,23 @@ discard block |
||
145 | 145 | public function ticket_selector_iframe() { |
146 | 146 | self::$_in_iframe = true; |
147 | 147 | /** @type EEM_Event $EEM_Event */ |
148 | - $EEM_Event = EE_Registry::instance()->load_model( 'Event' ); |
|
148 | + $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
149 | 149 | $event = $EEM_Event->get_one_by_ID( |
150 | - EE_Registry::instance()->REQ->get( 'event', 0 ) |
|
150 | + EE_Registry::instance()->REQ->get('event', 0) |
|
151 | 151 | ); |
152 | - EE_Registry::instance()->REQ->set_espresso_page( true ); |
|
153 | - $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event ); |
|
152 | + EE_Registry::instance()->REQ->set_espresso_page(true); |
|
153 | + $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event); |
|
154 | 154 | $template_args['css'] = apply_filters( |
155 | 155 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
156 | 156 | array( |
157 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
158 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
159 | - includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ), |
|
160 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
157 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION, |
|
158 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION, |
|
159 | + includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']), |
|
160 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION |
|
161 | 161 | ) |
162 | 162 | ); |
163 | - EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true; |
|
164 | - EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' ); |
|
163 | + EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true; |
|
164 | + EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso'); |
|
165 | 165 | $template_args['eei18n'] = apply_filters( |
166 | 166 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings', |
167 | 167 | EE_Registry::localize_i18n_js_strings() |
@@ -169,19 +169,19 @@ discard block |
||
169 | 169 | $template_args['js'] = apply_filters( |
170 | 170 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
171 | 171 | array( |
172 | - includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ), |
|
173 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION, |
|
174 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION |
|
172 | + includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']), |
|
173 | + EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION, |
|
174 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION |
|
175 | 175 | ) |
176 | 176 | ); |
177 | 177 | EE_Registry::instance()->load_helper('Template'); |
178 | - $template_args[ 'notices' ] = EEH_Template::display_template( |
|
179 | - EE_TEMPLATES . 'espresso-ajax-notices.template.php', |
|
178 | + $template_args['notices'] = EEH_Template::display_template( |
|
179 | + EE_TEMPLATES.'espresso-ajax-notices.template.php', |
|
180 | 180 | array(), |
181 | 181 | true |
182 | 182 | ); |
183 | 183 | EEH_Template::display_template( |
184 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php', |
|
184 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php', |
|
185 | 185 | $template_args |
186 | 186 | ); |
187 | 187 | exit; |
@@ -200,23 +200,23 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @return string The new html string for the permalink area. |
202 | 202 | */ |
203 | - public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) { |
|
203 | + public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) { |
|
204 | 204 | //make sure this is ONLY when editing and the event id has been set. |
205 | - if ( ! empty( $id ) ) { |
|
206 | - $post = get_post( $id ); |
|
205 | + if ( ! empty($id)) { |
|
206 | + $post = get_post($id); |
|
207 | 207 | |
208 | 208 | //if NOT event then let's get out. |
209 | - if ( $post->post_type !== 'espresso_events' ) { |
|
209 | + if ($post->post_type !== 'espresso_events') { |
|
210 | 210 | return $permalink_string; |
211 | 211 | } |
212 | 212 | |
213 | - $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
|
213 | + $ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url()); |
|
214 | 214 | |
215 | - $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' . __('Embed', 'event_espresso') . '</a> '; |
|
215 | + $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">'.__('Embed', 'event_espresso').'</a> '; |
|
216 | 216 | $permalink_string .= ' |
217 | 217 | <div id="js-ts-iframe" style="display:none"> |
218 | 218 | <div style="width:100%; height: 500px;"> |
219 | - <iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe> |
|
219 | + <iframe src="' . $ticket_selector_url.'" width="100%" height="100%"></iframe> |
|
220 | 220 | </div> |
221 | 221 | </div>'; |
222 | 222 | } |
@@ -235,22 +235,22 @@ discard block |
||
235 | 235 | * @param mixed $event |
236 | 236 | * @return bool |
237 | 237 | */ |
238 | - protected static function set_event( $event = null ) { |
|
239 | - if( $event === null ) { |
|
238 | + protected static function set_event($event = null) { |
|
239 | + if ($event === null) { |
|
240 | 240 | global $post; |
241 | 241 | $event = $post; |
242 | 242 | } |
243 | - if ( $event instanceof EE_Event ) { |
|
243 | + if ($event instanceof EE_Event) { |
|
244 | 244 | self::$_event = $event; |
245 | - } else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) { |
|
245 | + } else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) { |
|
246 | 246 | self::$_event = $event->EE_Event; |
247 | - } else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) { |
|
248 | - $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event ); |
|
247 | + } else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') { |
|
248 | + $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event); |
|
249 | 249 | self::$_event = $event->EE_Event; |
250 | 250 | } else { |
251 | - $user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' ); |
|
252 | - $dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' ); |
|
253 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
251 | + $user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso'); |
|
252 | + $dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso'); |
|
253 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
254 | 254 | return false; |
255 | 255 | } |
256 | 256 | return true; |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | * @param bool $view_details |
270 | 270 | * @return string |
271 | 271 | */ |
272 | - public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
|
272 | + public static function display_ticket_selector($event = NULL, $view_details = FALSE) { |
|
273 | 273 | // reset filter for displaying submit button |
274 | - remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
274 | + remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
275 | 275 | // poke and prod incoming event till it tells us what it is |
276 | - if ( ! EED_Ticket_Selector::set_event( $event )) { |
|
276 | + if ( ! EED_Ticket_Selector::set_event($event)) { |
|
277 | 277 | return false; |
278 | 278 | } |
279 | 279 | $event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | && ( |
285 | 285 | ! self::$_event->display_ticket_selector() |
286 | 286 | || $view_details |
287 | - || post_password_required( $event_post ) |
|
287 | + || post_password_required($event_post) |
|
288 | 288 | || ( |
289 | 289 | $_event_active_status != EE_Datetime::active |
290 | 290 | && $_event_active_status != EE_Datetime::upcoming |
@@ -302,70 +302,70 @@ discard block |
||
302 | 302 | $template_args = array(); |
303 | 303 | $template_args['event_status'] = $_event_active_status; |
304 | 304 | |
305 | - $template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) ); |
|
306 | - $template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) ); |
|
305 | + $template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format')); |
|
306 | + $template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format')); |
|
307 | 307 | |
308 | 308 | $template_args['EVT_ID'] = self::$_event->ID(); |
309 | 309 | $template_args['event'] = self::$_event; |
310 | 310 | |
311 | 311 | // is the event expired ? |
312 | 312 | $template_args['event_is_expired'] = self::$_event->is_expired(); |
313 | - if ( $template_args['event_is_expired'] ) { |
|
314 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>'; |
|
313 | + if ($template_args['event_is_expired']) { |
|
314 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>'; |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | $ticket_query_args = array( |
318 | - array( 'Datetime.EVT_ID' => self::$_event->ID() ), |
|
319 | - 'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' ) |
|
318 | + array('Datetime.EVT_ID' => self::$_event->ID()), |
|
319 | + 'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC') |
|
320 | 320 | ); |
321 | 321 | |
322 | - if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) { |
|
322 | + if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) { |
|
323 | 323 | //use the correct applicable time query depending on what version of core is being run. |
324 | - $current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp'); |
|
325 | - $ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time ); |
|
324 | + $current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp'); |
|
325 | + $ticket_query_args[0]['TKT_end_date'] = array('>', $current_time); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | // get all tickets for this event ordered by the datetime |
329 | - $template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args ); |
|
329 | + $template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args); |
|
330 | 330 | |
331 | - if ( count( $template_args['tickets'] ) < 1 ) { |
|
332 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>'; |
|
331 | + if (count($template_args['tickets']) < 1) { |
|
332 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>'; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | // filter the maximum qty that can appear in the Ticket Selector qty dropdowns |
336 | - $template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit() ); |
|
337 | - if ( $template_args['max_atndz'] < 1 ) { |
|
338 | - $sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' ); |
|
339 | - if ( current_user_can( 'edit_post', self::$_event->ID() )) { |
|
340 | - $sales_closed_msg .= sprintf( |
|
341 | - __( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ), |
|
336 | + $template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit()); |
|
337 | + if ($template_args['max_atndz'] < 1) { |
|
338 | + $sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso'); |
|
339 | + if (current_user_can('edit_post', self::$_event->ID())) { |
|
340 | + $sales_closed_msg .= sprintf( |
|
341 | + __('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'), |
|
342 | 342 | '<div class="ee-attention" style="text-align: left;"><b>', |
343 | 343 | '</b><br />', |
344 | - $link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">', |
|
344 | + $link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">', |
|
345 | 345 | '</a></span></div>' |
346 | 346 | ); |
347 | 347 | } |
348 | - return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>'; |
|
348 | + return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>'; |
|
349 | 349 | } |
350 | 350 | |
351 | - $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php'; |
|
352 | - $templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event ); |
|
351 | + $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php'; |
|
352 | + $templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event); |
|
353 | 353 | |
354 | 354 | // redirecting to another site for registration ?? |
355 | 355 | $external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE; |
356 | 356 | // set up the form (but not for the admin) |
357 | - $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : ''; |
|
357 | + $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : ''; |
|
358 | 358 | // if not redirecting to another site for registration |
359 | - if ( ! $external_url ) { |
|
360 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
361 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
359 | + if ( ! $external_url) { |
|
360 | + EE_Registry::instance()->load_helper('Template'); |
|
361 | + EE_Registry::instance()->load_helper('URL'); |
|
362 | 362 | // then display the ticket selector |
363 | - $ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args ); |
|
363 | + $ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args); |
|
364 | 364 | } else { |
365 | 365 | // if not we still need to trigger the display of the submit button |
366 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
366 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
367 | 367 | //display notice to admin that registration is external |
368 | - $ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' ); |
|
368 | + $ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso'); |
|
369 | 369 | } |
370 | 370 | // submit button and form close tag |
371 | 371 | $ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : ''; |
@@ -385,27 +385,27 @@ discard block |
||
385 | 385 | * @param string $external_url |
386 | 386 | * @return string |
387 | 387 | */ |
388 | - public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) { |
|
388 | + public static function ticket_selector_form_open($ID = 0, $external_url = '') { |
|
389 | 389 | // if redirecting, we don't need any anything else |
390 | - if ( $external_url ) { |
|
391 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
392 | - $html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">'; |
|
393 | - $query_args = EEH_URL::get_query_string( $external_url ); |
|
394 | - foreach ( $query_args as $query_arg => $value ) { |
|
395 | - $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">'; |
|
390 | + if ($external_url) { |
|
391 | + EE_Registry::instance()->load_helper('URL'); |
|
392 | + $html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">'; |
|
393 | + $query_args = EEH_URL::get_query_string($external_url); |
|
394 | + foreach ($query_args as $query_arg => $value) { |
|
395 | + $html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">'; |
|
396 | 396 | } |
397 | 397 | return $html; |
398 | 398 | } |
399 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
400 | - $checkout_url = EEH_Event_View::event_link_url( $ID ); |
|
401 | - if ( ! $checkout_url ) { |
|
402 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
399 | + EE_Registry::instance()->load_helper('Event_View'); |
|
400 | + $checkout_url = EEH_Event_View::event_link_url($ID); |
|
401 | + if ( ! $checkout_url) { |
|
402 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
403 | 403 | } |
404 | 404 | $extra_params = self::$_in_iframe ? ' target="_blank"' : ''; |
405 | - $html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>'; |
|
406 | - $html .= wp_nonce_field( 'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE ); |
|
405 | + $html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>'; |
|
406 | + $html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE); |
|
407 | 407 | $html .= '<input type="hidden" name="ee" value="process_ticket_selections">'; |
408 | - $html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event ); |
|
408 | + $html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event); |
|
409 | 409 | return $html; |
410 | 410 | } |
411 | 411 | |
@@ -420,21 +420,21 @@ discard block |
||
420 | 420 | * @return string |
421 | 421 | */ |
422 | 422 | public static function display_ticket_selector_submit() { |
423 | - if ( ! is_admin() ) { |
|
424 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) { |
|
423 | + if ( ! is_admin()) { |
|
424 | + if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) { |
|
425 | 425 | $btn_text = apply_filters( |
426 | 426 | 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', |
427 | - __('Register Now', 'event_espresso' ), |
|
427 | + __('Register Now', 'event_espresso'), |
|
428 | 428 | self::$_event |
429 | 429 | ); |
430 | - $html = '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn"'; |
|
430 | + $html = '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn"'; |
|
431 | 431 | $html .= ' class="ticket-selector-submit-btn ticket-selector-submit-ajax"'; |
432 | - $html .= ' type="submit" value="' . $btn_text . '" />'; |
|
433 | - $html .= apply_filters( 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event ); |
|
432 | + $html .= ' type="submit" value="'.$btn_text.'" />'; |
|
433 | + $html .= apply_filters('FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event); |
|
434 | 434 | $html .= '<div class="clear"><br/></div></form>'; |
435 | 435 | return $html; |
436 | - } else if ( is_archive() ) { |
|
437 | - return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn(); |
|
436 | + } else if (is_archive()) { |
|
437 | + return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn(); |
|
438 | 438 | } |
439 | 439 | } |
440 | 440 | return ''; |
@@ -466,13 +466,13 @@ discard block |
||
466 | 466 | * @return string |
467 | 467 | */ |
468 | 468 | public static function display_view_details_btn() { |
469 | - if ( ! self::$_event->get_permalink() ) { |
|
470 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
469 | + if ( ! self::$_event->get_permalink()) { |
|
470 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
471 | 471 | } |
472 | - $view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">'; |
|
473 | - $btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event ); |
|
474 | - $view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />'; |
|
475 | - $view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event ); |
|
472 | + $view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">'; |
|
473 | + $btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event); |
|
474 | + $view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />'; |
|
475 | + $view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event); |
|
476 | 476 | $view_details_btn .= '<div class="clear"><br/></div>'; |
477 | 477 | $view_details_btn .= '</form>'; |
478 | 478 | return $view_details_btn; |
@@ -491,11 +491,11 @@ discard block |
||
491 | 491 | * @return array or FALSE |
492 | 492 | */ |
493 | 493 | public function process_ticket_selections() { |
494 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
494 | + do_action('EED_Ticket_Selector__process_ticket_selections__before'); |
|
495 | 495 | // check nonce |
496 | - if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) { |
|
496 | + if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce') || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'), 'process_ticket_selections'))) { |
|
497 | 497 | EE_Error::add_error( |
498 | - sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
498 | + sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
499 | 499 | __FILE__, __FUNCTION__, __LINE__ |
500 | 500 | ); |
501 | 501 | return FALSE; |
@@ -509,16 +509,16 @@ discard block |
||
509 | 509 | |
510 | 510 | //we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart. |
511 | 511 | // When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc. |
512 | - EE_Registry::instance()->load_core( 'Session' ); |
|
512 | + EE_Registry::instance()->load_core('Session'); |
|
513 | 513 | // unless otherwise requested, clear the session |
514 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) { |
|
515 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
514 | + if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) { |
|
515 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
516 | 516 | } |
517 | 517 | //d( EE_Registry::instance()->SSN ); |
518 | 518 | |
519 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
519 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
520 | 520 | // do we have an event id? |
521 | - if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) { |
|
521 | + if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) { |
|
522 | 522 | // validate/sanitize data |
523 | 523 | $valid = self::_validate_post_data(); |
524 | 524 | |
@@ -528,43 +528,43 @@ discard block |
||
528 | 528 | //EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ ); |
529 | 529 | |
530 | 530 | //check total tickets ordered vs max number of attendees that can register |
531 | - if ( $valid['total_tickets'] > $valid['max_atndz'] ) { |
|
531 | + if ($valid['total_tickets'] > $valid['max_atndz']) { |
|
532 | 532 | |
533 | 533 | // ordering too many tickets !!! |
534 | 534 | $singular = 'You have attempted to purchase %s ticket.'; |
535 | 535 | $plural = 'You have attempted to purchase %s tickets.'; |
536 | - $limit_error_1 = sprintf( _n( $singular, $plural, $valid['total_tickets'], 'event_espresso' ), $valid['total_tickets'], $valid['total_tickets'] ); |
|
536 | + $limit_error_1 = sprintf(_n($singular, $plural, $valid['total_tickets'], 'event_espresso'), $valid['total_tickets'], $valid['total_tickets']); |
|
537 | 537 | // dev only message |
538 | 538 | $singular = 'The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.'; |
539 | 539 | $plural = 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.'; |
540 | - $limit_error_2 = sprintf( _n( $singular, $plural, $valid['max_atndz'], 'event_espresso' ), $valid['max_atndz'], $valid['max_atndz'] ); |
|
541 | - EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ ); |
|
540 | + $limit_error_2 = sprintf(_n($singular, $plural, $valid['max_atndz'], 'event_espresso'), $valid['max_atndz'], $valid['max_atndz']); |
|
541 | + EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__); |
|
542 | 542 | } else { |
543 | 543 | |
544 | 544 | // all data appears to be valid |
545 | 545 | $tckts_slctd = FALSE; |
546 | 546 | $success = TRUE; |
547 | 547 | // load cart |
548 | - EE_Registry::instance()->load_core( 'Cart' ); |
|
548 | + EE_Registry::instance()->load_core('Cart'); |
|
549 | 549 | |
550 | 550 | // cycle thru the number of data rows sent from the event listing |
551 | - for ( $x = 0; $x < $valid['rows']; $x++ ) { |
|
551 | + for ($x = 0; $x < $valid['rows']; $x++) { |
|
552 | 552 | // does this row actually contain a ticket quantity? |
553 | - if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) { |
|
553 | + if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) { |
|
554 | 554 | // YES we have a ticket quantity |
555 | 555 | $tckts_slctd = TRUE; |
556 | 556 | // d( $valid['ticket_obj'][$x] ); |
557 | - if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) { |
|
557 | + if ($valid['ticket_obj'][$x] instanceof EE_Ticket) { |
|
558 | 558 | // then add ticket to cart |
559 | - $ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] ); |
|
559 | + $ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]); |
|
560 | 560 | $success = ! $ticket_added ? FALSE : $success; |
561 | - if ( EE_Error::has_error() ) { |
|
561 | + if (EE_Error::has_error()) { |
|
562 | 562 | break; |
563 | 563 | } |
564 | 564 | } else { |
565 | 565 | // nothing added to cart retrieved |
566 | 566 | EE_Error::add_error( |
567 | - sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
567 | + sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
568 | 568 | __FILE__, __FUNCTION__, __LINE__ |
569 | 569 | ); |
570 | 570 | } |
@@ -573,45 +573,45 @@ discard block |
||
573 | 573 | //d( EE_Registry::instance()->CART ); |
574 | 574 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE |
575 | 575 | |
576 | - if ( $tckts_slctd ) { |
|
577 | - if ( $success ) { |
|
578 | - do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this ); |
|
576 | + if ($tckts_slctd) { |
|
577 | + if ($success) { |
|
578 | + do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this); |
|
579 | 579 | EE_Registry::instance()->CART->recalculate_all_cart_totals(); |
580 | - EE_Registry::instance()->CART->save_cart( FALSE ); |
|
580 | + EE_Registry::instance()->CART->save_cart(FALSE); |
|
581 | 581 | EE_Registry::instance()->SSN->update(); |
582 | 582 | //d( EE_Registry::instance()->CART ); |
583 | 583 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE |
584 | 584 | // just return TRUE for registrations being made from admin |
585 | - if ( is_admin() ) { |
|
585 | + if (is_admin()) { |
|
586 | 586 | return TRUE; |
587 | 587 | } |
588 | - wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() )); |
|
588 | + wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url())); |
|
589 | 589 | exit(); |
590 | 590 | |
591 | 591 | } else { |
592 | - if ( ! EE_Error::has_error() ) { |
|
592 | + if ( ! EE_Error::has_error()) { |
|
593 | 593 | // nothing added to cart |
594 | - EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
594 | + EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
595 | 595 | } |
596 | 596 | } |
597 | 597 | |
598 | 598 | } else { |
599 | 599 | // no ticket quantities were selected |
600 | - EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
600 | + EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
601 | 601 | } |
602 | 602 | } |
603 | 603 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT |
604 | 604 | // at this point, just return if registration is being made from admin |
605 | - if ( is_admin() ) { |
|
605 | + if (is_admin()) { |
|
606 | 606 | return FALSE; |
607 | 607 | } |
608 | - if ( $valid['return_url'] ) { |
|
609 | - EE_Error::get_notices( FALSE, TRUE ); |
|
610 | - wp_safe_redirect( $valid['return_url'] ); |
|
608 | + if ($valid['return_url']) { |
|
609 | + EE_Error::get_notices(FALSE, TRUE); |
|
610 | + wp_safe_redirect($valid['return_url']); |
|
611 | 611 | exit(); |
612 | - } elseif ( isset( $event_to_add['id'] )) { |
|
613 | - EE_Error::get_notices( FALSE, TRUE ); |
|
614 | - wp_safe_redirect( get_permalink( $event_to_add['id'] )); |
|
612 | + } elseif (isset($event_to_add['id'])) { |
|
613 | + EE_Error::get_notices(FALSE, TRUE); |
|
614 | + wp_safe_redirect(get_permalink($event_to_add['id'])); |
|
615 | 615 | exit(); |
616 | 616 | } else { |
617 | 617 | echo EE_Error::get_notices(); |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | } else { |
621 | 621 | // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
622 | 622 | EE_Error::add_error( |
623 | - sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
623 | + sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
624 | 624 | __FILE__, __FUNCTION__, __LINE__ |
625 | 625 | ); |
626 | 626 | } |
@@ -638,18 +638,18 @@ discard block |
||
638 | 638 | * @return array or FALSE |
639 | 639 | */ |
640 | 640 | private static function _validate_post_data() { |
641 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
641 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
642 | 642 | |
643 | 643 | // start with an empty array() |
644 | 644 | $valid_data = array(); |
645 | 645 | // d( $_POST ); |
646 | 646 | //if event id is valid |
647 | - $id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' )); |
|
648 | - if ( $id ) { |
|
647 | + $id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id')); |
|
648 | + if ($id) { |
|
649 | 649 | // grab valid id |
650 | 650 | $valid_data['id'] = $id; |
651 | 651 | // grab and sanitize return-url |
652 | - $valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id )); |
|
652 | + $valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id)); |
|
653 | 653 | // array of other form names |
654 | 654 | $inputs_to_clean = array( |
655 | 655 | 'event_id' => 'tkt-slctr-event-id', |
@@ -662,22 +662,22 @@ discard block |
||
662 | 662 | // let's track the total number of tickets ordered.' |
663 | 663 | $valid_data['total_tickets'] = 0; |
664 | 664 | // cycle through $inputs_to_clean array |
665 | - foreach ( $inputs_to_clean as $what => $input_to_clean ) { |
|
665 | + foreach ($inputs_to_clean as $what => $input_to_clean) { |
|
666 | 666 | // check for POST data |
667 | - if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) { |
|
667 | + if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) { |
|
668 | 668 | // grab value |
669 | - $input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id ); |
|
669 | + $input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id); |
|
670 | 670 | switch ($what) { |
671 | 671 | |
672 | 672 | // integers |
673 | 673 | case 'event_id': |
674 | - $valid_data[$what] = absint( $input_value ); |
|
674 | + $valid_data[$what] = absint($input_value); |
|
675 | 675 | // get event via the event id we put in the form |
676 | - $valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] ); |
|
676 | + $valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']); |
|
677 | 677 | break; |
678 | 678 | case 'rows': |
679 | 679 | case 'max_atndz': |
680 | - $valid_data[$what] = absint( $input_value ); |
|
680 | + $valid_data[$what] = absint($input_value); |
|
681 | 681 | break; |
682 | 682 | |
683 | 683 | // arrays of integers |
@@ -685,27 +685,27 @@ discard block |
||
685 | 685 | // d( $input_value ); |
686 | 686 | $row_qty = $input_value; |
687 | 687 | // if qty is coming from a radio button input, then we need to assemble an array of rows |
688 | - if( ! is_array( $row_qty )) { |
|
688 | + if ( ! is_array($row_qty)) { |
|
689 | 689 | // get number of rows |
690 | - $rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1; |
|
690 | + $rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1; |
|
691 | 691 | // d( $rows ); |
692 | 692 | // explode ints by the dash |
693 | - $row_qty = explode( '-', $row_qty ); |
|
694 | - $row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1; |
|
695 | - $qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0; |
|
696 | - $row_qty = array( $row => $qty ); |
|
693 | + $row_qty = explode('-', $row_qty); |
|
694 | + $row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1; |
|
695 | + $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0; |
|
696 | + $row_qty = array($row => $qty); |
|
697 | 697 | // d( $row_qty ); |
698 | - for( $x = 1; $x <= $rows; $x++ ) { |
|
699 | - if ( ! isset( $row_qty[$x] )) { |
|
698 | + for ($x = 1; $x <= $rows; $x++) { |
|
699 | + if ( ! isset($row_qty[$x])) { |
|
700 | 700 | $row_qty[$x] = 0; |
701 | 701 | } |
702 | 702 | } |
703 | 703 | } |
704 | - ksort( $row_qty ); |
|
704 | + ksort($row_qty); |
|
705 | 705 | // d( $row_qty ); |
706 | 706 | // cycle thru values |
707 | - foreach ( $row_qty as $qty ) { |
|
708 | - $qty = absint( $qty ); |
|
707 | + foreach ($row_qty as $qty) { |
|
708 | + $qty = absint($qty); |
|
709 | 709 | // sanitize as integers |
710 | 710 | $valid_data[$what][] = $qty; |
711 | 711 | $valid_data['total_tickets'] += $qty; |
@@ -716,19 +716,19 @@ discard block |
||
716 | 716 | case 'ticket_id': |
717 | 717 | $value_array = array(); |
718 | 718 | // cycle thru values |
719 | - foreach ( $input_value as $key=>$value ) { |
|
719 | + foreach ($input_value as $key=>$value) { |
|
720 | 720 | // allow only numbers, letters, spaces, commas and dashes |
721 | - $value_array[ $key ] = wp_strip_all_tags( $value ); |
|
721 | + $value_array[$key] = wp_strip_all_tags($value); |
|
722 | 722 | // get ticket via the ticket id we put in the form |
723 | - $ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value ); |
|
724 | - $valid_data['ticket_obj'][ $key ] = $ticket_obj; |
|
723 | + $ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value); |
|
724 | + $valid_data['ticket_obj'][$key] = $ticket_obj; |
|
725 | 725 | } |
726 | - $valid_data[ $what ] = $value_array; |
|
726 | + $valid_data[$what] = $value_array; |
|
727 | 727 | break; |
728 | 728 | |
729 | 729 | case 'return_url' : |
730 | 730 | // grab and sanitize return-url |
731 | - $valid_data[$what] = esc_url_raw( $input_value ); |
|
731 | + $valid_data[$what] = esc_url_raw($input_value); |
|
732 | 732 | break; |
733 | 733 | |
734 | 734 | } // end switch $what |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | } // end foreach $inputs_to_clean |
737 | 737 | |
738 | 738 | } else { |
739 | - EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
739 | + EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
740 | 740 | return FALSE; |
741 | 741 | } |
742 | 742 | |
@@ -754,28 +754,28 @@ discard block |
||
754 | 754 | * @param int $qty |
755 | 755 | * @return TRUE on success, FALSE on fail |
756 | 756 | */ |
757 | - private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) { |
|
758 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
757 | + private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) { |
|
758 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
759 | 759 | // get the number of spaces left for this datetime ticket |
760 | - $available_spaces = self::_ticket_datetime_availability( $ticket ); |
|
760 | + $available_spaces = self::_ticket_datetime_availability($ticket); |
|
761 | 761 | // compare available spaces against the number of tickets being purchased |
762 | - if ( $available_spaces >= $qty ) { |
|
762 | + if ($available_spaces >= $qty) { |
|
763 | 763 | // allow addons to prevent a ticket from being added to cart |
764 | - if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) { |
|
764 | + if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) { |
|
765 | 765 | return false; |
766 | 766 | } |
767 | 767 | // add event to cart |
768 | - if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) { |
|
769 | - self::_recalculate_ticket_datetime_availability( $ticket, $qty ); |
|
768 | + if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) { |
|
769 | + self::_recalculate_ticket_datetime_availability($ticket, $qty); |
|
770 | 770 | return true; |
771 | 771 | } else { |
772 | 772 | return false; |
773 | 773 | } |
774 | 774 | } else { |
775 | 775 | // tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets |
776 | - $available_spaces = self::_ticket_datetime_availability( $ticket, true ); |
|
776 | + $available_spaces = self::_ticket_datetime_availability($ticket, true); |
|
777 | 777 | // greedy greedy greedy eh? |
778 | - if ( $available_spaces > 0 ) { |
|
778 | + if ($available_spaces > 0) { |
|
779 | 779 | // add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces |
780 | 780 | EE_Error::add_error( |
781 | 781 | sprintf( |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | __FILE__, __FUNCTION__, __LINE__ |
792 | 792 | ); |
793 | 793 | } else { |
794 | - EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
794 | + EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
795 | 795 | } |
796 | 796 | return false; |
797 | 797 | } |
@@ -809,22 +809,22 @@ discard block |
||
809 | 809 | * @param bool $get_original_ticket_spaces |
810 | 810 | * @return int |
811 | 811 | */ |
812 | - private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) { |
|
812 | + private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) { |
|
813 | 813 | // if the $_available_spaces array has not been set up yet... |
814 | - if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
815 | - self::_set_initial_ticket_datetime_availability( $ticket ); |
|
814 | + if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
815 | + self::_set_initial_ticket_datetime_availability($ticket); |
|
816 | 816 | } |
817 | 817 | $available_spaces = $ticket->qty() - $ticket->sold(); |
818 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
818 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
819 | 819 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
820 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
820 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
821 | 821 | // if we want the original datetime availability BEFORE we started subtracting tickets ? |
822 | - if ( $get_original_ticket_spaces ) { |
|
822 | + if ($get_original_ticket_spaces) { |
|
823 | 823 | // then grab the available spaces from the "tickets" array and compare with the above to get the lowest number |
824 | - $available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] ); |
|
824 | + $available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]); |
|
825 | 825 | } else { |
826 | 826 | // we want the updated ticket availability as stored in the "datetimes" array |
827 | - $available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] ); |
|
827 | + $available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]); |
|
828 | 828 | } |
829 | 829 | } |
830 | 830 | } |
@@ -840,23 +840,23 @@ discard block |
||
840 | 840 | * @param EE_Ticket $ticket |
841 | 841 | * @return int |
842 | 842 | */ |
843 | - private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) { |
|
843 | + private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) { |
|
844 | 844 | // first, get all of the datetimes that are available to this ticket |
845 | 845 | $datetimes = $ticket->get_many_related( |
846 | 846 | 'Datetime', |
847 | - array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' )) |
|
847 | + array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC')) |
|
848 | 848 | ); |
849 | - if ( ! empty( $datetimes )) { |
|
849 | + if ( ! empty($datetimes)) { |
|
850 | 850 | // now loop thru all of the datetimes |
851 | - foreach ( $datetimes as $datetime ) { |
|
852 | - if ( $datetime instanceof EE_Datetime ) { |
|
851 | + foreach ($datetimes as $datetime) { |
|
852 | + if ($datetime instanceof EE_Datetime) { |
|
853 | 853 | // the number of spaces available for the datetime without considering individual ticket quantities |
854 | 854 | $spaces_remaining = $datetime->spaces_remaining(); |
855 | 855 | // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key |
856 | - self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining ); |
|
856 | + self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining); |
|
857 | 857 | // if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number, |
858 | 858 | // else just take the datetime spaces remaining, and assign to the datetimes array |
859 | - self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining; |
|
859 | + self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining; |
|
860 | 860 | } |
861 | 861 | } |
862 | 862 | } |
@@ -872,12 +872,12 @@ discard block |
||
872 | 872 | * @param int $qty |
873 | 873 | * @return int |
874 | 874 | */ |
875 | - private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) { |
|
876 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
875 | + private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) { |
|
876 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
877 | 877 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
878 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
878 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
879 | 879 | // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to, |
880 | - self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty; |
|
880 | + self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty; |
|
881 | 881 | } |
882 | 882 | } |
883 | 883 | } |
@@ -894,8 +894,8 @@ discard block |
||
894 | 894 | */ |
895 | 895 | public static function load_tckt_slctr_assets() { |
896 | 896 | // add some style |
897 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
|
898 | - wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'); |
|
897 | + if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) { |
|
898 | + wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css'); |
|
899 | 899 | wp_enqueue_style('ticket_selector'); |
900 | 900 | // make it dance |
901 | 901 | // wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE); |
@@ -909,9 +909,9 @@ discard block |
||
909 | 909 | |
910 | 910 | public static function load_tckt_slctr_assets_admin() { |
911 | 911 | //iframe button js on admin event editor page |
912 | - if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) { |
|
913 | - wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true ); |
|
914 | - wp_enqueue_script( 'ticket_selector_embed' ); |
|
912 | + if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') { |
|
913 | + wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
914 | + wp_enqueue_script('ticket_selector_embed'); |
|
915 | 915 | } |
916 | 916 | } |
917 | 917 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -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; |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | //(all other times it gets resurrected from a wordpress option) |
14 | 14 | $stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*'); |
15 | 15 | $class_to_filepath = array(); |
16 | -foreach($stages as $filepath){ |
|
16 | +foreach ($stages as $filepath) { |
|
17 | 17 | $matches = array(); |
18 | - preg_match('~4_8_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
18 | + preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
19 | 19 | $class_to_filepath[$matches[1]] = $filepath; |
20 | 20 | } |
21 | 21 | //give addons a chance to autoload their stages too |
22 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages',$class_to_filepath); |
|
22 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath); |
|
23 | 23 | EEH_Autoloader::register_autoloader($class_to_filepath); |
24 | 24 | |
25 | 25 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @since 4.6.0 |
36 | 36 | * |
37 | 37 | */ |
38 | -class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base{ |
|
38 | +class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base { |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * return EE_DMS_Core_4_8_0 |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function can_migrate_from_version($version_array) { |
64 | 64 | $version_string = $version_array['Core']; |
65 | - if( $version_string <= '4.8.0' && $version_string >= '4.7.0' ){ |
|
65 | + if ($version_string <= '4.8.0' && $version_string >= '4.7.0') { |
|
66 | 66 | // echo "$version_string can be migrated from"; |
67 | 67 | return true; |
68 | - }elseif( ! $version_string ){ |
|
68 | + }elseif ( ! $version_string) { |
|
69 | 69 | // echo "no version string provided: $version_string"; |
70 | 70 | //no version string provided... this must be pre 4.3 |
71 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | - }else{ |
|
71 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | + } else { |
|
73 | 73 | // echo "$version_string doesnt apply"; |
74 | 74 | return false; |
75 | 75 | } |
@@ -90,18 +90,18 @@ discard block |
||
90 | 90 | * @return bool |
91 | 91 | */ |
92 | 92 | public function schema_changes_before_migration() { |
93 | - $now_in_mysql = current_time( 'mysql', true ); |
|
93 | + $now_in_mysql = current_time('mysql', true); |
|
94 | 94 | |
95 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
96 | - $table_name='esp_answer'; |
|
97 | - $sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
95 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
96 | + $table_name = 'esp_answer'; |
|
97 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
98 | 98 | REG_ID INT UNSIGNED NOT NULL, |
99 | 99 | QST_ID INT UNSIGNED NOT NULL, |
100 | 100 | ANS_value TEXT NOT NULL, |
101 | 101 | PRIMARY KEY (ANS_ID), |
102 | 102 | KEY REG_ID (REG_ID), |
103 | 103 | KEY QST_ID (QST_ID)"; |
104 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
104 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
105 | 105 | |
106 | 106 | $table_name = 'esp_attendee_meta'; |
107 | 107 | $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | CNT_is_EU TINYINT(1) DEFAULT '0', |
142 | 142 | CNT_active TINYINT(1) DEFAULT '0', |
143 | 143 | PRIMARY KEY (CNT_ISO)"; |
144 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
144 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
145 | 145 | |
146 | 146 | $table_name = 'esp_currency'; |
147 | 147 | $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
152 | 152 | CUR_active TINYINT(1) DEFAULT '0', |
153 | 153 | PRIMARY KEY (CUR_code)"; |
154 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
154 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
155 | 155 | |
156 | 156 | |
157 | 157 | $table_name = 'esp_currency_payment_method'; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | KEY EVT_ID (EVT_ID), |
182 | 182 | KEY DTT_is_primary (DTT_is_primary)"; |
183 | 183 | |
184 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
184 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
185 | 185 | |
186 | 186 | $table_name = 'esp_event_meta'; |
187 | 187 | $sql = " |
@@ -200,41 +200,41 @@ discard block |
||
200 | 200 | EVT_donations TINYINT(1) NULL, |
201 | 201 | PRIMARY KEY (EVTM_ID), |
202 | 202 | KEY EVT_ID (EVT_ID)"; |
203 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
203 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
204 | 204 | |
205 | 205 | |
206 | 206 | |
207 | - $table_name='esp_event_question_group'; |
|
208 | - $sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
207 | + $table_name = 'esp_event_question_group'; |
|
208 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
209 | 209 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
210 | 210 | QSG_ID INT UNSIGNED NOT NULL, |
211 | 211 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
212 | 212 | PRIMARY KEY (EQG_ID), |
213 | 213 | KEY EVT_ID (EVT_ID), |
214 | 214 | KEY QSG_ID (QSG_ID)"; |
215 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
215 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
216 | 216 | |
217 | 217 | |
218 | 218 | |
219 | - $table_name='esp_event_venue'; |
|
220 | - $sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
219 | + $table_name = 'esp_event_venue'; |
|
220 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
221 | 221 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
222 | 222 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
223 | 223 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
224 | 224 | PRIMARY KEY (EVV_ID)"; |
225 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
225 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
226 | 226 | |
227 | 227 | |
228 | 228 | |
229 | - $table_name='esp_extra_meta'; |
|
230 | - $sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
229 | + $table_name = 'esp_extra_meta'; |
|
230 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
231 | 231 | OBJ_ID INT(11) DEFAULT NULL, |
232 | 232 | EXM_type VARCHAR(45) DEFAULT NULL, |
233 | 233 | EXM_key VARCHAR(45) DEFAULT NULL, |
234 | 234 | EXM_value TEXT, |
235 | 235 | PRIMARY KEY (EXM_ID), |
236 | 236 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
237 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
237 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
238 | 238 | |
239 | 239 | $table_name = 'esp_extra_join'; |
240 | 240 | $sql = "EXJ_ID INT(11) NOT NULL AUTO_INCREMENT, |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
248 | 248 | $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
249 | 249 | |
250 | - $table_name='esp_line_item'; |
|
251 | - $sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
250 | + $table_name = 'esp_line_item'; |
|
251 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
252 | 252 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
253 | 253 | TXN_ID INT(11) DEFAULT NULL, |
254 | 254 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | PRIMARY KEY (LIN_ID), |
268 | 268 | KEY LIN_code (LIN_code(191)), |
269 | 269 | KEY TXN_ID (TXN_ID)"; |
270 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' ); |
|
270 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
271 | 271 | |
272 | 272 | $table_name = 'esp_log'; |
273 | 273 | $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
307 | 307 | PRIMARY KEY (GRP_ID), |
308 | 308 | KEY MTP_user_id (MTP_user_id)"; |
309 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
309 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
310 | 310 | |
311 | 311 | $table_name = 'esp_event_message_template'; |
312 | 312 | $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | PRIMARY KEY (EMT_ID), |
316 | 316 | KEY EVT_ID (EVT_ID), |
317 | 317 | KEY GRP_ID (GRP_ID)"; |
318 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
318 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
319 | 319 | |
320 | 320 | |
321 | 321 | $table_name = 'esp_payment'; |
@@ -388,8 +388,8 @@ discard block |
||
388 | 388 | PRIMARY KEY (TTM_ID)"; |
389 | 389 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
390 | 390 | |
391 | - $table_name='esp_question'; |
|
392 | - $sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
391 | + $table_name = 'esp_question'; |
|
392 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
393 | 393 | QST_display_text TEXT NOT NULL, |
394 | 394 | QST_admin_label VARCHAR(255) NOT NULL, |
395 | 395 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -403,22 +403,22 @@ discard block |
||
403 | 403 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
404 | 404 | PRIMARY KEY (QST_ID), |
405 | 405 | KEY QST_order (QST_order)'; |
406 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
406 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
407 | 407 | |
408 | - $table_name='esp_question_group_question'; |
|
409 | - $sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
408 | + $table_name = 'esp_question_group_question'; |
|
409 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
410 | 410 | QSG_ID INT UNSIGNED NOT NULL, |
411 | 411 | QST_ID INT UNSIGNED NOT NULL, |
412 | 412 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
413 | 413 | PRIMARY KEY (QGQ_ID), |
414 | 414 | KEY QST_ID (QST_ID), |
415 | 415 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
416 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
416 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
417 | 417 | |
418 | 418 | |
419 | 419 | |
420 | - $table_name='esp_question_option'; |
|
421 | - $sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
420 | + $table_name = 'esp_question_option'; |
|
421 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
422 | 422 | QSO_value VARCHAR(255) NOT NULL, |
423 | 423 | QSO_desc TEXT NOT NULL, |
424 | 424 | QST_ID INT UNSIGNED NOT NULL, |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | PRIMARY KEY (QSO_ID), |
429 | 429 | KEY QST_ID (QST_ID), |
430 | 430 | KEY QSO_order (QSO_order)"; |
431 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
431 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
432 | 432 | |
433 | 433 | |
434 | 434 | |
@@ -474,8 +474,8 @@ discard block |
||
474 | 474 | |
475 | 475 | |
476 | 476 | |
477 | - $table_name='esp_checkin'; |
|
478 | - $sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
477 | + $table_name = 'esp_checkin'; |
|
478 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
479 | 479 | REG_ID INT(10) UNSIGNED NOT NULL, |
480 | 480 | DTT_ID INT(10) UNSIGNED NOT NULL, |
481 | 481 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
571 | 571 | PRIMARY KEY (PRC_ID), |
572 | 572 | KEY PRT_ID (PRT_ID)"; |
573 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
573 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
574 | 574 | |
575 | 575 | $table_name = "esp_price_type"; |
576 | 576 | $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -608,10 +608,10 @@ discard block |
||
608 | 608 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
609 | 609 | PRIMARY KEY (TKT_ID), |
610 | 610 | KEY TKT_start_date (TKT_start_date)"; |
611 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
611 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
612 | 612 | |
613 | 613 | $table_name = 'esp_question_group'; |
614 | - $sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
614 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
615 | 615 | QSG_name VARCHAR(255) NOT NULL, |
616 | 616 | QSG_identifier VARCHAR(100) NOT NULL, |
617 | 617 | QSG_desc TEXT NULL, |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | PRIMARY KEY (QSG_ID), |
625 | 625 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
626 | 626 | KEY QSG_order (QSG_order)'; |
627 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
627 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
628 | 628 | |
629 | 629 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
630 | 630 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | return $script_4_7_defaults->schema_changes_after_migration(); |
661 | 661 | } |
662 | 662 | |
663 | - public function migration_page_hooks(){ |
|
663 | + public function migration_page_hooks() { |
|
664 | 664 | |
665 | 665 | } |
666 | 666 | |
@@ -674,19 +674,19 @@ discard block |
||
674 | 674 | //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 |
675 | 675 | //('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
676 | 676 | $newer_countries = array( |
677 | - array( 'AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0 ), |
|
678 | - array( 'BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
679 | - array( 'CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0 ), |
|
680 | - array( 'GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0 ), |
|
681 | - array( 'IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
682 | - array( 'JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
683 | - array( 'MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
684 | - array( 'MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0 ), |
|
685 | - array( 'RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0 ), |
|
686 | - array( 'SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0 ), |
|
687 | - array( 'SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0 ), |
|
688 | - array( 'XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0 ), |
|
689 | - array( 'YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0 ), |
|
677 | + array('AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
678 | + array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
679 | + array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
680 | + array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
681 | + array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
682 | + array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
683 | + array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
684 | + array('MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
685 | + array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0), |
|
686 | + array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
687 | + array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
688 | + array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0), |
|
689 | + array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
690 | 690 | ); |
691 | 691 | global $wpdb; |
692 | 692 | $country_table = $wpdb->prefix."esp_country"; |
@@ -705,14 +705,14 @@ discard block |
||
705 | 705 | "CNT_is_EU" => '%d', |
706 | 706 | "CNT_active" => '%d', |
707 | 707 | ); |
708 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $country_table . "'") == $country_table ) { |
|
709 | - foreach( $newer_countries as $country ) { |
|
710 | - $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1" ; |
|
708 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$country_table."'") == $country_table) { |
|
709 | + foreach ($newer_countries as $country) { |
|
710 | + $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
711 | 711 | $countries = $wpdb->get_var($SQL); |
712 | - if ( ! $countries ) { |
|
712 | + if ( ! $countries) { |
|
713 | 713 | |
714 | - $wpdb->insert( $country_table, |
|
715 | - array_combine( array_keys( $country_format), $country ), |
|
714 | + $wpdb->insert($country_table, |
|
715 | + array_combine(array_keys($country_format), $country), |
|
716 | 716 | $country_format |
717 | 717 | ); |
718 | 718 | } |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
731 | 731 | //( 'EUR', 'Euro', 'Euros', '€', 2,1), |
732 | 732 | $newer_currencies = array( |
733 | - array( 'RSD', 'Dinar', 'Dinars', '', 3, 1 ), |
|
733 | + array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
734 | 734 | ); |
735 | 735 | global $wpdb; |
736 | 736 | $currency_table = $wpdb->prefix."esp_currency"; |
@@ -742,14 +742,14 @@ discard block |
||
742 | 742 | "CUR_dec_plc" => '%d', |
743 | 743 | "CUR_active" => '%d', |
744 | 744 | ); |
745 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $currency_table . "'") == $currency_table ) { |
|
746 | - foreach( $newer_currencies as $currency ) { |
|
747 | - $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1" ; |
|
745 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$currency_table."'") == $currency_table) { |
|
746 | + foreach ($newer_currencies as $currency) { |
|
747 | + $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
748 | 748 | $countries = $wpdb->get_var($SQL); |
749 | - if ( ! $countries ) { |
|
749 | + if ( ! $countries) { |
|
750 | 750 | |
751 | - $wpdb->insert( $currency_table, |
|
752 | - array_combine( array_keys( $currency_format), $currency ), |
|
751 | + $wpdb->insert($currency_table, |
|
752 | + array_combine(array_keys($currency_format), $currency), |
|
753 | 753 | $currency_format |
754 | 754 | ); |
755 | 755 | } |
@@ -761,9 +761,9 @@ discard block |
||
761 | 761 | * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
762 | 762 | * we should be able to stop doing this in 4.9 |
763 | 763 | */ |
764 | - public function fix_non_default_taxes(){ |
|
764 | + public function fix_non_default_taxes() { |
|
765 | 765 | global $wpdb; |
766 | - $query = $wpdb->prepare( "UPDATE |
|
766 | + $query = $wpdb->prepare("UPDATE |
|
767 | 767 | {$wpdb->prefix}esp_price p INNER JOIN |
768 | 768 | {$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID |
769 | 769 | SET |
@@ -771,8 +771,8 @@ discard block |
||
771 | 771 | WHERE |
772 | 772 | p.PRC_is_default = 0 AND |
773 | 773 | pt.PBT_ID = %d |
774 | - ", EEM_Price_Type::base_type_tax ); |
|
775 | - $wpdb->query( $query ); |
|
774 | + ", EEM_Price_Type::base_type_tax); |
|
775 | + $wpdb->query($query); |
|
776 | 776 | } |
777 | 777 | } |
778 | 778 |
@@ -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> |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -220,8 +222,9 @@ discard block |
||
220 | 222 | */ |
221 | 223 | public function remove_pages_from_nav_menu( $post_type ) { |
222 | 224 | //if this isn't the "pages" post type let's get out |
223 | - if ( $post_type->name !== 'page' ) |
|
224 | - return $post_type; |
|
225 | + if ( $post_type->name !== 'page' ) { |
|
226 | + return $post_type; |
|
227 | + } |
|
225 | 228 | |
226 | 229 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
227 | 230 | |
@@ -296,8 +299,9 @@ discard block |
||
296 | 299 | * @return string the (maybe) modified link |
297 | 300 | */ |
298 | 301 | public function modify_edit_post_link( $link, $id, $context ) { |
299 | - if ( ! $post = get_post( $id ) ) |
|
300 | - return $link; |
|
302 | + if ( ! $post = get_post( $id ) ) { |
|
303 | + return $link; |
|
304 | + } |
|
301 | 305 | |
302 | 306 | if ( $post->post_type == 'espresso_attendees' ) { |
303 | 307 | $query_args = array( |
@@ -337,7 +341,10 @@ discard block |
||
337 | 341 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
338 | 342 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
339 | 343 | <li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>> |
340 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
344 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) { |
|
345 | + echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); |
|
346 | +} |
|
347 | +?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
341 | 348 | <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
342 | 349 | </a> |
343 | 350 | </li> |
@@ -870,8 +877,9 @@ discard block |
||
870 | 877 | */ |
871 | 878 | public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
872 | 879 | EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
873 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) |
|
874 | - $config['page_path'] = $page_path; |
|
880 | + if ( class_exists( 'EE_Register_Admin_Page' ) ) { |
|
881 | + $config['page_path'] = $page_path; |
|
882 | + } |
|
875 | 883 | EE_Register_Admin_Page::register( $page_basename, $config ); |
876 | 884 | } |
877 | 885 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public static function instance() { |
49 | 49 | // check if class object is instantiated |
50 | - if ( ! self::$_instance instanceof EE_Admin ) { |
|
50 | + if ( ! self::$_instance instanceof EE_Admin) { |
|
51 | 51 | self::$_instance = new self(); |
52 | 52 | } |
53 | 53 | return self::$_instance; |
@@ -62,25 +62,25 @@ discard block |
||
62 | 62 | // define global EE_Admin constants |
63 | 63 | $this->_define_all_constants(); |
64 | 64 | // set autoloaders for our admin page classes based on included path information |
65 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN ); |
|
65 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN); |
|
66 | 66 | // admin hooks |
67 | - add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 ); |
|
67 | + add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2); |
|
68 | 68 | // load EE_Request_Handler early |
69 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' )); |
|
70 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' )); |
|
71 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 ); |
|
72 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 ); |
|
73 | - add_action( 'admin_init', array( $this, 'admin_init' ), 100 ); |
|
74 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 ); |
|
75 | - add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
76 | - add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
77 | - add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 ); |
|
78 | - add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' )); |
|
69 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request')); |
|
70 | + add_action('AHEE__EE_System__initialize_last', array($this, 'init')); |
|
71 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2); |
|
72 | + add_action('wp_loaded', array($this, 'wp_loaded'), 100); |
|
73 | + add_action('admin_init', array($this, 'admin_init'), 100); |
|
74 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20); |
|
75 | + add_action('admin_notices', array($this, 'display_admin_notices'), 10); |
|
76 | + add_action('network_admin_notices', array($this, 'display_admin_notices'), 10); |
|
77 | + add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2); |
|
78 | + add_filter('admin_footer_text', array($this, 'espresso_admin_footer')); |
|
79 | 79 | |
80 | 80 | //reset Environment config (we only do this on admin page loads); |
81 | 81 | EE_Registry::instance()->CFG->environment->recheck_values(); |
82 | 82 | |
83 | - do_action( 'AHEE__EE_Admin__loaded' ); |
|
83 | + do_action('AHEE__EE_Admin__loaded'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | private function _define_all_constants() { |
98 | - define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' ); |
|
99 | - define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' ); |
|
100 | - define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS ); |
|
101 | - define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' ); |
|
102 | - define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' )); |
|
103 | - define( 'JQPLOT_URL', EE_GLOBAL_ASSETS_URL . 'scripts/jqplot/' ); |
|
98 | + define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/'); |
|
99 | + define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/'); |
|
100 | + define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS); |
|
101 | + define('WP_ADMIN_PATH', ABSPATH.'wp-admin/'); |
|
102 | + define('WP_AJAX_URL', admin_url('admin-ajax.php')); |
|
103 | + define('JQPLOT_URL', EE_GLOBAL_ASSETS_URL.'scripts/jqplot/'); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -113,23 +113,23 @@ discard block |
||
113 | 113 | * @param string $plugin |
114 | 114 | * @return array |
115 | 115 | */ |
116 | - public function filter_plugin_actions( $links, $plugin ) { |
|
116 | + public function filter_plugin_actions($links, $plugin) { |
|
117 | 117 | // set $main_file in stone |
118 | 118 | static $main_file; |
119 | 119 | // if $main_file is not set yet |
120 | - if ( ! $main_file ) { |
|
121 | - $main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE ); |
|
120 | + if ( ! $main_file) { |
|
121 | + $main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE); |
|
122 | 122 | } |
123 | - if ( $plugin == $main_file ) { |
|
123 | + if ($plugin == $main_file) { |
|
124 | 124 | // compare current plugin to this one |
125 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
126 | - $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>'; |
|
127 | - array_unshift( $links, $maintenance_link ); |
|
125 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
126 | + $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>'; |
|
127 | + array_unshift($links, $maintenance_link); |
|
128 | 128 | } else { |
129 | - $org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>'; |
|
130 | - $events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>'; |
|
129 | + $org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>'; |
|
130 | + $events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>'; |
|
131 | 131 | // add before other links |
132 | - array_unshift( $links, $org_settings_link, $events_link ); |
|
132 | + array_unshift($links, $org_settings_link, $events_link); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | return $links; |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | * @return void |
145 | 145 | */ |
146 | 146 | public function get_request() { |
147 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
148 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
147 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
148 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | * @param array $admin_page_folder_names |
158 | 158 | * @return array |
159 | 159 | */ |
160 | - public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){ |
|
160 | + public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) { |
|
161 | 161 | return array( |
162 | - 'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS, |
|
163 | - 'about' => EE_ADMIN_PAGES . 'about' . DS, |
|
164 | - 'support' => EE_ADMIN_PAGES . 'support' . DS |
|
162 | + 'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS, |
|
163 | + 'about' => EE_ADMIN_PAGES.'about'.DS, |
|
164 | + 'support' => EE_ADMIN_PAGES.'support'.DS |
|
165 | 165 | ); |
166 | 166 | } |
167 | 167 | |
@@ -176,36 +176,36 @@ discard block |
||
176 | 176 | public function init() { |
177 | 177 | |
178 | 178 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
179 | - if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
179 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
180 | 180 | //ok so we want to enable the entire admin |
181 | - add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' )); |
|
182 | - add_action( 'save_post', array( 'EE_Admin', 'parse_post_content_on_save' ), 100, 2 ); |
|
183 | - add_action( 'update_option', array( $this, 'reset_page_for_posts_on_change' ), 100, 3 ); |
|
184 | - add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 ); |
|
185 | - add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
186 | - add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
181 | + add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback')); |
|
182 | + add_action('save_post', array('EE_Admin', 'parse_post_content_on_save'), 100, 2); |
|
183 | + add_action('update_option', array($this, 'reset_page_for_posts_on_change'), 100, 3); |
|
184 | + add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1); |
|
185 | + add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
186 | + add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
187 | 187 | //at a glance dashboard widget |
188 | - add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items'), 10 ); |
|
188 | + add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10); |
|
189 | 189 | //filter for get_edit_post_link used on comments for custom post types |
190 | - add_filter('get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 3 ); |
|
190 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | // run the admin page factory but ONLY if we are doing an ee admin ajax request |
194 | - if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) { |
|
194 | + if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) { |
|
195 | 195 | try { |
196 | 196 | //this loads the controller for the admin pages which will setup routing etc |
197 | - EE_Registry::instance()->load_core( 'Admin_Page_Loader' ); |
|
198 | - } catch ( EE_Error $e ) { |
|
197 | + EE_Registry::instance()->load_core('Admin_Page_Loader'); |
|
198 | + } catch (EE_Error $e) { |
|
199 | 199 | $e->get_error(); |
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
203 | 203 | //make sure our CPTs and custom taxonomy metaboxes get shown for first time users |
204 | - add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 ); |
|
205 | - add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 ); |
|
204 | + add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10); |
|
205 | + add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10); |
|
206 | 206 | |
207 | 207 | //exclude EE critical pages from all nav menus and wp_list_pages |
208 | - add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 ); |
|
208 | + add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -218,9 +218,9 @@ discard block |
||
218 | 218 | * @param object $post_type WP post type object |
219 | 219 | * @return object WP post type object |
220 | 220 | */ |
221 | - public function remove_pages_from_nav_menu( $post_type ) { |
|
221 | + public function remove_pages_from_nav_menu($post_type) { |
|
222 | 222 | //if this isn't the "pages" post type let's get out |
223 | - if ( $post_type->name !== 'page' ) |
|
223 | + if ($post_type->name !== 'page') |
|
224 | 224 | return $post_type; |
225 | 225 | |
226 | 226 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
@@ -240,28 +240,28 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function enable_hidden_ee_nav_menu_metaboxes() { |
242 | 242 | global $wp_meta_boxes, $pagenow; |
243 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) { |
|
243 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') { |
|
244 | 244 | return; |
245 | 245 | } |
246 | 246 | $user = wp_get_current_user(); |
247 | 247 | //has this been done yet? |
248 | - if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) { |
|
248 | + if (get_user_option('ee_nav_menu_initialized', $user->ID)) { |
|
249 | 249 | return; |
250 | 250 | } |
251 | 251 | |
252 | - $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID ); |
|
253 | - $initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) ); |
|
252 | + $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID); |
|
253 | + $initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page')); |
|
254 | 254 | |
255 | - if ( is_array( $hidden_meta_boxes ) ) { |
|
256 | - foreach ( $hidden_meta_boxes as $key => $meta_box_id ) { |
|
257 | - if ( in_array( $meta_box_id, $initial_meta_boxes ) ) { |
|
258 | - unset( $hidden_meta_boxes[ $key ] ); |
|
255 | + if (is_array($hidden_meta_boxes)) { |
|
256 | + foreach ($hidden_meta_boxes as $key => $meta_box_id) { |
|
257 | + if (in_array($meta_box_id, $initial_meta_boxes)) { |
|
258 | + unset($hidden_meta_boxes[$key]); |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
263 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
264 | - update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true ); |
|
263 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
264 | + update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @return void |
281 | 281 | */ |
282 | 282 | public function register_custom_nav_menu_boxes() { |
283 | - add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' ); |
|
283 | + add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core'); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | |
@@ -297,17 +297,17 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @return string the (maybe) modified link |
299 | 299 | */ |
300 | - public function modify_edit_post_link( $link, $id, $context ) { |
|
301 | - if ( ! $post = get_post( $id ) ) |
|
300 | + public function modify_edit_post_link($link, $id, $context) { |
|
301 | + if ( ! $post = get_post($id)) |
|
302 | 302 | return $link; |
303 | 303 | |
304 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
304 | + if ($post->post_type == 'espresso_attendees') { |
|
305 | 305 | $query_args = array( |
306 | 306 | 'action' => 'edit_attendee', |
307 | 307 | 'post' => $id |
308 | 308 | ); |
309 | 309 | EE_Registry::instance()->load_helper('URL'); |
310 | - return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') ); |
|
310 | + return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations')); |
|
311 | 311 | } |
312 | 312 | return $link; |
313 | 313 | } |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | global $nav_menu_selected_id; |
320 | 320 | |
321 | 321 | $db_fields = false; |
322 | - $walker = new Walker_Nav_Menu_Checklist( $db_fields ); |
|
322 | + $walker = new Walker_Nav_Menu_Checklist($db_fields); |
|
323 | 323 | $current_tab = 'event-archives'; |
324 | 324 | |
325 | 325 | /*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { |
@@ -338,9 +338,9 @@ discard block |
||
338 | 338 | ?> |
339 | 339 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
340 | 340 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
341 | - <li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>> |
|
342 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
343 | - <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
|
341 | + <li <?php echo ('event-archives' == $current_tab ? ' class="tabs"' : ''); ?>> |
|
342 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
343 | + <?php _e('Event Archive Pages', 'event_espresso'); ?> |
|
344 | 344 | </a> |
345 | 345 | </li> |
346 | 346 | <?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs. |
@@ -358,13 +358,13 @@ discard block |
||
358 | 358 | <?php */ ?> |
359 | 359 | |
360 | 360 | <div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php |
361 | - echo ( 'event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); |
|
361 | + echo ('event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive'); |
|
362 | 362 | ?>"> |
363 | 363 | <ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear"> |
364 | 364 | <?php |
365 | 365 | $pages = $this->_get_extra_nav_menu_pages_items(); |
366 | 366 | $args['walker'] = $walker; |
367 | - echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args ); |
|
367 | + echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args); |
|
368 | 368 | ?> |
369 | 369 | </ul> |
370 | 370 | </div><!-- /.tabs-panel --> |
@@ -372,18 +372,18 @@ discard block |
||
372 | 372 | <p class="button-controls"> |
373 | 373 | <span class="list-controls"> |
374 | 374 | <a href="<?php |
375 | - echo esc_url( add_query_arg( |
|
375 | + echo esc_url(add_query_arg( |
|
376 | 376 | array( |
377 | 377 | 'extra-nav-menu-pages-tab' => 'event-archives', |
378 | 378 | 'selectall' => 1, |
379 | 379 | ), |
380 | - remove_query_arg( $removed_args ) |
|
380 | + remove_query_arg($removed_args) |
|
381 | 381 | )); |
382 | 382 | ?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a> |
383 | 383 | </span> |
384 | 384 | |
385 | 385 | <span class="add-to-menu"> |
386 | - <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" /> |
|
386 | + <input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" /> |
|
387 | 387 | <span class="spinner"></span> |
388 | 388 | </span> |
389 | 389 | </p> |
@@ -404,10 +404,10 @@ discard block |
||
404 | 404 | private function _get_extra_nav_menu_pages_items() { |
405 | 405 | $menuitems[] = array( |
406 | 406 | 'title' => __('Event List', 'event_espresso'), |
407 | - 'url' => get_post_type_archive_link( 'espresso_events' ), |
|
407 | + 'url' => get_post_type_archive_link('espresso_events'), |
|
408 | 408 | 'description' => __('Archive page for all events.', 'event_espresso') |
409 | 409 | ); |
410 | - return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems ); |
|
410 | + return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems); |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * @param $menuitem |
420 | 420 | * @return stdClass |
421 | 421 | */ |
422 | - private function _setup_extra_nav_menu_pages_items( $menuitem ) { |
|
422 | + private function _setup_extra_nav_menu_pages_items($menuitem) { |
|
423 | 423 | $menu_item = new stdClass(); |
424 | 424 | $keys = array( |
425 | 425 | 'ID' => 0, |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | 'xfn' => '' |
440 | 440 | ); |
441 | 441 | |
442 | - foreach ( $keys as $key => $value) { |
|
442 | + foreach ($keys as $key => $value) { |
|
443 | 443 | $menu_item->$key = isset($menuitem[$key]) ? $menuitem[$key] : $value; |
444 | 444 | } |
445 | 445 | return $menu_item; |
@@ -479,10 +479,10 @@ discard block |
||
479 | 479 | * - check if doing post processing of one of EE CPTs |
480 | 480 | * - instantiate the corresponding EE CPT model for the post_type being processed. |
481 | 481 | */ |
482 | - if ( isset( $_POST['action'] ) && $_POST['action'] == 'editpost' ) { |
|
483 | - if ( isset( $_POST['post_type'] ) ) { |
|
484 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
485 | - EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] ); |
|
482 | + if (isset($_POST['action']) && $_POST['action'] == 'editpost') { |
|
483 | + if (isset($_POST['post_type'])) { |
|
484 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
485 | + EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); |
|
486 | 486 | } |
487 | 487 | } |
488 | 488 | |
@@ -492,8 +492,8 @@ discard block |
||
492 | 492 | * 'options-reading.php' core WordPress admin settings page. This is for user-proofing. |
493 | 493 | */ |
494 | 494 | global $pagenow; |
495 | - if ( $pagenow == 'options-reading.php' ) { |
|
496 | - add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) ); |
|
495 | + if ($pagenow == 'options-reading.php') { |
|
496 | + add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages')); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | } |
@@ -505,25 +505,25 @@ discard block |
||
505 | 505 | * @param string $output Current output. |
506 | 506 | * @return string |
507 | 507 | */ |
508 | - public function modify_dropdown_pages( $output ) { |
|
508 | + public function modify_dropdown_pages($output) { |
|
509 | 509 | //get critical pages |
510 | 510 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
511 | 511 | |
512 | 512 | //split current output by line break for easier parsing. |
513 | - $split_output = explode( "\n", $output ); |
|
513 | + $split_output = explode("\n", $output); |
|
514 | 514 | |
515 | 515 | //loop through to remove any critical pages from the array. |
516 | - foreach ( $critical_pages as $page_id ) { |
|
517 | - $needle = 'value="' . $page_id . '"'; |
|
518 | - foreach( $split_output as $key => $haystack ) { |
|
519 | - if( strpos( $haystack, $needle ) !== false ) { |
|
520 | - unset( $split_output[$key] ); |
|
516 | + foreach ($critical_pages as $page_id) { |
|
517 | + $needle = 'value="'.$page_id.'"'; |
|
518 | + foreach ($split_output as $key => $haystack) { |
|
519 | + if (strpos($haystack, $needle) !== false) { |
|
520 | + unset($split_output[$key]); |
|
521 | 521 | } |
522 | 522 | } |
523 | 523 | } |
524 | 524 | |
525 | 525 | //replace output with the new contents |
526 | - $output = implode( "\n", $split_output ); |
|
526 | + $output = implode("\n", $split_output); |
|
527 | 527 | |
528 | 528 | return $output; |
529 | 529 | } |
@@ -539,37 +539,37 @@ discard block |
||
539 | 539 | public function enqueue_admin_scripts() { |
540 | 540 | // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js. |
541 | 541 | // Note: the intention of this script is to only do TARGETED injections. I.E, only injecting on certain script calls. |
542 | - wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
542 | + wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
543 | 543 | // register cookie script for future dependencies |
544 | - wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE ); |
|
544 | + wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE); |
|
545 | 545 | // jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
546 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
546 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
547 | 547 | // register jQuery Validate |
548 | - wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
548 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
549 | 549 | } |
550 | 550 | //joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' ); |
551 | - if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) { |
|
551 | + if (apply_filters('FHEE_load_joyride', FALSE)) { |
|
552 | 552 | //joyride style |
553 | - wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1'); |
|
554 | - wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION ); |
|
555 | - wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE ); |
|
553 | + wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1'); |
|
554 | + wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION); |
|
555 | + wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE); |
|
556 | 556 | //joyride JS |
557 | - wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE ); |
|
557 | + wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE); |
|
558 | 558 | // wanna go for a joyride? |
559 | 559 | wp_enqueue_style('ee-joyride-css'); |
560 | 560 | wp_enqueue_script('jquery-joyride'); |
561 | 561 | } |
562 | 562 | //qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' ); |
563 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
563 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
564 | 564 | EE_Registry::instance()->load_helper('Qtip_Loader'); |
565 | 565 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
566 | 566 | } |
567 | 567 | //accounting.js library |
568 | 568 | // @link http://josscrowcroft.github.io/accounting.js/ |
569 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
570 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
571 | - wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE ); |
|
572 | - wp_enqueue_script( 'ee-accounting' ); |
|
569 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
570 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
571 | + wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE); |
|
572 | + wp_enqueue_script('ee-accounting'); |
|
573 | 573 | // array of settings to get converted to JSON array via wp_localize_script |
574 | 574 | $currency_config = array( |
575 | 575 | 'currency' => array( |
@@ -616,11 +616,11 @@ discard block |
||
616 | 616 | public function get_persistent_admin_notices() { |
617 | 617 | // http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30 |
618 | 618 | $args = array( |
619 | - 'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '', |
|
620 | - 'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '', |
|
619 | + 'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '', |
|
620 | + 'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '', |
|
621 | 621 | ); |
622 | - $return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL ); |
|
623 | - echo EE_Error::get_persistent_admin_notices( $return_url ); |
|
622 | + $return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL); |
|
623 | + echo EE_Error::get_persistent_admin_notices($return_url); |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | |
@@ -641,26 +641,26 @@ discard block |
||
641 | 641 | * @param $elements |
642 | 642 | * @return array |
643 | 643 | */ |
644 | - public function dashboard_glance_items( $elements ) { |
|
644 | + public function dashboard_glance_items($elements) { |
|
645 | 645 | $events = EEM_Event::instance()->count(); |
646 | - $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') ); |
|
647 | - $items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) ); |
|
646 | + $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php')); |
|
647 | + $items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events)); |
|
648 | 648 | $items['events']['title'] = __('Click to view all Events', 'event_espresso'); |
649 | 649 | $registrations = EEM_Registration::instance()->count( |
650 | 650 | array( |
651 | 651 | array( |
652 | - 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) |
|
652 | + 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete) |
|
653 | 653 | ) |
654 | 654 | ) |
655 | 655 | ); |
656 | - $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') ); |
|
657 | - $items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) ); |
|
656 | + $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php')); |
|
657 | + $items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations)); |
|
658 | 658 | $items['registrations']['title'] = __('Click to view all registrations', 'event_espresso'); |
659 | 659 | |
660 | - $items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items ); |
|
660 | + $items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items); |
|
661 | 661 | |
662 | - foreach ( $items as $type => $item_properties ) { |
|
663 | - $elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] ); |
|
662 | + foreach ($items as $type => $item_properties) { |
|
663 | + $elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']); |
|
664 | 664 | } |
665 | 665 | return $elements; |
666 | 666 | } |
@@ -679,63 +679,63 @@ discard block |
||
679 | 679 | * @param $post |
680 | 680 | * @return void |
681 | 681 | */ |
682 | - public static function parse_post_content_on_save( $post_ID, $post ) { |
|
682 | + public static function parse_post_content_on_save($post_ID, $post) { |
|
683 | 683 | // default post types |
684 | - $post_types = array( 'post' => 0, 'page' => 1 ); |
|
684 | + $post_types = array('post' => 0, 'page' => 1); |
|
685 | 685 | // add CPTs |
686 | 686 | $CPTs = EE_Register_CPTs::get_CPTs(); |
687 | - $post_types = array_merge( $post_types, $CPTs ); |
|
687 | + $post_types = array_merge($post_types, $CPTs); |
|
688 | 688 | // for default or CPT posts... |
689 | - if ( isset( $post_types[ $post->post_type ] )) { |
|
689 | + if (isset($post_types[$post->post_type])) { |
|
690 | 690 | // post on frontpage ? |
691 | 691 | $page_for_posts = EE_Config::get_page_for_posts(); |
692 | 692 | $maybe_remove_from_posts = array(); |
693 | 693 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
694 | 694 | $critical_shortcodes = EE_Registry::instance()->CFG->core->get_critical_pages_shortcodes_array(); |
695 | 695 | // array of shortcodes indexed by post name |
696 | - EE_Registry::instance()->CFG->core->post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
696 | + EE_Registry::instance()->CFG->core->post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
697 | 697 | // whether to proceed with update, if an entry already exists for this post, then we want to update |
698 | - $update_post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] ) ? true : false; |
|
698 | + $update_post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name]) ? true : false; |
|
699 | 699 | // empty both arrays |
700 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] = array(); |
|
700 | + EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name] = array(); |
|
701 | 701 | // check that posts page is already being tracked |
702 | - if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] ) ) { |
|
702 | + if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) { |
|
703 | 703 | // if not, then ensure that it is properly added |
704 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] = array(); |
|
704 | + EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts] = array(); |
|
705 | 705 | } |
706 | 706 | // loop thru shortcodes |
707 | - foreach ( EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) { |
|
707 | + foreach (EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) { |
|
708 | 708 | // convert to UPPERCASE to get actual shortcode |
709 | - $EES_Shortcode = strtoupper( $EES_Shortcode ); |
|
709 | + $EES_Shortcode = strtoupper($EES_Shortcode); |
|
710 | 710 | // is the shortcode in the post_content ? |
711 | - if ( strpos( $post->post_content, $EES_Shortcode ) !== FALSE ) { |
|
711 | + if (strpos($post->post_content, $EES_Shortcode) !== FALSE) { |
|
712 | 712 | // map shortcode to post names and post IDs |
713 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID; |
|
713 | + EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID; |
|
714 | 714 | // if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE |
715 | - if ( ! in_array( $EES_Shortcode, $critical_shortcodes )) { |
|
715 | + if ( ! in_array($EES_Shortcode, $critical_shortcodes)) { |
|
716 | 716 | // add shortcode to "Posts page" tracking |
717 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = $post_ID; |
|
717 | + EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = $post_ID; |
|
718 | 718 | } |
719 | 719 | $update_post_shortcodes = TRUE; |
720 | - unset( $maybe_remove_from_posts[ $EES_Shortcode ] ); |
|
720 | + unset($maybe_remove_from_posts[$EES_Shortcode]); |
|
721 | 721 | } else { |
722 | - $maybe_remove_from_posts[ $EES_Shortcode ] = $post_ID; |
|
722 | + $maybe_remove_from_posts[$EES_Shortcode] = $post_ID; |
|
723 | 723 | } |
724 | 724 | } |
725 | - if ( $update_post_shortcodes ) { |
|
725 | + if ($update_post_shortcodes) { |
|
726 | 726 | // remove shortcodes from $maybe_remove_from_posts that are still being used |
727 | - foreach ( EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes ) { |
|
728 | - if ( $post_name == $page_for_posts ) { |
|
727 | + foreach (EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes) { |
|
728 | + if ($post_name == $page_for_posts) { |
|
729 | 729 | continue; |
730 | 730 | } |
731 | 731 | // compute difference between active post_shortcodes array and $maybe_remove_from_posts array |
732 | - $maybe_remove_from_posts = array_diff_key( $maybe_remove_from_posts, $shortcodes ); |
|
732 | + $maybe_remove_from_posts = array_diff_key($maybe_remove_from_posts, $shortcodes); |
|
733 | 733 | } |
734 | 734 | // now unset unused shortcodes from the $page_for_posts post_shortcodes |
735 | - foreach ( $maybe_remove_from_posts as $shortcode => $post_ID ) { |
|
736 | - unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode ] ); |
|
735 | + foreach ($maybe_remove_from_posts as $shortcode => $post_ID) { |
|
736 | + unset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$shortcode]); |
|
737 | 737 | } |
738 | - EE_Registry::instance()->CFG->update_post_shortcodes( $page_for_posts ); |
|
738 | + EE_Registry::instance()->CFG->update_post_shortcodes($page_for_posts); |
|
739 | 739 | } |
740 | 740 | } |
741 | 741 | } |
@@ -753,32 +753,32 @@ discard block |
||
753 | 753 | * @throws EE_Error |
754 | 754 | * @return string |
755 | 755 | */ |
756 | - public function check_for_invalid_datetime_formats( $value, $option ) { |
|
757 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
756 | + public function check_for_invalid_datetime_formats($value, $option) { |
|
757 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
758 | 758 | // check for date_format or time_format |
759 | - switch ( $option ) { |
|
759 | + switch ($option) { |
|
760 | 760 | case 'date_format' : |
761 | - $date_time_format = $value . ' ' . get_option('time_format'); |
|
761 | + $date_time_format = $value.' '.get_option('time_format'); |
|
762 | 762 | break; |
763 | 763 | case 'time_format' : |
764 | - $date_time_format = get_option('date_format') . ' ' . $value; |
|
764 | + $date_time_format = get_option('date_format').' '.$value; |
|
765 | 765 | break; |
766 | 766 | default : |
767 | 767 | $date_time_format = FALSE; |
768 | 768 | } |
769 | 769 | // do we have a date_time format to check ? |
770 | - if ( $date_time_format ) { |
|
771 | - $error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format ); |
|
770 | + if ($date_time_format) { |
|
771 | + $error_msg = EEH_DTT_Helper::validate_format_string($date_time_format); |
|
772 | 772 | |
773 | - if ( is_array( $error_msg ) ) { |
|
774 | - $msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format ) . '</p><p><ul>'; |
|
773 | + if (is_array($error_msg)) { |
|
774 | + $msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>'; |
|
775 | 775 | |
776 | 776 | |
777 | - foreach ( $error_msg as $error ) { |
|
778 | - $msg .= '<li>' . $error . '</li>'; |
|
777 | + foreach ($error_msg as $error) { |
|
778 | + $msg .= '<li>'.$error.'</li>'; |
|
779 | 779 | } |
780 | 780 | |
781 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
781 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
782 | 782 | |
783 | 783 | // trigger WP settings error |
784 | 784 | add_settings_error( |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | ); |
789 | 789 | |
790 | 790 | // set format to something valid |
791 | - switch ( $option ) { |
|
791 | + switch ($option) { |
|
792 | 792 | case 'date_format' : |
793 | 793 | $value = 'F j, Y'; |
794 | 794 | break; |
@@ -814,14 +814,14 @@ discard block |
||
814 | 814 | * @param $value |
815 | 815 | * @return void |
816 | 816 | */ |
817 | - public function reset_page_for_posts_on_change( $option, $old_value, $value ) { |
|
818 | - if ( $option == 'page_for_posts' ) { |
|
817 | + public function reset_page_for_posts_on_change($option, $old_value, $value) { |
|
818 | + if ($option == 'page_for_posts') { |
|
819 | 819 | global $wpdb; |
820 | - $SQL = 'SELECT post_name from ' . $wpdb->posts . ' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s'; |
|
821 | - $old_page_for_posts = $old_value ? $wpdb->get_var( $wpdb->prepare( $SQL, $old_value )) : 'posts'; |
|
822 | - $new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value )) : 'posts'; |
|
823 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $new_page_for_posts ] = EE_Registry::instance()->CFG->core->post_shortcodes[ $old_page_for_posts ]; |
|
824 | - EE_Registry::instance()->CFG->update_post_shortcodes( $new_page_for_posts ); |
|
820 | + $SQL = 'SELECT post_name from '.$wpdb->posts.' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s'; |
|
821 | + $old_page_for_posts = $old_value ? $wpdb->get_var($wpdb->prepare($SQL, $old_value)) : 'posts'; |
|
822 | + $new_page_for_posts = $value ? $wpdb->get_var($wpdb->prepare($SQL, $value)) : 'posts'; |
|
823 | + EE_Registry::instance()->CFG->core->post_shortcodes[$new_page_for_posts] = EE_Registry::instance()->CFG->core->post_shortcodes[$old_page_for_posts]; |
|
824 | + EE_Registry::instance()->CFG->update_post_shortcodes($new_page_for_posts); |
|
825 | 825 | } |
826 | 826 | } |
827 | 827 | |
@@ -834,8 +834,8 @@ discard block |
||
834 | 834 | * @param $content |
835 | 835 | * @return string |
836 | 836 | */ |
837 | - public function its_eSpresso( $content ) { |
|
838 | - return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content ); |
|
837 | + public function its_eSpresso($content) { |
|
838 | + return str_replace('[EXPRESSO_', '[ESPRESSO_', $content); |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | |
@@ -848,9 +848,9 @@ discard block |
||
848 | 848 | */ |
849 | 849 | public function espresso_admin_footer() { |
850 | 850 | return sprintf( |
851 | - __( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ), |
|
851 | + __('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'), |
|
852 | 852 | '<a href="https://eventespresso.com/" title="', |
853 | - '">' . EVENT_ESPRESSO_POWERED_BY . '</a>' |
|
853 | + '">'.EVENT_ESPRESSO_POWERED_BY.'</a>' |
|
854 | 854 | ); |
855 | 855 | } |
856 | 856 | |
@@ -870,11 +870,11 @@ discard block |
||
870 | 870 | * @param array $config |
871 | 871 | * @return void |
872 | 872 | */ |
873 | - public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
|
874 | - EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
|
875 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) |
|
873 | + public static function register_ee_admin_page($page_basename, $page_path, $config = array()) { |
|
874 | + EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3'); |
|
875 | + if (class_exists('EE_Register_Admin_Page')) |
|
876 | 876 | $config['page_path'] = $page_path; |
877 | - EE_Register_Admin_Page::register( $page_basename, $config ); |
|
877 | + EE_Register_Admin_Page::register($page_basename, $config); |
|
878 | 878 | } |
879 | 879 | |
880 | 880 |