@@ -10,17 +10,17 @@ discard block |
||
10 | 10 | * @since 4.6 |
11 | 11 | * |
12 | 12 | */ |
13 | -class EE_Simple_HTML_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
13 | +class EE_Simple_HTML_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * @param null $validation_error_message |
17 | 17 | */ |
18 | - public function __construct( $validation_error_message = NULL ) { |
|
19 | - if( ! $validation_error_message ){ |
|
18 | + public function __construct($validation_error_message = NULL) { |
|
19 | + if ( ! $validation_error_message) { |
|
20 | 20 | $allowedtags = $this->_get_allowed_tags(); |
21 | - $validation_error_message = sprintf( __( "Only simple HTML tags are allowed. Eg, %s", "event_espresso" ), implode( ",", array_keys( $allowedtags ) ) ); |
|
21 | + $validation_error_message = sprintf(__("Only simple HTML tags are allowed. Eg, %s", "event_espresso"), implode(",", array_keys($allowedtags))); |
|
22 | 22 | } |
23 | - parent::__construct( $validation_error_message ); |
|
23 | + parent::__construct($validation_error_message); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function get_list_of_allowed_tags() { |
45 | 45 | $allowed_tags = $this->_get_allowed_tags(); |
46 | - ksort( $allowed_tags ); |
|
47 | - return implode( ', ', array_keys( $allowed_tags ) ); |
|
46 | + ksort($allowed_tags); |
|
47 | + return implode(', ', array_keys($allowed_tags)); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function validate($normalized_value) { |
57 | 57 | $allowedtags = $this->_get_allowed_tags(); |
58 | - parent::validate( $normalized_value ); |
|
59 | - $normalized_value_sans_tags = wp_kses( "$normalized_value",$allowedtags ); |
|
60 | - if ( strlen( $normalized_value ) > strlen( $normalized_value_sans_tags ) ) { |
|
61 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'complex_html_tags' ); |
|
58 | + parent::validate($normalized_value); |
|
59 | + $normalized_value_sans_tags = wp_kses("$normalized_value", $allowedtags); |
|
60 | + if (strlen($normalized_value) > strlen($normalized_value_sans_tags)) { |
|
61 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'complex_html_tags'); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | } |
65 | 65 | \ No newline at end of file |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | use EventEspressoBatchRequest\Helpers\JobParameters; |
20 | 20 | use EventEspressoBatchRequest\Helpers\JobStepResponse; |
21 | 21 | |
22 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
23 | - exit( 'No direct script access allowed' ); |
|
22 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
23 | + exit('No direct script access allowed'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -35,35 +35,35 @@ discard block |
||
35 | 35 | * @throws BatchRequestException |
36 | 36 | * @return JobStepResponse |
37 | 37 | */ |
38 | - public function create_job( JobParameters $job_parameters ) { |
|
39 | - $event_id = intval( $job_parameters->request_datum( 'EVT_ID', '0' ) ); |
|
40 | - if( ! \EE_Capabilities::instance()->current_user_can( 'ee_read_registrations', 'generating_report' ) ) { |
|
38 | + public function create_job(JobParameters $job_parameters) { |
|
39 | + $event_id = intval($job_parameters->request_datum('EVT_ID', '0')); |
|
40 | + if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_registrations', 'generating_report')) { |
|
41 | 41 | throw new BatchRequestException( |
42 | - __( 'You do not have permission to view registrations', 'event_espresso') |
|
42 | + __('You do not have permission to view registrations', 'event_espresso') |
|
43 | 43 | ); |
44 | 44 | } |
45 | 45 | $filepath = $this->create_file_from_job_with_name( |
46 | 46 | $job_parameters->job_id(), |
47 | - $this->get_filename_from_event( $event_id ) |
|
47 | + $this->get_filename_from_event($event_id) |
|
48 | 48 | ); |
49 | - $job_parameters->add_extra_data( 'filepath', $filepath ); |
|
50 | - $question_data_for_columns = $this->_get_questions_for_report( $event_id ); |
|
51 | - $job_parameters->add_extra_data( 'questions_data', $question_data_for_columns ); |
|
52 | - $job_parameters->set_job_size( $this->count_units_to_process( $event_id ) ); |
|
49 | + $job_parameters->add_extra_data('filepath', $filepath); |
|
50 | + $question_data_for_columns = $this->_get_questions_for_report($event_id); |
|
51 | + $job_parameters->add_extra_data('questions_data', $question_data_for_columns); |
|
52 | + $job_parameters->set_job_size($this->count_units_to_process($event_id)); |
|
53 | 53 | //we should also set the header columns |
54 | 54 | $csv_data_for_row = $this->get_csv_data_for( |
55 | 55 | $event_id, |
56 | 56 | 0, |
57 | 57 | 1, |
58 | - $job_parameters->extra_datum( 'questions_data' ) ); |
|
59 | - \EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true ); |
|
58 | + $job_parameters->extra_datum('questions_data') ); |
|
59 | + \EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true); |
|
60 | 60 | //if we actually processed a row there, record it |
61 | - if( $job_parameters->job_size() ) { |
|
62 | - $job_parameters->mark_processed( 1 ); |
|
61 | + if ($job_parameters->job_size()) { |
|
62 | + $job_parameters->mark_processed(1); |
|
63 | 63 | } |
64 | 64 | return new JobStepResponse( |
65 | 65 | $job_parameters, |
66 | - __( 'Registrations report started successfully...', 'event_espresso' ) |
|
66 | + __('Registrations report started successfully...', 'event_espresso') |
|
67 | 67 | ); |
68 | 68 | } |
69 | 69 | |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | * @param int $event_id |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - protected function get_filename_from_event( $event_id ) { |
|
78 | - if( $event_id ){ |
|
79 | - $event_slug = \EEM_Event::instance()->get_var( array( array( 'EVT_ID' => $event_id ) ), 'EVT_slug' ); |
|
80 | - if( ! $event_slug ) { |
|
81 | - $event_slug = __( 'unknown', 'event_espresso' ); |
|
77 | + protected function get_filename_from_event($event_id) { |
|
78 | + if ($event_id) { |
|
79 | + $event_slug = \EEM_Event::instance()->get_var(array(array('EVT_ID' => $event_id)), 'EVT_slug'); |
|
80 | + if ( ! $event_slug) { |
|
81 | + $event_slug = __('unknown', 'event_espresso'); |
|
82 | 82 | } |
83 | - }else{ |
|
84 | - $event_slug = __( 'all', 'event_espresso' ); |
|
83 | + } else { |
|
84 | + $event_slug = __('all', 'event_espresso'); |
|
85 | 85 | } |
86 | - return sprintf( "registrations-for-%s.csv", $event_slug ); |
|
86 | + return sprintf("registrations-for-%s.csv", $event_slug); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -92,17 +92,17 @@ discard block |
||
92 | 92 | * @param int|null $event_id |
93 | 93 | * @return array of wpdb results for questions which are to be used for this report |
94 | 94 | */ |
95 | - protected function _get_questions_for_report( $event_id ) { |
|
95 | + protected function _get_questions_for_report($event_id) { |
|
96 | 96 | $question_query_params = array( |
97 | 97 | array( |
98 | - 'Answer.ANS_ID' => array( 'IS_NOT_NULL' ), |
|
98 | + 'Answer.ANS_ID' => array('IS_NOT_NULL'), |
|
99 | 99 | ), |
100 | - 'group_by' => array( 'QST_ID' ) |
|
100 | + 'group_by' => array('QST_ID') |
|
101 | 101 | ); |
102 | - if( $event_id ) { |
|
102 | + if ($event_id) { |
|
103 | 103 | $question_query_params[0]['Answer.Registration.EVT_ID'] = $event_id; |
104 | 104 | } |
105 | - return \EEM_Question::instance()->get_all_wpdb_results( $question_query_params ); |
|
105 | + return \EEM_Question::instance()->get_all_wpdb_results($question_query_params); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -115,27 +115,27 @@ discard block |
||
115 | 115 | * @return JobStepResponse |
116 | 116 | * @throws \EE_Error |
117 | 117 | */ |
118 | - public function continue_job( JobParameters $job_parameters, $batch_size = 50 ) { |
|
118 | + public function continue_job(JobParameters $job_parameters, $batch_size = 50) { |
|
119 | 119 | $csv_data = $this->get_csv_data_for( |
120 | - $job_parameters->request_datum( 'EVT_ID', '0'), |
|
120 | + $job_parameters->request_datum('EVT_ID', '0'), |
|
121 | 121 | $job_parameters->units_processed(), |
122 | 122 | $batch_size, |
123 | - $job_parameters->extra_datum( 'questions_data' ) ); |
|
124 | - \EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false ); |
|
125 | - $units_processed = count( $csv_data ); |
|
126 | - $job_parameters->mark_processed( $units_processed ); |
|
123 | + $job_parameters->extra_datum('questions_data') ); |
|
124 | + \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false); |
|
125 | + $units_processed = count($csv_data); |
|
126 | + $job_parameters->mark_processed($units_processed); |
|
127 | 127 | $extra_response_data = array( |
128 | 128 | 'file_url' => '' |
129 | 129 | ); |
130 | - if( $units_processed < $batch_size ) { |
|
131 | - $job_parameters->set_status( JobParameters::status_complete ); |
|
132 | - $extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) ); |
|
130 | + if ($units_processed < $batch_size) { |
|
131 | + $job_parameters->set_status(JobParameters::status_complete); |
|
132 | + $extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath')); |
|
133 | 133 | } |
134 | 134 | return new JobStepResponse( |
135 | 135 | $job_parameters, |
136 | 136 | sprintf( |
137 | - __( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ), |
|
138 | - count( $csv_data ) ), |
|
137 | + __('Wrote %1$s rows to report CSV file...', 'event_espresso'), |
|
138 | + count($csv_data) ), |
|
139 | 139 | $extra_response_data ); |
140 | 140 | } |
141 | 141 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @return array top-level keys are numeric, next-level keys are column headers |
149 | 149 | * |
150 | 150 | */ |
151 | - function get_csv_data_for( $event_id, $offset, $limit, $questions_for_these_regs_rows ) { |
|
151 | + function get_csv_data_for($event_id, $offset, $limit, $questions_for_these_regs_rows) { |
|
152 | 152 | $reg_fields_to_include = array( |
153 | 153 | 'TXN_ID', |
154 | 154 | 'ATT_ID', |
@@ -179,166 +179,166 @@ discard block |
||
179 | 179 | array( |
180 | 180 | 'OR' => array( |
181 | 181 | //don't include registrations from failed or abandoned transactions... |
182 | - 'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ), |
|
182 | + 'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)), |
|
183 | 183 | //unless the registration is approved, in which case include it regardless of transaction status |
184 | 184 | 'STS_ID' => \EEM_Registration::status_id_approved |
185 | 185 | ), |
186 | - 'Ticket.TKT_deleted' => array( 'IN', array( true, false ) ) |
|
186 | + 'Ticket.TKT_deleted' => array('IN', array(true, false)) |
|
187 | 187 | ), |
188 | - 'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'), |
|
189 | - 'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ), |
|
190 | - 'limit' => array( $offset, $limit ), |
|
188 | + 'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'), |
|
189 | + 'force_join' => array('Transaction', 'Ticket', 'Attendee'), |
|
190 | + 'limit' => array($offset, $limit), |
|
191 | 191 | 'caps' => \EEM_Base::caps_read_admin |
192 | 192 | ), |
193 | 193 | $event_id |
194 | 194 | ); |
195 | - if( $event_id ){ |
|
196 | - $query_params[0]['EVT_ID'] = $event_id; |
|
197 | - }else{ |
|
198 | - $query_params[ 'force_join' ][] = 'Event'; |
|
195 | + if ($event_id) { |
|
196 | + $query_params[0]['EVT_ID'] = $event_id; |
|
197 | + } else { |
|
198 | + $query_params['force_join'][] = 'Event'; |
|
199 | 199 | } |
200 | - $registration_rows = $reg_model->get_all_wpdb_results( $query_params ); |
|
200 | + $registration_rows = $reg_model->get_all_wpdb_results($query_params); |
|
201 | 201 | //get all questions which relate to someone in this group |
202 | 202 | $registration_ids = array(); |
203 | - foreach( $registration_rows as $reg_row ) { |
|
204 | - $registration_ids[] = intval( $reg_row[ 'Registration.REG_ID'] ); |
|
203 | + foreach ($registration_rows as $reg_row) { |
|
204 | + $registration_ids[] = intval($reg_row['Registration.REG_ID']); |
|
205 | 205 | } |
206 | 206 | |
207 | - foreach($registration_rows as $reg_row){ |
|
208 | - if ( is_array( $reg_row ) ) { |
|
207 | + foreach ($registration_rows as $reg_row) { |
|
208 | + if (is_array($reg_row)) { |
|
209 | 209 | $reg_csv_array = array(); |
210 | - if( ! $event_id ){ |
|
210 | + if ( ! $event_id) { |
|
211 | 211 | //get the event's name and Id |
212 | - $reg_csv_array[ __( 'Event', 'event_espresso' ) ] = sprintf( __( '%1$s (%2$s)', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( \EEM_Event::instance(), 'EVT_name', $reg_row[ 'Event_CPT.post_title'] ), $reg_row[ 'Event_CPT.ID' ] ); |
|
212 | + $reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'), \EEH_Export::prepare_value_from_db_for_display(\EEM_Event::instance(), 'EVT_name', $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']); |
|
213 | 213 | } |
214 | - $is_primary_reg = $reg_row[ 'Registration.REG_count' ] == '1' ? true : false; |
|
214 | + $is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false; |
|
215 | 215 | /*@var $reg_row EE_Registration */ |
216 | - foreach($reg_fields_to_include as $field_name){ |
|
216 | + foreach ($reg_fields_to_include as $field_name) { |
|
217 | 217 | $field = $reg_model->field_settings_for($field_name); |
218 | - if($field_name == 'REG_final_price'){ |
|
219 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' ); |
|
220 | - }elseif( $field_name == 'REG_count' ){ |
|
221 | - $value = sprintf( __( '%s of %s', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_count', $reg_row['Registration.REG_count'] ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size' ] ) ); |
|
222 | - }elseif( $field_name == 'REG_date' ) { |
|
223 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' ); |
|
224 | - }else{ |
|
225 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] ); |
|
218 | + if ($field_name == 'REG_final_price') { |
|
219 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_final_price'], 'localized_float'); |
|
220 | + }elseif ($field_name == 'REG_count') { |
|
221 | + $value = sprintf(__('%s of %s', 'event_espresso'), \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_count', $reg_row['Registration.REG_count']), \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size'])); |
|
222 | + }elseif ($field_name == 'REG_date') { |
|
223 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_date'], 'no_html'); |
|
224 | + } else { |
|
225 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row[$field->get_qualified_column()]); |
|
226 | 226 | } |
227 | 227 | $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value; |
228 | - if($field_name == 'REG_final_price'){ |
|
228 | + if ($field_name == 'REG_final_price') { |
|
229 | 229 | //add a column named Currency after the final price |
230 | 230 | $reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code; |
231 | 231 | } |
232 | 232 | } |
233 | 233 | //get pretty status |
234 | - $stati = \EEM_Status::instance()->localized_status( array( |
|
235 | - $reg_row[ 'Registration.STS_ID' ] => __( 'unknown', 'event_espresso' ), |
|
236 | - $reg_row[ 'Transaction.STS_ID' ] => __( 'unknown', 'event_espresso' ) ), |
|
234 | + $stati = \EEM_Status::instance()->localized_status(array( |
|
235 | + $reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'), |
|
236 | + $reg_row['Transaction.STS_ID'] => __('unknown', 'event_espresso') ), |
|
237 | 237 | FALSE, |
238 | - 'sentence' ); |
|
239 | - $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[ $reg_row[ 'Registration.STS_ID' ] ]; |
|
238 | + 'sentence'); |
|
239 | + $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']]; |
|
240 | 240 | //get pretty transaction status |
241 | - $reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[ $reg_row[ 'Transaction.STS_ID' ] ]; |
|
242 | - $reg_csv_array[ __( 'Transaction Amount Due', 'event_espresso' ) ] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display( \EEM_Transaction::instance(), 'TXN_total', $reg_row[ 'Transaction.TXN_total' ], 'localized_float' ) : '0.00'; |
|
243 | - $reg_csv_array[ __( 'Amount Paid', 'event_espresso' )] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display( \EEM_Transaction::instance(), 'TXN_paid', $reg_row[ 'Transaction.TXN_paid' ], 'localized_float' ) : '0.00'; |
|
241 | + $reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[$reg_row['Transaction.STS_ID']]; |
|
242 | + $reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total', $reg_row['Transaction.TXN_total'], 'localized_float') : '0.00'; |
|
243 | + $reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid', $reg_row['Transaction.TXN_paid'], 'localized_float') : '0.00'; |
|
244 | 244 | $payment_methods = array(); |
245 | 245 | $gateway_txn_ids_etc = array(); |
246 | 246 | $payment_times = array(); |
247 | - if( $is_primary_reg && $reg_row[ 'Transaction.TXN_ID' ] ){ |
|
247 | + if ($is_primary_reg && $reg_row['Transaction.TXN_ID']) { |
|
248 | 248 | $payments_info = \EEM_Payment::instance()->get_all_wpdb_results( |
249 | 249 | array( |
250 | 250 | array( |
251 | - 'TXN_ID' => $reg_row[ 'Transaction.TXN_ID' ], |
|
251 | + 'TXN_ID' => $reg_row['Transaction.TXN_ID'], |
|
252 | 252 | 'STS_ID' => \EEM_Payment::status_id_approved |
253 | 253 | ), |
254 | - 'force_join' => array( 'Payment_Method' ), |
|
254 | + 'force_join' => array('Payment_Method'), |
|
255 | 255 | |
256 | 256 | ), |
257 | 257 | ARRAY_A, |
258 | 258 | 'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' ); |
259 | 259 | |
260 | - foreach( $payments_info as $payment_method_and_gateway_txn_id ){ |
|
261 | - $payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' ); |
|
262 | - $gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : ''; |
|
263 | - $payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : ''; |
|
260 | + foreach ($payments_info as $payment_method_and_gateway_txn_id) { |
|
261 | + $payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso'); |
|
262 | + $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : ''; |
|
263 | + $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) ? $payment_method_and_gateway_txn_id['payment_time'] : ''; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | } |
267 | - $reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times ); |
|
268 | - $reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods ); |
|
269 | - $reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc ); |
|
267 | + $reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times); |
|
268 | + $reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods); |
|
269 | + $reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc); |
|
270 | 270 | |
271 | 271 | //get whether or not the user has checked in |
272 | - $reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related( $reg_row[ 'Registration.REG_ID'] , 'Checkin' ); |
|
272 | + $reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin'); |
|
273 | 273 | //get ticket of registration and its price |
274 | 274 | $ticket_model = \EE_Registry::instance()->load_model('Ticket'); |
275 | - if( $reg_row[ 'Ticket.TKT_ID'] ) { |
|
276 | - $ticket_name = \EEH_Export::prepare_value_from_db_for_display( $ticket_model, 'TKT_name', $reg_row[ 'Ticket.TKT_name' ] ); |
|
275 | + if ($reg_row['Ticket.TKT_ID']) { |
|
276 | + $ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name', $reg_row['Ticket.TKT_name']); |
|
277 | 277 | $datetimes_strings = array(); |
278 | - foreach( \EEM_Datetime::instance()->get_all_wpdb_results( array( array( 'Ticket.TKT_ID' => $reg_row[ 'Ticket.TKT_ID' ] ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ), 'default_where_conditions' => 'none' ) ) as $datetime){ |
|
279 | - $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display( \EEM_Datetime::instance(), 'DTT_EVT_start', $datetime[ 'Datetime.DTT_EVT_start'] ); |
|
278 | + foreach (\EEM_Datetime::instance()->get_all_wpdb_results(array(array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']), 'order_by' => array('DTT_EVT_start' => 'ASC'), 'default_where_conditions' => 'none')) as $datetime) { |
|
279 | + $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(), 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | } else { |
283 | - $ticket_name = __( 'Unknown', 'event_espresso' ); |
|
284 | - $datetimes_strings = array( __( 'Unknown', 'event_espresso' ) ); |
|
283 | + $ticket_name = __('Unknown', 'event_espresso'); |
|
284 | + $datetimes_strings = array(__('Unknown', 'event_espresso')); |
|
285 | 285 | } |
286 | 286 | $reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name; |
287 | 287 | $reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings); |
288 | 288 | //get datetime(s) of registration |
289 | 289 | |
290 | 290 | //add attendee columns |
291 | - foreach($att_fields_to_include as $att_field_name){ |
|
291 | + foreach ($att_fields_to_include as $att_field_name) { |
|
292 | 292 | $field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name); |
293 | - if( $reg_row[ 'Attendee_CPT.ID' ]){ |
|
294 | - if($att_field_name == 'STA_ID'){ |
|
295 | - $value = \EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' ); |
|
296 | - }elseif($att_field_name == 'CNT_ISO'){ |
|
297 | - $value = \EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' ); |
|
298 | - }else{ |
|
299 | - $value = \EEH_Export::prepare_value_from_db_for_display( \EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] ); |
|
293 | + if ($reg_row['Attendee_CPT.ID']) { |
|
294 | + if ($att_field_name == 'STA_ID') { |
|
295 | + $value = \EEM_State::instance()->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), 'STA_name'); |
|
296 | + }elseif ($att_field_name == 'CNT_ISO') { |
|
297 | + $value = \EEM_Country::instance()->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), 'CNT_name'); |
|
298 | + } else { |
|
299 | + $value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(), $att_field_name, $reg_row[$field_obj->get_qualified_column()]); |
|
300 | 300 | } |
301 | - }else{ |
|
301 | + } else { |
|
302 | 302 | $value = ''; |
303 | 303 | } |
304 | 304 | |
305 | - $reg_csv_array[ \EEH_Export::get_column_name_for_field($field_obj) ] = $value; |
|
305 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value; |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | //make sure each registration has the same questions in the same order |
309 | - foreach($questions_for_these_regs_rows as $question_row){ |
|
310 | - if( ! isset($reg_csv_array[$question_row[ 'Question.QST_admin_label']])){ |
|
311 | - $reg_csv_array[$question_row[ 'Question.QST_admin_label' ] ] = null; |
|
309 | + foreach ($questions_for_these_regs_rows as $question_row) { |
|
310 | + if ( ! isset($reg_csv_array[$question_row['Question.QST_admin_label']])) { |
|
311 | + $reg_csv_array[$question_row['Question.QST_admin_label']] = null; |
|
312 | 312 | } |
313 | 313 | } |
314 | 314 | $answers = \EEM_Answer::instance()->get_all_wpdb_results( |
315 | 315 | array( |
316 | - array( 'REG_ID' => $reg_row[ 'Registration.REG_ID' ] ), |
|
317 | - 'force_join' => array( 'Question' ) |
|
316 | + array('REG_ID' => $reg_row['Registration.REG_ID']), |
|
317 | + 'force_join' => array('Question') |
|
318 | 318 | ) |
319 | 319 | ); |
320 | 320 | //now fill out the questions THEY answered |
321 | - foreach( $answers as $answer_row ){ |
|
322 | - if( $answer_row[ 'Question.QST_ID' ] ){ |
|
321 | + foreach ($answers as $answer_row) { |
|
322 | + if ($answer_row['Question.QST_ID']) { |
|
323 | 323 | $question_label = \EEH_Export::prepare_value_from_db_for_display( |
324 | 324 | \EEM_Question::instance(), |
325 | 325 | 'QST_admin_label', |
326 | - $answer_row[ 'Question.QST_admin_label' ] |
|
326 | + $answer_row['Question.QST_admin_label'] |
|
327 | 327 | ); |
328 | 328 | } else { |
329 | - $question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] ); |
|
329 | + $question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']); |
|
330 | 330 | } |
331 | - if ( isset( $answer_row[ 'Question.QST_type' ] ) |
|
332 | - && $answer_row[ 'Question.QST_type' ] == \EEM_Question::QST_type_state |
|
331 | + if (isset($answer_row['Question.QST_type']) |
|
332 | + && $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state |
|
333 | 333 | ) { |
334 | - $reg_csv_array[ $question_label ] = \EEM_State::instance()->get_state_name_by_ID( |
|
335 | - $answer_row[ 'Answer.ANS_value' ] |
|
334 | + $reg_csv_array[$question_label] = \EEM_State::instance()->get_state_name_by_ID( |
|
335 | + $answer_row['Answer.ANS_value'] |
|
336 | 336 | ); |
337 | 337 | } else { |
338 | - $reg_csv_array[ $question_label ] = \EEH_Export::prepare_value_from_db_for_display( |
|
338 | + $reg_csv_array[$question_label] = \EEH_Export::prepare_value_from_db_for_display( |
|
339 | 339 | \EEM_Answer::instance(), |
340 | 340 | 'ANS_value', |
341 | - $answer_row[ 'Answer.ANS_value' ] |
|
341 | + $answer_row['Answer.ANS_value'] |
|
342 | 342 | ); |
343 | 343 | } |
344 | 344 | } |
@@ -349,17 +349,17 @@ discard block |
||
349 | 349 | } |
350 | 350 | } |
351 | 351 | //if we couldn't export anything, we want to at least show the column headers |
352 | - if ( empty( $registrations_csv_ready_array ) ) { |
|
352 | + if (empty($registrations_csv_ready_array)) { |
|
353 | 353 | $reg_csv_array = array(); |
354 | 354 | $model_and_fields_to_include = array( |
355 | 355 | 'Registration' => $reg_fields_to_include, |
356 | 356 | 'Attendee' => $att_fields_to_include |
357 | 357 | ); |
358 | - foreach ( $model_and_fields_to_include as $model_name => $field_list ) { |
|
359 | - $model = \EE_Registry::instance()->load_model( $model_name ); |
|
360 | - foreach ( $field_list as $field_name ) { |
|
361 | - $field = $model->field_settings_for( $field_name ); |
|
362 | - $reg_csv_array[ \EEH_Export::get_column_name_for_field( $field ) ] = null; |
|
358 | + foreach ($model_and_fields_to_include as $model_name => $field_list) { |
|
359 | + $model = \EE_Registry::instance()->load_model($model_name); |
|
360 | + foreach ($field_list as $field_name) { |
|
361 | + $field = $model->field_settings_for($field_name); |
|
362 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null; |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 | $registrations_csv_ready_array[] = $reg_csv_array; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * @param int $event_id |
376 | 376 | * @return int |
377 | 377 | */ |
378 | - public function count_units_to_process( $event_id ) { |
|
378 | + public function count_units_to_process($event_id) { |
|
379 | 379 | //use the legacy filter |
380 | 380 | $query_params = apply_filters( |
381 | 381 | 'FHEE__EE_Export__report_registration_for_event', |
@@ -383,24 +383,24 @@ discard block |
||
383 | 383 | array( |
384 | 384 | 'OR' => array( |
385 | 385 | //don't include registrations from failed or abandoned transactions... |
386 | - 'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ), |
|
386 | + 'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)), |
|
387 | 387 | //unless the registration is approved, in which case include it regardless of transaction status |
388 | 388 | 'STS_ID' => \EEM_Registration::status_id_approved |
389 | 389 | ), |
390 | - 'Ticket.TKT_deleted' => array( 'IN', array( true, false ) ) |
|
390 | + 'Ticket.TKT_deleted' => array('IN', array(true, false)) |
|
391 | 391 | ), |
392 | - 'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'), |
|
393 | - 'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ), |
|
392 | + 'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'), |
|
393 | + 'force_join' => array('Transaction', 'Ticket', 'Attendee'), |
|
394 | 394 | 'caps' => \EEM_Base::caps_read_admin |
395 | 395 | ), |
396 | 396 | $event_id |
397 | 397 | ); |
398 | - if( $event_id ){ |
|
399 | - $query_params[0]['EVT_ID'] = $event_id; |
|
398 | + if ($event_id) { |
|
399 | + $query_params[0]['EVT_ID'] = $event_id; |
|
400 | 400 | } else { |
401 | - $query_params[ 'force_join' ][] = 'Event'; |
|
401 | + $query_params['force_join'][] = 'Event'; |
|
402 | 402 | } |
403 | - return \EEM_Registration::instance()->count( $query_params ); |
|
403 | + return \EEM_Registration::instance()->count($query_params); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | |
@@ -411,13 +411,13 @@ discard block |
||
411 | 411 | * @param JobParameters $job_parameters |
412 | 412 | * @return boolean |
413 | 413 | */ |
414 | - public function cleanup_job( JobParameters $job_parameters ){ |
|
414 | + public function cleanup_job(JobParameters $job_parameters) { |
|
415 | 415 | $this->_file_helper->delete( |
416 | - \EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ), |
|
416 | + \EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')), |
|
417 | 417 | true, |
418 | 418 | 'd' |
419 | 419 | ); |
420 | - return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) ); |
|
420 | + return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso')); |
|
421 | 421 | } |
422 | 422 | } |
423 | 423 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use EventEspressoBatchRequest\Helpers\JobParameters; |
19 | 19 | use EventEspressoBatchRequest\Helpers\JobStepResponse; |
20 | 20 | |
21 | -if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
21 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
22 | 22 | exit('No direct script access allowed'); |
23 | 23 | } |
24 | 24 | |
@@ -27,84 +27,84 @@ discard block |
||
27 | 27 | |
28 | 28 | |
29 | 29 | public function create_job(JobParameters $job_parameters) { |
30 | - if( ! \EE_Capabilities::instance()->current_user_can( 'ee_read_contacts', 'generating_report' ) ) { |
|
30 | + if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_contacts', 'generating_report')) { |
|
31 | 31 | throw new BatchRequestException( |
32 | - __( 'You do not have permission to view contacts', 'event_espresso') |
|
32 | + __('You do not have permission to view contacts', 'event_espresso') |
|
33 | 33 | ); |
34 | 34 | } |
35 | 35 | $filepath = $this->create_file_from_job_with_name( |
36 | 36 | $job_parameters->job_id(), |
37 | 37 | __('contact-list-report.csv', 'event_espresso') |
38 | 38 | ); |
39 | - $job_parameters->add_extra_data( 'filepath', $filepath ); |
|
40 | - $job_parameters->set_job_size( $this->count_units_to_process() ); |
|
39 | + $job_parameters->add_extra_data('filepath', $filepath); |
|
40 | + $job_parameters->set_job_size($this->count_units_to_process()); |
|
41 | 41 | //we should also set the header columns |
42 | - $csv_data_for_row = $this->get_csv_data( 0, 1 ); |
|
43 | - \EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true ); |
|
42 | + $csv_data_for_row = $this->get_csv_data(0, 1); |
|
43 | + \EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true); |
|
44 | 44 | //if we actually processed a row there, record it |
45 | - if( $job_parameters->job_size() ) { |
|
46 | - $job_parameters->mark_processed( 1 ); |
|
45 | + if ($job_parameters->job_size()) { |
|
46 | + $job_parameters->mark_processed(1); |
|
47 | 47 | } |
48 | 48 | return new JobStepResponse( |
49 | 49 | $job_parameters, |
50 | - __( 'Contacts report started successfully...', 'event_espresso' ) |
|
50 | + __('Contacts report started successfully...', 'event_espresso') |
|
51 | 51 | ); |
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | public function continue_job(JobParameters $job_parameters, $batch_size = 50) { |
56 | - $csv_data = $this->get_csv_data( $job_parameters->units_processed(), $batch_size ); |
|
57 | - \EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false ); |
|
58 | - $units_processed = count( $csv_data ); |
|
59 | - $job_parameters->mark_processed( $units_processed ); |
|
56 | + $csv_data = $this->get_csv_data($job_parameters->units_processed(), $batch_size); |
|
57 | + \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false); |
|
58 | + $units_processed = count($csv_data); |
|
59 | + $job_parameters->mark_processed($units_processed); |
|
60 | 60 | $extra_response_data = array( |
61 | 61 | 'file_url' => '' |
62 | 62 | ); |
63 | - if( $units_processed < $batch_size ) { |
|
64 | - $job_parameters->set_status( JobParameters::status_complete ); |
|
65 | - $extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) ); |
|
63 | + if ($units_processed < $batch_size) { |
|
64 | + $job_parameters->set_status(JobParameters::status_complete); |
|
65 | + $extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath')); |
|
66 | 66 | } |
67 | 67 | return new JobStepResponse( |
68 | 68 | $job_parameters, |
69 | 69 | sprintf( |
70 | - __( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ), |
|
71 | - count( $csv_data ) ), |
|
70 | + __('Wrote %1$s rows to report CSV file...', 'event_espresso'), |
|
71 | + count($csv_data) ), |
|
72 | 72 | $extra_response_data ); |
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | 76 | public function cleanup_job(JobParameters $job_parameters) { |
77 | 77 | $this->_file_helper->delete( |
78 | - \EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ), |
|
78 | + \EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')), |
|
79 | 79 | true, |
80 | 80 | 'd' |
81 | 81 | ); |
82 | - return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) ); |
|
82 | + return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso')); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | public function count_units_to_process() { |
86 | - return \EEM_Attendee::instance()->count( array( 'caps' => \EEM_Base::caps_read_admin )); |
|
86 | + return \EEM_Attendee::instance()->count(array('caps' => \EEM_Base::caps_read_admin)); |
|
87 | 87 | } |
88 | - public function get_csv_data( $offset, $limit ) { |
|
88 | + public function get_csv_data($offset, $limit) { |
|
89 | 89 | $attendee_rows = \EEM_Attendee::instance()->get_all_wpdb_results( |
90 | 90 | array( |
91 | - 'limit' => array( $offset, $limit ), |
|
92 | - 'force_join' => array( 'State', 'Country' ), |
|
91 | + 'limit' => array($offset, $limit), |
|
92 | + 'force_join' => array('State', 'Country'), |
|
93 | 93 | 'caps' => \EEM_Base::caps_read_admin |
94 | 94 | ) |
95 | 95 | ); |
96 | 96 | $csv_data = array(); |
97 | - foreach( $attendee_rows as $attendee_row ){ |
|
97 | + foreach ($attendee_rows as $attendee_row) { |
|
98 | 98 | $csv_row = array(); |
99 | - foreach( \EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){ |
|
100 | - if( $field_name == 'STA_ID' ){ |
|
101 | - $state_name_field = \EEM_State::instance()->field_settings_for( 'STA_name' ); |
|
102 | - $csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ]; |
|
103 | - }elseif( $field_name == 'CNT_ISO' ){ |
|
104 | - $country_name_field = \EEM_Country::instance()->field_settings_for( 'CNT_name' ); |
|
105 | - $csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ]; |
|
106 | - }else{ |
|
107 | - $csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ]; |
|
99 | + foreach (\EEM_Attendee::instance()->field_settings() as $field_name => $field_obj) { |
|
100 | + if ($field_name == 'STA_ID') { |
|
101 | + $state_name_field = \EEM_State::instance()->field_settings_for('STA_name'); |
|
102 | + $csv_row[__('State', 'event_espresso')] = $attendee_row[$state_name_field->get_qualified_column()]; |
|
103 | + }elseif ($field_name == 'CNT_ISO') { |
|
104 | + $country_name_field = \EEM_Country::instance()->field_settings_for('CNT_name'); |
|
105 | + $csv_row[__('Country', 'event_espresso')] = $attendee_row[$country_name_field->get_qualified_column()]; |
|
106 | + } else { |
|
107 | + $csv_row[$field_obj->get_nicename()] = $attendee_row[$field_obj->get_qualified_column()]; |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | $csv_data[] = $csv_row; |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | * @param int | \EE_Event $event |
28 | 28 | * @return bool |
29 | 29 | */ |
30 | -function is_espresso_event( $event = NULL ) { |
|
31 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
30 | +function is_espresso_event($event = NULL) { |
|
31 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
32 | 32 | // extract EE_Event object from passed param regardless of what it is (within reason of course) |
33 | - $event = EEH_Event_View::get_event( $event ); |
|
33 | + $event = EEH_Event_View::get_event($event); |
|
34 | 34 | // do we have a valid event ? |
35 | - return $event instanceof EE_Event ? TRUE : FALSE; |
|
35 | + return $event instanceof EE_Event ? TRUE : FALSE; |
|
36 | 36 | } |
37 | 37 | return FALSE; |
38 | 38 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @return bool |
45 | 45 | */ |
46 | 46 | function is_espresso_event_single() { |
47 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
47 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
48 | 48 | global $wp_query; |
49 | 49 | // return conditionals set by CPTs |
50 | 50 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_single : FALSE; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @return bool |
60 | 60 | */ |
61 | 61 | function is_espresso_event_archive() { |
62 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
62 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
63 | 63 | global $wp_query; |
64 | 64 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_archive : FALSE; |
65 | 65 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return bool |
74 | 74 | */ |
75 | 75 | function is_espresso_event_taxonomy() { |
76 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
76 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
77 | 77 | global $wp_query; |
78 | 78 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_taxonomy : FALSE; |
79 | 79 | } |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | * @param int | \EE_Venue $venue |
88 | 88 | * @return bool |
89 | 89 | */ |
90 | -function is_espresso_venue( $venue = NULL ) { |
|
91 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
90 | +function is_espresso_venue($venue = NULL) { |
|
91 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
92 | 92 | // extract EE_Venue object from passed param regardless of what it is (within reason of course) |
93 | - $venue = EEH_Venue_View::get_venue( $venue, FALSE ); |
|
93 | + $venue = EEH_Venue_View::get_venue($venue, FALSE); |
|
94 | 94 | // do we have a valid event ? |
95 | 95 | return $venue instanceof EE_Venue ? TRUE : FALSE; |
96 | 96 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @return bool |
105 | 105 | */ |
106 | 106 | function is_espresso_venue_single() { |
107 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
107 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
108 | 108 | global $wp_query; |
109 | 109 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_single : FALSE; |
110 | 110 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @return bool |
119 | 119 | */ |
120 | 120 | function is_espresso_venue_archive() { |
121 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
121 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
122 | 122 | global $wp_query; |
123 | 123 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_archive : FALSE; |
124 | 124 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @return bool |
133 | 133 | */ |
134 | 134 | function is_espresso_venue_taxonomy() { |
135 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
135 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
136 | 136 | global $wp_query; |
137 | 137 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_taxonomy : FALSE; |
138 | 138 | } |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | * @param $conditional_tag |
147 | 147 | * @return bool |
148 | 148 | */ |
149 | -function can_use_espresso_conditionals( $conditional_tag ) { |
|
150 | - if ( ! did_action( 'AHEE__EE_System__initialize' )) { |
|
149 | +function can_use_espresso_conditionals($conditional_tag) { |
|
150 | + if ( ! did_action('AHEE__EE_System__initialize')) { |
|
151 | 151 | EE_Error::doing_it_wrong( |
152 | 152 | __FUNCTION__, |
153 | 153 | sprintf( |
154 | - __( 'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.','event_espresso'), |
|
154 | + __('The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.', 'event_espresso'), |
|
155 | 155 | $conditional_tag |
156 | 156 | ), |
157 | 157 | '4.4.0' |
@@ -166,13 +166,13 @@ discard block |
||
166 | 166 | |
167 | 167 | /*************************** Event Queries ***************************/ |
168 | 168 | |
169 | -if ( ! function_exists( 'espresso_get_events' )) { |
|
169 | +if ( ! function_exists('espresso_get_events')) { |
|
170 | 170 | /** |
171 | 171 | * espresso_get_events |
172 | 172 | * @param array $params |
173 | 173 | * @return array |
174 | 174 | */ |
175 | - function espresso_get_events( $params = array() ) { |
|
175 | + function espresso_get_events($params = array()) { |
|
176 | 176 | //set default params |
177 | 177 | $default_espresso_events_params = array( |
178 | 178 | 'limit' => 10, |
@@ -183,18 +183,18 @@ discard block |
||
183 | 183 | 'sort' => 'ASC' |
184 | 184 | ); |
185 | 185 | // allow the defaults to be filtered |
186 | - $default_espresso_events_params = apply_filters( 'espresso_get_events__default_espresso_events_params', $default_espresso_events_params ); |
|
186 | + $default_espresso_events_params = apply_filters('espresso_get_events__default_espresso_events_params', $default_espresso_events_params); |
|
187 | 187 | // grab params and merge with defaults, then extract |
188 | - $params = array_merge( $default_espresso_events_params, $params ); |
|
188 | + $params = array_merge($default_espresso_events_params, $params); |
|
189 | 189 | // run the query |
190 | - $events_query = new EE_Event_List_Query( $params ); |
|
190 | + $events_query = new EE_Event_List_Query($params); |
|
191 | 191 | // assign results to a variable so we can return it |
192 | 192 | $events = $events_query->have_posts() ? $events_query->posts : array(); |
193 | 193 | // but first reset the query and postdata |
194 | 194 | wp_reset_query(); |
195 | 195 | wp_reset_postdata(); |
196 | 196 | EED_Events_Archive::remove_all_events_archive_filters(); |
197 | - unset( $events_query ); |
|
197 | + unset($events_query); |
|
198 | 198 | return $events; |
199 | 199 | } |
200 | 200 | } |
@@ -208,32 +208,32 @@ discard block |
||
208 | 208 | * espresso_load_ticket_selector |
209 | 209 | */ |
210 | 210 | function espresso_load_ticket_selector() { |
211 | - EE_Registry::instance()->load_file( EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module' ); |
|
211 | + EE_Registry::instance()->load_file(EE_MODULES.'ticket_selector', 'EED_Ticket_Selector', 'module'); |
|
212 | 212 | } |
213 | 213 | |
214 | -if ( ! function_exists( 'espresso_ticket_selector' )) { |
|
214 | +if ( ! function_exists('espresso_ticket_selector')) { |
|
215 | 215 | /** |
216 | 216 | * espresso_ticket_selector |
217 | 217 | * @param null $event |
218 | 218 | */ |
219 | - function espresso_ticket_selector( $event = NULL ) { |
|
220 | - if ( ! apply_filters( 'FHEE_disable_espresso_ticket_selector', FALSE ) ) { |
|
219 | + function espresso_ticket_selector($event = NULL) { |
|
220 | + if ( ! apply_filters('FHEE_disable_espresso_ticket_selector', FALSE)) { |
|
221 | 221 | espresso_load_ticket_selector(); |
222 | - echo EED_Ticket_Selector::display_ticket_selector( $event ); |
|
222 | + echo EED_Ticket_Selector::display_ticket_selector($event); |
|
223 | 223 | } |
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | 227 | |
228 | - if ( ! function_exists( 'espresso_view_details_btn' )) { |
|
228 | + if ( ! function_exists('espresso_view_details_btn')) { |
|
229 | 229 | /** |
230 | 230 | * espresso_view_details_btn |
231 | 231 | * @param null $event |
232 | 232 | */ |
233 | - function espresso_view_details_btn( $event = NULL ) { |
|
234 | - if ( ! apply_filters( 'FHEE_disable_espresso_view_details_btn', FALSE ) ) { |
|
233 | + function espresso_view_details_btn($event = NULL) { |
|
234 | + if ( ! apply_filters('FHEE_disable_espresso_view_details_btn', FALSE)) { |
|
235 | 235 | espresso_load_ticket_selector(); |
236 | - echo EED_Ticket_Selector::display_ticket_selector( $event, TRUE ); |
|
236 | + echo EED_Ticket_Selector::display_ticket_selector($event, TRUE); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | /*************************** EEH_Event_View ***************************/ |
245 | 245 | |
246 | -if ( ! function_exists( 'espresso_load_event_list_assets' )) { |
|
246 | +if ( ! function_exists('espresso_load_event_list_assets')) { |
|
247 | 247 | /** |
248 | 248 | * espresso_load_event_list_assets |
249 | 249 | * ensures that event list styles and scripts are loaded |
@@ -252,13 +252,13 @@ discard block |
||
252 | 252 | */ |
253 | 253 | function espresso_load_event_list_assets() { |
254 | 254 | $event_list = EED_Events_Archive::instance(); |
255 | - add_action( 'AHEE__EE_System__initialize_last', array( $event_list, 'load_event_list_assets' ), 10 ); |
|
256 | - add_filter( 'FHEE_enable_default_espresso_css', '__return_true' ); |
|
255 | + add_action('AHEE__EE_System__initialize_last', array($event_list, 'load_event_list_assets'), 10); |
|
256 | + add_filter('FHEE_enable_default_espresso_css', '__return_true'); |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | |
260 | 260 | |
261 | -if ( ! function_exists( 'espresso_event_reg_button' )) { |
|
261 | +if ( ! function_exists('espresso_event_reg_button')) { |
|
262 | 262 | /** |
263 | 263 | * espresso_event_reg_button |
264 | 264 | * returns the "Register Now" button if event is active, |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | * @param bool $EVT_ID |
271 | 271 | * @return string |
272 | 272 | */ |
273 | - function espresso_event_reg_button( $btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE ) { |
|
274 | - $event_status = EEH_Event_View::event_active_status( $EVT_ID ); |
|
275 | - switch ( $event_status ) { |
|
273 | + function espresso_event_reg_button($btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE) { |
|
274 | + $event_status = EEH_Event_View::event_active_status($EVT_ID); |
|
275 | + switch ($event_status) { |
|
276 | 276 | case EE_Datetime::sold_out : |
277 | 277 | $btn_text = __('Sold Out', 'event_espresso'); |
278 | 278 | $class = 'ee-pink'; |
@@ -288,10 +288,10 @@ discard block |
||
288 | 288 | case EE_Datetime::upcoming : |
289 | 289 | case EE_Datetime::active : |
290 | 290 | default : |
291 | - $btn_text =! empty( $btn_text_if_active ) ? $btn_text_if_active : __( 'Register Now', 'event_espresso' ); |
|
291 | + $btn_text = ! empty($btn_text_if_active) ? $btn_text_if_active : __('Register Now', 'event_espresso'); |
|
292 | 292 | $class = 'ee-green'; |
293 | 293 | } |
294 | - if ( $event_status < 1 && ! empty( $btn_text_if_inactive )) { |
|
294 | + if ($event_status < 1 && ! empty($btn_text_if_inactive)) { |
|
295 | 295 | $btn_text = $btn_text_if_inactive; |
296 | 296 | $class = 'ee-grey'; |
297 | 297 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | |
306 | 306 | |
307 | 307 | |
308 | -if ( ! function_exists( 'espresso_display_ticket_selector' )) { |
|
308 | +if ( ! function_exists('espresso_display_ticket_selector')) { |
|
309 | 309 | /** |
310 | 310 | * espresso_display_ticket_selector |
311 | 311 | * whether or not to display the Ticket Selector for an event |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | * @param bool $EVT_ID |
314 | 314 | * @return boolean |
315 | 315 | */ |
316 | - function espresso_display_ticket_selector( $EVT_ID = FALSE ) { |
|
317 | - return EEH_Event_View::display_ticket_selector( $EVT_ID ); |
|
316 | + function espresso_display_ticket_selector($EVT_ID = FALSE) { |
|
317 | + return EEH_Event_View::display_ticket_selector($EVT_ID); |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | |
321 | 321 | |
322 | 322 | |
323 | -if ( ! function_exists( 'espresso_event_status_banner' )) { |
|
323 | +if ( ! function_exists('espresso_event_status_banner')) { |
|
324 | 324 | /** |
325 | 325 | * espresso_event_status |
326 | 326 | * returns a banner showing the event status if it is sold out, expired, or inactive |
@@ -328,13 +328,13 @@ discard block |
||
328 | 328 | * @param bool $EVT_ID |
329 | 329 | * @return string |
330 | 330 | */ |
331 | - function espresso_event_status_banner( $EVT_ID = FALSE ) { |
|
332 | - return EEH_Event_View::event_status( $EVT_ID ); |
|
331 | + function espresso_event_status_banner($EVT_ID = FALSE) { |
|
332 | + return EEH_Event_View::event_status($EVT_ID); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | |
336 | 336 | |
337 | -if ( ! function_exists( 'espresso_event_status' )) { |
|
337 | +if ( ! function_exists('espresso_event_status')) { |
|
338 | 338 | /** |
339 | 339 | * espresso_event_status |
340 | 340 | * returns the event status if it is sold out, expired, or inactive |
@@ -343,17 +343,17 @@ discard block |
||
343 | 343 | * @param bool $echo |
344 | 344 | * @return string |
345 | 345 | */ |
346 | - function espresso_event_status( $EVT_ID = 0, $echo = TRUE ) { |
|
347 | - if ( $echo ) { |
|
348 | - echo EEH_Event_View::event_active_status( $EVT_ID ); |
|
346 | + function espresso_event_status($EVT_ID = 0, $echo = TRUE) { |
|
347 | + if ($echo) { |
|
348 | + echo EEH_Event_View::event_active_status($EVT_ID); |
|
349 | 349 | return ''; |
350 | 350 | } |
351 | - return EEH_Event_View::event_active_status( $EVT_ID ); |
|
351 | + return EEH_Event_View::event_active_status($EVT_ID); |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | |
355 | 355 | |
356 | -if ( ! function_exists( 'espresso_event_categories' )) { |
|
356 | +if ( ! function_exists('espresso_event_categories')) { |
|
357 | 357 | /** |
358 | 358 | * espresso_event_categories |
359 | 359 | * returns the terms associated with an event |
@@ -363,17 +363,17 @@ discard block |
||
363 | 363 | * @param bool $echo |
364 | 364 | * @return string |
365 | 365 | */ |
366 | - function espresso_event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE ) { |
|
367 | - if ( $echo ) { |
|
368 | - echo EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized ); |
|
366 | + function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) { |
|
367 | + if ($echo) { |
|
368 | + echo EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
369 | 369 | return ''; |
370 | 370 | } |
371 | - return EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized ); |
|
371 | + return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
372 | 372 | } |
373 | 373 | } |
374 | 374 | |
375 | 375 | |
376 | -if ( ! function_exists( 'espresso_event_tickets_available' )) { |
|
376 | +if ( ! function_exists('espresso_event_tickets_available')) { |
|
377 | 377 | /** |
378 | 378 | * espresso_event_tickets_available |
379 | 379 | * returns the ticket types available for purchase for an event |
@@ -383,26 +383,26 @@ discard block |
||
383 | 383 | * @param bool $format |
384 | 384 | * @return string |
385 | 385 | */ |
386 | - function espresso_event_tickets_available( $EVT_ID = 0, $echo = TRUE, $format = TRUE ) { |
|
387 | - $tickets = EEH_Event_View::event_tickets_available( $EVT_ID ); |
|
388 | - if ( is_array( $tickets ) && ! empty( $tickets )) { |
|
386 | + function espresso_event_tickets_available($EVT_ID = 0, $echo = TRUE, $format = TRUE) { |
|
387 | + $tickets = EEH_Event_View::event_tickets_available($EVT_ID); |
|
388 | + if (is_array($tickets) && ! empty($tickets)) { |
|
389 | 389 | // if formatting then $html will be a string, else it will be an array of ticket objects |
390 | - $html = $format ? '<ul id="ee-event-tickets-ul-' . $EVT_ID . '" class="ee-event-tickets-ul">' : array(); |
|
391 | - foreach ( $tickets as $ticket ) { |
|
392 | - if ( $ticket instanceof EE_Ticket ) { |
|
393 | - if ( $format ) { |
|
394 | - $html .= '<li id="ee-event-tickets-li-' . $ticket->ID() . '" class="ee-event-tickets-li">'; |
|
395 | - $html .= $ticket->name() . ' ' . EEH_Template::format_currency( $ticket->get_ticket_total_with_taxes() ); |
|
390 | + $html = $format ? '<ul id="ee-event-tickets-ul-'.$EVT_ID.'" class="ee-event-tickets-ul">' : array(); |
|
391 | + foreach ($tickets as $ticket) { |
|
392 | + if ($ticket instanceof EE_Ticket) { |
|
393 | + if ($format) { |
|
394 | + $html .= '<li id="ee-event-tickets-li-'.$ticket->ID().'" class="ee-event-tickets-li">'; |
|
395 | + $html .= $ticket->name().' '.EEH_Template::format_currency($ticket->get_ticket_total_with_taxes()); |
|
396 | 396 | $html .= '</li>'; |
397 | 397 | } else { |
398 | 398 | $html[] = $ticket; |
399 | 399 | } |
400 | 400 | } |
401 | 401 | } |
402 | - if ( $format ) { |
|
402 | + if ($format) { |
|
403 | 403 | $html .= '</ul>'; |
404 | 404 | } |
405 | - if ( $echo && ! $format ) { |
|
405 | + if ($echo && ! $format) { |
|
406 | 406 | echo $html; |
407 | 407 | return ''; |
408 | 408 | } |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | } |
413 | 413 | } |
414 | 414 | |
415 | -if ( ! function_exists( 'espresso_event_date_obj' )) { |
|
415 | +if ( ! function_exists('espresso_event_date_obj')) { |
|
416 | 416 | /** |
417 | 417 | * espresso_event_date_obj |
418 | 418 | * returns the primary date object for an event |
@@ -420,13 +420,13 @@ discard block |
||
420 | 420 | * @param bool $EVT_ID |
421 | 421 | * @return object |
422 | 422 | */ |
423 | - function espresso_event_date_obj( $EVT_ID = FALSE ) { |
|
424 | - return EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
423 | + function espresso_event_date_obj($EVT_ID = FALSE) { |
|
424 | + return EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
425 | 425 | } |
426 | 426 | } |
427 | 427 | |
428 | 428 | |
429 | -if ( ! function_exists( 'espresso_event_date' )) { |
|
429 | +if ( ! function_exists('espresso_event_date')) { |
|
430 | 430 | /** |
431 | 431 | * espresso_event_date |
432 | 432 | * returns the primary date for an event |
@@ -437,22 +437,22 @@ discard block |
||
437 | 437 | * @param bool $echo |
438 | 438 | * @return string |
439 | 439 | */ |
440 | - function espresso_event_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
441 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
442 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
443 | - $date_format = apply_filters( 'FHEE__espresso_event_date__date_format', $date_format ); |
|
444 | - $time_format = apply_filters( 'FHEE__espresso_event_date__time_format', $time_format ); |
|
445 | - if($echo){ |
|
446 | - echo EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID ); |
|
440 | + function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
441 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
442 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
443 | + $date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format); |
|
444 | + $time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format); |
|
445 | + if ($echo) { |
|
446 | + echo EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
447 | 447 | return ''; |
448 | 448 | } |
449 | - return EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID ); |
|
449 | + return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
450 | 450 | |
451 | 451 | } |
452 | 452 | } |
453 | 453 | |
454 | 454 | |
455 | -if ( ! function_exists( 'espresso_list_of_event_dates' )) { |
|
455 | +if ( ! function_exists('espresso_list_of_event_dates')) { |
|
456 | 456 | /** |
457 | 457 | * espresso_list_of_event_dates |
458 | 458 | * returns a unordered list of dates for an event |
@@ -467,40 +467,40 @@ discard block |
||
467 | 467 | * @param null $limit |
468 | 468 | * @return string |
469 | 469 | */ |
470 | - function espresso_list_of_event_dates( $EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL ) { |
|
471 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
472 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
473 | - $date_format = apply_filters( 'FHEE__espresso_list_of_event_dates__date_format', $date_format ); |
|
474 | - $time_format = apply_filters( 'FHEE__espresso_list_of_event_dates__time_format', $time_format ); |
|
475 | - $datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, $show_expired, FALSE, $limit ); |
|
476 | - if ( ! $format ) { |
|
477 | - return apply_filters( 'FHEE__espresso_list_of_event_dates__datetimes', $datetimes ); |
|
470 | + function espresso_list_of_event_dates($EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL) { |
|
471 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
472 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
473 | + $date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format); |
|
474 | + $time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format); |
|
475 | + $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, FALSE, $limit); |
|
476 | + if ( ! $format) { |
|
477 | + return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes); |
|
478 | 478 | } |
479 | 479 | //d( $datetimes ); |
480 | - if ( is_array( $datetimes ) && ! empty( $datetimes )) { |
|
480 | + if (is_array($datetimes) && ! empty($datetimes)) { |
|
481 | 481 | global $post; |
482 | - $html = $format ? '<ul id="ee-event-datetimes-ul-' . $post->ID . '" class="ee-event-datetimes-ul ee-clearfix">' : ''; |
|
483 | - foreach ( $datetimes as $datetime ) { |
|
484 | - if ( $datetime instanceof EE_Datetime ) { |
|
485 | - $html .= '<li id="ee-event-datetimes-li-' . $datetime->ID(); |
|
486 | - $html .= '" class="ee-event-datetimes-li ee-event-datetimes-li-' . $datetime->get_active_status() . '">'; |
|
482 | + $html = $format ? '<ul id="ee-event-datetimes-ul-'.$post->ID.'" class="ee-event-datetimes-ul ee-clearfix">' : ''; |
|
483 | + foreach ($datetimes as $datetime) { |
|
484 | + if ($datetime instanceof EE_Datetime) { |
|
485 | + $html .= '<li id="ee-event-datetimes-li-'.$datetime->ID(); |
|
486 | + $html .= '" class="ee-event-datetimes-li ee-event-datetimes-li-'.$datetime->get_active_status().'">'; |
|
487 | 487 | $datetime_name = $datetime->name(); |
488 | - $html .= ! empty( $datetime_name ) ? '<strong>' . $datetime_name . '</strong>' : ''; |
|
489 | - $html .= ! empty( $datetime_name ) && $add_breaks ? '<br />' : ''; |
|
490 | - $html .= '<span class="dashicons dashicons-calendar"></span>' . $datetime->date_range( $date_format ) . '<br/>'; |
|
491 | - $html .= '<span class="dashicons dashicons-clock"></span>' . $datetime->time_range( $time_format ); |
|
488 | + $html .= ! empty($datetime_name) ? '<strong>'.$datetime_name.'</strong>' : ''; |
|
489 | + $html .= ! empty($datetime_name) && $add_breaks ? '<br />' : ''; |
|
490 | + $html .= '<span class="dashicons dashicons-calendar"></span>'.$datetime->date_range($date_format).'<br/>'; |
|
491 | + $html .= '<span class="dashicons dashicons-clock"></span>'.$datetime->time_range($time_format); |
|
492 | 492 | $datetime_description = $datetime->description(); |
493 | - $html .= ! empty( $datetime_description ) && $add_breaks ? '<br />' : ''; |
|
494 | - $html .= ! empty( $datetime_description ) ? ' - ' . $datetime_description : ''; |
|
495 | - $html = apply_filters( 'FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime ); |
|
493 | + $html .= ! empty($datetime_description) && $add_breaks ? '<br />' : ''; |
|
494 | + $html .= ! empty($datetime_description) ? ' - '.$datetime_description : ''; |
|
495 | + $html = apply_filters('FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime); |
|
496 | 496 | $html .= '</li>'; |
497 | 497 | } |
498 | 498 | } |
499 | 499 | $html .= $format ? '</ul>' : ''; |
500 | 500 | } else { |
501 | - $html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>' . __( 'There are no upcoming dates for this event.', 'event_espresso' ) . '</p><br/>' : ''; |
|
501 | + $html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>'.__('There are no upcoming dates for this event.', 'event_espresso').'</p><br/>' : ''; |
|
502 | 502 | } |
503 | - if ( $echo ) { |
|
503 | + if ($echo) { |
|
504 | 504 | echo $html; |
505 | 505 | return ''; |
506 | 506 | } |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | } |
510 | 510 | |
511 | 511 | |
512 | -if ( ! function_exists( 'espresso_event_end_date' )) { |
|
512 | +if ( ! function_exists('espresso_event_end_date')) { |
|
513 | 513 | /** |
514 | 514 | * espresso_event_end_date |
515 | 515 | * returns the last date for an event |
@@ -520,20 +520,20 @@ discard block |
||
520 | 520 | * @param bool $echo |
521 | 521 | * @return string |
522 | 522 | */ |
523 | - function espresso_event_end_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
524 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
525 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
526 | - $date_format = apply_filters( 'FHEE__espresso_event_end_date__date_format', $date_format ); |
|
527 | - $time_format = apply_filters( 'FHEE__espresso_event_end_date__time_format', $time_format ); |
|
528 | - if($echo){ |
|
529 | - echo EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID ); |
|
523 | + function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
524 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
525 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
526 | + $date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format); |
|
527 | + $time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format); |
|
528 | + if ($echo) { |
|
529 | + echo EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
530 | 530 | return ''; |
531 | 531 | } |
532 | - return EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID ); |
|
532 | + return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
533 | 533 | } |
534 | 534 | } |
535 | 535 | |
536 | -if ( ! function_exists( 'espresso_event_date_range' )) { |
|
536 | +if ( ! function_exists('espresso_event_date_range')) { |
|
537 | 537 | /** |
538 | 538 | * espresso_event_date_range |
539 | 539 | * returns the first and last chronologically ordered dates for an event (if different) |
@@ -545,31 +545,31 @@ discard block |
||
545 | 545 | * @param bool $EVT_ID |
546 | 546 | * @return string |
547 | 547 | */ |
548 | - function espresso_event_date_range( $date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
548 | + function espresso_event_date_range($date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
549 | 549 | // set and filter date and time formats when a range is returned |
550 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
551 | - $date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', $date_format ); |
|
550 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
551 | + $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format); |
|
552 | 552 | // get the start and end date with NO time portion |
553 | - $the_event_date = EEH_Event_View::the_earliest_event_date( $date_format, '', $EVT_ID ); |
|
554 | - $the_event_end_date = EEH_Event_View::the_latest_event_date( $date_format, '', $EVT_ID ); |
|
553 | + $the_event_date = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID); |
|
554 | + $the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID); |
|
555 | 555 | // now we can determine if date range spans more than one day |
556 | - if ( $the_event_date != $the_event_end_date ) { |
|
557 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
558 | - $time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', $time_format ); |
|
556 | + if ($the_event_date != $the_event_end_date) { |
|
557 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
558 | + $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format); |
|
559 | 559 | $html = sprintf( |
560 | - __( '%1$s - %2$s', 'event_espresso' ), |
|
561 | - EEH_Event_View::the_earliest_event_date( $date_format, $time_format, $EVT_ID ), |
|
562 | - EEH_Event_View::the_latest_event_date( $date_format, $time_format, $EVT_ID ) |
|
560 | + __('%1$s - %2$s', 'event_espresso'), |
|
561 | + EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID), |
|
562 | + EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID) |
|
563 | 563 | ); |
564 | 564 | } else { |
565 | 565 | // set and filter date and time formats when only a single datetime is returned |
566 | - $single_date_format = ! empty( $single_date_format ) ? $single_date_format : get_option( 'date_format' ); |
|
567 | - $single_time_format = ! empty( $single_time_format ) ? $single_time_format : get_option( 'time_format' ); |
|
568 | - $single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', $single_date_format ); |
|
569 | - $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', $single_time_format ); |
|
570 | - $html = EEH_Event_View::the_earliest_event_date( $single_date_format, $single_time_format, $EVT_ID ); |
|
566 | + $single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format'); |
|
567 | + $single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format'); |
|
568 | + $single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format); |
|
569 | + $single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format); |
|
570 | + $html = EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID); |
|
571 | 571 | } |
572 | - if ( $echo ) { |
|
572 | + if ($echo) { |
|
573 | 573 | echo $html; |
574 | 574 | return ''; |
575 | 575 | } |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | } |
579 | 579 | |
580 | 580 | |
581 | -if ( ! function_exists( 'espresso_event_date_as_calendar_page' )) { |
|
581 | +if ( ! function_exists('espresso_event_date_as_calendar_page')) { |
|
582 | 582 | /** |
583 | 583 | * espresso_event_date_as_calendar_page |
584 | 584 | * returns the primary date for an event, stylized to appear as the page of a calendar |
@@ -586,15 +586,15 @@ discard block |
||
586 | 586 | * @param bool $EVT_ID |
587 | 587 | * @return string |
588 | 588 | */ |
589 | - function espresso_event_date_as_calendar_page( $EVT_ID = FALSE ) { |
|
590 | - EEH_Event_View::event_date_as_calendar_page( $EVT_ID ); |
|
589 | + function espresso_event_date_as_calendar_page($EVT_ID = FALSE) { |
|
590 | + EEH_Event_View::event_date_as_calendar_page($EVT_ID); |
|
591 | 591 | } |
592 | 592 | } |
593 | 593 | |
594 | 594 | |
595 | 595 | |
596 | 596 | |
597 | -if ( ! function_exists( 'espresso_event_link_url' )) { |
|
597 | +if ( ! function_exists('espresso_event_link_url')) { |
|
598 | 598 | /** |
599 | 599 | * espresso_event_link_url |
600 | 600 | * |
@@ -602,18 +602,18 @@ discard block |
||
602 | 602 | * @param bool $echo |
603 | 603 | * @return string |
604 | 604 | */ |
605 | - function espresso_event_link_url( $EVT_ID = 0, $echo = TRUE ) { |
|
606 | - if ( $echo ) { |
|
607 | - echo EEH_Event_View::event_link_url( $EVT_ID ); |
|
605 | + function espresso_event_link_url($EVT_ID = 0, $echo = TRUE) { |
|
606 | + if ($echo) { |
|
607 | + echo EEH_Event_View::event_link_url($EVT_ID); |
|
608 | 608 | return ''; |
609 | 609 | } |
610 | - return EEH_Event_View::event_link_url( $EVT_ID ); |
|
610 | + return EEH_Event_View::event_link_url($EVT_ID); |
|
611 | 611 | } |
612 | 612 | } |
613 | 613 | |
614 | 614 | |
615 | 615 | |
616 | -if ( ! function_exists( 'espresso_event_has_content_or_excerpt' )) { |
|
616 | +if ( ! function_exists('espresso_event_has_content_or_excerpt')) { |
|
617 | 617 | /** |
618 | 618 | * espresso_event_has_content_or_excerpt |
619 | 619 | * |
@@ -621,15 +621,15 @@ discard block |
||
621 | 621 | * @param bool $EVT_ID |
622 | 622 | * @return boolean |
623 | 623 | */ |
624 | - function espresso_event_has_content_or_excerpt( $EVT_ID = FALSE ) { |
|
625 | - return EEH_Event_View::event_has_content_or_excerpt( $EVT_ID ); |
|
624 | + function espresso_event_has_content_or_excerpt($EVT_ID = FALSE) { |
|
625 | + return EEH_Event_View::event_has_content_or_excerpt($EVT_ID); |
|
626 | 626 | } |
627 | 627 | } |
628 | 628 | |
629 | 629 | |
630 | 630 | |
631 | 631 | |
632 | -if ( ! function_exists( 'espresso_event_content_or_excerpt' )) { |
|
632 | +if ( ! function_exists('espresso_event_content_or_excerpt')) { |
|
633 | 633 | /** |
634 | 634 | * espresso_event_content_or_excerpt |
635 | 635 | * |
@@ -638,18 +638,18 @@ discard block |
||
638 | 638 | * @param bool $echo |
639 | 639 | * @return string |
640 | 640 | */ |
641 | - function espresso_event_content_or_excerpt( $num_words = 55, $more = NULL, $echo = TRUE ) { |
|
642 | - if ( $echo ) { |
|
643 | - echo EEH_Event_View::event_content_or_excerpt( $num_words, $more ); |
|
641 | + function espresso_event_content_or_excerpt($num_words = 55, $more = NULL, $echo = TRUE) { |
|
642 | + if ($echo) { |
|
643 | + echo EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
644 | 644 | return ''; |
645 | 645 | } |
646 | - return EEH_Event_View::event_content_or_excerpt( $num_words, $more ); |
|
646 | + return EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
647 | 647 | } |
648 | 648 | } |
649 | 649 | |
650 | 650 | |
651 | 651 | |
652 | -if ( ! function_exists( 'espresso_event_phone' )) { |
|
652 | +if ( ! function_exists('espresso_event_phone')) { |
|
653 | 653 | /** |
654 | 654 | * espresso_event_phone |
655 | 655 | * |
@@ -657,18 +657,18 @@ discard block |
||
657 | 657 | * @param bool $echo |
658 | 658 | * @return string |
659 | 659 | */ |
660 | - function espresso_event_phone( $EVT_ID = 0, $echo = TRUE ) { |
|
661 | - if ( $echo ) { |
|
662 | - echo EEH_Event_View::event_phone( $EVT_ID ); |
|
660 | + function espresso_event_phone($EVT_ID = 0, $echo = TRUE) { |
|
661 | + if ($echo) { |
|
662 | + echo EEH_Event_View::event_phone($EVT_ID); |
|
663 | 663 | return ''; |
664 | 664 | } |
665 | - return EEH_Event_View::event_phone( $EVT_ID ); |
|
665 | + return EEH_Event_View::event_phone($EVT_ID); |
|
666 | 666 | } |
667 | 667 | } |
668 | 668 | |
669 | 669 | |
670 | 670 | |
671 | -if ( ! function_exists( 'espresso_edit_event_link' )) { |
|
671 | +if ( ! function_exists('espresso_edit_event_link')) { |
|
672 | 672 | /** |
673 | 673 | * espresso_edit_event_link |
674 | 674 | * returns a link to edit an event |
@@ -677,39 +677,39 @@ discard block |
||
677 | 677 | * @param bool $echo |
678 | 678 | * @return string |
679 | 679 | */ |
680 | - function espresso_edit_event_link( $EVT_ID = 0, $echo = TRUE ) { |
|
681 | - if ( $echo ) { |
|
682 | - echo EEH_Event_View::edit_event_link( $EVT_ID ); |
|
680 | + function espresso_edit_event_link($EVT_ID = 0, $echo = TRUE) { |
|
681 | + if ($echo) { |
|
682 | + echo EEH_Event_View::edit_event_link($EVT_ID); |
|
683 | 683 | return ''; |
684 | 684 | } |
685 | - return EEH_Event_View::edit_event_link( $EVT_ID ); |
|
685 | + return EEH_Event_View::edit_event_link($EVT_ID); |
|
686 | 686 | } |
687 | 687 | } |
688 | 688 | |
689 | 689 | |
690 | -if ( ! function_exists( 'espresso_organization_name' )) { |
|
690 | +if ( ! function_exists('espresso_organization_name')) { |
|
691 | 691 | /** |
692 | 692 | * espresso_organization_name |
693 | 693 | * @param bool $echo |
694 | 694 | * @return string |
695 | 695 | */ |
696 | 696 | function espresso_organization_name($echo = TRUE) { |
697 | - if($echo){ |
|
698 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
697 | + if ($echo) { |
|
698 | + echo EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
699 | 699 | return ''; |
700 | 700 | } |
701 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
701 | + return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
702 | 702 | } |
703 | 703 | } |
704 | 704 | |
705 | -if ( ! function_exists( 'espresso_organization_address' )) { |
|
705 | +if ( ! function_exists('espresso_organization_address')) { |
|
706 | 706 | /** |
707 | 707 | * espresso_organization_address |
708 | 708 | * @param string $type |
709 | 709 | * @return string |
710 | 710 | */ |
711 | - function espresso_organization_address( $type = 'inline' ) { |
|
712 | - if ( EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ) { |
|
711 | + function espresso_organization_address($type = 'inline') { |
|
712 | + if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) { |
|
713 | 713 | $address = new EventEspresso\core\entities\GenericAddress( |
714 | 714 | EE_Registry::instance()->CFG->organization->address_1, |
715 | 715 | EE_Registry::instance()->CFG->organization->address_2, |
@@ -718,129 +718,129 @@ discard block |
||
718 | 718 | EE_Registry::instance()->CFG->organization->zip, |
719 | 719 | EE_Registry::instance()->CFG->organization->CNT_ISO |
720 | 720 | ); |
721 | - return EEH_Address::format( $address, $type ); |
|
721 | + return EEH_Address::format($address, $type); |
|
722 | 722 | } |
723 | 723 | return ''; |
724 | 724 | } |
725 | 725 | } |
726 | 726 | |
727 | -if ( ! function_exists( 'espresso_organization_email' )) { |
|
727 | +if ( ! function_exists('espresso_organization_email')) { |
|
728 | 728 | /** |
729 | 729 | * espresso_organization_email |
730 | 730 | * @param bool $echo |
731 | 731 | * @return string |
732 | 732 | */ |
733 | - function espresso_organization_email( $echo = TRUE ) { |
|
734 | - if($echo){ |
|
735 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
733 | + function espresso_organization_email($echo = TRUE) { |
|
734 | + if ($echo) { |
|
735 | + echo EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
736 | 736 | return ''; |
737 | 737 | } |
738 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
738 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
739 | 739 | } |
740 | 740 | } |
741 | 741 | |
742 | -if ( ! function_exists( 'espresso_organization_logo_url' )) { |
|
742 | +if ( ! function_exists('espresso_organization_logo_url')) { |
|
743 | 743 | /** |
744 | 744 | * espresso_organization_logo_url |
745 | 745 | * @param bool $echo |
746 | 746 | * @return string |
747 | 747 | */ |
748 | - function espresso_organization_logo_url( $echo = TRUE ) { |
|
749 | - if($echo){ |
|
750 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
748 | + function espresso_organization_logo_url($echo = TRUE) { |
|
749 | + if ($echo) { |
|
750 | + echo EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
751 | 751 | return ''; |
752 | 752 | } |
753 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
753 | + return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
754 | 754 | } |
755 | 755 | } |
756 | 756 | |
757 | -if ( ! function_exists( 'espresso_organization_facebook' )) { |
|
757 | +if ( ! function_exists('espresso_organization_facebook')) { |
|
758 | 758 | /** |
759 | 759 | * espresso_organization_facebook |
760 | 760 | * @param bool $echo |
761 | 761 | * @return string |
762 | 762 | */ |
763 | - function espresso_organization_facebook( $echo = TRUE ) { |
|
764 | - if($echo){ |
|
765 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
763 | + function espresso_organization_facebook($echo = TRUE) { |
|
764 | + if ($echo) { |
|
765 | + echo EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
766 | 766 | return ''; |
767 | 767 | } |
768 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
768 | + return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
769 | 769 | } |
770 | 770 | } |
771 | 771 | |
772 | -if ( ! function_exists( 'espresso_organization_twitter' )) { |
|
772 | +if ( ! function_exists('espresso_organization_twitter')) { |
|
773 | 773 | /** |
774 | 774 | * espresso_organization_twitter |
775 | 775 | * @param bool $echo |
776 | 776 | * @return string |
777 | 777 | */ |
778 | - function espresso_organization_twitter( $echo = TRUE ) { |
|
779 | - if($echo){ |
|
780 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
778 | + function espresso_organization_twitter($echo = TRUE) { |
|
779 | + if ($echo) { |
|
780 | + echo EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
781 | 781 | return ''; |
782 | 782 | } |
783 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
783 | + return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
784 | 784 | } |
785 | 785 | } |
786 | 786 | |
787 | -if ( ! function_exists( 'espresso_organization_linkedin' )) { |
|
787 | +if ( ! function_exists('espresso_organization_linkedin')) { |
|
788 | 788 | /** |
789 | 789 | * espresso_organization_linkedin |
790 | 790 | * @param bool $echo |
791 | 791 | * @return string |
792 | 792 | */ |
793 | - function espresso_organization_linkedin( $echo = TRUE ) { |
|
794 | - if($echo){ |
|
795 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
793 | + function espresso_organization_linkedin($echo = TRUE) { |
|
794 | + if ($echo) { |
|
795 | + echo EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
796 | 796 | return ''; |
797 | 797 | } |
798 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
798 | + return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
799 | 799 | } |
800 | 800 | } |
801 | 801 | |
802 | -if ( ! function_exists( 'espresso_organization_pinterest' )) { |
|
802 | +if ( ! function_exists('espresso_organization_pinterest')) { |
|
803 | 803 | /** |
804 | 804 | * espresso_organization_pinterest |
805 | 805 | * @param bool $echo |
806 | 806 | * @return string |
807 | 807 | */ |
808 | - function espresso_organization_pinterest( $echo = TRUE ) { |
|
809 | - if($echo){ |
|
810 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
808 | + function espresso_organization_pinterest($echo = TRUE) { |
|
809 | + if ($echo) { |
|
810 | + echo EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
811 | 811 | return ''; |
812 | 812 | } |
813 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
813 | + return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
814 | 814 | } |
815 | 815 | } |
816 | 816 | |
817 | -if ( ! function_exists( 'espresso_organization_google' )) { |
|
817 | +if ( ! function_exists('espresso_organization_google')) { |
|
818 | 818 | /** |
819 | 819 | * espresso_organization_google |
820 | 820 | * @param bool $echo |
821 | 821 | * @return string |
822 | 822 | */ |
823 | - function espresso_organization_google( $echo = TRUE ) { |
|
824 | - if($echo){ |
|
825 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
823 | + function espresso_organization_google($echo = TRUE) { |
|
824 | + if ($echo) { |
|
825 | + echo EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
826 | 826 | return ''; |
827 | 827 | } |
828 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
828 | + return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
829 | 829 | } |
830 | 830 | } |
831 | 831 | |
832 | -if ( ! function_exists( 'espresso_organization_instagram' )) { |
|
832 | +if ( ! function_exists('espresso_organization_instagram')) { |
|
833 | 833 | /** |
834 | 834 | * espresso_organization_instagram |
835 | 835 | * @param bool $echo |
836 | 836 | * @return string |
837 | 837 | */ |
838 | - function espresso_organization_instagram( $echo = TRUE ) { |
|
839 | - if($echo){ |
|
840 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
838 | + function espresso_organization_instagram($echo = TRUE) { |
|
839 | + if ($echo) { |
|
840 | + echo EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
841 | 841 | return ''; |
842 | 842 | } |
843 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
843 | + return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
844 | 844 | } |
845 | 845 | } |
846 | 846 | |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | |
851 | 851 | |
852 | 852 | |
853 | -if ( ! function_exists( 'espresso_event_venues' )) { |
|
853 | +if ( ! function_exists('espresso_event_venues')) { |
|
854 | 854 | /** |
855 | 855 | * espresso_event_venues |
856 | 856 | * |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | |
865 | 865 | |
866 | 866 | |
867 | -if ( ! function_exists( 'espresso_venue_id' )) { |
|
867 | +if ( ! function_exists('espresso_venue_id')) { |
|
868 | 868 | /** |
869 | 869 | * espresso_venue_name |
870 | 870 | * |
@@ -872,15 +872,15 @@ discard block |
||
872 | 872 | * @param int $EVT_ID |
873 | 873 | * @return string |
874 | 874 | */ |
875 | - function espresso_venue_id( $EVT_ID = 0 ) { |
|
876 | - $venue = EEH_Venue_View::get_venue( $EVT_ID ); |
|
875 | + function espresso_venue_id($EVT_ID = 0) { |
|
876 | + $venue = EEH_Venue_View::get_venue($EVT_ID); |
|
877 | 877 | return $venue instanceof EE_Venue ? $venue->ID() : 0; |
878 | 878 | } |
879 | 879 | } |
880 | 880 | |
881 | 881 | |
882 | 882 | |
883 | -if ( ! function_exists( 'espresso_is_venue_private' ) ) { |
|
883 | +if ( ! function_exists('espresso_is_venue_private')) { |
|
884 | 884 | /** |
885 | 885 | * Return whether a venue is private or not. |
886 | 886 | * @see EEH_Venue_View::get_venue() for more info on expected return results. |
@@ -889,15 +889,15 @@ discard block |
||
889 | 889 | * |
890 | 890 | * @return bool | null |
891 | 891 | */ |
892 | - function espresso_is_venue_private( $VNU_ID = 0 ) { |
|
893 | - return EEH_Venue_View::is_venue_private( $VNU_ID ); |
|
892 | + function espresso_is_venue_private($VNU_ID = 0) { |
|
893 | + return EEH_Venue_View::is_venue_private($VNU_ID); |
|
894 | 894 | } |
895 | 895 | } |
896 | 896 | |
897 | 897 | |
898 | 898 | |
899 | 899 | |
900 | -if ( ! function_exists( 'espresso_venue_name' )) { |
|
900 | +if ( ! function_exists('espresso_venue_name')) { |
|
901 | 901 | /** |
902 | 902 | * espresso_venue_name |
903 | 903 | * |
@@ -907,19 +907,19 @@ discard block |
||
907 | 907 | * @param bool $echo |
908 | 908 | * @return string |
909 | 909 | */ |
910 | - function espresso_venue_name( $VNU_ID = 0, $link_to = 'details', $echo = TRUE ) { |
|
911 | - if($echo){ |
|
912 | - echo EEH_Venue_View::venue_name( $link_to, $VNU_ID ); |
|
910 | + function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = TRUE) { |
|
911 | + if ($echo) { |
|
912 | + echo EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
913 | 913 | return ''; |
914 | 914 | } |
915 | - return EEH_Venue_View::venue_name( $link_to, $VNU_ID ); |
|
915 | + return EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
916 | 916 | } |
917 | 917 | } |
918 | 918 | |
919 | 919 | |
920 | 920 | |
921 | 921 | |
922 | -if ( ! function_exists( 'espresso_venue_link' )) { |
|
922 | +if ( ! function_exists('espresso_venue_link')) { |
|
923 | 923 | /** |
924 | 924 | * espresso_venue_link |
925 | 925 | * |
@@ -928,14 +928,14 @@ discard block |
||
928 | 928 | * @param string $text |
929 | 929 | * @return string |
930 | 930 | */ |
931 | - function espresso_venue_link( $VNU_ID = 0, $text = '' ) { |
|
932 | - return EEH_Venue_View::venue_details_link( $VNU_ID, $text ); |
|
931 | + function espresso_venue_link($VNU_ID = 0, $text = '') { |
|
932 | + return EEH_Venue_View::venue_details_link($VNU_ID, $text); |
|
933 | 933 | } |
934 | 934 | } |
935 | 935 | |
936 | 936 | |
937 | 937 | |
938 | -if ( ! function_exists( 'espresso_venue_description' )) { |
|
938 | +if ( ! function_exists('espresso_venue_description')) { |
|
939 | 939 | /** |
940 | 940 | * espresso_venue_description |
941 | 941 | * |
@@ -944,17 +944,17 @@ discard block |
||
944 | 944 | * @param bool $echo |
945 | 945 | * @return string |
946 | 946 | */ |
947 | - function espresso_venue_description( $VNU_ID = FALSE, $echo = TRUE ) { |
|
948 | - if($echo){ |
|
949 | - echo EEH_Venue_View::venue_description( $VNU_ID ); |
|
947 | + function espresso_venue_description($VNU_ID = FALSE, $echo = TRUE) { |
|
948 | + if ($echo) { |
|
949 | + echo EEH_Venue_View::venue_description($VNU_ID); |
|
950 | 950 | return ''; |
951 | 951 | } |
952 | - return EEH_Venue_View::venue_description( $VNU_ID ); |
|
952 | + return EEH_Venue_View::venue_description($VNU_ID); |
|
953 | 953 | } |
954 | 954 | } |
955 | 955 | |
956 | 956 | |
957 | -if ( ! function_exists( 'espresso_venue_excerpt' )) { |
|
957 | +if ( ! function_exists('espresso_venue_excerpt')) { |
|
958 | 958 | /** |
959 | 959 | * espresso_venue_excerpt |
960 | 960 | * |
@@ -963,18 +963,18 @@ discard block |
||
963 | 963 | * @param bool $echo |
964 | 964 | * @return string |
965 | 965 | */ |
966 | - function espresso_venue_excerpt( $VNU_ID = 0, $echo = TRUE ) { |
|
967 | - if ( $echo ) { |
|
968 | - echo EEH_Venue_View::venue_excerpt( $VNU_ID ); |
|
966 | + function espresso_venue_excerpt($VNU_ID = 0, $echo = TRUE) { |
|
967 | + if ($echo) { |
|
968 | + echo EEH_Venue_View::venue_excerpt($VNU_ID); |
|
969 | 969 | return ''; |
970 | 970 | } |
971 | - return EEH_Venue_View::venue_excerpt( $VNU_ID ); |
|
971 | + return EEH_Venue_View::venue_excerpt($VNU_ID); |
|
972 | 972 | } |
973 | 973 | } |
974 | 974 | |
975 | 975 | |
976 | 976 | |
977 | -if ( ! function_exists( 'espresso_venue_categories' )) { |
|
977 | +if ( ! function_exists('espresso_venue_categories')) { |
|
978 | 978 | /** |
979 | 979 | * espresso_venue_categories |
980 | 980 | * returns the terms associated with a venue |
@@ -984,17 +984,17 @@ discard block |
||
984 | 984 | * @param bool $echo |
985 | 985 | * @return string |
986 | 986 | */ |
987 | - function espresso_venue_categories( $VNU_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE ) { |
|
988 | - if ( $echo ) { |
|
989 | - echo EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized ); |
|
987 | + function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) { |
|
988 | + if ($echo) { |
|
989 | + echo EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
990 | 990 | return ''; |
991 | 991 | } |
992 | - return EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized ); |
|
992 | + return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
993 | 993 | } |
994 | 994 | } |
995 | 995 | |
996 | 996 | |
997 | -if ( ! function_exists( 'espresso_venue_address' )) { |
|
997 | +if ( ! function_exists('espresso_venue_address')) { |
|
998 | 998 | /** |
999 | 999 | * espresso_venue_address |
1000 | 1000 | * returns a formatted block of html for displaying a venue's address |
@@ -1004,17 +1004,17 @@ discard block |
||
1004 | 1004 | * @param bool $echo |
1005 | 1005 | * @return string |
1006 | 1006 | */ |
1007 | - function espresso_venue_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) { |
|
1008 | - if ( $echo ) { |
|
1009 | - echo EEH_Venue_View::venue_address( $type, $VNU_ID ); |
|
1007 | + function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) { |
|
1008 | + if ($echo) { |
|
1009 | + echo EEH_Venue_View::venue_address($type, $VNU_ID); |
|
1010 | 1010 | return ''; |
1011 | 1011 | } |
1012 | - return EEH_Venue_View::venue_address( $type, $VNU_ID ); |
|
1012 | + return EEH_Venue_View::venue_address($type, $VNU_ID); |
|
1013 | 1013 | } |
1014 | 1014 | } |
1015 | 1015 | |
1016 | 1016 | |
1017 | -if ( ! function_exists( 'espresso_venue_raw_address' )) { |
|
1017 | +if ( ! function_exists('espresso_venue_raw_address')) { |
|
1018 | 1018 | /** |
1019 | 1019 | * espresso_venue_address |
1020 | 1020 | * returns an UN-formatted string containing a venue's address |
@@ -1024,17 +1024,17 @@ discard block |
||
1024 | 1024 | * @param bool $echo |
1025 | 1025 | * @return string |
1026 | 1026 | */ |
1027 | - function espresso_venue_raw_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) { |
|
1028 | - if ( $echo ) { |
|
1029 | - echo EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE ); |
|
1027 | + function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) { |
|
1028 | + if ($echo) { |
|
1029 | + echo EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE); |
|
1030 | 1030 | return ''; |
1031 | 1031 | } |
1032 | - return EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE ); |
|
1032 | + return EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE); |
|
1033 | 1033 | } |
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | |
1037 | -if ( ! function_exists( 'espresso_venue_has_address' )) { |
|
1037 | +if ( ! function_exists('espresso_venue_has_address')) { |
|
1038 | 1038 | /** |
1039 | 1039 | * espresso_venue_has_address |
1040 | 1040 | * returns TRUE or FALSE if a Venue has address information |
@@ -1042,13 +1042,13 @@ discard block |
||
1042 | 1042 | * @param int $VNU_ID |
1043 | 1043 | * @return bool |
1044 | 1044 | */ |
1045 | - function espresso_venue_has_address( $VNU_ID = 0 ) { |
|
1046 | - return EEH_Venue_View::venue_has_address( $VNU_ID ); |
|
1045 | + function espresso_venue_has_address($VNU_ID = 0) { |
|
1046 | + return EEH_Venue_View::venue_has_address($VNU_ID); |
|
1047 | 1047 | } |
1048 | 1048 | } |
1049 | 1049 | |
1050 | 1050 | |
1051 | -if ( ! function_exists( 'espresso_venue_gmap' )) { |
|
1051 | +if ( ! function_exists('espresso_venue_gmap')) { |
|
1052 | 1052 | /** |
1053 | 1053 | * espresso_venue_gmap |
1054 | 1054 | * returns a google map for the venue address |
@@ -1059,17 +1059,17 @@ discard block |
||
1059 | 1059 | * @param bool $echo |
1060 | 1060 | * @return string |
1061 | 1061 | */ |
1062 | - function espresso_venue_gmap( $VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE ) { |
|
1063 | - if ( $echo ) { |
|
1064 | - echo EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap ); |
|
1062 | + function espresso_venue_gmap($VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE) { |
|
1063 | + if ($echo) { |
|
1064 | + echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
1065 | 1065 | return ''; |
1066 | 1066 | } |
1067 | - return EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap ); |
|
1067 | + return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
1068 | 1068 | } |
1069 | 1069 | } |
1070 | 1070 | |
1071 | 1071 | |
1072 | -if ( ! function_exists( 'espresso_venue_phone' )) { |
|
1072 | +if ( ! function_exists('espresso_venue_phone')) { |
|
1073 | 1073 | /** |
1074 | 1074 | * espresso_venue_phone |
1075 | 1075 | * |
@@ -1077,18 +1077,18 @@ discard block |
||
1077 | 1077 | * @param bool $echo |
1078 | 1078 | * @return string |
1079 | 1079 | */ |
1080 | - function espresso_venue_phone( $VNU_ID = 0, $echo = TRUE ) { |
|
1081 | - if ( $echo ) { |
|
1082 | - echo EEH_Venue_View::venue_phone( $VNU_ID ); |
|
1080 | + function espresso_venue_phone($VNU_ID = 0, $echo = TRUE) { |
|
1081 | + if ($echo) { |
|
1082 | + echo EEH_Venue_View::venue_phone($VNU_ID); |
|
1083 | 1083 | return ''; |
1084 | 1084 | } |
1085 | - return EEH_Venue_View::venue_phone( $VNU_ID ); |
|
1085 | + return EEH_Venue_View::venue_phone($VNU_ID); |
|
1086 | 1086 | } |
1087 | 1087 | } |
1088 | 1088 | |
1089 | 1089 | |
1090 | 1090 | |
1091 | -if ( ! function_exists( 'espresso_venue_website' )) { |
|
1091 | +if ( ! function_exists('espresso_venue_website')) { |
|
1092 | 1092 | /** |
1093 | 1093 | * espresso_venue_website |
1094 | 1094 | * |
@@ -1096,18 +1096,18 @@ discard block |
||
1096 | 1096 | * @param bool $echo |
1097 | 1097 | * @return string |
1098 | 1098 | */ |
1099 | - function espresso_venue_website( $VNU_ID = 0, $echo = TRUE ) { |
|
1100 | - if ( $echo ) { |
|
1101 | - echo EEH_Venue_View::venue_website_link( $VNU_ID ); |
|
1099 | + function espresso_venue_website($VNU_ID = 0, $echo = TRUE) { |
|
1100 | + if ($echo) { |
|
1101 | + echo EEH_Venue_View::venue_website_link($VNU_ID); |
|
1102 | 1102 | return ''; |
1103 | 1103 | } |
1104 | - return EEH_Venue_View::venue_website_link( $VNU_ID ); |
|
1104 | + return EEH_Venue_View::venue_website_link($VNU_ID); |
|
1105 | 1105 | } |
1106 | 1106 | } |
1107 | 1107 | |
1108 | 1108 | |
1109 | 1109 | |
1110 | -if ( ! function_exists( 'espresso_edit_venue_link' )) { |
|
1110 | +if ( ! function_exists('espresso_edit_venue_link')) { |
|
1111 | 1111 | /** |
1112 | 1112 | * espresso_edit_venue_link |
1113 | 1113 | * |
@@ -1115,12 +1115,12 @@ discard block |
||
1115 | 1115 | * @param bool $echo |
1116 | 1116 | * @return string |
1117 | 1117 | */ |
1118 | - function espresso_edit_venue_link( $VNU_ID = 0, $echo = TRUE ) { |
|
1119 | - if($echo){ |
|
1120 | - echo EEH_Venue_View::edit_venue_link( $VNU_ID ); |
|
1118 | + function espresso_edit_venue_link($VNU_ID = 0, $echo = TRUE) { |
|
1119 | + if ($echo) { |
|
1120 | + echo EEH_Venue_View::edit_venue_link($VNU_ID); |
|
1121 | 1121 | return ''; |
1122 | 1122 | } |
1123 | - return EEH_Venue_View::edit_venue_link( $VNU_ID ); |
|
1123 | + return EEH_Venue_View::edit_venue_link($VNU_ID); |
|
1124 | 1124 | } |
1125 | 1125 | } |
1126 | 1126 |