@@ -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,166 +182,166 @@ 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 | 'caps' => \EEM_Base::caps_read_admin |
195 | 195 | ), |
196 | 196 | $event_id |
197 | 197 | ); |
198 | - if( $event_id ){ |
|
199 | - $query_params[0]['EVT_ID'] = $event_id; |
|
200 | - }else{ |
|
201 | - $query_params[ 'force_join' ][] = 'Event'; |
|
198 | + if ($event_id) { |
|
199 | + $query_params[0]['EVT_ID'] = $event_id; |
|
200 | + } else { |
|
201 | + $query_params['force_join'][] = 'Event'; |
|
202 | 202 | } |
203 | - $registration_rows = $reg_model->get_all_wpdb_results( $query_params ); |
|
203 | + $registration_rows = $reg_model->get_all_wpdb_results($query_params); |
|
204 | 204 | //get all questions which relate to someone in this group |
205 | 205 | $registration_ids = array(); |
206 | - foreach( $registration_rows as $reg_row ) { |
|
207 | - $registration_ids[] = intval( $reg_row[ 'Registration.REG_ID'] ); |
|
206 | + foreach ($registration_rows as $reg_row) { |
|
207 | + $registration_ids[] = intval($reg_row['Registration.REG_ID']); |
|
208 | 208 | } |
209 | 209 | |
210 | - foreach($registration_rows as $reg_row){ |
|
211 | - if ( is_array( $reg_row ) ) { |
|
210 | + foreach ($registration_rows as $reg_row) { |
|
211 | + if (is_array($reg_row)) { |
|
212 | 212 | $reg_csv_array = array(); |
213 | - if( ! $event_id ){ |
|
213 | + if ( ! $event_id) { |
|
214 | 214 | //get the event's name and Id |
215 | - $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 | + $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']); |
|
216 | 216 | } |
217 | - $is_primary_reg = $reg_row[ 'Registration.REG_count' ] == '1' ? true : false; |
|
217 | + $is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false; |
|
218 | 218 | /*@var $reg_row EE_Registration */ |
219 | - foreach($reg_fields_to_include as $field_name){ |
|
219 | + foreach ($reg_fields_to_include as $field_name) { |
|
220 | 220 | $field = $reg_model->field_settings_for($field_name); |
221 | - if($field_name == 'REG_final_price'){ |
|
222 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' ); |
|
223 | - }elseif( $field_name == 'REG_count' ){ |
|
224 | - $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' ] ) ); |
|
225 | - }elseif( $field_name == 'REG_date' ) { |
|
226 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' ); |
|
227 | - }else{ |
|
228 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] ); |
|
221 | + if ($field_name == 'REG_final_price') { |
|
222 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_final_price'], 'localized_float'); |
|
223 | + }elseif ($field_name == 'REG_count') { |
|
224 | + $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'])); |
|
225 | + }elseif ($field_name == 'REG_date') { |
|
226 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_date'], 'no_html'); |
|
227 | + } else { |
|
228 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row[$field->get_qualified_column()]); |
|
229 | 229 | } |
230 | 230 | $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value; |
231 | - if($field_name == 'REG_final_price'){ |
|
231 | + if ($field_name == 'REG_final_price') { |
|
232 | 232 | //add a column named Currency after the final price |
233 | 233 | $reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code; |
234 | 234 | } |
235 | 235 | } |
236 | 236 | //get pretty status |
237 | - $stati = \EEM_Status::instance()->localized_status( array( |
|
238 | - $reg_row[ 'Registration.STS_ID' ] => __( 'unknown', 'event_espresso' ), |
|
239 | - $reg_row[ 'TransactionTable.STS_ID' ] => __( 'unknown', 'event_espresso' ) ), |
|
237 | + $stati = \EEM_Status::instance()->localized_status(array( |
|
238 | + $reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'), |
|
239 | + $reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso') ), |
|
240 | 240 | FALSE, |
241 | - 'sentence' ); |
|
242 | - $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[ $reg_row[ 'Registration.STS_ID' ] ]; |
|
241 | + 'sentence'); |
|
242 | + $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']]; |
|
243 | 243 | //get pretty transaction status |
244 | - $reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[ $reg_row[ 'TransactionTable.STS_ID' ] ]; |
|
245 | - $reg_csv_array[ __( 'Transaction Amount Due', 'event_espresso' ) ] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display( \EEM_Transaction::instance(), 'TXN_total', $reg_row[ 'TransactionTable.TXN_total' ], 'localized_float' ) : '0.00'; |
|
246 | - $reg_csv_array[ __( 'Amount Paid', 'event_espresso' )] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display( \EEM_Transaction::instance(), 'TXN_paid', $reg_row[ 'TransactionTable.TXN_paid' ], 'localized_float' ) : '0.00'; |
|
244 | + $reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']]; |
|
245 | + $reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total', $reg_row['TransactionTable.TXN_total'], 'localized_float') : '0.00'; |
|
246 | + $reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid', $reg_row['TransactionTable.TXN_paid'], 'localized_float') : '0.00'; |
|
247 | 247 | $payment_methods = array(); |
248 | 248 | $gateway_txn_ids_etc = array(); |
249 | 249 | $payment_times = array(); |
250 | - if( $is_primary_reg && $reg_row[ 'TransactionTable.TXN_ID' ] ){ |
|
250 | + if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) { |
|
251 | 251 | $payments_info = \EEM_Payment::instance()->get_all_wpdb_results( |
252 | 252 | array( |
253 | 253 | array( |
254 | - 'TXN_ID' => $reg_row[ 'TransactionTable.TXN_ID' ], |
|
254 | + 'TXN_ID' => $reg_row['TransactionTable.TXN_ID'], |
|
255 | 255 | 'STS_ID' => \EEM_Payment::status_id_approved |
256 | 256 | ), |
257 | - 'force_join' => array( 'Payment_Method' ), |
|
257 | + 'force_join' => array('Payment_Method'), |
|
258 | 258 | |
259 | 259 | ), |
260 | 260 | ARRAY_A, |
261 | 261 | 'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' ); |
262 | 262 | |
263 | - foreach( $payments_info as $payment_method_and_gateway_txn_id ){ |
|
264 | - $payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' ); |
|
265 | - $gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : ''; |
|
266 | - $payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : ''; |
|
263 | + foreach ($payments_info as $payment_method_and_gateway_txn_id) { |
|
264 | + $payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso'); |
|
265 | + $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : ''; |
|
266 | + $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) ? $payment_method_and_gateway_txn_id['payment_time'] : ''; |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | } |
270 | - $reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times ); |
|
271 | - $reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods ); |
|
272 | - $reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc ); |
|
270 | + $reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times); |
|
271 | + $reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods); |
|
272 | + $reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc); |
|
273 | 273 | |
274 | 274 | //get whether or not the user has checked in |
275 | - $reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related( $reg_row[ 'Registration.REG_ID'] , 'Checkin' ); |
|
275 | + $reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin'); |
|
276 | 276 | //get ticket of registration and its price |
277 | 277 | $ticket_model = \EE_Registry::instance()->load_model('Ticket'); |
278 | - if( $reg_row[ 'Ticket.TKT_ID'] ) { |
|
279 | - $ticket_name = \EEH_Export::prepare_value_from_db_for_display( $ticket_model, 'TKT_name', $reg_row[ 'Ticket.TKT_name' ] ); |
|
278 | + if ($reg_row['Ticket.TKT_ID']) { |
|
279 | + $ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name', $reg_row['Ticket.TKT_name']); |
|
280 | 280 | $datetimes_strings = array(); |
281 | - 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){ |
|
282 | - $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display( \EEM_Datetime::instance(), 'DTT_EVT_start', $datetime[ 'Datetime.DTT_EVT_start'] ); |
|
281 | + 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) { |
|
282 | + $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(), 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | } else { |
286 | - $ticket_name = __( 'Unknown', 'event_espresso' ); |
|
287 | - $datetimes_strings = array( __( 'Unknown', 'event_espresso' ) ); |
|
286 | + $ticket_name = __('Unknown', 'event_espresso'); |
|
287 | + $datetimes_strings = array(__('Unknown', 'event_espresso')); |
|
288 | 288 | } |
289 | 289 | $reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name; |
290 | 290 | $reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings); |
291 | 291 | //get datetime(s) of registration |
292 | 292 | |
293 | 293 | //add attendee columns |
294 | - foreach($att_fields_to_include as $att_field_name){ |
|
294 | + foreach ($att_fields_to_include as $att_field_name) { |
|
295 | 295 | $field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name); |
296 | - if( $reg_row[ 'Attendee_CPT.ID' ]){ |
|
297 | - if($att_field_name == 'STA_ID'){ |
|
298 | - $value = \EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' ); |
|
299 | - }elseif($att_field_name == 'CNT_ISO'){ |
|
300 | - $value = \EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' ); |
|
301 | - }else{ |
|
302 | - $value = \EEH_Export::prepare_value_from_db_for_display( \EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] ); |
|
296 | + if ($reg_row['Attendee_CPT.ID']) { |
|
297 | + if ($att_field_name == 'STA_ID') { |
|
298 | + $value = \EEM_State::instance()->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), 'STA_name'); |
|
299 | + }elseif ($att_field_name == 'CNT_ISO') { |
|
300 | + $value = \EEM_Country::instance()->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), 'CNT_name'); |
|
301 | + } else { |
|
302 | + $value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(), $att_field_name, $reg_row[$field_obj->get_qualified_column()]); |
|
303 | 303 | } |
304 | - }else{ |
|
304 | + } else { |
|
305 | 305 | $value = ''; |
306 | 306 | } |
307 | 307 | |
308 | - $reg_csv_array[ \EEH_Export::get_column_name_for_field($field_obj) ] = $value; |
|
308 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | //make sure each registration has the same questions in the same order |
312 | - foreach($questions_for_these_regs_rows as $question_row){ |
|
313 | - if( ! isset($reg_csv_array[$question_row[ 'Question.QST_admin_label']])){ |
|
314 | - $reg_csv_array[$question_row[ 'Question.QST_admin_label' ] ] = null; |
|
312 | + foreach ($questions_for_these_regs_rows as $question_row) { |
|
313 | + if ( ! isset($reg_csv_array[$question_row['Question.QST_admin_label']])) { |
|
314 | + $reg_csv_array[$question_row['Question.QST_admin_label']] = null; |
|
315 | 315 | } |
316 | 316 | } |
317 | 317 | $answers = \EEM_Answer::instance()->get_all_wpdb_results( |
318 | 318 | array( |
319 | - array( 'REG_ID' => $reg_row[ 'Registration.REG_ID' ] ), |
|
320 | - 'force_join' => array( 'Question' ) |
|
319 | + array('REG_ID' => $reg_row['Registration.REG_ID']), |
|
320 | + 'force_join' => array('Question') |
|
321 | 321 | ) |
322 | 322 | ); |
323 | 323 | //now fill out the questions THEY answered |
324 | - foreach( $answers as $answer_row ){ |
|
325 | - if( $answer_row[ 'Question.QST_ID' ] ){ |
|
324 | + foreach ($answers as $answer_row) { |
|
325 | + if ($answer_row['Question.QST_ID']) { |
|
326 | 326 | $question_label = \EEH_Export::prepare_value_from_db_for_display( |
327 | 327 | \EEM_Question::instance(), |
328 | 328 | 'QST_admin_label', |
329 | - $answer_row[ 'Question.QST_admin_label' ] |
|
329 | + $answer_row['Question.QST_admin_label'] |
|
330 | 330 | ); |
331 | 331 | } else { |
332 | - $question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] ); |
|
332 | + $question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']); |
|
333 | 333 | } |
334 | - if ( isset( $answer_row[ 'Question.QST_type' ] ) |
|
335 | - && $answer_row[ 'Question.QST_type' ] == \EEM_Question::QST_type_state |
|
334 | + if (isset($answer_row['Question.QST_type']) |
|
335 | + && $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state |
|
336 | 336 | ) { |
337 | - $reg_csv_array[ $question_label ] = \EEM_State::instance()->get_state_name_by_ID( |
|
338 | - $answer_row[ 'Answer.ANS_value' ] |
|
337 | + $reg_csv_array[$question_label] = \EEM_State::instance()->get_state_name_by_ID( |
|
338 | + $answer_row['Answer.ANS_value'] |
|
339 | 339 | ); |
340 | 340 | } else { |
341 | - $reg_csv_array[ $question_label ] = \EEH_Export::prepare_value_from_db_for_display( |
|
341 | + $reg_csv_array[$question_label] = \EEH_Export::prepare_value_from_db_for_display( |
|
342 | 342 | \EEM_Answer::instance(), |
343 | 343 | 'ANS_value', |
344 | - $answer_row[ 'Answer.ANS_value' ] |
|
344 | + $answer_row['Answer.ANS_value'] |
|
345 | 345 | ); |
346 | 346 | } |
347 | 347 | } |
@@ -352,17 +352,17 @@ discard block |
||
352 | 352 | } |
353 | 353 | } |
354 | 354 | //if we couldn't export anything, we want to at least show the column headers |
355 | - if ( empty( $registrations_csv_ready_array ) ) { |
|
355 | + if (empty($registrations_csv_ready_array)) { |
|
356 | 356 | $reg_csv_array = array(); |
357 | 357 | $model_and_fields_to_include = array( |
358 | 358 | 'Registration' => $reg_fields_to_include, |
359 | 359 | 'Attendee' => $att_fields_to_include |
360 | 360 | ); |
361 | - foreach ( $model_and_fields_to_include as $model_name => $field_list ) { |
|
362 | - $model = \EE_Registry::instance()->load_model( $model_name ); |
|
363 | - foreach ( $field_list as $field_name ) { |
|
364 | - $field = $model->field_settings_for( $field_name ); |
|
365 | - $reg_csv_array[ \EEH_Export::get_column_name_for_field( $field ) ] = null; |
|
361 | + foreach ($model_and_fields_to_include as $model_name => $field_list) { |
|
362 | + $model = \EE_Registry::instance()->load_model($model_name); |
|
363 | + foreach ($field_list as $field_name) { |
|
364 | + $field = $model->field_settings_for($field_name); |
|
365 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null; |
|
366 | 366 | } |
367 | 367 | } |
368 | 368 | $registrations_csv_ready_array[] = $reg_csv_array; |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | * @param int $event_id |
379 | 379 | * @return int |
380 | 380 | */ |
381 | - public function count_units_to_process( $event_id ) { |
|
381 | + public function count_units_to_process($event_id) { |
|
382 | 382 | //use the legacy filter |
383 | 383 | $query_params = apply_filters( |
384 | 384 | 'FHEE__EE_Export__report_registration_for_event', |
@@ -386,24 +386,24 @@ discard block |
||
386 | 386 | array( |
387 | 387 | 'OR' => array( |
388 | 388 | //don't include registrations from failed or abandoned transactions... |
389 | - 'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ), |
|
389 | + 'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)), |
|
390 | 390 | //unless the registration is approved, in which case include it regardless of transaction status |
391 | 391 | 'STS_ID' => \EEM_Registration::status_id_approved |
392 | 392 | ), |
393 | - 'Ticket.TKT_deleted' => array( 'IN', array( true, false ) ) |
|
393 | + 'Ticket.TKT_deleted' => array('IN', array(true, false)) |
|
394 | 394 | ), |
395 | - 'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'), |
|
396 | - 'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ), |
|
395 | + 'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'), |
|
396 | + 'force_join' => array('Transaction', 'Ticket', 'Attendee'), |
|
397 | 397 | 'caps' => \EEM_Base::caps_read_admin |
398 | 398 | ), |
399 | 399 | $event_id |
400 | 400 | ); |
401 | - if( $event_id ){ |
|
402 | - $query_params[0]['EVT_ID'] = $event_id; |
|
401 | + if ($event_id) { |
|
402 | + $query_params[0]['EVT_ID'] = $event_id; |
|
403 | 403 | } else { |
404 | - $query_params[ 'force_join' ][] = 'Event'; |
|
404 | + $query_params['force_join'][] = 'Event'; |
|
405 | 405 | } |
406 | - return \EEM_Registration::instance()->count( $query_params ); |
|
406 | + return \EEM_Registration::instance()->count($query_params); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | |
@@ -414,13 +414,13 @@ discard block |
||
414 | 414 | * @param JobParameters $job_parameters |
415 | 415 | * @return boolean |
416 | 416 | */ |
417 | - public function cleanup_job( JobParameters $job_parameters ){ |
|
417 | + public function cleanup_job(JobParameters $job_parameters) { |
|
418 | 418 | $this->_file_helper->delete( |
419 | - \EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ), |
|
419 | + \EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')), |
|
420 | 420 | true, |
421 | 421 | 'd' |
422 | 422 | ); |
423 | - return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) ); |
|
423 | + return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso')); |
|
424 | 424 | } |
425 | 425 | } |
426 | 426 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | <?php _e('Adjust the settings for the Authorize.net AIM payment gateway.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | 5 | <p> |
6 | -<?php printf( __( 'See %1$shere%2$s for list of currencies supported by Authorize.net AIM.', 'event_espresso' ), "<a href='http://www.authorize.net/international/' target='_blank'>","</a>" ); ?> |
|
6 | +<?php printf(__('See %1$shere%2$s for list of currencies supported by Authorize.net AIM.', 'event_espresso'), "<a href='http://www.authorize.net/international/' target='_blank'>", "</a>"); ?> |
|
7 | 7 | </p> |
8 | 8 | <p><strong><?php _e('Authorize.net AIM Settings', 'event_espresso'); ?></strong></p> |
9 | 9 | <ul> |
@@ -28,16 +28,16 @@ discard block |
||
28 | 28 | <?php _e('By logging into Authorize.net, you can change which payment fields are required by Authorize.net when processing payments. These settings affect both the Advanced Integration Method (AIM, this) and the Simple Integration Method (SIM, different). The payment method settings "Excluded Payment Form Fields" and "Required Payment Form Fields" allow you to change the billing form in Event Espresso to reflect your payment form settings in Authorize.net.', 'event_espresso'); ?> |
29 | 29 | <br> |
30 | 30 | <?php printf( |
31 | - __( 'To change your payment form settings in Authorize.net, %1$slog in to authorize.net%2$s, go to %3$sAccount then Payment Form%2$s, then %4$sForm Fields%2$s. It will look similar to %5$sthis%2$s. If you make a field required in Authorize.net, you should also make it required in Event Espresso. If it isn\'t required in Authorize.net, and you want to simplify the billing form in Event Espresso, you can exclude it from the Event Espresso Form too.'), |
|
31 | + __('To change your payment form settings in Authorize.net, %1$slog in to authorize.net%2$s, go to %3$sAccount then Payment Form%2$s, then %4$sForm Fields%2$s. It will look similar to %5$sthis%2$s. If you make a field required in Authorize.net, you should also make it required in Event Espresso. If it isn\'t required in Authorize.net, and you want to simplify the billing form in Event Espresso, you can exclude it from the Event Espresso Form too.'), |
|
32 | 32 | '<a href="http://authorize.net" target="_blank">', |
33 | 33 | '</a>', |
34 | 34 | '<a href="https://monosnap.com/file/nebVteOkEXcdDIos88SojStWOifP23" target="_blank">', |
35 | 35 | '<a href="https://monosnap.com/file/WyxGJtev87TcDmdGBEZ2oi1xaBIQAm" target="_blank">', |
36 | - '<a href="https://monosnap.com/image/DbCJNfEesWXeSNUs1wLIpGYODFw52m" target="_blank">');?> |
|
36 | + '<a href="https://monosnap.com/image/DbCJNfEesWXeSNUs1wLIpGYODFw52m" target="_blank">'); ?> |
|
37 | 37 | </li> |
38 | 38 | <li> |
39 | - <strong><?php _e( 'Server', 'event_espresso');?></strong> |
|
40 | - <?php _e( 'Use this setting to change the server where Authorize.net AIM requests are sent. Change this to "Authorize.net/Akamai" before June 30th 2016 to verify your server wil work with Authorize.net\'s servers which will be in use after that date.', 'event_espresso' );?> |
|
39 | + <strong><?php _e('Server', 'event_espresso'); ?></strong> |
|
40 | + <?php _e('Use this setting to change the server where Authorize.net AIM requests are sent. Change this to "Authorize.net/Akamai" before June 30th 2016 to verify your server wil work with Authorize.net\'s servers which will be in use after that date.', 'event_espresso'); ?> |
|
41 | 41 | </li> |
42 | 42 | <li> |
43 | 43 | <strong><?php _e('Button Image URL', 'event_espresso'); ?></strong><br /> |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_PMT_Aim extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Aim extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | |
31 | 31 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | require_once($this->file_folder().'EEG_Aim.gateway.php'); |
49 | 49 | $this->_gateway = new EEG_AIM(); |
50 | 50 | $this->_pretty_name = __("Authorize.net AIM", 'event_espresso'); |
51 | - $this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' ); |
|
51 | + $this->_default_description = __('Please provide the following billing information.', 'event_espresso'); |
|
52 | 52 | $this->_requires_https = true; |
53 | 53 | } |
54 | 54 | |
@@ -57,60 +57,60 @@ discard block |
||
57 | 57 | * @param \EE_Transaction $transaction |
58 | 58 | * @return EE_Billing_Info_Form |
59 | 59 | */ |
60 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
61 | - $billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance,array( |
|
60 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
61 | + $billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance, array( |
|
62 | 62 | 'name'=>'AIM_Form', |
63 | 63 | 'subsections'=>array( |
64 | 64 | 'credit_card'=>new EE_Credit_Card_Input(array( |
65 | 65 | 'required'=>true, |
66 | - 'html_label_text' => __( 'Card Number', 'event_espresso' ) |
|
66 | + 'html_label_text' => __('Card Number', 'event_espresso') |
|
67 | 67 | )), |
68 | 68 | 'exp_month'=>new EE_Credit_Card_Month_Input(true, array( |
69 | 69 | 'required'=>true, |
70 | - 'html_label_text' => __( 'Expiry Month', 'event_espresso' ) |
|
70 | + 'html_label_text' => __('Expiry Month', 'event_espresso') |
|
71 | 71 | )), |
72 | - 'exp_year'=>new EE_Credit_Card_Year_Input( array( |
|
72 | + 'exp_year'=>new EE_Credit_Card_Year_Input(array( |
|
73 | 73 | 'required'=>true, |
74 | - 'html_label_text' => __( 'Expiry Year', 'event_espresso' ) |
|
74 | + 'html_label_text' => __('Expiry Year', 'event_espresso') |
|
75 | 75 | )), |
76 | - 'cvv'=>new EE_CVV_Input( array( |
|
76 | + 'cvv'=>new EE_CVV_Input(array( |
|
77 | 77 | 'required'=>true, |
78 | - 'html_label_text' => __( 'CVV', 'event_espresso' ) ) ), |
|
78 | + 'html_label_text' => __('CVV', 'event_espresso') )), |
|
79 | 79 | ) |
80 | 80 | )); |
81 | - $billing_form->add_subsections( array( |
|
82 | - 'company' => new EE_Text_Input( array( |
|
81 | + $billing_form->add_subsections(array( |
|
82 | + 'company' => new EE_Text_Input(array( |
|
83 | 83 | 'html_label_text' => __('Company', 'event_espresso') |
84 | 84 | )) |
85 | - ), 'email', false ); |
|
85 | + ), 'email', false); |
|
86 | 86 | $billing_form->add_subsections( |
87 | 87 | array( |
88 | - 'fax' => new EE_Text_Input( array( |
|
88 | + 'fax' => new EE_Text_Input(array( |
|
89 | 89 | 'html_label_text' => __('Fax', 'event_espresso') |
90 | 90 | )) |
91 | 91 | ), |
92 | 92 | 'phone', |
93 | 93 | false ); |
94 | 94 | $settings_form = $this->settings_form(); |
95 | - if( $settings_form->get_input( 'excluded_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) { |
|
96 | - $billing_form->exclude( $settings_form->get_input( 'excluded_billing_inputs' )->normalized_value() ); |
|
95 | + if ($settings_form->get_input('excluded_billing_inputs') instanceof EE_Checkbox_Multi_Input) { |
|
96 | + $billing_form->exclude($settings_form->get_input('excluded_billing_inputs')->normalized_value()); |
|
97 | 97 | } |
98 | - if( $settings_form->get_input( 'required_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) { |
|
99 | - $required_inputs = $settings_form->get_input( 'required_billing_inputs' )->normalized_value(); |
|
98 | + if ($settings_form->get_input('required_billing_inputs') instanceof EE_Checkbox_Multi_Input) { |
|
99 | + $required_inputs = $settings_form->get_input('required_billing_inputs')->normalized_value(); |
|
100 | 100 | //only change the requirement of inputs which are allowed to be changed |
101 | 101 | $inputs_to_evaluate = array_intersect_key( |
102 | 102 | $billing_form->inputs(), |
103 | 103 | $this->billing_input_names() |
104 | 104 | ); |
105 | - foreach( $inputs_to_evaluate as $input_name => $input ) { |
|
106 | - if( in_array( $input_name, $required_inputs ) ) { |
|
107 | - $input->set_required( true ); |
|
105 | + foreach ($inputs_to_evaluate as $input_name => $input) { |
|
106 | + if (in_array($input_name, $required_inputs)) { |
|
107 | + $input->set_required(true); |
|
108 | 108 | } else { |
109 | - $input->set_required( false ); |
|
109 | + $input->set_required(false); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
113 | - return $this->apply_billing_form_debug_settings( $billing_form ); |
|
113 | + return $this->apply_billing_form_debug_settings($billing_form); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -122,19 +122,19 @@ discard block |
||
122 | 122 | * @param \EE_Billing_Info_Form $billing_form |
123 | 123 | * @return \EE_Billing_Info_Form |
124 | 124 | */ |
125 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
126 | - if ( $this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta( 'test_transactions', TRUE, FALSE )) { |
|
127 | - $billing_form->get_input( 'credit_card' )->set_default( '4007000000027' ); |
|
128 | - $billing_form->get_input( 'exp_year' )->set_default( '2020' ); |
|
129 | - if( $billing_form->get_subsection( 'cvv' ) instanceof EE_Form_Input_Base ) { |
|
130 | - $billing_form->get_input( 'cvv' )->set_default(( '123' )); |
|
125 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
126 | + if ($this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta('test_transactions', TRUE, FALSE)) { |
|
127 | + $billing_form->get_input('credit_card')->set_default('4007000000027'); |
|
128 | + $billing_form->get_input('exp_year')->set_default('2020'); |
|
129 | + if ($billing_form->get_subsection('cvv') instanceof EE_Form_Input_Base) { |
|
130 | + $billing_form->get_input('cvv')->set_default(('123')); |
|
131 | 131 | } |
132 | 132 | $billing_form->add_subsections( |
133 | - array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ), |
|
133 | + array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()), |
|
134 | 134 | 'credit_card' |
135 | 135 | ); |
136 | 136 | $billing_form->add_subsections( |
137 | - array( 'debug_content' => new EE_Form_Section_HTML_From_Template( dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php' )), |
|
137 | + array('debug_content' => new EE_Form_Section_HTML_From_Template(dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php')), |
|
138 | 138 | 'first_name' |
139 | 139 | ); |
140 | 140 | } |
@@ -154,17 +154,17 @@ discard block |
||
154 | 154 | 'extra_meta_inputs'=>array( |
155 | 155 | 'login_id'=>new EE_Text_Input( |
156 | 156 | array( |
157 | - 'html_label_text'=> sprintf( __("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link() ), |
|
157 | + 'html_label_text'=> sprintf(__("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link()), |
|
158 | 158 | 'required' => true ) |
159 | 159 | ), |
160 | 160 | 'transaction_key'=>new EE_Text_Input( |
161 | 161 | array( |
162 | - 'html_label_text'=> sprintf( __("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link() ), |
|
162 | + 'html_label_text'=> sprintf(__("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link()), |
|
163 | 163 | 'required' => true ) |
164 | 164 | ), |
165 | 165 | 'test_transactions'=>new EE_Yes_No_Input( |
166 | 166 | array( |
167 | - 'html_label_text'=> sprintf( __("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
167 | + 'html_label_text'=> sprintf(__("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link()), |
|
168 | 168 | 'html_help_text'=> __("Send test transactions, even to live server", 'event_espresso'), |
169 | 169 | 'default' => false, |
170 | 170 | 'required' => true |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | 'excluded_billing_inputs' => new EE_Checkbox_Multi_Input( |
174 | 174 | $billing_input_names, |
175 | 175 | array( |
176 | - 'html_label_text' => sprintf( __("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
176 | + 'html_label_text' => sprintf(__("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), |
|
177 | 177 | 'default' => array( |
178 | 178 | 'company', |
179 | 179 | 'fax', |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | 'required_billing_inputs' => new EE_Checkbox_Multi_Input( |
183 | 183 | $billing_input_names, |
184 | 184 | array( |
185 | - 'html_label_text' => sprintf( __("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
185 | + 'html_label_text' => sprintf(__("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), |
|
186 | 186 | 'default' => array_diff( |
187 | - array_keys( $billing_input_names ), |
|
188 | - array( 'address2', 'phone', 'company', 'fax' ) |
|
187 | + array_keys($billing_input_names), |
|
188 | + array('address2', 'phone', 'company', 'fax') |
|
189 | 189 | ), |
190 | 190 | 'html_help_text' => __('Note: if fields are excluded they cannot be required.', 'event_espresso') |
191 | 191 | ) |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | apply_filters( |
195 | 195 | 'FHEE__EE_PMT_Aim__generate_new_settings_form__server_select_input__options', |
196 | 196 | array( |
197 | - 'authorize.net' => __( 'Authorize.net (default)', 'event_espresso' ), |
|
198 | - 'akamai' => __( 'Authorize.net/Akamai', 'event_espresso' ) |
|
197 | + 'authorize.net' => __('Authorize.net (default)', 'event_espresso'), |
|
198 | + 'akamai' => __('Authorize.net/Akamai', 'event_espresso') |
|
199 | 199 | ), |
200 | 200 | $this |
201 | 201 | ), |
202 | 202 | array( |
203 | - 'html_label_text' => __( 'Server', 'event_espresso' ), |
|
204 | - 'html_help_text' => __( 'The Gateway Server where payment requests will be sent', 'event_espresso' ) |
|
203 | + 'html_label_text' => __('Server', 'event_espresso'), |
|
204 | + 'html_help_text' => __('The Gateway Server where payment requests will be sent', 'event_espresso') |
|
205 | 205 | ) |
206 | 206 | ) |
207 | 207 | |
@@ -217,10 +217,10 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function billing_input_names() { |
219 | 219 | return array( |
220 | - 'first_name' => __( 'First Name', 'event_espresso' ), |
|
220 | + 'first_name' => __('First Name', 'event_espresso'), |
|
221 | 221 | 'last_name' => __('Last Name', 'event_espresso'), |
222 | - 'email' => __( 'Email', 'event_espresso' ), |
|
223 | - 'company' => __( 'Company', 'event_espresso' ), |
|
222 | + 'email' => __('Email', 'event_espresso'), |
|
223 | + 'company' => __('Company', 'event_espresso'), |
|
224 | 224 | 'address' => __('Address', 'event_espresso'), |
225 | 225 | 'address2' => __('Address2', 'event_espresso'), |
226 | 226 | 'city' => __('City', 'event_espresso'), |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | 'country' => __('Country', 'event_espresso'), |
229 | 229 | 'zip' => __('Zip', 'event_espresso'), |
230 | 230 | 'phone' => __('Phone', 'event_espresso'), |
231 | - 'fax' => __( 'Fax', 'event_espresso' ), |
|
231 | + 'fax' => __('Fax', 'event_espresso'), |
|
232 | 232 | 'cvv' => __('CVV', 'event_espresso') |
233 | 233 | ); |
234 | 234 | } |
@@ -239,10 +239,10 @@ discard block |
||
239 | 239 | * @param type $billing_form |
240 | 240 | * @return array |
241 | 241 | */ |
242 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
242 | + protected function _get_billing_values_from_form($billing_form) { |
|
243 | 243 | $all_billing_values_empty = array(); |
244 | - foreach( array_keys( $this->billing_input_names() ) as $input_name ) { |
|
245 | - $all_billing_values_empty[ $input_name ] = ''; |
|
244 | + foreach (array_keys($this->billing_input_names()) as $input_name) { |
|
245 | + $all_billing_values_empty[$input_name] = ''; |
|
246 | 246 | } |
247 | 247 | return array_merge( |
248 | 248 | $all_billing_values_empty, |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @see EE_PMT_Base::help_tabs_config() |
258 | 258 | * @return array |
259 | 259 | */ |
260 | - public function help_tabs_config(){ |
|
260 | + public function help_tabs_config() { |
|
261 | 261 | return array( |
262 | 262 | $this->get_help_tab_name() => array( |
263 | 263 | 'title' => __('Authorize.net AIM Settings', 'event_espresso'), |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EEG_Aim extends EE_Onsite_Gateway{ |
|
28 | +class EEG_Aim extends EE_Onsite_Gateway { |
|
29 | 29 | protected $_login_id; |
30 | 30 | protected $_transaction_key; |
31 | 31 | protected $_server; |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * @param EEG_Aim $gateway_object |
95 | 95 | * @return string |
96 | 96 | */ |
97 | - public function possibly_use_akamai_server( $url, EEG_Aim $gateway_object ) { |
|
98 | - if( $gateway_object->_server === 'akamai' && ! $gateway_object->_debug_mode ) { |
|
97 | + public function possibly_use_akamai_server($url, EEG_Aim $gateway_object) { |
|
98 | + if ($gateway_object->_server === 'akamai' && ! $gateway_object->_debug_mode) { |
|
99 | 99 | return 'https://secure2.authorize.net/gateway/transact.dll'; |
100 | 100 | } else { |
101 | 101 | return $url; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | |
120 | 120 | public function do_direct_payment($payment, $billing_info = null) { |
121 | - add_filter( 'FHEE__EEG_Aim___get_server_url', array( $this, 'possibly_use_akamai_server' ), 10, 2 ); |
|
121 | + add_filter('FHEE__EEG_Aim___get_server_url', array($this, 'possibly_use_akamai_server'), 10, 2); |
|
122 | 122 | // Enable test mode if needed |
123 | 123 | //4007000000027 <-- test successful visa |
124 | 124 | //4222222222222 <-- test failure card number |
@@ -129,17 +129,17 @@ discard block |
||
129 | 129 | $primary_registrant = $transaction->primary_registration(); |
130 | 130 | //if we're are charging for the full amount, show the normal line items |
131 | 131 | //and the itemized total adds up properly |
132 | - if( $this->_can_easily_itemize_transaction_for( $payment ) ){ |
|
132 | + if ($this->_can_easily_itemize_transaction_for($payment)) { |
|
133 | 133 | $total_line_item = $transaction->total_line_item(); |
134 | 134 | foreach ($total_line_item->get_items() as $line_item) { |
135 | 135 | $this->addLineItem($item_num++, $line_item->name(), $line_item->desc(), $line_item->quantity(), $line_item->unit_price(), 'N'); |
136 | 136 | $order_description .= $line_item->desc().', '; |
137 | 137 | } |
138 | - foreach($total_line_item->tax_descendants() as $tax_line_item){ |
|
138 | + foreach ($total_line_item->tax_descendants() as $tax_line_item) { |
|
139 | 139 | $this->addLineItem($item_num++, $tax_line_item->name(), $tax_line_item->desc(), 1, $tax_line_item->total(), 'N'); |
140 | 140 | } |
141 | - }else{//partial payment |
|
142 | - $order_description = sprintf(__("Payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code()); |
|
141 | + } else {//partial payment |
|
142 | + $order_description = sprintf(__("Payment of %s for %s", "event_espresso"), $payment->amount(), $primary_registrant->reg_code()); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -148,18 +148,18 @@ discard block |
||
148 | 148 | //start transaction |
149 | 149 | //if in debug mode, use authorize.net's sandbox id; otherwise use the Event Espresso partner id |
150 | 150 | $partner_id = $this->_debug_mode ? 'AAA100302' : 'AAA105363'; |
151 | - $this->setField( 'solution_id', $partner_id ); |
|
151 | + $this->setField('solution_id', $partner_id); |
|
152 | 152 | $this->setField('amount', $this->format_currency($payment->amount())); |
153 | - $this->setField('description',substr(rtrim($order_description, ', '), 0, 255)); |
|
154 | - $this->_set_sensitive_billing_data( $billing_info ); |
|
153 | + $this->setField('description', substr(rtrim($order_description, ', '), 0, 255)); |
|
154 | + $this->_set_sensitive_billing_data($billing_info); |
|
155 | 155 | $this->setField('first_name', $billing_info['first_name']); |
156 | 156 | $this->setField('last_name', $billing_info['last_name']); |
157 | 157 | $this->setField('email', $billing_info['email']); |
158 | 158 | $this->setField('company', $billing_info['company']); |
159 | 159 | $this->setField('address', $billing_info['address'].' '.$billing_info['address2']); |
160 | 160 | $this->setField('city', $billing_info['city']); |
161 | - $this->setField('state', $billing_info['state'] ); |
|
162 | - $this->setField('country', $billing_info['country'] ); |
|
161 | + $this->setField('state', $billing_info['state']); |
|
162 | + $this->setField('country', $billing_info['country']); |
|
163 | 163 | $this->setField('zip', $billing_info['zip']); |
164 | 164 | $this->setField('fax', $billing_info['fax']); |
165 | 165 | $this->setField('cust_id', $primary_registrant->ID()); |
@@ -167,9 +167,9 @@ discard block |
||
167 | 167 | //invoice_num would be nice to have itbe unique per SPCO page-load, taht way if users |
168 | 168 | //press back, they don't submit a duplicate. However, we may be keepin gthe user on teh same spco page |
169 | 169 | //in which case, we need to generate teh invoice num per request right here... |
170 | - $this->setField('invoice_num', wp_generate_password(12,false));//$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']); |
|
170 | + $this->setField('invoice_num', wp_generate_password(12, false)); //$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']); |
|
171 | 171 | //tell AIM that any duplicates sent in the next 5 minutes are to be ignored |
172 | - $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS ); |
|
172 | + $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS); |
|
173 | 173 | |
174 | 174 | |
175 | 175 | if ($this->_test_transactions) { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | //Capture response |
180 | 180 | $this->type = "AUTH_CAPTURE"; |
181 | 181 | $response = $this->_sendRequest($payment); |
182 | - if (!empty($response)){ |
|
182 | + if ( ! empty($response)) { |
|
183 | 183 | if ($this->_debug_mode) { |
184 | 184 | $txn_id = $response->invoice_number; |
185 | 185 | } else { |
@@ -188,15 +188,15 @@ discard block |
||
188 | 188 | $payment_status = $response->approved ? $this->_pay_model->approved_status() : $this->_pay_model->declined_status(); |
189 | 189 | $payment->set_status($payment_status); |
190 | 190 | //make sure we interpret the AMT as a float, not an international string (where periods are thousand seperators) |
191 | - $payment->set_amount( floatval( $response->amount ) ); |
|
192 | - $payment->set_gateway_response(sprintf("%s (code: %s)",$response->response_reason_text,$response->response_reason_code)); |
|
193 | - $payment->set_txn_id_chq_nmbr( $txn_id ); |
|
191 | + $payment->set_amount(floatval($response->amount)); |
|
192 | + $payment->set_gateway_response(sprintf("%s (code: %s)", $response->response_reason_text, $response->response_reason_code)); |
|
193 | + $payment->set_txn_id_chq_nmbr($txn_id); |
|
194 | 194 | $payment->set_extra_accntng($primary_registrant->reg_code()); |
195 | - $payment->set_details(print_r($response,true)); |
|
195 | + $payment->set_details(print_r($response, true)); |
|
196 | 196 | } else { |
197 | 197 | $payment->set_status($this->_pay_model->failed_status()); |
198 | 198 | $payment->set_gateway_response(__("There was no response from Authorize.net", 'event_espresso')); |
199 | - $payment->set_details(print_r($response,true)); |
|
199 | + $payment->set_details(print_r($response, true)); |
|
200 | 200 | } |
201 | 201 | return $payment; |
202 | 202 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * what billing data gets sent |
208 | 208 | * @param array $billing_info |
209 | 209 | */ |
210 | - protected function _set_sensitive_billing_data( $billing_info ) { |
|
210 | + protected function _set_sensitive_billing_data($billing_info) { |
|
211 | 211 | $this->setField('card_num', $billing_info['credit_card']); |
212 | 212 | $this->setField('exp_date', $billing_info['exp_month'].$billing_info['exp_year']); |
213 | 213 | $this->setField('card_code', $billing_info['cvv']); |
@@ -259,22 +259,22 @@ discard block |
||
259 | 259 | $this->_x_post_fields['tran_key'] = $this->_transaction_key; |
260 | 260 | $x_keys = array(); |
261 | 261 | foreach ($this->_x_post_fields as $key => $value) { |
262 | - $x_keys[] = "x_$key=" . urlencode($value); |
|
262 | + $x_keys[] = "x_$key=".urlencode($value); |
|
263 | 263 | } |
264 | 264 | // Add line items |
265 | 265 | foreach ($this->_additional_line_items as $key => $value) { |
266 | - $x_keys[] = "x_line_item=" . urlencode($value); |
|
266 | + $x_keys[] = "x_line_item=".urlencode($value); |
|
267 | 267 | } |
268 | 268 | $this->_log_clean_request($x_keys, $payment); |
269 | 269 | $post_url = $this->_get_server_url(); |
270 | 270 | $curl_request = curl_init($post_url); |
271 | - curl_setopt($curl_request, CURLOPT_POSTFIELDS, implode("&",$x_keys)); |
|
271 | + curl_setopt($curl_request, CURLOPT_POSTFIELDS, implode("&", $x_keys)); |
|
272 | 272 | curl_setopt($curl_request, CURLOPT_HEADER, 0); |
273 | 273 | curl_setopt($curl_request, CURLOPT_TIMEOUT, 45); |
274 | 274 | curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1); |
275 | 275 | curl_setopt($curl_request, CURLOPT_SSL_VERIFYHOST, 2); |
276 | 276 | if ($this->VERIFY_PEER) { |
277 | - curl_setopt($curl_request, CURLOPT_CAINFO, dirname(dirname(__FILE__)) . '/ssl/cert.pem'); |
|
277 | + curl_setopt($curl_request, CURLOPT_CAINFO, dirname(dirname(__FILE__)).'/ssl/cert.pem'); |
|
278 | 278 | } else { |
279 | 279 | curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, false); |
280 | 280 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $response = curl_exec($curl_request); |
287 | 287 | |
288 | 288 | curl_close($curl_request); |
289 | - $response_obj = new EE_AuthorizeNetAIM_Response($response); |
|
289 | + $response_obj = new EE_AuthorizeNetAIM_Response($response); |
|
290 | 290 | |
291 | 291 | return $this->_log_and_clean_response($response_obj, $payment); |
292 | 292 | } |
@@ -295,18 +295,18 @@ discard block |
||
295 | 295 | * @param array $request_array |
296 | 296 | * @param EEI_Payment $payment |
297 | 297 | */ |
298 | - protected function _log_clean_request($request_array,$payment){ |
|
299 | - $keys_to_filter_out = array( 'x_card_num', 'x_card_code', 'x_exp_date' ); |
|
300 | - foreach($request_array as $index => $keyvaltogether ) { |
|
301 | - foreach( $keys_to_filter_out as $key ) { |
|
302 | - if( strpos( $keyvaltogether, $key ) === 0 ){ |
|
298 | + protected function _log_clean_request($request_array, $payment) { |
|
299 | + $keys_to_filter_out = array('x_card_num', 'x_card_code', 'x_exp_date'); |
|
300 | + foreach ($request_array as $index => $keyvaltogether) { |
|
301 | + foreach ($keys_to_filter_out as $key) { |
|
302 | + if (strpos($keyvaltogether, $key) === 0) { |
|
303 | 303 | //found it at the first character |
304 | 304 | //so its one of them |
305 | - unset( $request_array[ $index ] ); |
|
305 | + unset($request_array[$index]); |
|
306 | 306 | } |
307 | 307 | } |
308 | 308 | } |
309 | - $this->log(array('AIM Request sent:'=>$request_array),$payment); |
|
309 | + $this->log(array('AIM Request sent:'=>$request_array), $payment); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | * @param EE_AuthorizeNetAIM_Response $response_obj |
315 | 315 | * @param EE_Payment $payment |
316 | 316 | */ |
317 | - private function _log_and_clean_response($response_obj,$payment){ |
|
317 | + private function _log_and_clean_response($response_obj, $payment) { |
|
318 | 318 | $response_obj->account_number = ''; |
319 | - $this->log(array('AIM Response received:'=>$response_obj),$payment); |
|
319 | + $this->log(array('AIM Response received:'=>$response_obj), $payment); |
|
320 | 320 | return $response_obj; |
321 | 321 | } |
322 | 322 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | // Split Array |
413 | 413 | $this->response = $response; |
414 | 414 | if ($encap_char) { |
415 | - $this->_response_array = explode($encap_char . $delimiter . $encap_char, substr($response, 1, -1)); |
|
415 | + $this->_response_array = explode($encap_char.$delimiter.$encap_char, substr($response, 1, -1)); |
|
416 | 416 | } else { |
417 | 417 | $this->_response_array = explode($delimiter, $response); |
418 | 418 | } |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | $this->held = ($this->response_code == self::HELD); |
483 | 483 | |
484 | 484 | if ($this->error || $this->declined || $this->held) { |
485 | - $this->error_message = '<p><strong class="credit_card_failure">Attention: your transaction was declined for the following reason(s):</strong><br />' . $this->response_reason_text . '<br /><span class="response_code">Response Code: ' . $this->response_code . '<br /></span><span class="response_subcode">Response Subcode: ' . $this->response_subcode . '</span></p><p>To try again, <a href="#payment_options">please click here</a>.</p> '; |
|
485 | + $this->error_message = '<p><strong class="credit_card_failure">Attention: your transaction was declined for the following reason(s):</strong><br />'.$this->response_reason_text.'<br /><span class="response_code">Response Code: '.$this->response_code.'<br /></span><span class="response_subcode">Response Subcode: '.$this->response_subcode.'</span></p><p>To try again, <a href="#payment_options">please click here</a>.</p> '; |
|
486 | 486 | |
487 | 487 | |
488 | 488 | /* $this->error_message = "AuthorizeNet Error: |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public static function instance() { |
80 | 80 | // check if class object is instantiated |
81 | - if ( ! self::$_instance instanceof EE_CPT_Strategy ) { |
|
81 | + if ( ! self::$_instance instanceof EE_CPT_Strategy) { |
|
82 | 82 | self::$_instance = new self(); |
83 | 83 | } |
84 | 84 | return self::$_instance; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | // d( $this->_CPT_endpoints ); |
102 | 102 | // d( $this->_CPT_taxonomies ); |
103 | 103 | |
104 | - add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 5 ); |
|
104 | + add_action('pre_get_posts', array($this, 'pre_get_posts'), 5); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | */ |
115 | 115 | private function _set_CPT_endpoints() { |
116 | 116 | $_CPT_endpoints = array(); |
117 | - if ( is_array( $this->_CPTs )) { |
|
118 | - foreach ( $this->_CPTs as $CPT_type => $CPT ) { |
|
119 | - $_CPT_endpoints [ $CPT['plural_slug'] ] = $CPT_type; |
|
117 | + if (is_array($this->_CPTs)) { |
|
118 | + foreach ($this->_CPTs as $CPT_type => $CPT) { |
|
119 | + $_CPT_endpoints [$CPT['plural_slug']] = $CPT_type; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | return $_CPT_endpoints; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param WP_Query $WP_Query |
132 | 132 | * @return void |
133 | 133 | */ |
134 | - private function _set_EE_tags_on_WP_Query( WP_Query $WP_Query) { |
|
134 | + private function _set_EE_tags_on_WP_Query(WP_Query $WP_Query) { |
|
135 | 135 | $WP_Query->is_espresso_event_single = FALSE; |
136 | 136 | $WP_Query->is_espresso_event_archive = FALSE; |
137 | 137 | $WP_Query->is_espresso_event_taxonomy = FALSE; |
@@ -158,16 +158,16 @@ discard block |
||
158 | 158 | */ |
159 | 159 | private function _set_CPT_taxonomies() { |
160 | 160 | // check if taxonomies have already been set |
161 | - if ( empty( $this->_CPT_taxonomies )) { |
|
161 | + if (empty($this->_CPT_taxonomies)) { |
|
162 | 162 | // and that this CPT has taxonomies registered for it |
163 | - if ( isset( $this->CPT['args'] ) && isset( $this->CPT['args']['taxonomies'] )) { |
|
163 | + if (isset($this->CPT['args']) && isset($this->CPT['args']['taxonomies'])) { |
|
164 | 164 | // if so then grab them, but we want the taxonomy name as the key |
165 | - $taxonomies = array_flip( $this->CPT['args']['taxonomies'] ); |
|
165 | + $taxonomies = array_flip($this->CPT['args']['taxonomies']); |
|
166 | 166 | // then grab the list of ALL taxonomies |
167 | 167 | $all_taxonomies = EE_Register_CPTs::get_taxonomies(); |
168 | - foreach ( $taxonomies as $taxonomy => $details ) { |
|
168 | + foreach ($taxonomies as $taxonomy => $details) { |
|
169 | 169 | // add details to our taxonomies if they exist |
170 | - $taxonomies[ $taxonomy ] = isset( $all_taxonomies[ $taxonomy ] ) ? $all_taxonomies[ $taxonomy ] : NULL; |
|
170 | + $taxonomies[$taxonomy] = isset($all_taxonomies[$taxonomy]) ? $all_taxonomies[$taxonomy] : NULL; |
|
171 | 171 | } |
172 | 172 | $this->_CPT_taxonomies = $taxonomies; |
173 | 173 | } |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | * @return void |
193 | 193 | */ |
194 | 194 | private function _set_CPT_terms() { |
195 | - if ( empty( $this->_CPT_terms )) { |
|
195 | + if (empty($this->_CPT_terms)) { |
|
196 | 196 | $terms = EEM_Term::instance()->get_all_CPT_post_tags(); |
197 | - foreach ( $terms as $term ) { |
|
198 | - if ( $term instanceof EE_Term ) { |
|
199 | - $this->_CPT_terms[ $term->slug() ] = $term; |
|
197 | + foreach ($terms as $term) { |
|
198 | + if ($term instanceof EE_Term) { |
|
199 | + $this->_CPT_terms[$term->slug()] = $term; |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | } |
@@ -211,24 +211,24 @@ discard block |
||
211 | 211 | * @param $WP_Query |
212 | 212 | * @return void |
213 | 213 | */ |
214 | - private function _set_post_type_for_terms( WP_Query $WP_Query ) { |
|
214 | + private function _set_post_type_for_terms(WP_Query $WP_Query) { |
|
215 | 215 | // is a tag set ? |
216 | - if ( isset( $WP_Query->query['tag'] )) { |
|
216 | + if (isset($WP_Query->query['tag'])) { |
|
217 | 217 | // set post_tags |
218 | 218 | $this->_set_CPT_terms(); |
219 | 219 | // is this tag archive term in the list of terms used by our CPTs ? |
220 | - $term = isset ( $this->_CPT_terms[ $WP_Query->query['tag'] ] ) ? $this->_CPT_terms[ $WP_Query->query['tag'] ] : NULL; |
|
220 | + $term = isset ($this->_CPT_terms[$WP_Query->query['tag']]) ? $this->_CPT_terms[$WP_Query->query['tag']] : NULL; |
|
221 | 221 | // verify the term |
222 | - if ( $term instanceof EE_Term ) { |
|
223 | - $term->post_type = array_merge( array( 'post', 'page' ), (array)$term->post_type ); |
|
224 | - $term->post_type = apply_filters( 'FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term ); |
|
222 | + if ($term instanceof EE_Term) { |
|
223 | + $term->post_type = array_merge(array('post', 'page'), (array) $term->post_type); |
|
224 | + $term->post_type = apply_filters('FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term); |
|
225 | 225 | // if a post type is already set |
226 | - if ( isset( $WP_Query->query_vars['post_type'] )) { |
|
226 | + if (isset($WP_Query->query_vars['post_type'])) { |
|
227 | 227 | // add to existing array |
228 | - $term->post_type = array_merge ( (array)$WP_Query->query_vars['post_type'], $term->post_type ); |
|
228 | + $term->post_type = array_merge((array) $WP_Query->query_vars['post_type'], $term->post_type); |
|
229 | 229 | } |
230 | 230 | // just set post_type to our CPT |
231 | - $WP_Query->set( 'post_type', $term->post_type ); |
|
231 | + $WP_Query->set('post_type', $term->post_type); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | } |
@@ -243,17 +243,17 @@ discard block |
||
243 | 243 | * in order for is_archive() and is_single() methods to work properly. |
244 | 244 | * @return void |
245 | 245 | */ |
246 | - public function _possibly_set_ee_request_var(){ |
|
246 | + public function _possibly_set_ee_request_var() { |
|
247 | 247 | // check if ee action var has been set |
248 | - if ( ! EE_Registry::instance()->REQ->is_set( 'ee' )) { |
|
248 | + if ( ! EE_Registry::instance()->REQ->is_set('ee')) { |
|
249 | 249 | // check that route exists for CPT archive slug |
250 | - if ( is_archive() && EE_Config::get_route( $this->CPT['plural_slug'] )) { |
|
250 | + if (is_archive() && EE_Config::get_route($this->CPT['plural_slug'])) { |
|
251 | 251 | // ie: set "ee" to "events" |
252 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['plural_slug'] ); |
|
252 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['plural_slug']); |
|
253 | 253 | // or does it match a single page CPT like /event/ |
254 | - } else if ( is_single() && EE_Config::get_route( $this->CPT['singular_slug'] )) { |
|
254 | + } else if (is_single() && EE_Config::get_route($this->CPT['singular_slug'])) { |
|
255 | 255 | // ie: set "ee" to "event" |
256 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] ); |
|
256 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']); |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | } |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | * @param WP_Query $WP_Query |
268 | 268 | * @return void |
269 | 269 | */ |
270 | - public function _set_paging( $WP_Query ) { |
|
271 | - if ( $WP_Query->is_main_query() && apply_filters( 'FHEE__EE_CPT_Strategy___set_paging', TRUE )) { |
|
272 | - $page = ( get_query_var('page') ) ? get_query_var('page') : NULL; |
|
273 | - $paged = ( get_query_var('paged') ) ? get_query_var('paged') : $page; |
|
274 | - $WP_Query->set( 'paged', $paged ); |
|
270 | + public function _set_paging($WP_Query) { |
|
271 | + if ($WP_Query->is_main_query() && apply_filters('FHEE__EE_CPT_Strategy___set_paging', TRUE)) { |
|
272 | + $page = (get_query_var('page')) ? get_query_var('page') : NULL; |
|
273 | + $paged = (get_query_var('paged')) ? get_query_var('paged') : $page; |
|
274 | + $WP_Query->set('paged', $paged); |
|
275 | 275 | } |
276 | 276 | } |
277 | 277 | |
@@ -288,35 +288,35 @@ discard block |
||
288 | 288 | * @param WP_Query $WP_Query |
289 | 289 | * @return void |
290 | 290 | */ |
291 | - public function pre_get_posts( $WP_Query ) { |
|
291 | + public function pre_get_posts($WP_Query) { |
|
292 | 292 | // check that post-type is set |
293 | - if ( ! $WP_Query instanceof WP_Query ) { |
|
293 | + if ( ! $WP_Query instanceof WP_Query) { |
|
294 | 294 | return; |
295 | 295 | } |
296 | 296 | |
297 | 297 | // add our conditionals |
298 | - $this->_set_EE_tags_on_WP_Query( $WP_Query ); |
|
298 | + $this->_set_EE_tags_on_WP_Query($WP_Query); |
|
299 | 299 | // check for terms |
300 | - $this->_set_post_type_for_terms( $WP_Query ); |
|
300 | + $this->_set_post_type_for_terms($WP_Query); |
|
301 | 301 | // make sure paging is always set |
302 | - $this->_set_paging( $WP_Query ); |
|
302 | + $this->_set_paging($WP_Query); |
|
303 | 303 | |
304 | 304 | // is a taxonomy set ? |
305 | - if ( $WP_Query->is_tax ) { |
|
305 | + if ($WP_Query->is_tax) { |
|
306 | 306 | // loop thru our taxonomies |
307 | - foreach ( $this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details ) { |
|
307 | + foreach ($this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details) { |
|
308 | 308 | // check if one of our taxonomies is set as a query var |
309 | - if ( isset( $WP_Query->query[ $CPT_taxonomy ] )) { |
|
309 | + if (isset($WP_Query->query[$CPT_taxonomy])) { |
|
310 | 310 | // but which CPT does that correspond to??? hmmm... guess we gotta go looping |
311 | - foreach ( $this->_CPTs as $post_type => $CPT ) { |
|
311 | + foreach ($this->_CPTs as $post_type => $CPT) { |
|
312 | 312 | // verify our CPT has args, is public and has taxonomies set |
313 | - if ( isset( $CPT['args'] ) && $CPT['args']['public'] && ! empty( $CPT['args']['taxonomies'] )) { |
|
313 | + if (isset($CPT['args']) && $CPT['args']['public'] && ! empty($CPT['args']['taxonomies'])) { |
|
314 | 314 | // does the captured taxonomy belong to this CPT ? |
315 | - if ( in_array( $CPT_taxonomy, $CPT['args']['taxonomies'] )) { |
|
315 | + if (in_array($CPT_taxonomy, $CPT['args']['taxonomies'])) { |
|
316 | 316 | // if so, then add this CPT post_type to the current query's array of post_types' |
317 | - $WP_Query->query_vars['post_type'] = isset( $WP_Query->query_vars['post_type'] ) ? (array)$WP_Query->query_vars['post_type'] : array(); |
|
317 | + $WP_Query->query_vars['post_type'] = isset($WP_Query->query_vars['post_type']) ? (array) $WP_Query->query_vars['post_type'] : array(); |
|
318 | 318 | $WP_Query->query_vars['post_type'][] = $post_type; |
319 | - switch( $post_type ) { |
|
319 | + switch ($post_type) { |
|
320 | 320 | case 'espresso_events' : |
321 | 321 | $WP_Query->is_espresso_event_taxonomy = TRUE; |
322 | 322 | break; |
@@ -337,27 +337,27 @@ discard block |
||
337 | 337 | // d( $CPT_taxonomy ); |
338 | 338 | // d( $WP_Query ); |
339 | 339 | |
340 | - if ( isset( $WP_Query->query_vars['post_type'] )) { |
|
340 | + if (isset($WP_Query->query_vars['post_type'])) { |
|
341 | 341 | // loop thru post_types as array |
342 | - foreach ( (array)$WP_Query->query_vars['post_type'] as $post_type ) { |
|
342 | + foreach ((array) $WP_Query->query_vars['post_type'] as $post_type) { |
|
343 | 343 | |
344 | 344 | // is current query for an EE CPT ? |
345 | - if ( isset( $this->_CPTs[ $post_type ] )) { |
|
345 | + if (isset($this->_CPTs[$post_type])) { |
|
346 | 346 | // is EE on or off ? |
347 | - if ( EE_Maintenance_Mode::instance()->level() ) { |
|
347 | + if (EE_Maintenance_Mode::instance()->level()) { |
|
348 | 348 | // reroute CPT template view to maintenance_mode.template.php |
349 | - if( ! has_filter( 'template_include',array( 'EE_Maintenance_Mode', 'template_include' ))){ |
|
350 | - add_filter( 'template_include', array( 'EE_Maintenance_Mode', 'template_include' ), 99999 ); |
|
349 | + if ( ! has_filter('template_include', array('EE_Maintenance_Mode', 'template_include'))) { |
|
350 | + add_filter('template_include', array('EE_Maintenance_Mode', 'template_include'), 99999); |
|
351 | 351 | } |
352 | - if( has_filter( 'the_content',array( EE_Maintenance_Mode::instance(), 'the_content' ) ) ) { |
|
353 | - add_filter( 'the_content', array( $this, 'inject_EE_shortcode_placeholder' ), 1 ); |
|
352 | + if (has_filter('the_content', array(EE_Maintenance_Mode::instance(), 'the_content'))) { |
|
353 | + add_filter('the_content', array($this, 'inject_EE_shortcode_placeholder'), 1); |
|
354 | 354 | } |
355 | 355 | return; |
356 | 356 | } |
357 | 357 | // load EE_Request_Handler (this was added as a result of https://events.codebasehq.com/projects/event-espresso/tickets/9037 |
358 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
358 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
359 | 359 | // grab details for the CPT the current query is for |
360 | - $this->CPT = $this->_CPTs[ $post_type ]; |
|
360 | + $this->CPT = $this->_CPTs[$post_type]; |
|
361 | 361 | // set post type |
362 | 362 | $this->CPT['post_type'] = $post_type; |
363 | 363 | // set taxonomies |
@@ -365,27 +365,27 @@ discard block |
||
365 | 365 | // the post or category or term that is triggering EE |
366 | 366 | $this->CPT['espresso_page'] = EE_Registry::instance()->REQ->is_espresso_page(); |
367 | 367 | // requested post name |
368 | - $this->CPT['post_name'] = EE_Registry::instance()->REQ->get( 'post_name' ); |
|
368 | + $this->CPT['post_name'] = EE_Registry::instance()->REQ->get('post_name'); |
|
369 | 369 | //d( $this->CPT ); |
370 | 370 | // add support for viewing 'private', 'draft', or 'pending' posts |
371 | - if ( is_user_logged_in() && isset( $WP_Query->query_vars['p'] ) && $WP_Query->query_vars['p'] != 0 && current_user_can( 'edit_post', $WP_Query->query_vars['p'] )) { |
|
371 | + if (is_user_logged_in() && isset($WP_Query->query_vars['p']) && $WP_Query->query_vars['p'] != 0 && current_user_can('edit_post', $WP_Query->query_vars['p'])) { |
|
372 | 372 | // we can just inject directly into the WP_Query object |
373 | - $WP_Query->query['post_status'] = array( 'publish', 'private', 'draft', 'pending' ); |
|
373 | + $WP_Query->query['post_status'] = array('publish', 'private', 'draft', 'pending'); |
|
374 | 374 | // now set the main 'ee' request var so that the appropriate module can load the appropriate template(s) |
375 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] ); |
|
375 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']); |
|
376 | 376 | } |
377 | 377 | $this->_possibly_set_ee_request_var(); |
378 | 378 | // convert post_type to model name |
379 | - $model_name = str_replace( 'EE_', '', $this->CPT['class_name'] ); |
|
379 | + $model_name = str_replace('EE_', '', $this->CPT['class_name']); |
|
380 | 380 | // get CPT table data via CPT Model |
381 | - $this->CPT_model = EE_Registry::instance()->load_model( $model_name ); |
|
381 | + $this->CPT_model = EE_Registry::instance()->load_model($model_name); |
|
382 | 382 | $this->CPT['tables'] = $this->CPT_model->get_tables(); |
383 | 383 | // is there a Meta Table for this CPT? |
384 | - $this->CPT['meta_table'] = isset( $this->CPT['tables'][ $model_name . '_Meta' ] ) ? $this->CPT['tables'][ $model_name . '_Meta' ] : FALSE; |
|
384 | + $this->CPT['meta_table'] = isset($this->CPT['tables'][$model_name.'_Meta']) ? $this->CPT['tables'][$model_name.'_Meta'] : FALSE; |
|
385 | 385 | // creates classname like: CPT_Event_Strategy |
386 | - $CPT_Strategy_class_name = 'CPT_' . $model_name . '_Strategy'; |
|
386 | + $CPT_Strategy_class_name = 'CPT_'.$model_name.'_Strategy'; |
|
387 | 387 | // load and instantiate |
388 | - $CPT_Strategy = EE_Registry::instance()->load_core ( $CPT_Strategy_class_name, array( 'WP_Query' => $WP_Query, 'CPT' => $this->CPT )); |
|
388 | + $CPT_Strategy = EE_Registry::instance()->load_core($CPT_Strategy_class_name, array('WP_Query' => $WP_Query, 'CPT' => $this->CPT)); |
|
389 | 389 | |
390 | 390 | // !!!!!!!!!! IMPORTANT !!!!!!!!!!!! |
391 | 391 | // here's the list of available filters in the WP_Query object |
@@ -397,13 +397,13 @@ discard block |
||
397 | 397 | // 'post_limits' |
398 | 398 | // 'posts_fields' |
399 | 399 | // 'posts_join' |
400 | - add_filter( 'posts_fields', array( $this, 'posts_fields' )); |
|
401 | - add_filter( 'posts_join', array( $this, 'posts_join' )); |
|
402 | - add_filter( 'get_' . $this->CPT['post_type'] . '_metadata', array( $CPT_Strategy, 'get_EE_post_type_metadata' ), 1, 4 ); |
|
403 | - add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 1 ); |
|
404 | - add_filter( 'get_edit_post_link', array( $this, 'get_edit_post_link' ), 10, 2 ); |
|
400 | + add_filter('posts_fields', array($this, 'posts_fields')); |
|
401 | + add_filter('posts_join', array($this, 'posts_join')); |
|
402 | + add_filter('get_'.$this->CPT['post_type'].'_metadata', array($CPT_Strategy, 'get_EE_post_type_metadata'), 1, 4); |
|
403 | + add_filter('the_posts', array($this, 'the_posts'), 1, 1); |
|
404 | + add_filter('get_edit_post_link', array($this, 'get_edit_post_link'), 10, 2); |
|
405 | 405 | |
406 | - $this->_do_template_filters( $WP_Query ); |
|
406 | + $this->_do_template_filters($WP_Query); |
|
407 | 407 | } |
408 | 408 | } |
409 | 409 | } |
@@ -418,13 +418,13 @@ discard block |
||
418 | 418 | * @param $SQL |
419 | 419 | * @return string |
420 | 420 | */ |
421 | - public function posts_fields( $SQL ) { |
|
421 | + public function posts_fields($SQL) { |
|
422 | 422 | // does this CPT have a meta table ? |
423 | - if ( ! empty( $this->CPT['meta_table'] )) { |
|
423 | + if ( ! empty($this->CPT['meta_table'])) { |
|
424 | 424 | // adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement |
425 | - $SQL .= ', ' . $this->CPT['meta_table']->get_table_name() . '.* ' ; |
|
425 | + $SQL .= ', '.$this->CPT['meta_table']->get_table_name().'.* '; |
|
426 | 426 | } |
427 | - remove_filter( 'posts_fields', array( $this, 'posts_fields' )); |
|
427 | + remove_filter('posts_fields', array($this, 'posts_fields')); |
|
428 | 428 | return $SQL; |
429 | 429 | } |
430 | 430 | |
@@ -452,14 +452,14 @@ discard block |
||
452 | 452 | * @param $SQL |
453 | 453 | * @return string |
454 | 454 | */ |
455 | - public function posts_join( $SQL ) { |
|
455 | + public function posts_join($SQL) { |
|
456 | 456 | // does this CPT have a meta table ? |
457 | - if ( ! empty( $this->CPT['meta_table'] )) { |
|
457 | + if ( ! empty($this->CPT['meta_table'])) { |
|
458 | 458 | global $wpdb; |
459 | 459 | // adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement |
460 | - $SQL .= ' LEFT JOIN ' . $this->CPT['meta_table']->get_table_name() . ' ON ( ' . $this->CPT['meta_table']->get_table_name() . '.' . $this->CPT['meta_table']->get_fk_on_table() . ' = ' . $wpdb->posts . '.ID ) '; |
|
460 | + $SQL .= ' LEFT JOIN '.$this->CPT['meta_table']->get_table_name().' ON ( '.$this->CPT['meta_table']->get_table_name().'.'.$this->CPT['meta_table']->get_fk_on_table().' = '.$wpdb->posts.'.ID ) '; |
|
461 | 461 | } |
462 | - remove_filter( 'posts_join', array( $this, 'posts_join' )); |
|
462 | + remove_filter('posts_join', array($this, 'posts_join')); |
|
463 | 463 | return $SQL; |
464 | 464 | } |
465 | 465 | |
@@ -472,18 +472,18 @@ discard block |
||
472 | 472 | * @param \WP_Post[] $posts |
473 | 473 | * @return \WP_Post[] |
474 | 474 | */ |
475 | - public function the_posts( $posts ) { |
|
475 | + public function the_posts($posts) { |
|
476 | 476 | // d( $posts ); |
477 | 477 | $CPT_class = $this->CPT['class_name']; |
478 | 478 | // loop thru posts |
479 | - if ( is_array( $posts )) { |
|
480 | - foreach( $posts as $key => $post ) { |
|
481 | - if ( isset( $this->_CPTs[ $post->post_type ] )) { |
|
482 | - $post->{$CPT_class} = $this->CPT_model->instantiate_class_from_post_object( $post ); |
|
479 | + if (is_array($posts)) { |
|
480 | + foreach ($posts as $key => $post) { |
|
481 | + if (isset($this->_CPTs[$post->post_type])) { |
|
482 | + $post->{$CPT_class} = $this->CPT_model->instantiate_class_from_post_object($post); |
|
483 | 483 | } |
484 | 484 | } |
485 | 485 | } |
486 | - remove_filter( 'the_posts', array( $this, 'the_posts' ), 1 ); |
|
486 | + remove_filter('the_posts', array($this, 'the_posts'), 1); |
|
487 | 487 | return $posts; |
488 | 488 | } |
489 | 489 | |
@@ -494,17 +494,17 @@ discard block |
||
494 | 494 | * @param $ID |
495 | 495 | * @return string |
496 | 496 | */ |
497 | - function get_edit_post_link( $url, $ID ) { |
|
497 | + function get_edit_post_link($url, $ID) { |
|
498 | 498 | //need to make sure we only edit links if our cpt |
499 | 499 | global $post; |
500 | - if ( ! isset( $this->_CPTs[ $post->post_type ] )) { |
|
500 | + if ( ! isset($this->_CPTs[$post->post_type])) { |
|
501 | 501 | return $url; |
502 | 502 | } |
503 | 503 | //k made it here so all is good. |
504 | 504 | $scheme = is_ssl() ? 'https' : 'http'; |
505 | - $url = get_admin_url( EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme ); |
|
505 | + $url = get_admin_url(EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme); |
|
506 | 506 | // http://example.com/wp-admin/admin.php?page=espresso_events&action=edit&post=205&edit_nonce=0d403530d6 |
507 | - return wp_nonce_url( add_query_arg( array( 'page' => $post->post_type, 'post' =>$ID, 'action' =>'edit' ), $url ), 'edit', 'edit_nonce' ); |
|
507 | + return wp_nonce_url(add_query_arg(array('page' => $post->post_type, 'post' =>$ID, 'action' =>'edit'), $url), 'edit', 'edit_nonce'); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
@@ -518,11 +518,11 @@ discard block |
||
518 | 518 | * @param WP_Query $WP_Query |
519 | 519 | * @return void |
520 | 520 | */ |
521 | - protected function _do_template_filters( WP_Query $WP_Query ) { |
|
521 | + protected function _do_template_filters(WP_Query $WP_Query) { |
|
522 | 522 | // if it's the main query and requested cpt supports page_templates, |
523 | - if ( $WP_Query->is_main_query() && ! empty( $this->CPT['args']['page_templates'] ) ) { |
|
523 | + if ($WP_Query->is_main_query() && ! empty($this->CPT['args']['page_templates'])) { |
|
524 | 524 | // then let's hook into the appropriate query_template hook |
525 | - add_filter( 'single_template', array( $this, 'single_cpt_template' ) ); |
|
525 | + add_filter('single_template', array($this, 'single_cpt_template')); |
|
526 | 526 | } |
527 | 527 | } |
528 | 528 | |
@@ -536,17 +536,17 @@ discard block |
||
536 | 536 | * @param string $current_template Existing default template path derived for this page call. |
537 | 537 | * @return string the path to the full template file. |
538 | 538 | */ |
539 | - public function single_cpt_template( $current_template ) { |
|
539 | + public function single_cpt_template($current_template) { |
|
540 | 540 | $object = get_queried_object(); |
541 | 541 | //does this called object HAVE a page template set that is something other than the default. |
542 | - $template = get_post_meta( $object->ID, '_wp_page_template', true ); |
|
542 | + $template = get_post_meta($object->ID, '_wp_page_template', true); |
|
543 | 543 | |
544 | 544 | //exit early if default or not set or invalid path (accounts for theme changes) |
545 | - if ( $template == 'default' || empty( $template ) || ! is_readable( get_stylesheet_directory() . '/' . $template ) ) { |
|
545 | + if ($template == 'default' || empty($template) || ! is_readable(get_stylesheet_directory().'/'.$template)) { |
|
546 | 546 | return $current_template; |
547 | 547 | } |
548 | 548 | //made it here so we SHOULD be able to just locate the template and then return it. |
549 | - $template = locate_template( array($template) ); |
|
549 | + $template = locate_template(array($template)); |
|
550 | 550 | |
551 | 551 | return $template; |
552 | 552 | } |
@@ -594,9 +594,9 @@ discard block |
||
594 | 594 | * @param array $arguments |
595 | 595 | * @return \EE_CPT_Default_Strategy |
596 | 596 | */ |
597 | - public function __construct( $arguments = array() ) { |
|
598 | - $this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL; |
|
599 | - $WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL; |
|
597 | + public function __construct($arguments = array()) { |
|
598 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL; |
|
599 | + $WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL; |
|
600 | 600 | //EEH_Debug_Tools::printr( $this->CPT, '$this->CPT <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
601 | 601 | // add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ), 999 ); |
602 | 602 | // add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 ); |
@@ -611,9 +611,9 @@ discard block |
||
611 | 611 | * @param \WP_Query $WP_Query |
612 | 612 | * @return \WP_Query |
613 | 613 | */ |
614 | - public function pre_get_posts( WP_Query $WP_Query ) { |
|
614 | + public function pre_get_posts(WP_Query $WP_Query) { |
|
615 | 615 | //EEH_Debug_Tools::printr( $WP_Query, '$WP_Query <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
616 | - if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive() ) { |
|
616 | + if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) { |
|
617 | 617 | return $WP_Query; |
618 | 618 | } |
619 | 619 | // $WP_Query->set( 'post_type', array( $this->CPT['post_type'] )); |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | * @param \WP_Query $WP_Query |
632 | 632 | * @return \WP_Post[] |
633 | 633 | */ |
634 | - public function the_posts( $posts, WP_Query $WP_Query ) { |
|
634 | + public function the_posts($posts, WP_Query $WP_Query) { |
|
635 | 635 | return $posts; |
636 | 636 | } |
637 | 637 | |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | * @param string $single |
648 | 648 | * @return mixed |
649 | 649 | */ |
650 | - public function get_EE_post_type_metadata( $meta_value = NULL, $post_id, $meta_key, $single ) { |
|
650 | + public function get_EE_post_type_metadata($meta_value = NULL, $post_id, $meta_key, $single) { |
|
651 | 651 | return $meta_value; |
652 | 652 | } |
653 | 653 |
@@ -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 | /** |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | |
43 | - public function __construct( $routing = TRUE ) { |
|
44 | - parent::__construct( $routing ); |
|
43 | + public function __construct($routing = TRUE) { |
|
44 | + parent::__construct($routing); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | |
58 | 58 | |
59 | 59 | protected function _ajax_hooks() { |
60 | - add_action('wp_ajax_espresso_display_country_settings', array( $this, 'display_country_settings')); |
|
61 | - add_action('wp_ajax_espresso_display_country_states', array( $this, 'display_country_states')); |
|
62 | - add_action('wp_ajax_espresso_delete_state', array( $this, 'delete_state'), 10, 3 ); |
|
63 | - add_action('wp_ajax_espresso_add_new_state', array( $this, 'add_new_state')); |
|
60 | + add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings')); |
|
61 | + add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states')); |
|
62 | + add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3); |
|
63 | + add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state')); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
@@ -153,14 +153,14 @@ discard block |
||
153 | 153 | 'label' => __('Critical Pages', 'event_espresso'), |
154 | 154 | 'order' => 50 |
155 | 155 | ), |
156 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
156 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
157 | 157 | 'help_tabs' => array( |
158 | 158 | 'general_settings_critical_pages_help_tab' => array( |
159 | 159 | 'title' => __('Critical Pages', 'event_espresso'), |
160 | 160 | 'filename' => 'general_settings_critical_pages' |
161 | 161 | ) |
162 | 162 | ), |
163 | - 'help_tour' => array( 'Critical_Pages_Help_Tour' ), |
|
163 | + 'help_tour' => array('Critical_Pages_Help_Tour'), |
|
164 | 164 | 'require_nonce' => FALSE |
165 | 165 | ), |
166 | 166 | 'default' => array( |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | 'filename' => 'general_settings_your_organization' |
175 | 175 | ) |
176 | 176 | ), |
177 | - 'help_tour' => array( 'Your_Organization_Help_Tour' ), |
|
178 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
177 | + 'help_tour' => array('Your_Organization_Help_Tour'), |
|
178 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
179 | 179 | 'require_nonce' => FALSE |
180 | 180 | ), |
181 | 181 | 'admin_option_settings' => array( |
@@ -183,14 +183,14 @@ discard block |
||
183 | 183 | 'label' => __('Admin Options', 'event_espresso'), |
184 | 184 | 'order' => 60 |
185 | 185 | ), |
186 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
186 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
187 | 187 | 'help_tabs' => array( |
188 | 188 | 'general_settings_admin_options_help_tab' => array( |
189 | 189 | 'title' => __('Admin Options', 'event_espresso'), |
190 | 190 | 'filename' => 'general_settings_admin_options' |
191 | 191 | ) |
192 | 192 | ), |
193 | - 'help_tour' => array( 'Admin_Options_Help_Tour' ), |
|
193 | + 'help_tour' => array('Admin_Options_Help_Tour'), |
|
194 | 194 | 'require_nonce' => FALSE |
195 | 195 | ), |
196 | 196 | 'country_settings' => array( |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | 'filename' => 'general_settings_countries' |
205 | 205 | ) |
206 | 206 | ), |
207 | - 'help_tour' => array( 'Countries_Help_Tour' ), |
|
207 | + 'help_tour' => array('Countries_Help_Tour'), |
|
208 | 208 | 'require_nonce' => FALSE |
209 | 209 | ) |
210 | 210 | ); |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | } |
223 | 223 | |
224 | 224 | public function admin_init() { |
225 | - EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = __( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' ); |
|
226 | - EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' ); |
|
227 | - EE_Registry::$i18n_js_strings[ 'confirm_delete_state' ] = __( 'Are you sure you want to delete this State / Province?', 'event_espresso' ); |
|
228 | - $protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://'; |
|
229 | - EE_Registry::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php?page=espresso_general_settings', $protocol ); |
|
225 | + EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso'); |
|
226 | + EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso'); |
|
227 | + EE_Registry::$i18n_js_strings['confirm_delete_state'] = __('Are you sure you want to delete this State / Province?', 'event_espresso'); |
|
228 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
229 | + EE_Registry::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php?page=espresso_general_settings', $protocol); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | public function admin_notices() {} |
@@ -239,21 +239,21 @@ discard block |
||
239 | 239 | //scripts |
240 | 240 | wp_enqueue_script('media-upload'); |
241 | 241 | wp_enqueue_script('thickbox'); |
242 | - wp_register_script( 'organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js', array( 'jquery','media-upload','thickbox' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
243 | - wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION ); |
|
244 | - wp_enqueue_script( 'organization_settings' ); |
|
245 | - wp_enqueue_style( 'organization-css' ); |
|
246 | - $confirm_image_delete = array( 'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso')); |
|
247 | - wp_localize_script( 'organization_settings', 'confirm_image_delete', $confirm_image_delete ); |
|
242 | + wp_register_script('organization_settings', GEN_SET_ASSETS_URL.'your_organization_settings.js', array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, TRUE); |
|
243 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
244 | + wp_enqueue_script('organization_settings'); |
|
245 | + wp_enqueue_style('organization-css'); |
|
246 | + $confirm_image_delete = array('text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso')); |
|
247 | + wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete); |
|
248 | 248 | |
249 | 249 | } |
250 | 250 | |
251 | 251 | public function load_scripts_styles_country_settings() { |
252 | 252 | //scripts |
253 | - wp_register_script( 'gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js', array( 'ee_admin_js' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
254 | - wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION ); |
|
255 | - wp_enqueue_script( 'gen_settings_countries' ); |
|
256 | - wp_enqueue_style( 'organization-css' ); |
|
253 | + wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL.'gen_settings_countries.js', array('ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
254 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
255 | + wp_enqueue_script('gen_settings_countries'); |
|
256 | + wp_enqueue_style('organization-css'); |
|
257 | 257 | |
258 | 258 | } |
259 | 259 | |
@@ -265,37 +265,37 @@ discard block |
||
265 | 265 | |
266 | 266 | // Check to make sure all of the main pages are setup properly, |
267 | 267 | // if not create the default pages and display an admin notice |
268 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
268 | + EE_Registry::instance()->load_helper('Activation'); |
|
269 | 269 | EEH_Activation::verify_default_pages_exist(); |
270 | 270 | |
271 | 271 | $this->_transient_garbage_collection(); |
272 | 272 | $this->_template_args['values'] = $this->_yes_no_values; |
273 | 273 | |
274 | - $this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ?EE_Registry::instance()->CFG->core->reg_page_id : NULL; |
|
275 | - $this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id ) : FALSE; |
|
274 | + $this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? EE_Registry::instance()->CFG->core->reg_page_id : NULL; |
|
275 | + $this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id) : FALSE; |
|
276 | 276 | |
277 | - $this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ?EE_Registry::instance()->CFG->core->txn_page_id : NULL; |
|
278 | - $this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id ) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id ) : FALSE; |
|
277 | + $this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? EE_Registry::instance()->CFG->core->txn_page_id : NULL; |
|
278 | + $this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id) : FALSE; |
|
279 | 279 | |
280 | - $this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ?EE_Registry::instance()->CFG->core->thank_you_page_id : NULL; |
|
281 | - $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id ) : FALSE; |
|
280 | + $this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? EE_Registry::instance()->CFG->core->thank_you_page_id : NULL; |
|
281 | + $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id) : FALSE; |
|
282 | 282 | |
283 | - $this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ?EE_Registry::instance()->CFG->core->cancel_page_id : NULL; |
|
284 | - $this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id ) : FALSE; |
|
283 | + $this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? EE_Registry::instance()->CFG->core->cancel_page_id : NULL; |
|
284 | + $this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id) : FALSE; |
|
285 | 285 | |
286 | - $this->_set_add_edit_form_tags( 'update_espresso_page_settings' ); |
|
287 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
288 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', $this->_template_args, TRUE ); |
|
286 | + $this->_set_add_edit_form_tags('update_espresso_page_settings'); |
|
287 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
288 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php', $this->_template_args, TRUE); |
|
289 | 289 | $this->display_admin_page_with_sidebar(); |
290 | 290 | |
291 | 291 | } |
292 | 292 | |
293 | 293 | protected function _update_espresso_page_settings() { |
294 | 294 | // capture incoming request data |
295 | - $reg_page_id = isset( $this->_req_data['reg_page_id'] ) ? absint( $this->_req_data['reg_page_id'] ) : EE_Registry::instance()->CFG->core->reg_page_id; |
|
296 | - $txn_page_id = isset( $this->_req_data['txn_page_id'] ) ? absint( $this->_req_data['txn_page_id'] ) : EE_Registry::instance()->CFG->core->txn_page_id; |
|
297 | - $thank_you_page_id = isset( $this->_req_data['thank_you_page_id'] ) ? absint( $this->_req_data['thank_you_page_id'] ) : EE_Registry::instance()->CFG->core->thank_you_page_id; |
|
298 | - $cancel_page_id = isset( $this->_req_data['cancel_page_id'] ) ? absint( $this->_req_data['cancel_page_id'] ) : EE_Registry::instance()->CFG->core->cancel_page_id; |
|
295 | + $reg_page_id = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id; |
|
296 | + $txn_page_id = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id; |
|
297 | + $thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id; |
|
298 | + $cancel_page_id = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id; |
|
299 | 299 | // pack critical_pages into an array |
300 | 300 | $critical_pages = array( |
301 | 301 | 'reg_page_id' => $reg_page_id, |
@@ -303,17 +303,17 @@ discard block |
||
303 | 303 | 'thank_you_page_id' => $thank_you_page_id, |
304 | 304 | 'cancel_page_id' => $cancel_page_id |
305 | 305 | ); |
306 | - foreach ( $critical_pages as $critical_page_name => $critical_page_id ) { |
|
306 | + foreach ($critical_pages as $critical_page_name => $critical_page_id) { |
|
307 | 307 | // has the page changed ? |
308 | - if ( EE_Registry::instance()->CFG->core->{$critical_page_name} !== $critical_page_id ) { |
|
308 | + if (EE_Registry::instance()->CFG->core->{$critical_page_name} !== $critical_page_id) { |
|
309 | 309 | // grab post object for old page |
310 | - $post = get_post( EE_Registry::instance()->CFG->core->{$critical_page_name} ); |
|
310 | + $post = get_post(EE_Registry::instance()->CFG->core->{$critical_page_name} ); |
|
311 | 311 | // update post shortcodes for old page |
312 | - EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $critical_page_id, $post ); |
|
312 | + EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post); |
|
313 | 313 | // grab post object for new page |
314 | - $post = get_post( $critical_page_id ); |
|
314 | + $post = get_post($critical_page_id); |
|
315 | 315 | // update post shortcodes for new page |
316 | - EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $critical_page_id, $post ); |
|
316 | + EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post); |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | // set page IDs |
@@ -322,14 +322,14 @@ discard block |
||
322 | 322 | EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id; |
323 | 323 | EE_Registry::instance()->CFG->core->cancel_page_id = $cancel_page_id; |
324 | 324 | |
325 | - EE_Registry::instance()->CFG->core = apply_filters( 'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data ); |
|
325 | + EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data); |
|
326 | 326 | |
327 | 327 | $what = __('Critical Pages & Shortcodes', 'event_espresso'); |
328 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__ ); |
|
328 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__); |
|
329 | 329 | $query_args = array( |
330 | 330 | 'action' => 'critical_pages' |
331 | 331 | ); |
332 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
332 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
333 | 333 | |
334 | 334 | } |
335 | 335 | |
@@ -344,35 +344,35 @@ discard block |
||
344 | 344 | |
345 | 345 | protected function _your_organization_settings() { |
346 | 346 | |
347 | - $this->_template_args['site_license_key'] = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->get_pretty( 'site_license_key' ) : ''; |
|
348 | - $this->_template_args['organization_name'] = isset( EE_Registry::instance()->CFG->organization->name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : ''; |
|
349 | - $this->_template_args['organization_address_1'] = isset( EE_Registry::instance()->CFG->organization->address_1 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ) : ''; |
|
350 | - $this->_template_args['organization_address_2'] = isset( EE_Registry::instance()->CFG->organization->address_2 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ) : ''; |
|
351 | - $this->_template_args['organization_city'] = isset( EE_Registry::instance()->CFG->organization->city ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'city' ) : ''; |
|
352 | - $this->_template_args['organization_zip'] = isset( EE_Registry::instance()->CFG->organization->zip ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ) : ''; |
|
353 | - $this->_template_args['organization_email'] = isset( EE_Registry::instance()->CFG->organization->email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : ''; |
|
354 | - $this->_template_args['organization_phone'] = isset( EE_Registry::instance()->CFG->organization->phone ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ) : ''; |
|
355 | - $this->_template_args['organization_vat'] = isset( EE_Registry::instance()->CFG->organization->vat ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'vat' ) : ''; |
|
356 | - $this->_template_args['currency_sign'] = isset( EE_Registry::instance()->CFG->currency->sign ) ? EE_Registry::instance()->CFG->currency->get_pretty( 'sign' ) : '$'; |
|
357 | - $this->_template_args['organization_logo_url'] = isset( EE_Registry::instance()->CFG->organization->logo_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) : FALSE; |
|
358 | - $this->_template_args['organization_facebook'] = isset( EE_Registry::instance()->CFG->organization->facebook ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : ''; |
|
359 | - $this->_template_args['organization_twitter'] = isset( EE_Registry::instance()->CFG->organization->twitter ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : ''; |
|
360 | - $this->_template_args['organization_linkedin'] = isset( EE_Registry::instance()->CFG->organization->linkedin ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ) : ''; |
|
361 | - $this->_template_args['organization_pinterest'] = isset( EE_Registry::instance()->CFG->organization->pinterest ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ) : ''; |
|
362 | - $this->_template_args['organization_google'] = isset( EE_Registry::instance()->CFG->organization->google ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'google' ) : ''; |
|
363 | - $this->_template_args['organization_instagram'] = isset( EE_Registry::instance()->CFG->organization->instagram ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ) : ''; |
|
347 | + $this->_template_args['site_license_key'] = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : ''; |
|
348 | + $this->_template_args['organization_name'] = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : ''; |
|
349 | + $this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : ''; |
|
350 | + $this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : ''; |
|
351 | + $this->_template_args['organization_city'] = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : ''; |
|
352 | + $this->_template_args['organization_zip'] = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : ''; |
|
353 | + $this->_template_args['organization_email'] = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : ''; |
|
354 | + $this->_template_args['organization_phone'] = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : ''; |
|
355 | + $this->_template_args['organization_vat'] = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : ''; |
|
356 | + $this->_template_args['currency_sign'] = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$'; |
|
357 | + $this->_template_args['organization_logo_url'] = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : FALSE; |
|
358 | + $this->_template_args['organization_facebook'] = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : ''; |
|
359 | + $this->_template_args['organization_twitter'] = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : ''; |
|
360 | + $this->_template_args['organization_linkedin'] = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : ''; |
|
361 | + $this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : ''; |
|
362 | + $this->_template_args['organization_google'] = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : ''; |
|
363 | + $this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : ''; |
|
364 | 364 | //UXIP settings |
365 | - $this->_template_args['ee_ueip_optin'] = isset( EE_Registry::instance()->CFG->core->ee_ueip_optin ) ? EE_Registry::instance()->CFG->core->get_pretty( 'ee_ueip_optin' ) : TRUE; |
|
365 | + $this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : TRUE; |
|
366 | 366 | |
367 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
368 | - $STA_ID = isset( EE_Registry::instance()->CFG->organization->STA_ID ) ? EE_Registry::instance()->CFG->organization->STA_ID : 4; |
|
367 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
368 | + $STA_ID = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4; |
|
369 | 369 | $this->_template_args['states'] = new EE_Question_Form_Input( |
370 | - EE_Question::new_instance ( array( |
|
370 | + EE_Question::new_instance(array( |
|
371 | 371 | 'QST_ID'=> 0, |
372 | 372 | 'QST_display_text'=> __('State/Province', 'event_espresso'), |
373 | 373 | 'QST_system'=>'admin-state' |
374 | 374 | )), |
375 | - EE_Answer::new_instance ( array( |
|
375 | + EE_Answer::new_instance(array( |
|
376 | 376 | 'ANS_ID' => 0, |
377 | 377 | 'ANS_value' => $STA_ID |
378 | 378 | )), |
@@ -384,14 +384,14 @@ discard block |
||
384 | 384 | ) |
385 | 385 | ); |
386 | 386 | |
387 | - $CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
387 | + $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
388 | 388 | $this->_template_args['countries'] = new EE_Question_Form_Input( |
389 | - EE_Question::new_instance ( array( |
|
389 | + EE_Question::new_instance(array( |
|
390 | 390 | 'QST_ID'=> 0, |
391 | 391 | 'QST_display_text'=> __('Country', 'event_espresso'), |
392 | 392 | 'QST_system'=>'admin-country' |
393 | 393 | )), |
394 | - EE_Answer::new_instance ( array( |
|
394 | + EE_Answer::new_instance(array( |
|
395 | 395 | 'ANS_ID' => 0, |
396 | 396 | 'ANS_value' => $CNT_ISO |
397 | 397 | )), |
@@ -403,51 +403,51 @@ discard block |
||
403 | 403 | ) |
404 | 404 | ); |
405 | 405 | |
406 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 ); |
|
407 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 ); |
|
406 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
407 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
408 | 408 | |
409 | 409 | //PUE verification stuff |
410 | - $ver_option_key = 'puvererr_' . basename( EE_PLUGIN_BASENAME ); |
|
411 | - $verify_fail = get_option( $ver_option_key ); |
|
412 | - $this->_template_args['site_license_key_verified'] = $verify_fail || !empty( $verify_fail ) || ( empty( $this->_template_args['site_license_key'] ) && empty( $verify_fail ) )? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>'; |
|
410 | + $ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME); |
|
411 | + $verify_fail = get_option($ver_option_key); |
|
412 | + $this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>'; |
|
413 | 413 | |
414 | - $this->_set_add_edit_form_tags( 'update_your_organization_settings' ); |
|
415 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
416 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php', $this->_template_args, TRUE ); |
|
414 | + $this->_set_add_edit_form_tags('update_your_organization_settings'); |
|
415 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
416 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'your_organization_settings.template.php', $this->_template_args, TRUE); |
|
417 | 417 | |
418 | 418 | $this->display_admin_page_with_sidebar(); |
419 | 419 | } |
420 | 420 | |
421 | 421 | protected function _update_your_organization_settings() { |
422 | - if ( is_main_site() ) |
|
423 | - EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key; |
|
424 | - EE_Registry::instance()->CFG->organization->name = isset( $this->_req_data['organization_name'] ) ? sanitize_text_field( $this->_req_data['organization_name'] ) : EE_Registry::instance()->CFG->organization->name; |
|
425 | - EE_Registry::instance()->CFG->organization->address_1 = isset( $this->_req_data['organization_address_1'] ) ? sanitize_text_field( $this->_req_data['organization_address_1'] ) : EE_Registry::instance()->CFG->organization->address_1; |
|
426 | - EE_Registry::instance()->CFG->organization->address_2 = isset( $this->_req_data['organization_address_2'] ) ? sanitize_text_field( $this->_req_data['organization_address_2'] ) : EE_Registry::instance()->CFG->organization->address_2; |
|
427 | - EE_Registry::instance()->CFG->organization->city = isset( $this->_req_data['organization_city'] ) ? sanitize_text_field( $this->_req_data['organization_city'] ) : EE_Registry::instance()->CFG->organization->city; |
|
428 | - EE_Registry::instance()->CFG->organization->STA_ID = isset( $this->_req_data['organization_state'] ) ? absint( $this->_req_data['organization_state'] ) : EE_Registry::instance()->CFG->organization->STA_ID; |
|
429 | - EE_Registry::instance()->CFG->organization->CNT_ISO = isset( $this->_req_data['organization_country'] ) ? sanitize_text_field( $this->_req_data['organization_country'] ) : EE_Registry::instance()->CFG->organization->CNT_ISO; |
|
430 | - EE_Registry::instance()->CFG->organization->zip = isset( $this->_req_data['organization_zip'] ) ? sanitize_text_field( $this->_req_data['organization_zip'] ) : EE_Registry::instance()->CFG->organization->zip; |
|
431 | - EE_Registry::instance()->CFG->organization->email = isset( $this->_req_data['organization_email'] ) ? sanitize_email( $this->_req_data['organization_email'] ) : EE_Registry::instance()->CFG->organization->email; |
|
432 | - EE_Registry::instance()->CFG->organization->vat = isset( $this->_req_data['organization_vat'] ) ? sanitize_text_field( $this->_req_data['organization_vat'] ) : EE_Registry::instance()->CFG->organization->vat; |
|
433 | - EE_Registry::instance()->CFG->organization->phone = isset( $this->_req_data['organization_phone'] ) ? sanitize_text_field( $this->_req_data['organization_phone'] ) : EE_Registry::instance()->CFG->organization->phone; |
|
434 | - EE_Registry::instance()->CFG->organization->logo_url = isset( $this->_req_data['organization_logo_url'] ) ? esc_url_raw( $this->_req_data['organization_logo_url'] ) : EE_Registry::instance()->CFG->organization->logo_url; |
|
435 | - EE_Registry::instance()->CFG->organization->facebook = isset( $this->_req_data['organization_facebook'] ) ? esc_url_raw( $this->_req_data['organization_facebook'] ) : EE_Registry::instance()->CFG->organization->facebook; |
|
436 | - EE_Registry::instance()->CFG->organization->twitter = isset( $this->_req_data['organization_twitter'] ) ? esc_url_raw( $this->_req_data['organization_twitter'] ) : EE_Registry::instance()->CFG->organization->twitter; |
|
437 | - EE_Registry::instance()->CFG->organization->linkedin = isset( $this->_req_data['organization_linkedin'] ) ? esc_url_raw( $this->_req_data['organization_linkedin'] ) : EE_Registry::instance()->CFG->organization->linkedin; |
|
438 | - EE_Registry::instance()->CFG->organization->pinterest = isset( $this->_req_data['organization_pinterest'] ) ? esc_url_raw( $this->_req_data['organization_pinterest'] ) : EE_Registry::instance()->CFG->organization->pinterest; |
|
439 | - EE_Registry::instance()->CFG->organization->google = isset( $this->_req_data['organization_google'] ) ? esc_url_raw( $this->_req_data['organization_google'] ) : EE_Registry::instance()->CFG->organization->google; |
|
440 | - EE_Registry::instance()->CFG->organization->instagram = isset( $this->_req_data['organization_instagram'] ) ? esc_url_raw( $this->_req_data['organization_instagram'] ) : EE_Registry::instance()->CFG->organization->instagram; |
|
441 | - EE_Registry::instance()->CFG->core->ee_ueip_optin = isset( $this->_req_data['ueip_optin'] ) && !empty( $this->_req_data['ueip_optin'] ) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin; |
|
442 | - |
|
443 | - EE_Registry::instance()->CFG->currency = new EE_Currency_Config( EE_Registry::instance()->CFG->organization->CNT_ISO ); |
|
444 | - |
|
445 | - EE_Registry::instance()->CFG = apply_filters( 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG ); |
|
422 | + if (is_main_site()) |
|
423 | + EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key; |
|
424 | + EE_Registry::instance()->CFG->organization->name = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name; |
|
425 | + EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1; |
|
426 | + EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2; |
|
427 | + EE_Registry::instance()->CFG->organization->city = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city; |
|
428 | + EE_Registry::instance()->CFG->organization->STA_ID = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID; |
|
429 | + EE_Registry::instance()->CFG->organization->CNT_ISO = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO; |
|
430 | + EE_Registry::instance()->CFG->organization->zip = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip; |
|
431 | + EE_Registry::instance()->CFG->organization->email = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email; |
|
432 | + EE_Registry::instance()->CFG->organization->vat = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat; |
|
433 | + EE_Registry::instance()->CFG->organization->phone = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone; |
|
434 | + EE_Registry::instance()->CFG->organization->logo_url = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url; |
|
435 | + EE_Registry::instance()->CFG->organization->facebook = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook; |
|
436 | + EE_Registry::instance()->CFG->organization->twitter = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter; |
|
437 | + EE_Registry::instance()->CFG->organization->linkedin = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin; |
|
438 | + EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest; |
|
439 | + EE_Registry::instance()->CFG->organization->google = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google; |
|
440 | + EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram; |
|
441 | + EE_Registry::instance()->CFG->core->ee_ueip_optin = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin; |
|
442 | + |
|
443 | + EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO); |
|
444 | + |
|
445 | + EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG); |
|
446 | 446 | |
447 | 447 | $what = 'Your Organization Settings'; |
448 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ ); |
|
448 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__); |
|
449 | 449 | |
450 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default' ) ); |
|
450 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'default')); |
|
451 | 451 | |
452 | 452 | } |
453 | 453 | |
@@ -458,36 +458,36 @@ discard block |
||
458 | 458 | protected function _admin_option_settings() { |
459 | 459 | |
460 | 460 | $this->_template_args['values'] = $this->_yes_no_values; |
461 | - $this->_template_args['use_personnel_manager'] = isset( EE_Registry::instance()->CFG->admin->use_personnel_manager ) ? absint( EE_Registry::instance()->CFG->admin->use_personnel_manager ) : FALSE; |
|
462 | - $this->_template_args['use_dashboard_widget'] = isset( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) ? absint( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) : TRUE; |
|
463 | - $this->_template_args['events_in_dashboard'] = isset( EE_Registry::instance()->CFG->admin->events_in_dashboard ) ? absint( EE_Registry::instance()->CFG->admin->events_in_dashboard ) : 30; |
|
464 | - $this->_template_args['use_event_timezones'] = isset( EE_Registry::instance()->CFG->admin->use_event_timezones ) ? absint( EE_Registry::instance()->CFG->admin->use_event_timezones ) : FALSE; |
|
465 | - $this->_template_args['show_reg_footer'] = isset( EE_Registry::instance()->CFG->admin->show_reg_footer ) ? absint( EE_Registry::instance()->CFG->admin->show_reg_footer ) : TRUE; |
|
466 | - $this->_template_args['affiliate_id'] = isset( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : ''; |
|
467 | - $this->_template_args['help_tour_activation'] = isset( EE_Registry::instance()->CFG->admin->help_tour_activation ) ? absint( EE_Registry::instance()->CFG->admin->help_tour_activation ): 1; |
|
468 | - |
|
469 | - $this->_set_add_edit_form_tags( 'update_admin_option_settings' ); |
|
470 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
461 | + $this->_template_args['use_personnel_manager'] = isset(EE_Registry::instance()->CFG->admin->use_personnel_manager) ? absint(EE_Registry::instance()->CFG->admin->use_personnel_manager) : FALSE; |
|
462 | + $this->_template_args['use_dashboard_widget'] = isset(EE_Registry::instance()->CFG->admin->use_dashboard_widget) ? absint(EE_Registry::instance()->CFG->admin->use_dashboard_widget) : TRUE; |
|
463 | + $this->_template_args['events_in_dashboard'] = isset(EE_Registry::instance()->CFG->admin->events_in_dashboard) ? absint(EE_Registry::instance()->CFG->admin->events_in_dashboard) : 30; |
|
464 | + $this->_template_args['use_event_timezones'] = isset(EE_Registry::instance()->CFG->admin->use_event_timezones) ? absint(EE_Registry::instance()->CFG->admin->use_event_timezones) : FALSE; |
|
465 | + $this->_template_args['show_reg_footer'] = isset(EE_Registry::instance()->CFG->admin->show_reg_footer) ? absint(EE_Registry::instance()->CFG->admin->show_reg_footer) : TRUE; |
|
466 | + $this->_template_args['affiliate_id'] = isset(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : ''; |
|
467 | + $this->_template_args['help_tour_activation'] = isset(EE_Registry::instance()->CFG->admin->help_tour_activation) ? absint(EE_Registry::instance()->CFG->admin->help_tour_activation) : 1; |
|
468 | + |
|
469 | + $this->_set_add_edit_form_tags('update_admin_option_settings'); |
|
470 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
471 | 471 | $this->_template_args['template_args'] = $this->_template_args; |
472 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'admin_option_settings.template.php', $this->_template_args, TRUE ); |
|
472 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'admin_option_settings.template.php', $this->_template_args, TRUE); |
|
473 | 473 | $this->display_admin_page_with_sidebar(); |
474 | 474 | } |
475 | 475 | |
476 | 476 | protected function _update_admin_option_settings() { |
477 | - EE_Registry::instance()->CFG->admin->use_personnel_manager = isset( $this->_req_data['use_personnel_manager'] ) ? absint( $this->_req_data['use_personnel_manager'] ) : EE_Registry::instance()->CFG->admin->use_personnel_manager; |
|
478 | - EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset( $this->_req_data['use_dashboard_widget'] ) ? absint( $this->_req_data['use_dashboard_widget'] ) : EE_Registry::instance()->CFG->admin->use_dashboard_widget; |
|
479 | - EE_Registry::instance()->CFG->admin->events_in_dashboard = isset( $this->_req_data['events_in_dashboard'] ) ? absint( $this->_req_data['events_in_dashboard'] ) : EE_Registry::instance()->CFG->admin->events_in_dashboard; |
|
480 | - EE_Registry::instance()->CFG->admin->use_event_timezones = isset( $this->_req_data['use_event_timezones'] ) ? absint( $this->_req_data['use_event_timezones'] ) : EE_Registry::instance()->CFG->admin->use_event_timezones; |
|
481 | - EE_Registry::instance()->CFG->admin->show_reg_footer = isset( $this->_req_data['show_reg_footer'] ) ? absint( $this->_req_data['show_reg_footer'] ) : EE_Registry::instance()->CFG->admin->show_reg_footer; |
|
482 | - EE_Registry::instance()->CFG->admin->affiliate_id = isset( $this->_req_data['affiliate_id'] ) ? sanitize_text_field( $this->_req_data['affiliate_id'] ) : EE_Registry::instance()->CFG->admin->affiliate_id; |
|
483 | - EE_Registry::instance()->CFG->admin->help_tour_activation = isset( $this->_req_data['help_tour_activation'] ) ? absint( $this->_req_data['help_tour_activation'] ) : EE_Registry::instance()->CFG->admin->help_tour_activation; |
|
477 | + EE_Registry::instance()->CFG->admin->use_personnel_manager = isset($this->_req_data['use_personnel_manager']) ? absint($this->_req_data['use_personnel_manager']) : EE_Registry::instance()->CFG->admin->use_personnel_manager; |
|
478 | + EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset($this->_req_data['use_dashboard_widget']) ? absint($this->_req_data['use_dashboard_widget']) : EE_Registry::instance()->CFG->admin->use_dashboard_widget; |
|
479 | + EE_Registry::instance()->CFG->admin->events_in_dashboard = isset($this->_req_data['events_in_dashboard']) ? absint($this->_req_data['events_in_dashboard']) : EE_Registry::instance()->CFG->admin->events_in_dashboard; |
|
480 | + EE_Registry::instance()->CFG->admin->use_event_timezones = isset($this->_req_data['use_event_timezones']) ? absint($this->_req_data['use_event_timezones']) : EE_Registry::instance()->CFG->admin->use_event_timezones; |
|
481 | + EE_Registry::instance()->CFG->admin->show_reg_footer = isset($this->_req_data['show_reg_footer']) ? absint($this->_req_data['show_reg_footer']) : EE_Registry::instance()->CFG->admin->show_reg_footer; |
|
482 | + EE_Registry::instance()->CFG->admin->affiliate_id = isset($this->_req_data['affiliate_id']) ? sanitize_text_field($this->_req_data['affiliate_id']) : EE_Registry::instance()->CFG->admin->affiliate_id; |
|
483 | + EE_Registry::instance()->CFG->admin->help_tour_activation = isset($this->_req_data['help_tour_activation']) ? absint($this->_req_data['help_tour_activation']) : EE_Registry::instance()->CFG->admin->help_tour_activation; |
|
484 | 484 | |
485 | - EE_Registry::instance()->CFG->admin = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin ); |
|
485 | + EE_Registry::instance()->CFG->admin = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin); |
|
486 | 486 | |
487 | 487 | $what = 'Admin Options'; |
488 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__ ); |
|
489 | - $success = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success ); |
|
490 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'admin_option_settings' ) ); |
|
488 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__); |
|
489 | + $success = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success); |
|
490 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'admin_option_settings')); |
|
491 | 491 | |
492 | 492 | } |
493 | 493 | |
@@ -500,21 +500,21 @@ discard block |
||
500 | 500 | |
501 | 501 | protected function _country_settings() { |
502 | 502 | |
503 | - $CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
504 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO; |
|
503 | + $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
504 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO; |
|
505 | 505 | |
506 | 506 | //load field generator helper |
507 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
507 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
508 | 508 | |
509 | 509 | $this->_template_args['values'] = $this->_yes_no_values; |
510 | 510 | |
511 | 511 | $this->_template_args['countries'] = new EE_Question_Form_Input( |
512 | - EE_Question::new_instance ( array( |
|
512 | + EE_Question::new_instance(array( |
|
513 | 513 | 'QST_ID'=> 0, |
514 | 514 | 'QST_display_text'=> __('Select Country', 'event_espresso'), |
515 | 515 | 'QST_system'=>'admin-country' |
516 | 516 | )), |
517 | - EE_Answer::new_instance ( array( |
|
517 | + EE_Answer::new_instance(array( |
|
518 | 518 | 'ANS_ID' => 0, |
519 | 519 | 'ANS_value' => $CNT_ISO |
520 | 520 | )), |
@@ -527,14 +527,14 @@ discard block |
||
527 | 527 | ); |
528 | 528 | // EEH_Debug_Tools::printr( $this->_template_args['countries'], 'countries <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
529 | 529 | |
530 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 ); |
|
531 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 ); |
|
530 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
531 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
532 | 532 | $this->_template_args['country_details_settings'] = $this->display_country_settings(); |
533 | 533 | $this->_template_args['country_states_settings'] = $this->display_country_states(); |
534 | 534 | |
535 | - $this->_set_add_edit_form_tags( 'update_country_settings' ); |
|
536 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
537 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', $this->_template_args, TRUE ); |
|
535 | + $this->_set_add_edit_form_tags('update_country_settings'); |
|
536 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
537 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'countries_settings.template.php', $this->_template_args, TRUE); |
|
538 | 538 | $this->display_admin_page_with_no_sidebar(); |
539 | 539 | } |
540 | 540 | |
@@ -547,44 +547,44 @@ discard block |
||
547 | 547 | * @param string $CNT_ISO |
548 | 548 | * @return mixed string | array |
549 | 549 | */ |
550 | - public function display_country_settings( $CNT_ISO = '' ) { |
|
550 | + public function display_country_settings($CNT_ISO = '') { |
|
551 | 551 | |
552 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO; |
|
553 | - if ( ! $CNT_ISO ) { |
|
552 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO; |
|
553 | + if ( ! $CNT_ISO) { |
|
554 | 554 | return ''; |
555 | 555 | } |
556 | 556 | |
557 | 557 | // for ajax |
558 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
559 | - remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' ); |
|
560 | - remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' ); |
|
561 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 ); |
|
562 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 ); |
|
563 | - $country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO ); |
|
558 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
559 | + remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
560 | + remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
561 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
562 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
563 | + $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
564 | 564 | //EEH_Debug_Tools::printr( $country, '$country <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
565 | 565 | $country_input_types = array( |
566 | - 'CNT_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ), |
|
567 | - 'CNT_ISO' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
568 | - 'CNT_ISO3' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
569 | - 'RGN_ID' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
570 | - 'CNT_name' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'regular-text' ), |
|
571 | - 'CNT_cur_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
572 | - 'CNT_cur_single' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ), |
|
573 | - 'CNT_cur_plural' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ), |
|
574 | - 'CNT_cur_sign' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text', 'htmlentities' => FALSE ), |
|
575 | - 'CNT_cur_sign_b4' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ), |
|
576 | - 'CNT_cur_dec_plc' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => 0, 'text' => '' ), array( 'id' => 1, 'text' => '' ), array( 'id' => 2, 'text' => '' ), array( 'id' => 3, 'text' => '' ))), |
|
577 | - 'CNT_cur_dec_mrk' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ), |
|
578 | - 'CNT_cur_thsnds' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ), |
|
579 | - 'CNT_tel_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
580 | - 'CNT_is_EU' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ) |
|
566 | + 'CNT_active' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE), |
|
567 | + 'CNT_ISO' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
568 | + 'CNT_ISO3' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
569 | + 'RGN_ID' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
570 | + 'CNT_name' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'regular-text'), |
|
571 | + 'CNT_cur_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
572 | + 'CNT_cur_single' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'), |
|
573 | + 'CNT_cur_plural' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'), |
|
574 | + 'CNT_cur_sign' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text', 'htmlentities' => FALSE), |
|
575 | + 'CNT_cur_sign_b4' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE), |
|
576 | + 'CNT_cur_dec_plc' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => 0, 'text' => ''), array('id' => 1, 'text' => ''), array('id' => 2, 'text' => ''), array('id' => 3, 'text' => ''))), |
|
577 | + 'CNT_cur_dec_mrk' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE), |
|
578 | + 'CNT_cur_thsnds' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE), |
|
579 | + 'CNT_tel_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
580 | + 'CNT_is_EU' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE) |
|
581 | 581 | ); |
582 | - $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $country, $country_input_types ); |
|
583 | - $country_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', $this->_template_args, TRUE ); |
|
582 | + $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country, $country_input_types); |
|
583 | + $country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php', $this->_template_args, TRUE); |
|
584 | 584 | |
585 | - if ( defined( 'DOING_AJAX' )) { |
|
586 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE ); |
|
587 | - echo json_encode( array( 'return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] )); |
|
585 | + if (defined('DOING_AJAX')) { |
|
586 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE); |
|
587 | + echo json_encode(array('return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'])); |
|
588 | 588 | die(); |
589 | 589 | } else { |
590 | 590 | return $country_details_settings; |
@@ -602,50 +602,50 @@ discard block |
||
602 | 602 | * @param string $CNT_ISO |
603 | 603 | * @return string |
604 | 604 | */ |
605 | - public function display_country_states( $CNT_ISO = '' ) { |
|
605 | + public function display_country_states($CNT_ISO = '') { |
|
606 | 606 | |
607 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? sanitize_text_field( $this->_req_data['country'] ) : $CNT_ISO; |
|
607 | + $CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO; |
|
608 | 608 | |
609 | - if ( ! $CNT_ISO ) { |
|
609 | + if ( ! $CNT_ISO) { |
|
610 | 610 | return ''; |
611 | 611 | } |
612 | 612 | // for ajax |
613 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
614 | - remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' ); |
|
615 | - remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' ); |
|
616 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'state_form_field_label_wrap' ), 10, 2 ); |
|
617 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'state_form_field_input__wrap' ), 10, 2 ); |
|
618 | - $states = EEM_State::instance()->get_all_states_for_these_countries( array( $CNT_ISO => $CNT_ISO )); |
|
613 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
614 | + remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
615 | + remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
616 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2); |
|
617 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2); |
|
618 | + $states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO)); |
|
619 | 619 | |
620 | 620 | // echo '<h4>$CNT_ISO : ' . $CNT_ISO . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
621 | 621 | // global $wpdb; |
622 | 622 | // echo '<h4>' . $wpdb->last_query . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
623 | 623 | // EEH_Debug_Tools::printr( $states, '$states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
624 | - if ( $states ) { |
|
625 | - foreach ( $states as $STA_ID => $state ) { |
|
626 | - if ( $state instanceof EE_State ) { |
|
624 | + if ($states) { |
|
625 | + foreach ($states as $STA_ID => $state) { |
|
626 | + if ($state instanceof EE_State) { |
|
627 | 627 | //STA_abbrev STA_name STA_active |
628 | 628 | $state_input_types = array( |
629 | - 'STA_abbrev' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'mid-text' ), |
|
630 | - 'STA_name' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'regular-text' ), |
|
631 | - 'STA_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'states[' . $STA_ID . ']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true ) |
|
629 | + 'STA_abbrev' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'mid-text'), |
|
630 | + 'STA_name' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'regular-text'), |
|
631 | + 'STA_active' => array('type' => 'RADIO_BTN', 'input_name' => 'states['.$STA_ID.']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true) |
|
632 | 632 | ); |
633 | - $this->_template_args[ 'states' ][ $STA_ID ][ 'inputs' ] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $state, $state_input_types ); |
|
634 | - $query_args = array( 'action' => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev() ); |
|
635 | - $this->_template_args[ 'states' ][ $STA_ID ][ 'delete_state_url' ] = EE_Admin_Page::add_query_args_and_nonce( $query_args, GEN_SET_ADMIN_URL ); |
|
633 | + $this->_template_args['states'][$STA_ID]['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($state, $state_input_types); |
|
634 | + $query_args = array('action' => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev()); |
|
635 | + $this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, GEN_SET_ADMIN_URL); |
|
636 | 636 | } |
637 | 637 | } |
638 | 638 | } else { |
639 | 639 | $this->_template_args['states'] = FALSE; |
640 | 640 | } |
641 | 641 | // EEH_Debug_Tools::printr( $this->_template_args['states'], 'states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
642 | - $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'add_new_state' ), GEN_SET_ADMIN_URL ); |
|
642 | + $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'), GEN_SET_ADMIN_URL); |
|
643 | 643 | |
644 | - $state_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', $this->_template_args, TRUE ); |
|
644 | + $state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php', $this->_template_args, TRUE); |
|
645 | 645 | |
646 | - if ( defined( 'DOING_AJAX' )) { |
|
647 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE ); |
|
648 | - echo json_encode( array( 'return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] )); |
|
646 | + if (defined('DOING_AJAX')) { |
|
647 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE); |
|
648 | + echo json_encode(array('return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'])); |
|
649 | 649 | die(); |
650 | 650 | } else { |
651 | 651 | return $state_details_settings; |
@@ -666,40 +666,39 @@ discard block |
||
666 | 666 | |
667 | 667 | $success = TRUE; |
668 | 668 | |
669 | - $CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE; |
|
670 | - if ( ! $CNT_ISO ) { |
|
671 | - EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
669 | + $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE; |
|
670 | + if ( ! $CNT_ISO) { |
|
671 | + EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
672 | 672 | $success = FALSE; |
673 | 673 | } |
674 | - $STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE; |
|
675 | - if ( ! $STA_abbrev ) { |
|
676 | - EE_Error::add_error( __( 'No State ISO code or an invalid State ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
674 | + $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE; |
|
675 | + if ( ! $STA_abbrev) { |
|
676 | + EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
677 | 677 | $success = FALSE; |
678 | 678 | } |
679 | - $STA_name = isset( $this->_req_data['STA_name'] ) ? sanitize_text_field( $this->_req_data['STA_name'] ) : |
|
680 | - FALSE; |
|
681 | - if ( ! $STA_name ) { |
|
682 | - EE_Error::add_error( __( 'No State name or an invalid State name was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
679 | + $STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) : FALSE; |
|
680 | + if ( ! $STA_name) { |
|
681 | + EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
683 | 682 | $success = FALSE; |
684 | 683 | } |
685 | 684 | |
686 | - if ( $success ) { |
|
685 | + if ($success) { |
|
687 | 686 | $cols_n_values = array( |
688 | 687 | 'CNT_ISO' => $CNT_ISO, |
689 | 688 | 'STA_abbrev' => $STA_abbrev, |
690 | 689 | 'STA_name' => $STA_name, |
691 | 690 | 'STA_active' => TRUE |
692 | 691 | ); |
693 | - $success = EEM_State::instance()->insert ( $cols_n_values ); |
|
694 | - EE_Error::add_success( __( 'The State was added successfully.', 'event_espresso' ) ); |
|
692 | + $success = EEM_State::instance()->insert($cols_n_values); |
|
693 | + EE_Error::add_success(__('The State was added successfully.', 'event_espresso')); |
|
695 | 694 | } |
696 | 695 | |
697 | - if ( defined( 'DOING_AJAX' )) { |
|
698 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE ); |
|
699 | - echo json_encode( array_merge( $notices, array( 'return_data' => $CNT_ISO ) ) ); |
|
696 | + if (defined('DOING_AJAX')) { |
|
697 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE); |
|
698 | + echo json_encode(array_merge($notices, array('return_data' => $CNT_ISO))); |
|
700 | 699 | die(); |
701 | 700 | } else { |
702 | - $this->_redirect_after_action( $success, 'State', 'added', array( 'action' => 'country_settings' ) ); |
|
701 | + $this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings')); |
|
703 | 702 | } |
704 | 703 | } |
705 | 704 | |
@@ -712,25 +711,25 @@ discard block |
||
712 | 711 | * @return boolean | void |
713 | 712 | */ |
714 | 713 | public function delete_state() { |
715 | - $CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE; |
|
716 | - $STA_ID = isset( $this->_req_data['STA_ID'] ) ? sanitize_text_field( $this->_req_data['STA_ID'] ) : FALSE; |
|
717 | - $STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE; |
|
718 | - if ( ! $STA_ID ) { |
|
719 | - EE_Error::add_error( __( 'No State ID or an invalid State ID was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
714 | + $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE; |
|
715 | + $STA_ID = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : FALSE; |
|
716 | + $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE; |
|
717 | + if ( ! $STA_ID) { |
|
718 | + EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
720 | 719 | return FALSE; |
721 | 720 | } |
722 | - $success = EEM_State::instance()->delete_by_ID( $STA_ID ); |
|
723 | - if ( $success !== FALSE ) { |
|
724 | - do_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array( 'STA_abbrev' => $STA_abbrev )); |
|
725 | - EE_Error::add_success( __( 'The State was deleted successfully.', 'event_espresso' )); |
|
721 | + $success = EEM_State::instance()->delete_by_ID($STA_ID); |
|
722 | + if ($success !== FALSE) { |
|
723 | + do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array('STA_abbrev' => $STA_abbrev)); |
|
724 | + EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso')); |
|
726 | 725 | } |
727 | - if ( defined( 'DOING_AJAX' )) { |
|
728 | - $notices = EE_Error::get_notices( FALSE, FALSE ); |
|
726 | + if (defined('DOING_AJAX')) { |
|
727 | + $notices = EE_Error::get_notices(FALSE, FALSE); |
|
729 | 728 | $notices['return_data'] = TRUE; |
730 | - echo json_encode( $notices ); |
|
729 | + echo json_encode($notices); |
|
731 | 730 | die(); |
732 | 731 | } else { |
733 | - $this->_redirect_after_action( $success, 'State', 'deleted', array( 'action' => 'country_settings' ) ); |
|
732 | + $this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings')); |
|
734 | 733 | } |
735 | 734 | } |
736 | 735 | |
@@ -746,63 +745,63 @@ discard block |
||
746 | 745 | protected function _update_country_settings() { |
747 | 746 | // EEH_Debug_Tools::printr( $this->_req_data, '$this->_req_data <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
748 | 747 | // grab the country ISO code |
749 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : FALSE; |
|
750 | - if ( ! $CNT_ISO ) { |
|
751 | - EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
748 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : FALSE; |
|
749 | + if ( ! $CNT_ISO) { |
|
750 | + EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
752 | 751 | return; |
753 | 752 | } |
754 | 753 | $cols_n_values = array(); |
755 | - $cols_n_values['CNT_ISO3'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] )) : FALSE; |
|
756 | - $cols_n_values['RGN_ID'] = isset( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) : NULL; |
|
757 | - $cols_n_values['CNT_name'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) : NULL; |
|
758 | - $cols_n_values['CNT_cur_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] )) : 'USD'; |
|
759 | - $cols_n_values['CNT_cur_single'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) : 'dollar'; |
|
760 | - $cols_n_values['CNT_cur_plural'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) : 'dollars'; |
|
761 | - $cols_n_values['CNT_cur_sign'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) : '$'; |
|
762 | - $cols_n_values['CNT_cur_sign_b4'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) : TRUE; |
|
763 | - $cols_n_values['CNT_cur_dec_plc'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) : 2; |
|
764 | - $cols_n_values['CNT_cur_dec_mrk'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) : '.'; |
|
765 | - $cols_n_values['CNT_cur_thsnds'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) : ','; |
|
766 | - $cols_n_values['CNT_tel_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) : NULL; |
|
767 | - $cols_n_values['CNT_is_EU'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) : FALSE; |
|
768 | - $cols_n_values['CNT_active'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) : FALSE; |
|
754 | + $cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : FALSE; |
|
755 | + $cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : NULL; |
|
756 | + $cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : NULL; |
|
757 | + $cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD'; |
|
758 | + $cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar'; |
|
759 | + $cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars'; |
|
760 | + $cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$'; |
|
761 | + $cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : TRUE; |
|
762 | + $cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2; |
|
763 | + $cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.'; |
|
764 | + $cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ','; |
|
765 | + $cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : NULL; |
|
766 | + $cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : FALSE; |
|
767 | + $cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : FALSE; |
|
769 | 768 | // allow filtering of country data |
770 | - $cols_n_values = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values ); |
|
769 | + $cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values); |
|
771 | 770 | //EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
772 | 771 | // where values |
773 | - $where_cols_n_values = array( array( 'CNT_ISO' => $CNT_ISO )); |
|
772 | + $where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO)); |
|
774 | 773 | // run the update |
775 | - $success = EEM_Country::instance()->update( $cols_n_values, $where_cols_n_values ); |
|
774 | + $success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values); |
|
776 | 775 | // global $wpdb; |
777 | 776 | // echo '<h4>' . $wpdb->last_query . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
778 | 777 | // echo '<h4>$success : ' . $success . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
779 | - if ( isset( $this->_req_data['states'] ) && is_array( $this->_req_data['states'] ) && $success !== FALSE ) { |
|
778 | + if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== FALSE) { |
|
780 | 779 | // allow filtering of states data |
781 | - $states = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states'] ); |
|
780 | + $states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states']); |
|
782 | 781 | // EEH_Debug_Tools::printr( $states, '$states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
783 | 782 | // loop thru state data ( looks like : states[75][STA_name] ) |
784 | - foreach( $states as $STA_ID => $state ) { |
|
783 | + foreach ($states as $STA_ID => $state) { |
|
785 | 784 | $cols_n_values = array( |
786 | 785 | 'CNT_ISO' => $CNT_ISO, |
787 | - 'STA_abbrev' => sanitize_text_field( $state['STA_abbrev'] ), |
|
788 | - 'STA_name' => sanitize_text_field( $state['STA_name'] ), |
|
789 | - 'STA_active' => (bool)absint( $state['STA_active'] ) |
|
786 | + 'STA_abbrev' => sanitize_text_field($state['STA_abbrev']), |
|
787 | + 'STA_name' => sanitize_text_field($state['STA_name']), |
|
788 | + 'STA_active' => (bool) absint($state['STA_active']) |
|
790 | 789 | ); |
791 | 790 | // where values |
792 | - $where_cols_n_values = array( array( 'STA_ID' => $STA_ID )); |
|
791 | + $where_cols_n_values = array(array('STA_ID' => $STA_ID)); |
|
793 | 792 | // run the update |
794 | - $success = EEM_State::instance()->update( $cols_n_values, $where_cols_n_values ); |
|
795 | - if ( $success !== FALSE ) { |
|
796 | - do_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values ); |
|
793 | + $success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values); |
|
794 | + if ($success !== FALSE) { |
|
795 | + do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values); |
|
797 | 796 | } |
798 | 797 | } |
799 | 798 | } |
800 | 799 | // check if country being edited matches org option country, and if so, then update EE_Config with new settings |
801 | - if ( isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO ) { |
|
802 | - EE_Registry::instance()->CFG->currency = new EE_Currency_Config( $CNT_ISO ); |
|
800 | + if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) { |
|
801 | + EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO); |
|
803 | 802 | EE_Registry::instance()->CFG->update_espresso_config(); |
804 | 803 | } |
805 | - $this->_redirect_after_action( $success, 'Countries', 'updated', array( 'action' => 'country_settings', 'country' => $CNT_ISO )); |
|
804 | + $this->_redirect_after_action($success, 'Countries', 'updated', array('action' => 'country_settings', 'country' => $CNT_ISO)); |
|
806 | 805 | } |
807 | 806 | |
808 | 807 | |
@@ -816,11 +815,11 @@ discard block |
||
816 | 815 | * @param string $label |
817 | 816 | * @return string |
818 | 817 | */ |
819 | - public function country_form_field_label_wrap( $label, $required_text ) { |
|
818 | + public function country_form_field_label_wrap($label, $required_text) { |
|
820 | 819 | return ' |
821 | 820 | <tr> |
822 | 821 | <th> |
823 | - ' . $label . ' |
|
822 | + ' . $label.' |
|
824 | 823 | </th>'; |
825 | 824 | } |
826 | 825 | |
@@ -834,10 +833,10 @@ discard block |
||
834 | 833 | * @param string $label |
835 | 834 | * @return string |
836 | 835 | */ |
837 | - public function country_form_field_input__wrap( $input, $label ) { |
|
836 | + public function country_form_field_input__wrap($input, $label) { |
|
838 | 837 | return ' |
839 | 838 | <td class="general-settings-country-input-td"> |
840 | - ' . $input . ' |
|
839 | + ' . $input.' |
|
841 | 840 | </td> |
842 | 841 | </tr>'; |
843 | 842 | } |
@@ -853,7 +852,7 @@ discard block |
||
853 | 852 | * @param string $required_text |
854 | 853 | * @return string |
855 | 854 | */ |
856 | - public function state_form_field_label_wrap( $label, $required_text ) { |
|
855 | + public function state_form_field_label_wrap($label, $required_text) { |
|
857 | 856 | return $required_text; |
858 | 857 | } |
859 | 858 | |
@@ -867,10 +866,10 @@ discard block |
||
867 | 866 | * @param string $label |
868 | 867 | * @return string |
869 | 868 | */ |
870 | - public function state_form_field_input__wrap( $input, $label ) { |
|
869 | + public function state_form_field_input__wrap($input, $label) { |
|
871 | 870 | return ' |
872 | 871 | <td class="general-settings-country-state-input-td"> |
873 | - ' . $input . ' |
|
872 | + ' . $input.' |
|
874 | 873 | </td>'; |
875 | 874 | |
876 | 875 | } |
@@ -893,10 +892,10 @@ discard block |
||
893 | 892 | * @param int $ee_page_id |
894 | 893 | * @return string |
895 | 894 | */ |
896 | - public static function edit_view_links( $ee_page_id ) { |
|
897 | - $links = '<a href="' . add_query_arg( array( 'post' => $ee_page_id, 'action' => 'edit' ), admin_url( 'post.php' )) . '" >' . __('Edit', 'event_espresso') . '</a>'; |
|
895 | + public static function edit_view_links($ee_page_id) { |
|
896 | + $links = '<a href="'.add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), admin_url('post.php')).'" >'.__('Edit', 'event_espresso').'</a>'; |
|
898 | 897 | $links .= ' | '; |
899 | - $links .= '<a href="' . get_permalink( $ee_page_id ) . '" >' . __('View', 'event_espresso') . '</a>'; |
|
898 | + $links .= '<a href="'.get_permalink($ee_page_id).'" >'.__('View', 'event_espresso').'</a>'; |
|
900 | 899 | return $links; |
901 | 900 | } |
902 | 901 | |
@@ -909,27 +908,27 @@ discard block |
||
909 | 908 | * @param WP page object $ee_page |
910 | 909 | * @return string |
911 | 910 | */ |
912 | - public static function page_and_shortcode_status( $ee_page, $shortcode ) { |
|
911 | + public static function page_and_shortcode_status($ee_page, $shortcode) { |
|
913 | 912 | |
914 | 913 | // page status |
915 | - if ( isset( $ee_page->post_status ) && $ee_page->post_status == 'publish') { |
|
914 | + if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') { |
|
916 | 915 | $pg_colour = 'green'; |
917 | - $pg_status = sprintf( __('Page%sStatus%sOK', 'event_espresso'), ' ' , ' ' ); |
|
916 | + $pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), ' ', ' '); |
|
918 | 917 | } else { |
919 | 918 | $pg_colour = 'red'; |
920 | - $pg_status = sprintf( __('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' ' ); |
|
919 | + $pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' '); |
|
921 | 920 | } |
922 | 921 | |
923 | 922 | // shortcode status |
924 | - if ( isset( $ee_page->post_content ) && strpos( $ee_page->post_content, $shortcode ) !== FALSE ) { |
|
923 | + if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== FALSE) { |
|
925 | 924 | $sc_colour = 'green'; |
926 | - $sc_status = sprintf( __('Shortcode%sOK', 'event_espresso'), ' ' ); |
|
925 | + $sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), ' '); |
|
927 | 926 | } else { |
928 | 927 | $sc_colour = 'red'; |
929 | - $sc_status = sprintf( __('Shortcode%sProblem', 'event_espresso'), ' ' ); |
|
928 | + $sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), ' '); |
|
930 | 929 | } |
931 | 930 | |
932 | - return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>'; |
|
931 | + return '<span style="color:'.$pg_colour.'; margin-right:2em;"><strong>'.$pg_status.'</strong></span><span style="color:'.$sc_colour.'"><strong>'.$sc_status.'</strong></span>'; |
|
933 | 932 | |
934 | 933 | } |
935 | 934 | |
@@ -944,20 +943,20 @@ discard block |
||
944 | 943 | * @param unknown_type $level |
945 | 944 | * @return unknown |
946 | 945 | */ |
947 | - public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) { |
|
946 | + public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0) { |
|
948 | 947 | global $wpdb; |
949 | - $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent) ); |
|
948 | + $items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent)); |
|
950 | 949 | |
951 | - if ( $items ) { |
|
952 | - foreach ( $items as $item ) { |
|
953 | - $pad = str_repeat( ' ', $level * 3 ); |
|
954 | - if ( $item->ID == $default) |
|
950 | + if ($items) { |
|
951 | + foreach ($items as $item) { |
|
952 | + $pad = str_repeat(' ', $level * 3); |
|
953 | + if ($item->ID == $default) |
|
955 | 954 | $current = ' selected="selected"'; |
956 | 955 | else |
957 | 956 | $current = ''; |
958 | 957 | |
959 | - echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>"; |
|
960 | - parent_dropdown( $default, $item->ID, $level +1 ); |
|
958 | + echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad ".esc_html($item->post_title)."</option>"; |
|
959 | + parent_dropdown($default, $item->ID, $level + 1); |
|
961 | 960 | } |
962 | 961 | } else { |
963 | 962 | return false; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public static function instance() { |
42 | 42 | // check if class object is instantiated |
43 | - if ( ! self::$_instance instanceof EE_Admin ) { |
|
43 | + if ( ! self::$_instance instanceof EE_Admin) { |
|
44 | 44 | self::$_instance = new self(); |
45 | 45 | } |
46 | 46 | return self::$_instance; |
@@ -57,30 +57,30 @@ discard block |
||
57 | 57 | // define global EE_Admin constants |
58 | 58 | $this->_define_all_constants(); |
59 | 59 | // set autoloaders for our admin page classes based on included path information |
60 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN ); |
|
60 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN); |
|
61 | 61 | // admin hooks |
62 | - add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 ); |
|
62 | + add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2); |
|
63 | 63 | // load EE_Request_Handler early |
64 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' )); |
|
65 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' )); |
|
64 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request')); |
|
65 | + add_action('AHEE__EE_System__initialize_last', array($this, 'init')); |
|
66 | 66 | // post shortcode tracking |
67 | 67 | add_action( |
68 | 68 | 'AHEE__EE_System__initialize_last', |
69 | - array( 'EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin' ) |
|
69 | + array('EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin') |
|
70 | 70 | ); |
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' )); |
|
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,11 +95,11 @@ 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' )); |
|
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 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -112,23 +112,23 @@ discard block |
||
112 | 112 | * @param string $plugin |
113 | 113 | * @return array |
114 | 114 | */ |
115 | - public function filter_plugin_actions( $links, $plugin ) { |
|
115 | + public function filter_plugin_actions($links, $plugin) { |
|
116 | 116 | // set $main_file in stone |
117 | 117 | static $main_file; |
118 | 118 | // if $main_file is not set yet |
119 | - if ( ! $main_file ) { |
|
120 | - $main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE ); |
|
119 | + if ( ! $main_file) { |
|
120 | + $main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE); |
|
121 | 121 | } |
122 | - if ( $plugin === $main_file ) { |
|
122 | + if ($plugin === $main_file) { |
|
123 | 123 | // compare current plugin to this one |
124 | - if ( EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
125 | - $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>'; |
|
126 | - array_unshift( $links, $maintenance_link ); |
|
124 | + if (EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
125 | + $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>'; |
|
126 | + array_unshift($links, $maintenance_link); |
|
127 | 127 | } else { |
128 | - $org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>'; |
|
129 | - $events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>'; |
|
128 | + $org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>'; |
|
129 | + $events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>'; |
|
130 | 130 | // add before other links |
131 | - array_unshift( $links, $org_settings_link, $events_link ); |
|
131 | + array_unshift($links, $org_settings_link, $events_link); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | return $links; |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | * @return void |
144 | 144 | */ |
145 | 145 | public function get_request() { |
146 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
147 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
146 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
147 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | * @param array $admin_page_folder_names |
157 | 157 | * @return array |
158 | 158 | */ |
159 | - public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){ |
|
159 | + public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) { |
|
160 | 160 | return array( |
161 | - 'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS, |
|
162 | - 'about' => EE_ADMIN_PAGES . 'about' . DS, |
|
163 | - 'support' => EE_ADMIN_PAGES . 'support' . DS |
|
161 | + 'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS, |
|
162 | + 'about' => EE_ADMIN_PAGES.'about'.DS, |
|
163 | + 'support' => EE_ADMIN_PAGES.'support'.DS |
|
164 | 164 | ); |
165 | 165 | } |
166 | 166 | |
@@ -174,31 +174,31 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function init() { |
176 | 176 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
177 | - if ( EE_Maintenance_Mode::instance()->level() !== EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
177 | + if (EE_Maintenance_Mode::instance()->level() !== EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
178 | 178 | //ok so we want to enable the entire admin |
179 | - add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' )); |
|
180 | - add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
181 | - add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
179 | + add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback')); |
|
180 | + add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
181 | + add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
182 | 182 | //at a glance dashboard widget |
183 | - add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items' ), 10 ); |
|
183 | + add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10); |
|
184 | 184 | //filter for get_edit_post_link used on comments for custom post types |
185 | - add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 2 ); |
|
185 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 2); |
|
186 | 186 | } |
187 | 187 | // run the admin page factory but ONLY if we are doing an ee admin ajax request |
188 | - if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) { |
|
188 | + if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) { |
|
189 | 189 | try { |
190 | 190 | //this loads the controller for the admin pages which will setup routing etc |
191 | - EE_Registry::instance()->load_core( 'Admin_Page_Loader' ); |
|
192 | - } catch ( EE_Error $e ) { |
|
191 | + EE_Registry::instance()->load_core('Admin_Page_Loader'); |
|
192 | + } catch (EE_Error $e) { |
|
193 | 193 | $e->get_error(); |
194 | 194 | } |
195 | 195 | } |
196 | - add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 ); |
|
196 | + add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1); |
|
197 | 197 | //make sure our CPTs and custom taxonomy metaboxes get shown for first time users |
198 | - add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 ); |
|
199 | - add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 ); |
|
198 | + add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10); |
|
199 | + add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10); |
|
200 | 200 | //exclude EE critical pages from all nav menus and wp_list_pages |
201 | - add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 ); |
|
201 | + add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | * @param object $post_type WP post type object |
212 | 212 | * @return object WP post type object |
213 | 213 | */ |
214 | - public function remove_pages_from_nav_menu( $post_type ) { |
|
214 | + public function remove_pages_from_nav_menu($post_type) { |
|
215 | 215 | //if this isn't the "pages" post type let's get out |
216 | - if ( $post_type->name !== 'page' ) { |
|
216 | + if ($post_type->name !== 'page') { |
|
217 | 217 | return $post_type; |
218 | 218 | } |
219 | 219 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
@@ -233,28 +233,28 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public function enable_hidden_ee_nav_menu_metaboxes() { |
235 | 235 | global $wp_meta_boxes, $pagenow; |
236 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) { |
|
236 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') { |
|
237 | 237 | return; |
238 | 238 | } |
239 | 239 | $user = wp_get_current_user(); |
240 | 240 | //has this been done yet? |
241 | - if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) { |
|
241 | + if (get_user_option('ee_nav_menu_initialized', $user->ID)) { |
|
242 | 242 | return; |
243 | 243 | } |
244 | 244 | |
245 | - $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID ); |
|
246 | - $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' ) ); |
|
245 | + $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID); |
|
246 | + $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')); |
|
247 | 247 | |
248 | - if ( is_array( $hidden_meta_boxes ) ) { |
|
249 | - foreach ( $hidden_meta_boxes as $key => $meta_box_id ) { |
|
250 | - if ( in_array( $meta_box_id, $initial_meta_boxes ) ) { |
|
251 | - unset( $hidden_meta_boxes[ $key ] ); |
|
248 | + if (is_array($hidden_meta_boxes)) { |
|
249 | + foreach ($hidden_meta_boxes as $key => $meta_box_id) { |
|
250 | + if (in_array($meta_box_id, $initial_meta_boxes)) { |
|
251 | + unset($hidden_meta_boxes[$key]); |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
257 | - update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true ); |
|
256 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
257 | + update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @return void |
274 | 274 | */ |
275 | 275 | public function register_custom_nav_menu_boxes() { |
276 | - add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' ); |
|
276 | + add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core'); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -289,17 +289,17 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @return string the (maybe) modified link |
291 | 291 | */ |
292 | - public function modify_edit_post_link( $link, $id ) { |
|
293 | - if ( ! $post = get_post( $id ) ){ |
|
292 | + public function modify_edit_post_link($link, $id) { |
|
293 | + if ( ! $post = get_post($id)) { |
|
294 | 294 | return $link; |
295 | 295 | } |
296 | - if ( $post->post_type === 'espresso_attendees' ) { |
|
296 | + if ($post->post_type === 'espresso_attendees') { |
|
297 | 297 | $query_args = array( |
298 | 298 | 'action' => 'edit_attendee', |
299 | 299 | 'post' => $id |
300 | 300 | ); |
301 | 301 | EE_Registry::instance()->load_helper('URL'); |
302 | - return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') ); |
|
302 | + return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations')); |
|
303 | 303 | } |
304 | 304 | return $link; |
305 | 305 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | global $nav_menu_selected_id; |
312 | 312 | |
313 | 313 | $db_fields = false; |
314 | - $walker = new Walker_Nav_Menu_Checklist( $db_fields ); |
|
314 | + $walker = new Walker_Nav_Menu_Checklist($db_fields); |
|
315 | 315 | $current_tab = 'event-archives'; |
316 | 316 | |
317 | 317 | /*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { |
@@ -330,9 +330,9 @@ discard block |
||
330 | 330 | ?> |
331 | 331 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
332 | 332 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
333 | - <li <?php echo ( 'event-archives' === $current_tab ? ' class="tabs"' : '' ); ?>> |
|
334 | - <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"> |
|
335 | - <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
|
333 | + <li <?php echo ('event-archives' === $current_tab ? ' class="tabs"' : ''); ?>> |
|
334 | + <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"> |
|
335 | + <?php _e('Event Archive Pages', 'event_espresso'); ?> |
|
336 | 336 | </a> |
337 | 337 | </li> |
338 | 338 | <?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs. |
@@ -350,13 +350,13 @@ discard block |
||
350 | 350 | <?php */ ?> |
351 | 351 | |
352 | 352 | <div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php |
353 | - echo ( 'event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); |
|
353 | + echo ('event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive'); |
|
354 | 354 | ?>"> |
355 | 355 | <ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear"> |
356 | 356 | <?php |
357 | 357 | $pages = $this->_get_extra_nav_menu_pages_items(); |
358 | 358 | $args['walker'] = $walker; |
359 | - echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args ); |
|
359 | + echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args); |
|
360 | 360 | ?> |
361 | 361 | </ul> |
362 | 362 | </div><!-- /.tabs-panel --> |
@@ -364,18 +364,18 @@ discard block |
||
364 | 364 | <p class="button-controls"> |
365 | 365 | <span class="list-controls"> |
366 | 366 | <a href="<?php |
367 | - echo esc_url( add_query_arg( |
|
367 | + echo esc_url(add_query_arg( |
|
368 | 368 | array( |
369 | 369 | 'extra-nav-menu-pages-tab' => 'event-archives', |
370 | 370 | 'selectall' => 1, |
371 | 371 | ), |
372 | - remove_query_arg( $removed_args ) |
|
372 | + remove_query_arg($removed_args) |
|
373 | 373 | )); |
374 | 374 | ?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a> |
375 | 375 | </span> |
376 | 376 | |
377 | 377 | <span class="add-to-menu"> |
378 | - <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' ); ?>" /> |
|
378 | + <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'); ?>" /> |
|
379 | 379 | <span class="spinner"></span> |
380 | 380 | </span> |
381 | 381 | </p> |
@@ -396,10 +396,10 @@ discard block |
||
396 | 396 | private function _get_extra_nav_menu_pages_items() { |
397 | 397 | $menuitems[] = array( |
398 | 398 | 'title' => __('Event List', 'event_espresso'), |
399 | - 'url' => get_post_type_archive_link( 'espresso_events' ), |
|
399 | + 'url' => get_post_type_archive_link('espresso_events'), |
|
400 | 400 | 'description' => __('Archive page for all events.', 'event_espresso') |
401 | 401 | ); |
402 | - return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems ); |
|
402 | + return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems); |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * @param $menu_item_values |
412 | 412 | * @return stdClass |
413 | 413 | */ |
414 | - private function _setup_extra_nav_menu_pages_items( $menu_item_values ) { |
|
414 | + private function _setup_extra_nav_menu_pages_items($menu_item_values) { |
|
415 | 415 | $menu_item = new stdClass(); |
416 | 416 | $keys = array( |
417 | 417 | 'ID' => 0, |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | 'xfn' => '' |
432 | 432 | ); |
433 | 433 | |
434 | - foreach ( $keys as $key => $value) { |
|
435 | - $menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value; |
|
434 | + foreach ($keys as $key => $value) { |
|
435 | + $menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value; |
|
436 | 436 | } |
437 | 437 | return $menu_item; |
438 | 438 | } |
@@ -471,9 +471,9 @@ discard block |
||
471 | 471 | * - check if doing post processing of one of EE CPTs |
472 | 472 | * - instantiate the corresponding EE CPT model for the post_type being processed. |
473 | 473 | */ |
474 | - if ( isset( $_POST['action'], $_POST['post_type'] ) && $_POST['action'] === 'editpost' ) { |
|
475 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
476 | - EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] ); |
|
474 | + if (isset($_POST['action'], $_POST['post_type']) && $_POST['action'] === 'editpost') { |
|
475 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
476 | + EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | |
@@ -482,8 +482,8 @@ discard block |
||
482 | 482 | * 'options-reading.php' core WordPress admin settings page. This is for user-proofing. |
483 | 483 | */ |
484 | 484 | global $pagenow; |
485 | - if ( $pagenow === 'options-reading.php' ) { |
|
486 | - add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) ); |
|
485 | + if ($pagenow === 'options-reading.php') { |
|
486 | + add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages')); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | } |
@@ -495,25 +495,25 @@ discard block |
||
495 | 495 | * @param string $output Current output. |
496 | 496 | * @return string |
497 | 497 | */ |
498 | - public function modify_dropdown_pages( $output ) { |
|
498 | + public function modify_dropdown_pages($output) { |
|
499 | 499 | //get critical pages |
500 | 500 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
501 | 501 | |
502 | 502 | //split current output by line break for easier parsing. |
503 | - $split_output = explode( "\n", $output ); |
|
503 | + $split_output = explode("\n", $output); |
|
504 | 504 | |
505 | 505 | //loop through to remove any critical pages from the array. |
506 | - foreach ( $critical_pages as $page_id ) { |
|
507 | - $needle = 'value="' . $page_id . '"'; |
|
508 | - foreach( $split_output as $key => $haystack ) { |
|
509 | - if( strpos( $haystack, $needle ) !== false ) { |
|
510 | - unset( $split_output[$key] ); |
|
506 | + foreach ($critical_pages as $page_id) { |
|
507 | + $needle = 'value="'.$page_id.'"'; |
|
508 | + foreach ($split_output as $key => $haystack) { |
|
509 | + if (strpos($haystack, $needle) !== false) { |
|
510 | + unset($split_output[$key]); |
|
511 | 511 | } |
512 | 512 | } |
513 | 513 | } |
514 | 514 | |
515 | 515 | //replace output with the new contents |
516 | - return implode( "\n", $split_output ); |
|
516 | + return implode("\n", $split_output); |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | |
@@ -527,37 +527,37 @@ discard block |
||
527 | 527 | public function enqueue_admin_scripts() { |
528 | 528 | // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js. |
529 | 529 | // Note: the intention of this script is to only do TARGETED injections. I.E, only injecting on certain script calls. |
530 | - wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
530 | + wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
531 | 531 | // register cookie script for future dependencies |
532 | - wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE ); |
|
532 | + wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE); |
|
533 | 533 | // 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' ); |
534 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
534 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
535 | 535 | // register jQuery Validate |
536 | - wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
536 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
537 | 537 | } |
538 | 538 | //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' ); |
539 | - if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) { |
|
539 | + if (apply_filters('FHEE_load_joyride', FALSE)) { |
|
540 | 540 | //joyride style |
541 | - wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1'); |
|
542 | - wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION ); |
|
543 | - wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE ); |
|
541 | + wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1'); |
|
542 | + wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION); |
|
543 | + wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE); |
|
544 | 544 | //joyride JS |
545 | - wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE ); |
|
545 | + wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE); |
|
546 | 546 | // wanna go for a joyride? |
547 | 547 | wp_enqueue_style('ee-joyride-css'); |
548 | 548 | wp_enqueue_script('jquery-joyride'); |
549 | 549 | } |
550 | 550 | //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' ); |
551 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
551 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
552 | 552 | EE_Registry::instance()->load_helper('Qtip_Loader'); |
553 | 553 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
554 | 554 | } |
555 | 555 | //accounting.js library |
556 | 556 | // @link http://josscrowcroft.github.io/accounting.js/ |
557 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
558 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
559 | - wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE ); |
|
560 | - wp_enqueue_script( 'ee-accounting' ); |
|
557 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
558 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
559 | + wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE); |
|
560 | + wp_enqueue_script('ee-accounting'); |
|
561 | 561 | // array of settings to get converted to JSON array via wp_localize_script |
562 | 562 | $currency_config = array( |
563 | 563 | 'currency' => array( |
@@ -604,11 +604,11 @@ discard block |
||
604 | 604 | public function get_persistent_admin_notices() { |
605 | 605 | // http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30 |
606 | 606 | $args = array( |
607 | - 'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '', |
|
608 | - 'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '', |
|
607 | + 'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '', |
|
608 | + 'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '', |
|
609 | 609 | ); |
610 | - $return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL ); |
|
611 | - echo EE_Error::get_persistent_admin_notices( $return_url ); |
|
610 | + $return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL); |
|
611 | + echo EE_Error::get_persistent_admin_notices($return_url); |
|
612 | 612 | } |
613 | 613 | |
614 | 614 | |
@@ -629,26 +629,26 @@ discard block |
||
629 | 629 | * @param $elements |
630 | 630 | * @return array |
631 | 631 | */ |
632 | - public function dashboard_glance_items( $elements ) { |
|
632 | + public function dashboard_glance_items($elements) { |
|
633 | 633 | $events = EEM_Event::instance()->count(); |
634 | - $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') ); |
|
635 | - $items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) ); |
|
634 | + $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php')); |
|
635 | + $items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events)); |
|
636 | 636 | $items['events']['title'] = __('Click to view all Events', 'event_espresso'); |
637 | 637 | $registrations = EEM_Registration::instance()->count( |
638 | 638 | array( |
639 | 639 | array( |
640 | - 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) |
|
640 | + 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete) |
|
641 | 641 | ) |
642 | 642 | ) |
643 | 643 | ); |
644 | - $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') ); |
|
645 | - $items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) ); |
|
644 | + $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php')); |
|
645 | + $items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations)); |
|
646 | 646 | $items['registrations']['title'] = __('Click to view all registrations', 'event_espresso'); |
647 | 647 | |
648 | - $items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items ); |
|
648 | + $items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items); |
|
649 | 649 | |
650 | - foreach ( $items as $type => $item_properties ) { |
|
651 | - $elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] ); |
|
650 | + foreach ($items as $type => $item_properties) { |
|
651 | + $elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']); |
|
652 | 652 | } |
653 | 653 | return $elements; |
654 | 654 | } |
@@ -665,32 +665,32 @@ discard block |
||
665 | 665 | * @throws EE_Error |
666 | 666 | * @return string |
667 | 667 | */ |
668 | - public function check_for_invalid_datetime_formats( $value, $option ) { |
|
669 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
668 | + public function check_for_invalid_datetime_formats($value, $option) { |
|
669 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
670 | 670 | // check for date_format or time_format |
671 | - switch ( $option ) { |
|
671 | + switch ($option) { |
|
672 | 672 | case 'date_format' : |
673 | - $date_time_format = $value . ' ' . get_option('time_format'); |
|
673 | + $date_time_format = $value.' '.get_option('time_format'); |
|
674 | 674 | break; |
675 | 675 | case 'time_format' : |
676 | - $date_time_format = get_option('date_format') . ' ' . $value; |
|
676 | + $date_time_format = get_option('date_format').' '.$value; |
|
677 | 677 | break; |
678 | 678 | default : |
679 | 679 | $date_time_format = FALSE; |
680 | 680 | } |
681 | 681 | // do we have a date_time format to check ? |
682 | - if ( $date_time_format ) { |
|
683 | - $error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format ); |
|
682 | + if ($date_time_format) { |
|
683 | + $error_msg = EEH_DTT_Helper::validate_format_string($date_time_format); |
|
684 | 684 | |
685 | - if ( is_array( $error_msg ) ) { |
|
686 | - $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>'; |
|
685 | + if (is_array($error_msg)) { |
|
686 | + $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>'; |
|
687 | 687 | |
688 | 688 | |
689 | - foreach ( $error_msg as $error ) { |
|
690 | - $msg .= '<li>' . $error . '</li>'; |
|
689 | + foreach ($error_msg as $error) { |
|
690 | + $msg .= '<li>'.$error.'</li>'; |
|
691 | 691 | } |
692 | 692 | |
693 | - $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>'; |
|
693 | + $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>'; |
|
694 | 694 | |
695 | 695 | // trigger WP settings error |
696 | 696 | add_settings_error( |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | ); |
701 | 701 | |
702 | 702 | // set format to something valid |
703 | - switch ( $option ) { |
|
703 | + switch ($option) { |
|
704 | 704 | case 'date_format' : |
705 | 705 | $value = 'F j, Y'; |
706 | 706 | break; |
@@ -722,8 +722,8 @@ discard block |
||
722 | 722 | * @param $content |
723 | 723 | * @return string |
724 | 724 | */ |
725 | - public function its_eSpresso( $content ) { |
|
726 | - return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content ); |
|
725 | + public function its_eSpresso($content) { |
|
726 | + return str_replace('[EXPRESSO_', '[ESPRESSO_', $content); |
|
727 | 727 | } |
728 | 728 | |
729 | 729 | |
@@ -736,9 +736,9 @@ discard block |
||
736 | 736 | */ |
737 | 737 | public function espresso_admin_footer() { |
738 | 738 | return sprintf( |
739 | - __( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ), |
|
739 | + __('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'), |
|
740 | 740 | '<a href="https://eventespresso.com/" title="', |
741 | - '">' . EVENT_ESPRESSO_POWERED_BY . '</a>' |
|
741 | + '">'.EVENT_ESPRESSO_POWERED_BY.'</a>' |
|
742 | 742 | ); |
743 | 743 | } |
744 | 744 | |
@@ -758,12 +758,12 @@ discard block |
||
758 | 758 | * @param array $config |
759 | 759 | * @return void |
760 | 760 | */ |
761 | - public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
|
762 | - 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' ); |
|
763 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) { |
|
761 | + public static function register_ee_admin_page($page_basename, $page_path, $config = array()) { |
|
762 | + 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'); |
|
763 | + if (class_exists('EE_Register_Admin_Page')) { |
|
764 | 764 | $config['page_path'] = $page_path; |
765 | 765 | } |
766 | - EE_Register_Admin_Page::register( $page_basename, $config ); |
|
766 | + EE_Register_Admin_Page::register($page_basename, $config); |
|
767 | 767 | |
768 | 768 | } |
769 | 769 | |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | * @param \WP_Post $post |
777 | 777 | * @return void |
778 | 778 | */ |
779 | - public static function parse_post_content_on_save( $post_ID, $post ) { |
|
779 | + public static function parse_post_content_on_save($post_ID, $post) { |
|
780 | 780 | EE_Error::doing_it_wrong( |
781 | 781 | __METHOD__, |
782 | 782 | __( |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | ), |
786 | 786 | '4.8.41' |
787 | 787 | ); |
788 | - EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $post_ID, $post ); |
|
788 | + EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($post_ID, $post); |
|
789 | 789 | } |
790 | 790 | |
791 | 791 | |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | * @param $value |
799 | 799 | * @return void |
800 | 800 | */ |
801 | - public function reset_page_for_posts_on_change( $option, $old_value, $value ) { |
|
801 | + public function reset_page_for_posts_on_change($option, $old_value, $value) { |
|
802 | 802 | EE_Error::doing_it_wrong( |
803 | 803 | __METHOD__, |
804 | 804 | __( |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | ), |
808 | 808 | '4.8.41' |
809 | 809 | ); |
810 | - EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change( $option, $old_value, $value ); |
|
810 | + EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change($option, $old_value, $value); |
|
811 | 811 | } |
812 | 812 | |
813 | 813 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public static function instance() { |
123 | 123 | // check if class object is instantiated, and instantiated properly |
124 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
124 | + if ( ! self::$_instance instanceof EE_Config) { |
|
125 | 125 | self::$_instance = new self(); |
126 | 126 | } |
127 | 127 | return self::$_instance; |
@@ -141,20 +141,20 @@ discard block |
||
141 | 141 | * site was put into maintenance mode) |
142 | 142 | * @return EE_Config |
143 | 143 | */ |
144 | - public static function reset( $hard_reset = false, $reinstantiate = true ) { |
|
145 | - if ( $hard_reset ) { |
|
144 | + public static function reset($hard_reset = false, $reinstantiate = true) { |
|
145 | + if ($hard_reset) { |
|
146 | 146 | self::$_instance->_addon_option_names = array(); |
147 | 147 | self::$_instance->_initialize_config(); |
148 | 148 | self::$_instance->update_espresso_config(); |
149 | 149 | } |
150 | - if ( self::$_instance instanceof EE_Config ) { |
|
150 | + if (self::$_instance instanceof EE_Config) { |
|
151 | 151 | self::$_instance->update_addon_option_names(); |
152 | 152 | } |
153 | 153 | self::$_instance = null; |
154 | 154 | //we don't need to reset the static properties imo because those should |
155 | 155 | //only change when a module is added or removed. Currently we don't |
156 | 156 | //support removing a module during a request when it previously existed |
157 | - if ( $reinstantiate ) { |
|
157 | + if ($reinstantiate) { |
|
158 | 158 | return self::instance(); |
159 | 159 | } else { |
160 | 160 | return null; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @return \EE_Config |
171 | 171 | */ |
172 | 172 | private function __construct() { |
173 | - do_action( 'AHEE__EE_Config__construct__begin', $this ); |
|
173 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
174 | 174 | // setup empty config classes |
175 | 175 | $this->_initialize_config(); |
176 | 176 | // load existing EE site settings |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | // register shortcodes and modules |
181 | 181 | add_action( |
182 | 182 | 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
183 | - array( $this, 'register_shortcodes_and_modules' ), |
|
183 | + array($this, 'register_shortcodes_and_modules'), |
|
184 | 184 | 999 |
185 | 185 | ); |
186 | 186 | // initialize shortcodes and modules |
187 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) ); |
|
187 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
188 | 188 | // register widgets |
189 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
189 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
190 | 190 | // shutdown |
191 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
191 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
192 | 192 | // construct__end hook |
193 | - do_action( 'AHEE__EE_Config__construct__end', $this ); |
|
193 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
194 | 194 | // hardcoded hack |
195 | 195 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
196 | 196 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return string current theme set. |
204 | 204 | */ |
205 | 205 | public static function get_current_theme() { |
206 | - return isset( self::$_instance->template_settings->current_espresso_theme ) |
|
206 | + return isset(self::$_instance->template_settings->current_espresso_theme) |
|
207 | 207 | ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
208 | 208 | } |
209 | 209 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | private function _initialize_config() { |
219 | 219 | EE_Config::trim_log(); |
220 | 220 | //set defaults |
221 | - $this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() ); |
|
221 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
222 | 222 | $this->addons = new stdClass(); |
223 | 223 | // set _module_route_map |
224 | 224 | EE_Config::$_module_route_map = array(); |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | */ |
239 | 239 | private function _load_core_config() { |
240 | 240 | // load_core_config__start hook |
241 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
241 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
242 | 242 | $espresso_config = $this->get_espresso_config(); |
243 | - foreach ( $espresso_config as $config => $settings ) { |
|
243 | + foreach ($espresso_config as $config => $settings) { |
|
244 | 244 | // load_core_config__start hook |
245 | 245 | $settings = apply_filters( |
246 | 246 | 'FHEE__EE_Config___load_core_config__config_settings', |
@@ -248,22 +248,22 @@ discard block |
||
248 | 248 | $config, |
249 | 249 | $this |
250 | 250 | ); |
251 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
252 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
251 | + if (is_object($settings) && property_exists($this, $config)) { |
|
252 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
253 | 253 | //call configs populate method to ensure any defaults are set for empty values. |
254 | - if ( method_exists( $settings, 'populate' ) ) { |
|
254 | + if (method_exists($settings, 'populate')) { |
|
255 | 255 | $this->{$config}->populate(); |
256 | 256 | } |
257 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
257 | + if (method_exists($settings, 'do_hooks')) { |
|
258 | 258 | $this->{$config}->do_hooks(); |
259 | 259 | } |
260 | 260 | } |
261 | 261 | } |
262 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) { |
|
262 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
263 | 263 | $this->update_espresso_config(); |
264 | 264 | } |
265 | 265 | // load_core_config__end hook |
266 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
266 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -278,23 +278,23 @@ discard block |
||
278 | 278 | $this->core = $this->core instanceof EE_Core_Config |
279 | 279 | ? $this->core |
280 | 280 | : new EE_Core_Config(); |
281 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
281 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
282 | 282 | $this->organization = $this->organization instanceof EE_Organization_Config |
283 | 283 | ? $this->organization |
284 | 284 | : new EE_Organization_Config(); |
285 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
285 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
286 | 286 | $this->currency = $this->currency instanceof EE_Currency_Config |
287 | 287 | ? $this->currency |
288 | 288 | : new EE_Currency_Config(); |
289 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
289 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
290 | 290 | $this->registration = $this->registration instanceof EE_Registration_Config |
291 | 291 | ? $this->registration |
292 | 292 | : new EE_Registration_Config(); |
293 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
293 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
294 | 294 | $this->admin = $this->admin instanceof EE_Admin_Config |
295 | 295 | ? $this->admin |
296 | 296 | : new EE_Admin_Config(); |
297 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
297 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
298 | 298 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
299 | 299 | ? $this->template_settings |
300 | 300 | : new EE_Template_Config(); |
@@ -305,15 +305,15 @@ discard block |
||
305 | 305 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
306 | 306 | ? $this->map_settings |
307 | 307 | : new EE_Map_Config(); |
308 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
308 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
309 | 309 | $this->environment = $this->environment instanceof EE_Environment_Config |
310 | 310 | ? $this->environment |
311 | 311 | : new EE_Environment_Config(); |
312 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
312 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
313 | 313 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
314 | 314 | ? $this->gateway |
315 | 315 | : new EE_Gateway_Config(); |
316 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
316 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | // grab espresso configuration |
329 | 329 | return apply_filters( |
330 | 330 | 'FHEE__EE_Config__get_espresso_config__CFG', |
331 | - get_option( EE_Config::OPTION_NAME, array() ) |
|
331 | + get_option(EE_Config::OPTION_NAME, array()) |
|
332 | 332 | ); |
333 | 333 | } |
334 | 334 | |
@@ -342,12 +342,12 @@ discard block |
||
342 | 342 | * @param $old_value |
343 | 343 | * @param $value |
344 | 344 | */ |
345 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
345 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
346 | 346 | // make sure we're checking the ee config |
347 | - if ( $option === EE_Config::OPTION_NAME ) { |
|
347 | + if ($option === EE_Config::OPTION_NAME) { |
|
348 | 348 | // run a loose comparison of the old value against the new value for type and properties, |
349 | 349 | // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
350 | - if ( $value != $old_value ) { |
|
350 | + if ($value != $old_value) { |
|
351 | 351 | // if they are NOT the same, then remove the hook, |
352 | 352 | // which means the subsequent update results will be based solely on the update query results |
353 | 353 | // the reason we do this is because, as stated above, |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | // the string it sees in the db looks the same as the new one it has been passed!!! |
363 | 363 | // This results in the query returning an "affected rows" value of ZERO, |
364 | 364 | // which gets returned immediately by WP update_option and looks like an error. |
365 | - remove_action( 'update_option', array( $this, 'check_config_updated' ) ); |
|
365 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
366 | 366 | } |
367 | 367 | } |
368 | 368 | } |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | */ |
378 | 378 | protected function _reset_espresso_addon_config() { |
379 | 379 | $this->_addon_option_names = array(); |
380 | - foreach ( $this->addons as $addon_name => $addon_config_obj ) { |
|
381 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
382 | - $config_class = get_class( $addon_config_obj ); |
|
383 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
384 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, false ); |
|
380 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
381 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
382 | + $config_class = get_class($addon_config_obj); |
|
383 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
384 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
385 | 385 | } |
386 | 386 | $this->addons->{$addon_name} = null; |
387 | 387 | } |
@@ -397,18 +397,18 @@ discard block |
||
397 | 397 | * @param bool $add_error |
398 | 398 | * @return bool |
399 | 399 | */ |
400 | - public function update_espresso_config( $add_success = false, $add_error = true ) { |
|
400 | + public function update_espresso_config($add_success = false, $add_error = true) { |
|
401 | 401 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
402 | 402 | //$clone = clone( self::$_instance ); |
403 | 403 | //self::$_instance = NULL; |
404 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this ); |
|
404 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
405 | 405 | $this->_reset_espresso_addon_config(); |
406 | 406 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
407 | 407 | // but BEFORE the actual update occurs |
408 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
408 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
409 | 409 | // now update "ee_config" |
410 | - $saved = update_option( EE_Config::OPTION_NAME, $this ); |
|
411 | - EE_Config::log( EE_Config::OPTION_NAME ); |
|
410 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
411 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
412 | 412 | // if not saved... check if the hook we just added still exists; |
413 | 413 | // if it does, it means one of two things: |
414 | 414 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -419,17 +419,17 @@ discard block |
||
419 | 419 | // but just means no update occurred, so don't display an error to the user. |
420 | 420 | // BUT... if update_option returns FALSE, AND the hook is missing, |
421 | 421 | // then it means that something truly went wrong |
422 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved; |
|
422 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
423 | 423 | // remove our action since we don't want it in the system anymore |
424 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
425 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
424 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
425 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
426 | 426 | //self::$_instance = $clone; |
427 | 427 | //unset( $clone ); |
428 | 428 | // if config remains the same or was updated successfully |
429 | - if ( $saved ) { |
|
430 | - if ( $add_success ) { |
|
429 | + if ($saved) { |
|
430 | + if ($add_success) { |
|
431 | 431 | EE_Error::add_success( |
432 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
432 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
433 | 433 | __FILE__, |
434 | 434 | __FUNCTION__, |
435 | 435 | __LINE__ |
@@ -437,9 +437,9 @@ discard block |
||
437 | 437 | } |
438 | 438 | return true; |
439 | 439 | } else { |
440 | - if ( $add_error ) { |
|
440 | + if ($add_error) { |
|
441 | 441 | EE_Error::add_error( |
442 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
442 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
443 | 443 | __FILE__, |
444 | 444 | __FUNCTION__, |
445 | 445 | __LINE__ |
@@ -468,16 +468,16 @@ discard block |
||
468 | 468 | $name = '', |
469 | 469 | $config_class = '', |
470 | 470 | $config_obj = null, |
471 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
471 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
472 | 472 | $display_errors = true |
473 | 473 | ) { |
474 | 474 | try { |
475 | - foreach ( $tests_to_run as $test ) { |
|
476 | - switch ( $test ) { |
|
475 | + foreach ($tests_to_run as $test) { |
|
476 | + switch ($test) { |
|
477 | 477 | // TEST #1 : check that section was set |
478 | 478 | case 1 : |
479 | - if ( empty( $section ) ) { |
|
480 | - if ( $display_errors ) { |
|
479 | + if (empty($section)) { |
|
480 | + if ($display_errors) { |
|
481 | 481 | throw new EE_Error( |
482 | 482 | sprintf( |
483 | 483 | __( |
@@ -493,11 +493,11 @@ discard block |
||
493 | 493 | break; |
494 | 494 | // TEST #2 : check that settings section exists |
495 | 495 | case 2 : |
496 | - if ( ! isset( $this->{$section} ) ) { |
|
497 | - if ( $display_errors ) { |
|
496 | + if ( ! isset($this->{$section} )) { |
|
497 | + if ($display_errors) { |
|
498 | 498 | throw new EE_Error( |
499 | 499 | sprintf( |
500 | - __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
500 | + __('The "%s" configuration section does not exist.', 'event_espresso'), |
|
501 | 501 | $section |
502 | 502 | ) |
503 | 503 | ); |
@@ -508,9 +508,9 @@ discard block |
||
508 | 508 | // TEST #3 : check that section is the proper format |
509 | 509 | case 3 : |
510 | 510 | if ( |
511 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
511 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
512 | 512 | ) { |
513 | - if ( $display_errors ) { |
|
513 | + if ($display_errors) { |
|
514 | 514 | throw new EE_Error( |
515 | 515 | sprintf( |
516 | 516 | __( |
@@ -526,8 +526,8 @@ discard block |
||
526 | 526 | break; |
527 | 527 | // TEST #4 : check that config section name has been set |
528 | 528 | case 4 : |
529 | - if ( empty( $name ) ) { |
|
530 | - if ( $display_errors ) { |
|
529 | + if (empty($name)) { |
|
530 | + if ($display_errors) { |
|
531 | 531 | throw new EE_Error( |
532 | 532 | __( |
533 | 533 | 'No name has been provided for the specific configuration section.', |
@@ -540,8 +540,8 @@ discard block |
||
540 | 540 | break; |
541 | 541 | // TEST #5 : check that a config class name has been set |
542 | 542 | case 5 : |
543 | - if ( empty( $config_class ) ) { |
|
544 | - if ( $display_errors ) { |
|
543 | + if (empty($config_class)) { |
|
544 | + if ($display_errors) { |
|
545 | 545 | throw new EE_Error( |
546 | 546 | __( |
547 | 547 | 'No class name has been provided for the specific configuration section.', |
@@ -554,8 +554,8 @@ discard block |
||
554 | 554 | break; |
555 | 555 | // TEST #6 : verify config class is accessible |
556 | 556 | case 6 : |
557 | - if ( ! class_exists( $config_class ) ) { |
|
558 | - if ( $display_errors ) { |
|
557 | + if ( ! class_exists($config_class)) { |
|
558 | + if ($display_errors) { |
|
559 | 559 | throw new EE_Error( |
560 | 560 | sprintf( |
561 | 561 | __( |
@@ -571,11 +571,11 @@ discard block |
||
571 | 571 | break; |
572 | 572 | // TEST #7 : check that config has even been set |
573 | 573 | case 7 : |
574 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
575 | - if ( $display_errors ) { |
|
574 | + if ( ! isset($this->{$section}->{$name} )) { |
|
575 | + if ($display_errors) { |
|
576 | 576 | throw new EE_Error( |
577 | 577 | sprintf( |
578 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
578 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
579 | 579 | $section, |
580 | 580 | $name |
581 | 581 | ) |
@@ -584,13 +584,13 @@ discard block |
||
584 | 584 | return false; |
585 | 585 | } else { |
586 | 586 | // and make sure it's not serialized |
587 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
587 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
588 | 588 | } |
589 | 589 | break; |
590 | 590 | // TEST #8 : check that config is the requested type |
591 | 591 | case 8 : |
592 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
593 | - if ( $display_errors ) { |
|
592 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
593 | + if ($display_errors) { |
|
594 | 594 | throw new EE_Error( |
595 | 595 | sprintf( |
596 | 596 | __( |
@@ -608,12 +608,12 @@ discard block |
||
608 | 608 | break; |
609 | 609 | // TEST #9 : verify config object |
610 | 610 | case 9 : |
611 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
612 | - if ( $display_errors ) { |
|
611 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
612 | + if ($display_errors) { |
|
613 | 613 | throw new EE_Error( |
614 | 614 | sprintf( |
615 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
616 | - print_r( $config_obj, true ) |
|
615 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
616 | + print_r($config_obj, true) |
|
617 | 617 | ) |
618 | 618 | ); |
619 | 619 | } |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | break; |
623 | 623 | } |
624 | 624 | } |
625 | - } catch ( EE_Error $e ) { |
|
625 | + } catch (EE_Error $e) { |
|
626 | 626 | $e->get_error(); |
627 | 627 | } |
628 | 628 | // you have successfully run the gauntlet |
@@ -639,8 +639,8 @@ discard block |
||
639 | 639 | * @param string $name |
640 | 640 | * @return string |
641 | 641 | */ |
642 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
643 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
642 | + private function _generate_config_option_name($section = '', $name = '') { |
|
643 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | |
@@ -654,10 +654,10 @@ discard block |
||
654 | 654 | * @param string $name |
655 | 655 | * @return string |
656 | 656 | */ |
657 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
658 | - return ! empty( $config_class ) |
|
657 | + private function _set_config_class($config_class = '', $name = '') { |
|
658 | + return ! empty($config_class) |
|
659 | 659 | ? $config_class |
660 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
660 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
661 | 661 | } |
662 | 662 | |
663 | 663 | |
@@ -672,36 +672,36 @@ discard block |
||
672 | 672 | * @param EE_Config_Base $config_obj |
673 | 673 | * @return EE_Config_Base |
674 | 674 | */ |
675 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
675 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
676 | 676 | // ensure config class is set to something |
677 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
677 | + $config_class = $this->_set_config_class($config_class, $name); |
|
678 | 678 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
679 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
679 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
680 | 680 | return null; |
681 | 681 | } |
682 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
682 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
683 | 683 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
684 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
685 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
684 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
685 | + $this->_addon_option_names[$config_option_name] = $config_class; |
|
686 | 686 | $this->update_addon_option_names(); |
687 | 687 | } |
688 | 688 | // verify the incoming config object but suppress errors |
689 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
689 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
690 | 690 | $config_obj = new $config_class(); |
691 | 691 | } |
692 | - if ( get_option( $config_option_name ) ) { |
|
693 | - EE_Config::log( $config_option_name ); |
|
694 | - update_option( $config_option_name, $config_obj ); |
|
692 | + if (get_option($config_option_name)) { |
|
693 | + EE_Config::log($config_option_name); |
|
694 | + update_option($config_option_name, $config_obj); |
|
695 | 695 | $this->{$section}->{$name} = $config_obj; |
696 | 696 | return $this->{$section}->{$name}; |
697 | 697 | } else { |
698 | 698 | // create a wp-option for this config |
699 | - if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) { |
|
700 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
699 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
700 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
701 | 701 | return $this->{$section}->{$name}; |
702 | 702 | } else { |
703 | 703 | EE_Error::add_error( |
704 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
704 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
705 | 705 | __FILE__, |
706 | 706 | __FUNCTION__, |
707 | 707 | __LINE__ |
@@ -724,40 +724,40 @@ discard block |
||
724 | 724 | * @param bool $throw_errors |
725 | 725 | * @return bool |
726 | 726 | */ |
727 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
728 | - $config_obj = maybe_unserialize( $config_obj ); |
|
727 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
728 | + $config_obj = maybe_unserialize($config_obj); |
|
729 | 729 | // get class name of the incoming object |
730 | - $config_class = get_class( $config_obj ); |
|
730 | + $config_class = get_class($config_obj); |
|
731 | 731 | // run tests 1-5 and 9 to verify config |
732 | 732 | if ( ! $this->_verify_config_params( |
733 | 733 | $section, |
734 | 734 | $name, |
735 | 735 | $config_class, |
736 | 736 | $config_obj, |
737 | - array( 1, 2, 3, 4, 7, 9 ) |
|
737 | + array(1, 2, 3, 4, 7, 9) |
|
738 | 738 | ) |
739 | 739 | ) { |
740 | 740 | return false; |
741 | 741 | } |
742 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
742 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
743 | 743 | // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
744 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
744 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
745 | 745 | // save new config to db |
746 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
746 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
747 | 747 | } else { |
748 | 748 | // first check if the record already exists |
749 | - $existing_config = get_option( $config_option_name ); |
|
750 | - $config_obj = serialize( $config_obj ); |
|
749 | + $existing_config = get_option($config_option_name); |
|
750 | + $config_obj = serialize($config_obj); |
|
751 | 751 | // just return if db record is already up to date (NOT type safe comparison) |
752 | - if ( $existing_config == $config_obj ) { |
|
752 | + if ($existing_config == $config_obj) { |
|
753 | 753 | $this->{$section}->{$name} = $config_obj; |
754 | 754 | return true; |
755 | - } else if ( update_option( $config_option_name, $config_obj ) ) { |
|
756 | - EE_Config::log( $config_option_name ); |
|
755 | + } else if (update_option($config_option_name, $config_obj)) { |
|
756 | + EE_Config::log($config_option_name); |
|
757 | 757 | // update wp-option for this config class |
758 | 758 | $this->{$section}->{$name} = $config_obj; |
759 | 759 | return true; |
760 | - } elseif ( $throw_errors ) { |
|
760 | + } elseif ($throw_errors) { |
|
761 | 761 | EE_Error::add_error( |
762 | 762 | sprintf( |
763 | 763 | __( |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | 'event_espresso' |
766 | 766 | ), |
767 | 767 | $config_class, |
768 | - 'EE_Config->' . $section . '->' . $name |
|
768 | + 'EE_Config->'.$section.'->'.$name |
|
769 | 769 | ), |
770 | 770 | __FILE__, |
771 | 771 | __FUNCTION__, |
@@ -787,34 +787,34 @@ discard block |
||
787 | 787 | * @param string $config_class |
788 | 788 | * @return mixed EE_Config_Base | NULL |
789 | 789 | */ |
790 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
790 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
791 | 791 | // ensure config class is set to something |
792 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
792 | + $config_class = $this->_set_config_class($config_class, $name); |
|
793 | 793 | // run tests 1-4, 6 and 7 to verify that all params have been set |
794 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
794 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
795 | 795 | return null; |
796 | 796 | } |
797 | 797 | // now test if the requested config object exists, but suppress errors |
798 | - if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) { |
|
798 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
799 | 799 | // config already exists, so pass it back |
800 | 800 | return $this->{$section}->{$name}; |
801 | 801 | } |
802 | 802 | // load config option from db if it exists |
803 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) ); |
|
803 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
804 | 804 | // verify the newly retrieved config object, but suppress errors |
805 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
805 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
806 | 806 | // config is good, so set it and pass it back |
807 | 807 | $this->{$section}->{$name} = $config_obj; |
808 | 808 | return $this->{$section}->{$name}; |
809 | 809 | } |
810 | 810 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
811 | - $config_obj = $this->set_config( $section, $name, $config_class ); |
|
811 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
812 | 812 | // verify the newly created config object |
813 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) { |
|
813 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
814 | 814 | return $this->{$section}->{$name}; |
815 | 815 | } else { |
816 | 816 | EE_Error::add_error( |
817 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
817 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
818 | 818 | __FILE__, |
819 | 819 | __FUNCTION__, |
820 | 820 | __LINE__ |
@@ -832,11 +832,11 @@ discard block |
||
832 | 832 | * @param string $config_option_name |
833 | 833 | * @return mixed EE_Config_Base | FALSE |
834 | 834 | */ |
835 | - public function get_config_option( $config_option_name = '' ) { |
|
835 | + public function get_config_option($config_option_name = '') { |
|
836 | 836 | // retrieve the wp-option for this config class. |
837 | - $config_option = maybe_unserialize( get_option( $config_option_name, array() ) ); |
|
838 | - if ( empty( $config_option ) ) { |
|
839 | - EE_Config::log( $config_option_name . '-NOT-FOUND' ); |
|
837 | + $config_option = maybe_unserialize(get_option($config_option_name, array())); |
|
838 | + if (empty($config_option)) { |
|
839 | + EE_Config::log($config_option_name.'-NOT-FOUND'); |
|
840 | 840 | } |
841 | 841 | return $config_option; |
842 | 842 | } |
@@ -848,17 +848,17 @@ discard block |
||
848 | 848 | * |
849 | 849 | * @param string $config_option_name |
850 | 850 | */ |
851 | - public static function log( $config_option_name = '' ) { |
|
852 | - if ( ! empty( $config_option_name ) ) { |
|
853 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
851 | + public static function log($config_option_name = '') { |
|
852 | + if ( ! empty($config_option_name)) { |
|
853 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
854 | 854 | //copy incoming $_REQUEST and sanitize it so we can save it |
855 | 855 | $_request = $_REQUEST; |
856 | - array_walk_recursive( $_request, 'sanitize_text_field' ); |
|
857 | - $config_log[ (string) microtime( true ) ] = array( |
|
856 | + array_walk_recursive($_request, 'sanitize_text_field'); |
|
857 | + $config_log[(string) microtime(true)] = array( |
|
858 | 858 | 'config_name' => $config_option_name, |
859 | 859 | 'request' => $_request, |
860 | 860 | ); |
861 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
861 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
862 | 862 | } |
863 | 863 | } |
864 | 864 | |
@@ -869,12 +869,12 @@ discard block |
||
869 | 869 | * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
870 | 870 | */ |
871 | 871 | public static function trim_log() { |
872 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
873 | - $log_length = count( $config_log ); |
|
874 | - if ( $log_length > EE_Config::LOG_LENGTH ) { |
|
875 | - ksort( $config_log ); |
|
876 | - $config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true ); |
|
877 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
872 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
873 | + $log_length = count($config_log); |
|
874 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
875 | + ksort($config_log); |
|
876 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
877 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
878 | 878 | } |
879 | 879 | } |
880 | 880 | |
@@ -889,14 +889,14 @@ discard block |
||
889 | 889 | * @return string |
890 | 890 | */ |
891 | 891 | public static function get_page_for_posts() { |
892 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
893 | - if ( ! $page_for_posts ) { |
|
892 | + $page_for_posts = get_option('page_for_posts'); |
|
893 | + if ( ! $page_for_posts) { |
|
894 | 894 | return 'posts'; |
895 | 895 | } |
896 | 896 | /** @type WPDB $wpdb */ |
897 | 897 | global $wpdb; |
898 | 898 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
899 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) ); |
|
899 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | |
@@ -952,17 +952,17 @@ discard block |
||
952 | 952 | ) |
953 | 953 | ) { |
954 | 954 | // grab list of installed widgets |
955 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
955 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
956 | 956 | // filter list of modules to register |
957 | 957 | $widgets_to_register = apply_filters( |
958 | 958 | 'FHEE__EE_Config__register_widgets__widgets_to_register', |
959 | 959 | $widgets_to_register |
960 | 960 | ); |
961 | - if ( ! empty( $widgets_to_register ) ) { |
|
961 | + if ( ! empty($widgets_to_register)) { |
|
962 | 962 | // cycle thru widget folders |
963 | - foreach ( $widgets_to_register as $widget_path ) { |
|
963 | + foreach ($widgets_to_register as $widget_path) { |
|
964 | 964 | // add to list of installed widget modules |
965 | - EE_Config::register_ee_widget( $widget_path ); |
|
965 | + EE_Config::register_ee_widget($widget_path); |
|
966 | 966 | } |
967 | 967 | } |
968 | 968 | // filter list of installed modules |
@@ -982,57 +982,57 @@ discard block |
||
982 | 982 | * @param string $widget_path - full path up to and including widget folder |
983 | 983 | * @return void |
984 | 984 | */ |
985 | - public static function register_ee_widget( $widget_path = null ) { |
|
986 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
985 | + public static function register_ee_widget($widget_path = null) { |
|
986 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
987 | 987 | $widget_ext = '.widget.php'; |
988 | 988 | // make all separators match |
989 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
989 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
990 | 990 | // does the file path INCLUDE the actual file name as part of the path ? |
991 | - if ( strpos( $widget_path, $widget_ext ) !== false ) { |
|
991 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
992 | 992 | // grab and shortcode file name from directory name and break apart at dots |
993 | - $file_name = explode( '.', basename( $widget_path ) ); |
|
993 | + $file_name = explode('.', basename($widget_path)); |
|
994 | 994 | // take first segment from file name pieces and remove class prefix if it exists |
995 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
995 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
996 | 996 | // sanitize shortcode directory name |
997 | - $widget = sanitize_key( $widget ); |
|
997 | + $widget = sanitize_key($widget); |
|
998 | 998 | // now we need to rebuild the shortcode path |
999 | - $widget_path = explode( DS, $widget_path ); |
|
999 | + $widget_path = explode(DS, $widget_path); |
|
1000 | 1000 | // remove last segment |
1001 | - array_pop( $widget_path ); |
|
1001 | + array_pop($widget_path); |
|
1002 | 1002 | // glue it back together |
1003 | - $widget_path = implode( DS, $widget_path ); |
|
1003 | + $widget_path = implode(DS, $widget_path); |
|
1004 | 1004 | } else { |
1005 | 1005 | // grab and sanitize widget directory name |
1006 | - $widget = sanitize_key( basename( $widget_path ) ); |
|
1006 | + $widget = sanitize_key(basename($widget_path)); |
|
1007 | 1007 | } |
1008 | 1008 | // create classname from widget directory name |
1009 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) ); |
|
1009 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1010 | 1010 | // add class prefix |
1011 | - $widget_class = 'EEW_' . $widget; |
|
1011 | + $widget_class = 'EEW_'.$widget; |
|
1012 | 1012 | // does the widget exist ? |
1013 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) { |
|
1013 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
1014 | 1014 | $msg = sprintf( |
1015 | 1015 | __( |
1016 | 1016 | 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', |
1017 | 1017 | 'event_espresso' |
1018 | 1018 | ), |
1019 | 1019 | $widget_class, |
1020 | - $widget_path . DS . $widget_class . $widget_ext |
|
1020 | + $widget_path.DS.$widget_class.$widget_ext |
|
1021 | 1021 | ); |
1022 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1022 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1023 | 1023 | return; |
1024 | 1024 | } |
1025 | 1025 | // load the widget class file |
1026 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
1026 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
1027 | 1027 | // verify that class exists |
1028 | - if ( ! class_exists( $widget_class ) ) { |
|
1029 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
1030 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1028 | + if ( ! class_exists($widget_class)) { |
|
1029 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1030 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1031 | 1031 | return; |
1032 | 1032 | } |
1033 | - register_widget( $widget_class ); |
|
1033 | + register_widget($widget_class); |
|
1034 | 1034 | // add to array of registered widgets |
1035 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
1035 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
1036 | 1036 | } |
1037 | 1037 | |
1038 | 1038 | |
@@ -1045,17 +1045,17 @@ discard block |
||
1045 | 1045 | */ |
1046 | 1046 | private function _register_shortcodes() { |
1047 | 1047 | // grab list of installed shortcodes |
1048 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1048 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1049 | 1049 | // filter list of modules to register |
1050 | 1050 | $shortcodes_to_register = apply_filters( |
1051 | 1051 | 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
1052 | 1052 | $shortcodes_to_register |
1053 | 1053 | ); |
1054 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1054 | + if ( ! empty($shortcodes_to_register)) { |
|
1055 | 1055 | // cycle thru shortcode folders |
1056 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1056 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1057 | 1057 | // add to list of installed shortcode modules |
1058 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1058 | + EE_Config::register_shortcode($shortcode_path); |
|
1059 | 1059 | } |
1060 | 1060 | } |
1061 | 1061 | // filter list of installed modules |
@@ -1074,64 +1074,64 @@ discard block |
||
1074 | 1074 | * @param string $shortcode_path - full path up to and including shortcode folder |
1075 | 1075 | * @return bool |
1076 | 1076 | */ |
1077 | - public static function register_shortcode( $shortcode_path = null ) { |
|
1078 | - do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path ); |
|
1077 | + public static function register_shortcode($shortcode_path = null) { |
|
1078 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1079 | 1079 | $shortcode_ext = '.shortcode.php'; |
1080 | 1080 | // make all separators match |
1081 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1081 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1082 | 1082 | // does the file path INCLUDE the actual file name as part of the path ? |
1083 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) { |
|
1083 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
1084 | 1084 | // grab shortcode file name from directory name and break apart at dots |
1085 | - $shortcode_file = explode( '.', basename( $shortcode_path ) ); |
|
1085 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1086 | 1086 | // take first segment from file name pieces and remove class prefix if it exists |
1087 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 |
|
1088 | - ? substr( $shortcode_file[0], 4 ) |
|
1087 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
1088 | + ? substr($shortcode_file[0], 4) |
|
1089 | 1089 | : $shortcode_file[0]; |
1090 | 1090 | // sanitize shortcode directory name |
1091 | - $shortcode = sanitize_key( $shortcode ); |
|
1091 | + $shortcode = sanitize_key($shortcode); |
|
1092 | 1092 | // now we need to rebuild the shortcode path |
1093 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1093 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1094 | 1094 | // remove last segment |
1095 | - array_pop( $shortcode_path ); |
|
1095 | + array_pop($shortcode_path); |
|
1096 | 1096 | // glue it back together |
1097 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1097 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1098 | 1098 | } else { |
1099 | 1099 | // we need to generate the filename based off of the folder name |
1100 | 1100 | // grab and sanitize shortcode directory name |
1101 | - $shortcode = sanitize_key( basename( $shortcode_path ) ); |
|
1102 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1101 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1102 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1103 | 1103 | } |
1104 | 1104 | // create classname from shortcode directory or file name |
1105 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) ); |
|
1105 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1106 | 1106 | // add class prefix |
1107 | - $shortcode_class = 'EES_' . $shortcode; |
|
1107 | + $shortcode_class = 'EES_'.$shortcode; |
|
1108 | 1108 | // does the shortcode exist ? |
1109 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) { |
|
1109 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1110 | 1110 | $msg = sprintf( |
1111 | 1111 | __( |
1112 | 1112 | 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', |
1113 | 1113 | 'event_espresso' |
1114 | 1114 | ), |
1115 | 1115 | $shortcode_class, |
1116 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1116 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1117 | 1117 | ); |
1118 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1118 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1119 | 1119 | return false; |
1120 | 1120 | } |
1121 | 1121 | // load the shortcode class file |
1122 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1122 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1123 | 1123 | // verify that class exists |
1124 | - if ( ! class_exists( $shortcode_class ) ) { |
|
1124 | + if ( ! class_exists($shortcode_class)) { |
|
1125 | 1125 | $msg = sprintf( |
1126 | - __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), |
|
1126 | + __('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
1127 | 1127 | $shortcode_class |
1128 | 1128 | ); |
1129 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1129 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1130 | 1130 | return false; |
1131 | 1131 | } |
1132 | - $shortcode = strtoupper( $shortcode ); |
|
1132 | + $shortcode = strtoupper($shortcode); |
|
1133 | 1133 | // add to array of registered shortcodes |
1134 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1134 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1135 | 1135 | return true; |
1136 | 1136 | } |
1137 | 1137 | |
@@ -1145,22 +1145,22 @@ discard block |
||
1145 | 1145 | */ |
1146 | 1146 | private function _register_modules() { |
1147 | 1147 | // grab list of installed modules |
1148 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1148 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1149 | 1149 | // filter list of modules to register |
1150 | 1150 | $modules_to_register = apply_filters( |
1151 | 1151 | 'FHEE__EE_Config__register_modules__modules_to_register', |
1152 | 1152 | $modules_to_register |
1153 | 1153 | ); |
1154 | - if ( ! empty( $modules_to_register ) ) { |
|
1154 | + if ( ! empty($modules_to_register)) { |
|
1155 | 1155 | // loop through folders |
1156 | - foreach ( $modules_to_register as $module_path ) { |
|
1156 | + foreach ($modules_to_register as $module_path) { |
|
1157 | 1157 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1158 | 1158 | if ( |
1159 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1160 | - && $module_path !== EE_MODULES . 'gateways' |
|
1159 | + $module_path !== EE_MODULES.'zzz-copy-this-module-template' |
|
1160 | + && $module_path !== EE_MODULES.'gateways' |
|
1161 | 1161 | ) { |
1162 | 1162 | // add to list of installed modules |
1163 | - EE_Config::register_module( $module_path ); |
|
1163 | + EE_Config::register_module($module_path); |
|
1164 | 1164 | } |
1165 | 1165 | } |
1166 | 1166 | } |
@@ -1180,39 +1180,39 @@ discard block |
||
1180 | 1180 | * @param string $module_path - full path up to and including module folder |
1181 | 1181 | * @return bool |
1182 | 1182 | */ |
1183 | - public static function register_module( $module_path = null ) { |
|
1184 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1183 | + public static function register_module($module_path = null) { |
|
1184 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1185 | 1185 | $module_ext = '.module.php'; |
1186 | 1186 | // make all separators match |
1187 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1187 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1188 | 1188 | // does the file path INCLUDE the actual file name as part of the path ? |
1189 | - if ( strpos( $module_path, $module_ext ) !== false ) { |
|
1189 | + if (strpos($module_path, $module_ext) !== false) { |
|
1190 | 1190 | // grab and shortcode file name from directory name and break apart at dots |
1191 | - $module_file = explode( '.', basename( $module_path ) ); |
|
1191 | + $module_file = explode('.', basename($module_path)); |
|
1192 | 1192 | // now we need to rebuild the shortcode path |
1193 | - $module_path = explode( DS, $module_path ); |
|
1193 | + $module_path = explode(DS, $module_path); |
|
1194 | 1194 | // remove last segment |
1195 | - array_pop( $module_path ); |
|
1195 | + array_pop($module_path); |
|
1196 | 1196 | // glue it back together |
1197 | - $module_path = implode( DS, $module_path ) . DS; |
|
1197 | + $module_path = implode(DS, $module_path).DS; |
|
1198 | 1198 | // take first segment from file name pieces and sanitize it |
1199 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1199 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1200 | 1200 | // ensure class prefix is added |
1201 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1201 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1202 | 1202 | } else { |
1203 | 1203 | // we need to generate the filename based off of the folder name |
1204 | 1204 | // grab and sanitize module name |
1205 | - $module = strtolower( basename( $module_path ) ); |
|
1206 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module ); |
|
1205 | + $module = strtolower(basename($module_path)); |
|
1206 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1207 | 1207 | // like trailingslashit() |
1208 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1208 | + $module_path = rtrim($module_path, DS).DS; |
|
1209 | 1209 | // create classname from module directory name |
1210 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) ); |
|
1210 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1211 | 1211 | // add class prefix |
1212 | - $module_class = 'EED_' . $module; |
|
1212 | + $module_class = 'EED_'.$module; |
|
1213 | 1213 | } |
1214 | 1214 | // does the module exist ? |
1215 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) { |
|
1215 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1216 | 1216 | $msg = sprintf( |
1217 | 1217 | __( |
1218 | 1218 | 'The requested %s module file could not be found or is not readable due to file permissions.', |
@@ -1220,19 +1220,19 @@ discard block |
||
1220 | 1220 | ), |
1221 | 1221 | $module |
1222 | 1222 | ); |
1223 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1223 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1224 | 1224 | return false; |
1225 | 1225 | } |
1226 | 1226 | // load the module class file |
1227 | - require_once( $module_path . $module_class . $module_ext ); |
|
1227 | + require_once($module_path.$module_class.$module_ext); |
|
1228 | 1228 | // verify that class exists |
1229 | - if ( ! class_exists( $module_class ) ) { |
|
1230 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1231 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1229 | + if ( ! class_exists($module_class)) { |
|
1230 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1231 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1232 | 1232 | return false; |
1233 | 1233 | } |
1234 | 1234 | // add to array of registered modules |
1235 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1235 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1236 | 1236 | do_action( |
1237 | 1237 | 'AHEE__EE_Config__register_module__complete', |
1238 | 1238 | $module_class, |
@@ -1252,26 +1252,26 @@ discard block |
||
1252 | 1252 | */ |
1253 | 1253 | private function _initialize_shortcodes() { |
1254 | 1254 | // cycle thru shortcode folders |
1255 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1255 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1256 | 1256 | // add class prefix |
1257 | - $shortcode_class = 'EES_' . $shortcode; |
|
1257 | + $shortcode_class = 'EES_'.$shortcode; |
|
1258 | 1258 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1259 | 1259 | // which set hooks ? |
1260 | - if ( is_admin() ) { |
|
1260 | + if (is_admin()) { |
|
1261 | 1261 | // fire immediately |
1262 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' ) ); |
|
1262 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1263 | 1263 | } else { |
1264 | 1264 | // delay until other systems are online |
1265 | 1265 | add_action( |
1266 | 1266 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1267 | - array( $shortcode_class, 'set_hooks' ) |
|
1267 | + array($shortcode_class, 'set_hooks') |
|
1268 | 1268 | ); |
1269 | 1269 | // convert classname to UPPERCASE and create WP shortcode. |
1270 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1270 | + $shortcode_tag = strtoupper($shortcode); |
|
1271 | 1271 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1272 | - if ( ! shortcode_exists( $shortcode_tag ) ) { |
|
1272 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1273 | 1273 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1274 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) ); |
|
1274 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1275 | 1275 | } |
1276 | 1276 | } |
1277 | 1277 | } |
@@ -1288,17 +1288,17 @@ discard block |
||
1288 | 1288 | */ |
1289 | 1289 | private function _initialize_modules() { |
1290 | 1290 | // cycle thru shortcode folders |
1291 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1291 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1292 | 1292 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1293 | 1293 | // which set hooks ? |
1294 | - if ( is_admin() ) { |
|
1294 | + if (is_admin()) { |
|
1295 | 1295 | // fire immediately |
1296 | - call_user_func( array( $module_class, 'set_hooks_admin' ) ); |
|
1296 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1297 | 1297 | } else { |
1298 | 1298 | // delay until other systems are online |
1299 | 1299 | add_action( |
1300 | 1300 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1301 | - array( $module_class, 'set_hooks' ) |
|
1301 | + array($module_class, 'set_hooks') |
|
1302 | 1302 | ); |
1303 | 1303 | } |
1304 | 1304 | } |
@@ -1316,29 +1316,29 @@ discard block |
||
1316 | 1316 | * @param string $key - url param key indicating a route is being called |
1317 | 1317 | * @return bool |
1318 | 1318 | */ |
1319 | - public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) { |
|
1320 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1321 | - $module = str_replace( 'EED_', '', $module ); |
|
1322 | - $module_class = 'EED_' . $module; |
|
1323 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) { |
|
1324 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1325 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1319 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') { |
|
1320 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1321 | + $module = str_replace('EED_', '', $module); |
|
1322 | + $module_class = 'EED_'.$module; |
|
1323 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1324 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1325 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1326 | 1326 | return false; |
1327 | 1327 | } |
1328 | - if ( empty( $route ) ) { |
|
1329 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1330 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1328 | + if (empty($route)) { |
|
1329 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1330 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1331 | 1331 | return false; |
1332 | 1332 | } |
1333 | - if ( ! method_exists( 'EED_' . $module, $method_name ) ) { |
|
1333 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1334 | 1334 | $msg = sprintf( |
1335 | - __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), |
|
1335 | + __('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1336 | 1336 | $route |
1337 | 1337 | ); |
1338 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1338 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1339 | 1339 | return false; |
1340 | 1340 | } |
1341 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1341 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1342 | 1342 | return true; |
1343 | 1343 | } |
1344 | 1344 | |
@@ -1352,11 +1352,11 @@ discard block |
||
1352 | 1352 | * @param string $key - url param key indicating a route is being called |
1353 | 1353 | * @return string |
1354 | 1354 | */ |
1355 | - public static function get_route( $route = null, $key = 'ee' ) { |
|
1356 | - do_action( 'AHEE__EE_Config__get_route__begin', $route ); |
|
1357 | - $route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route ); |
|
1358 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) { |
|
1359 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1355 | + public static function get_route($route = null, $key = 'ee') { |
|
1356 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1357 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1358 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1359 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1360 | 1360 | } |
1361 | 1361 | return null; |
1362 | 1362 | } |
@@ -1386,49 +1386,49 @@ discard block |
||
1386 | 1386 | * @param string $key - url param key indicating a route is being called |
1387 | 1387 | * @return bool |
1388 | 1388 | */ |
1389 | - public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) { |
|
1390 | - do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward ); |
|
1391 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1389 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') { |
|
1390 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1391 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1392 | 1392 | $msg = sprintf( |
1393 | - __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), |
|
1393 | + __('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1394 | 1394 | $route |
1395 | 1395 | ); |
1396 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1396 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1397 | 1397 | return false; |
1398 | 1398 | } |
1399 | - if ( empty( $forward ) ) { |
|
1400 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1401 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1399 | + if (empty($forward)) { |
|
1400 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1401 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1402 | 1402 | return false; |
1403 | 1403 | } |
1404 | - if ( is_array( $forward ) ) { |
|
1405 | - if ( ! isset( $forward[1] ) ) { |
|
1404 | + if (is_array($forward)) { |
|
1405 | + if ( ! isset($forward[1])) { |
|
1406 | 1406 | $msg = sprintf( |
1407 | - __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), |
|
1407 | + __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1408 | 1408 | $route |
1409 | 1409 | ); |
1410 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1410 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1411 | 1411 | return false; |
1412 | 1412 | } |
1413 | - if ( ! method_exists( $forward[0], $forward[1] ) ) { |
|
1413 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1414 | 1414 | $msg = sprintf( |
1415 | - __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1415 | + __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1416 | 1416 | $forward[1], |
1417 | 1417 | $route |
1418 | 1418 | ); |
1419 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1419 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1420 | 1420 | return false; |
1421 | 1421 | } |
1422 | - } else if ( ! function_exists( $forward ) ) { |
|
1422 | + } else if ( ! function_exists($forward)) { |
|
1423 | 1423 | $msg = sprintf( |
1424 | - __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1424 | + __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1425 | 1425 | $forward, |
1426 | 1426 | $route |
1427 | 1427 | ); |
1428 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1428 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1429 | 1429 | return false; |
1430 | 1430 | } |
1431 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1431 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1432 | 1432 | return true; |
1433 | 1433 | } |
1434 | 1434 | |
@@ -1444,12 +1444,12 @@ discard block |
||
1444 | 1444 | * @param string $key - url param key indicating a route is being called |
1445 | 1445 | * @return string |
1446 | 1446 | */ |
1447 | - public static function get_forward( $route = null, $status = 0, $key = 'ee' ) { |
|
1448 | - do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status ); |
|
1449 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) { |
|
1447 | + public static function get_forward($route = null, $status = 0, $key = 'ee') { |
|
1448 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1449 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1450 | 1450 | return apply_filters( |
1451 | 1451 | 'FHEE__EE_Config__get_forward', |
1452 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1452 | + EE_Config::$_module_forward_map[$key][$route][$status], |
|
1453 | 1453 | $route, |
1454 | 1454 | $status |
1455 | 1455 | ); |
@@ -1471,17 +1471,17 @@ discard block |
||
1471 | 1471 | * @param string $key - url param key indicating a route is being called |
1472 | 1472 | * @return bool |
1473 | 1473 | */ |
1474 | - public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) { |
|
1475 | - do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view ); |
|
1476 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1474 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') { |
|
1475 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1476 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1477 | 1477 | $msg = sprintf( |
1478 | - __( 'The module route %s for this view has not been registered.', 'event_espresso' ), |
|
1478 | + __('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1479 | 1479 | $route |
1480 | 1480 | ); |
1481 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1481 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1482 | 1482 | return false; |
1483 | 1483 | } |
1484 | - if ( ! is_readable( $view ) ) { |
|
1484 | + if ( ! is_readable($view)) { |
|
1485 | 1485 | $msg = sprintf( |
1486 | 1486 | __( |
1487 | 1487 | 'The %s view file could not be found or is not readable due to file permissions.', |
@@ -1489,10 +1489,10 @@ discard block |
||
1489 | 1489 | ), |
1490 | 1490 | $view |
1491 | 1491 | ); |
1492 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1492 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1493 | 1493 | return false; |
1494 | 1494 | } |
1495 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1495 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1496 | 1496 | return true; |
1497 | 1497 | } |
1498 | 1498 | |
@@ -1508,12 +1508,12 @@ discard block |
||
1508 | 1508 | * @param string $key - url param key indicating a route is being called |
1509 | 1509 | * @return string |
1510 | 1510 | */ |
1511 | - public static function get_view( $route = null, $status = 0, $key = 'ee' ) { |
|
1512 | - do_action( 'AHEE__EE_Config__get_view__begin', $route, $status ); |
|
1513 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) { |
|
1511 | + public static function get_view($route = null, $status = 0, $key = 'ee') { |
|
1512 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1513 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1514 | 1514 | return apply_filters( |
1515 | 1515 | 'FHEE__EE_Config__get_view', |
1516 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1516 | + EE_Config::$_module_view_map[$key][$route][$status], |
|
1517 | 1517 | $route, |
1518 | 1518 | $status |
1519 | 1519 | ); |
@@ -1524,7 +1524,7 @@ discard block |
||
1524 | 1524 | |
1525 | 1525 | |
1526 | 1526 | public function update_addon_option_names() { |
1527 | - update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names ); |
|
1527 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1528 | 1528 | } |
1529 | 1529 | |
1530 | 1530 | |
@@ -1552,22 +1552,22 @@ discard block |
||
1552 | 1552 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1553 | 1553 | * @throws \EE_Error |
1554 | 1554 | */ |
1555 | - public function get_pretty( $property ) { |
|
1556 | - if ( ! property_exists( $this, $property ) ) { |
|
1555 | + public function get_pretty($property) { |
|
1556 | + if ( ! property_exists($this, $property)) { |
|
1557 | 1557 | throw new EE_Error( |
1558 | 1558 | sprintf( |
1559 | 1559 | __( |
1560 | 1560 | '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
1561 | 1561 | 'event_espresso' |
1562 | 1562 | ), |
1563 | - get_class( $this ), |
|
1563 | + get_class($this), |
|
1564 | 1564 | $property |
1565 | 1565 | ) |
1566 | 1566 | ); |
1567 | 1567 | } |
1568 | 1568 | //just handling escaping of strings for now. |
1569 | - if ( is_string( $this->{$property} ) ) { |
|
1570 | - return stripslashes( $this->{$property} ); |
|
1569 | + if (is_string($this->{$property} )) { |
|
1570 | + return stripslashes($this->{$property} ); |
|
1571 | 1571 | } |
1572 | 1572 | return $this->{$property}; |
1573 | 1573 | } |
@@ -1576,17 +1576,17 @@ discard block |
||
1576 | 1576 | |
1577 | 1577 | public function populate() { |
1578 | 1578 | //grab defaults via a new instance of this class. |
1579 | - $class_name = get_class( $this ); |
|
1579 | + $class_name = get_class($this); |
|
1580 | 1580 | $defaults = new $class_name; |
1581 | 1581 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1582 | 1582 | //default from our $defaults object. |
1583 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1584 | - if ( $this->{$property} === null ) { |
|
1583 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1584 | + if ($this->{$property} === null) { |
|
1585 | 1585 | $this->{$property} = $value; |
1586 | 1586 | } |
1587 | 1587 | } |
1588 | 1588 | //cleanup |
1589 | - unset( $defaults ); |
|
1589 | + unset($defaults); |
|
1590 | 1590 | } |
1591 | 1591 | |
1592 | 1592 | |
@@ -1602,7 +1602,7 @@ discard block |
||
1602 | 1602 | * @param $a |
1603 | 1603 | * @return bool |
1604 | 1604 | */ |
1605 | - public function __isset( $a ) { |
|
1605 | + public function __isset($a) { |
|
1606 | 1606 | return false; |
1607 | 1607 | } |
1608 | 1608 | |
@@ -1614,7 +1614,7 @@ discard block |
||
1614 | 1614 | * @param $a |
1615 | 1615 | * @return bool |
1616 | 1616 | */ |
1617 | - public function __unset( $a ) { |
|
1617 | + public function __unset($a) { |
|
1618 | 1618 | return false; |
1619 | 1619 | } |
1620 | 1620 | |
@@ -1713,18 +1713,18 @@ discard block |
||
1713 | 1713 | */ |
1714 | 1714 | public function __construct() { |
1715 | 1715 | $current_network_main_site = is_multisite() ? get_current_site() : null; |
1716 | - $current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1716 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1717 | 1717 | // set default organization settings |
1718 | 1718 | $this->current_blog_id = get_current_blog_id(); |
1719 | 1719 | $this->current_blog_id = $this->current_blog_id === null ? 1 : $this->current_blog_id; |
1720 | 1720 | $this->ee_ueip_optin = is_main_site() |
1721 | - ? get_option( 'ee_ueip_optin', true ) |
|
1721 | + ? get_option('ee_ueip_optin', true) |
|
1722 | 1722 | : get_blog_option( |
1723 | 1723 | $current_main_site_id, |
1724 | 1724 | 'ee_ueip_optin', |
1725 | 1725 | true |
1726 | 1726 | ); |
1727 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true; |
|
1727 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1728 | 1728 | $this->post_shortcodes = array(); |
1729 | 1729 | $this->module_route_map = array(); |
1730 | 1730 | $this->module_forward_map = array(); |
@@ -1740,9 +1740,9 @@ discard block |
||
1740 | 1740 | $this->thank_you_page_url = ''; |
1741 | 1741 | $this->cancel_page_url = ''; |
1742 | 1742 | //cpt slugs |
1743 | - $this->event_cpt_slug = __( 'events', 'event_espresso' ); |
|
1743 | + $this->event_cpt_slug = __('events', 'event_espresso'); |
|
1744 | 1744 | //ueip constant check |
1745 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1745 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1746 | 1746 | $this->ee_ueip_optin = false; |
1747 | 1747 | $this->ee_ueip_has_notified = true; |
1748 | 1748 | } |
@@ -1785,8 +1785,8 @@ discard block |
||
1785 | 1785 | * @return string |
1786 | 1786 | */ |
1787 | 1787 | public function reg_page_url() { |
1788 | - if ( ! $this->reg_page_url ) { |
|
1789 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
1788 | + if ( ! $this->reg_page_url) { |
|
1789 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
1790 | 1790 | } |
1791 | 1791 | return $this->reg_page_url; |
1792 | 1792 | } |
@@ -1801,12 +1801,12 @@ discard block |
||
1801 | 1801 | * @access public |
1802 | 1802 | * @return string |
1803 | 1803 | */ |
1804 | - public function txn_page_url( $query_args = array() ) { |
|
1805 | - if ( ! $this->txn_page_url ) { |
|
1806 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1804 | + public function txn_page_url($query_args = array()) { |
|
1805 | + if ( ! $this->txn_page_url) { |
|
1806 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1807 | 1807 | } |
1808 | - if ( $query_args ) { |
|
1809 | - return add_query_arg( $query_args, $this->txn_page_url ); |
|
1808 | + if ($query_args) { |
|
1809 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1810 | 1810 | } else { |
1811 | 1811 | return $this->txn_page_url; |
1812 | 1812 | } |
@@ -1822,12 +1822,12 @@ discard block |
||
1822 | 1822 | * @access public |
1823 | 1823 | * @return string |
1824 | 1824 | */ |
1825 | - public function thank_you_page_url( $query_args = array() ) { |
|
1826 | - if ( ! $this->thank_you_page_url ) { |
|
1827 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1825 | + public function thank_you_page_url($query_args = array()) { |
|
1826 | + if ( ! $this->thank_you_page_url) { |
|
1827 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1828 | 1828 | } |
1829 | - if ( $query_args ) { |
|
1830 | - return add_query_arg( $query_args, $this->thank_you_page_url ); |
|
1829 | + if ($query_args) { |
|
1830 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1831 | 1831 | } else { |
1832 | 1832 | return $this->thank_you_page_url; |
1833 | 1833 | } |
@@ -1842,8 +1842,8 @@ discard block |
||
1842 | 1842 | * @return string |
1843 | 1843 | */ |
1844 | 1844 | public function cancel_page_url() { |
1845 | - if ( ! $this->cancel_page_url ) { |
|
1846 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1845 | + if ( ! $this->cancel_page_url) { |
|
1846 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1847 | 1847 | } |
1848 | 1848 | return $this->cancel_page_url; |
1849 | 1849 | } |
@@ -1874,7 +1874,7 @@ discard block |
||
1874 | 1874 | //reset all url properties |
1875 | 1875 | $this->_reset_urls(); |
1876 | 1876 | //return what to save to db |
1877 | - return array_keys( get_object_vars( $this ) ); |
|
1877 | + return array_keys(get_object_vars($this)); |
|
1878 | 1878 | } |
1879 | 1879 | |
1880 | 1880 | } |
@@ -2022,14 +2022,14 @@ discard block |
||
2022 | 2022 | */ |
2023 | 2023 | public function __construct() { |
2024 | 2024 | // set default organization settings |
2025 | - $this->name = get_bloginfo( 'name' ); |
|
2025 | + $this->name = get_bloginfo('name'); |
|
2026 | 2026 | $this->address_1 = '123 Onna Road'; |
2027 | 2027 | $this->address_2 = 'PO Box 123'; |
2028 | 2028 | $this->city = 'Inna City'; |
2029 | 2029 | $this->STA_ID = 4; |
2030 | 2030 | $this->CNT_ISO = 'US'; |
2031 | 2031 | $this->zip = '12345'; |
2032 | - $this->email = get_bloginfo( 'admin_email' ); |
|
2032 | + $this->email = get_bloginfo('admin_email'); |
|
2033 | 2033 | $this->phone = ''; |
2034 | 2034 | $this->vat = '123456789'; |
2035 | 2035 | $this->logo_url = ''; |
@@ -2117,45 +2117,45 @@ discard block |
||
2117 | 2117 | * @param string $CNT_ISO |
2118 | 2118 | * @return \EE_Currency_Config |
2119 | 2119 | */ |
2120 | - public function __construct( $CNT_ISO = '' ) { |
|
2120 | + public function __construct($CNT_ISO = '') { |
|
2121 | 2121 | // get country code from organization settings or use default |
2122 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
|
2122 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2123 | 2123 | && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
2124 | 2124 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2125 | 2125 | : ''; |
2126 | 2126 | // but override if requested |
2127 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
2128 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
2127 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2128 | + EE_Registry::instance()->load_helper('Activation'); |
|
2129 | 2129 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
2130 | 2130 | if ( |
2131 | - ! empty( $CNT_ISO ) |
|
2131 | + ! empty($CNT_ISO) |
|
2132 | 2132 | && EE_Maintenance_Mode::instance()->models_can_query() |
2133 | - && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) |
|
2133 | + && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table()) |
|
2134 | 2134 | ) { |
2135 | 2135 | // retrieve the country settings from the db, just in case they have been customized |
2136 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
2137 | - if ( $country instanceof EE_Country ) { |
|
2138 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2139 | - $this->name = $country->currency_name_single(); // Dollar |
|
2140 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
2141 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
2142 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2143 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2144 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2145 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2136 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2137 | + if ($country instanceof EE_Country) { |
|
2138 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2139 | + $this->name = $country->currency_name_single(); // Dollar |
|
2140 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
2141 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
2142 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2143 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2144 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2145 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2146 | 2146 | } |
2147 | 2147 | } |
2148 | 2148 | // fallback to hardcoded defaults, in case the above failed |
2149 | - if ( empty( $this->code ) ) { |
|
2149 | + if (empty($this->code)) { |
|
2150 | 2150 | // set default currency settings |
2151 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2152 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
2153 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
2154 | - $this->sign = '$'; // currency sign: $ |
|
2155 | - $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2156 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2157 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2158 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2151 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2152 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
2153 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
2154 | + $this->sign = '$'; // currency sign: $ |
|
2155 | + $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2156 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2157 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2158 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2159 | 2159 | } |
2160 | 2160 | } |
2161 | 2161 | } |
@@ -2318,7 +2318,7 @@ discard block |
||
2318 | 2318 | * @since 4.8.8.rc.019 |
2319 | 2319 | */ |
2320 | 2320 | public function do_hooks() { |
2321 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) ); |
|
2321 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2322 | 2322 | } |
2323 | 2323 | |
2324 | 2324 | |
@@ -2327,7 +2327,7 @@ discard block |
||
2327 | 2327 | * @return void |
2328 | 2328 | */ |
2329 | 2329 | public function set_default_reg_status_on_EEM_Event() { |
2330 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2330 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2331 | 2331 | } |
2332 | 2332 | |
2333 | 2333 | |
@@ -2432,10 +2432,10 @@ discard block |
||
2432 | 2432 | * @param bool $reset |
2433 | 2433 | * @return string |
2434 | 2434 | */ |
2435 | - public function log_file_name( $reset = false ) { |
|
2436 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2437 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2438 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2435 | + public function log_file_name($reset = false) { |
|
2436 | + if (empty($this->log_file_name) || $reset) { |
|
2437 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt'; |
|
2438 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2439 | 2439 | } |
2440 | 2440 | return $this->log_file_name; |
2441 | 2441 | } |
@@ -2446,10 +2446,10 @@ discard block |
||
2446 | 2446 | * @param bool $reset |
2447 | 2447 | * @return string |
2448 | 2448 | */ |
2449 | - public function debug_file_name( $reset = false ) { |
|
2450 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2451 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2452 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2449 | + public function debug_file_name($reset = false) { |
|
2450 | + if (empty($this->debug_file_name) || $reset) { |
|
2451 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt'; |
|
2452 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2453 | 2453 | } |
2454 | 2454 | return $this->debug_file_name; |
2455 | 2455 | } |
@@ -2621,21 +2621,21 @@ discard block |
||
2621 | 2621 | // set default map settings |
2622 | 2622 | $this->use_google_maps = true; |
2623 | 2623 | // for event details pages (reg page) |
2624 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2625 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2626 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2627 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2628 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2629 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2630 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2624 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2625 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2626 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2627 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2628 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2629 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2630 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2631 | 2631 | // for event list pages |
2632 | - $this->event_list_map_width = 300; // ee_map_width |
|
2633 | - $this->event_list_map_height = 185; // ee_map_height |
|
2634 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2635 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2636 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2637 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2638 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2632 | + $this->event_list_map_width = 300; // ee_map_width |
|
2633 | + $this->event_list_map_height = 185; // ee_map_height |
|
2634 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2635 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2636 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2637 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2638 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2639 | 2639 | } |
2640 | 2640 | |
2641 | 2641 | } |
@@ -2788,7 +2788,7 @@ discard block |
||
2788 | 2788 | * @return void |
2789 | 2789 | */ |
2790 | 2790 | protected function _set_php_values() { |
2791 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2791 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2792 | 2792 | $this->php->version = phpversion(); |
2793 | 2793 | } |
2794 | 2794 | |
@@ -2807,10 +2807,10 @@ discard block |
||
2807 | 2807 | * @type string $msg Any message to be displayed. |
2808 | 2808 | * } |
2809 | 2809 | */ |
2810 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2811 | - if ( ! empty( $this->php->max_input_vars ) |
|
2812 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2813 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2810 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2811 | + if ( ! empty($this->php->max_input_vars) |
|
2812 | + && ($input_count >= $this->php->max_input_vars) |
|
2813 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
2814 | 2814 | ) { |
2815 | 2815 | return sprintf( |
2816 | 2816 | __( |
@@ -2876,7 +2876,7 @@ discard block |
||
2876 | 2876 | */ |
2877 | 2877 | public function __construct() { |
2878 | 2878 | $this->payment_settings = array(); |
2879 | - $this->active_gateways = array( 'Invoice' => false ); |
|
2879 | + $this->active_gateways = array('Invoice' => false); |
|
2880 | 2880 | } |
2881 | 2881 | } |
2882 | 2882 |