@@ -219,11 +219,11 @@ discard block |
||
219 | 219 | |
220 | 220 | |
221 | 221 | /** |
222 | - * retrieve ALL registrations for a particular Attendee from db |
|
223 | - * @access public |
|
224 | - * @param int $ATT_ID |
|
225 | - * @return EE_Registration[] |
|
226 | - */ |
|
222 | + * retrieve ALL registrations for a particular Attendee from db |
|
223 | + * @access public |
|
224 | + * @param int $ATT_ID |
|
225 | + * @return EE_Registration[] |
|
226 | + */ |
|
227 | 227 | public function get_all_registrations_for_attendee( $ATT_ID = 0 ) { |
228 | 228 | if ( ! $ATT_ID ) { |
229 | 229 | return FALSE; |
@@ -250,14 +250,14 @@ discard block |
||
250 | 250 | |
251 | 251 | |
252 | 252 | /** |
253 | - * retrieve registration for a specific transaction attendee from db |
|
254 | - * |
|
255 | - * @access public |
|
256 | - * @param int $TXN_ID |
|
257 | - * @param int $ATT_ID |
|
258 | - * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
|
259 | - * @return mixed array on success, FALSE on fail |
|
260 | - */ |
|
253 | + * retrieve registration for a specific transaction attendee from db |
|
254 | + * |
|
255 | + * @access public |
|
256 | + * @param int $TXN_ID |
|
257 | + * @param int $ATT_ID |
|
258 | + * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
|
259 | + * @return mixed array on success, FALSE on fail |
|
260 | + */ |
|
261 | 261 | public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) { |
262 | 262 | return $this->get_one(array( |
263 | 263 | array( |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | |
271 | 271 | |
272 | 272 | /** |
273 | - * get the number of registrations per day for the Registration Admin page Reports Tab. |
|
273 | + * get the number of registrations per day for the Registration Admin page Reports Tab. |
|
274 | 274 | * (doesn't utilize models because it's a fairly specialized query) |
275 | - * @access public |
|
275 | + * @access public |
|
276 | 276 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
277 | 277 | * @return stdClass[] with properties regDate and total |
278 | - */ |
|
278 | + */ |
|
279 | 279 | public function get_registrations_per_day_report( $period = '-1 month' ) { |
280 | 280 | |
281 | 281 | $sql_date = $this->convert_datetime_for_query( 'REG_date', date("Y-m-d H:i:s", strtotime($period) ), 'Y-m-d H:i:s', 'UTC' ); |
@@ -304,11 +304,11 @@ discard block |
||
304 | 304 | |
305 | 305 | |
306 | 306 | /** |
307 | - * get the number of registrations per event for the Registration Admin page Reports Tab |
|
308 | - * @access public |
|
307 | + * get the number of registrations per event for the Registration Admin page Reports Tab |
|
308 | + * @access public |
|
309 | 309 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
310 | 310 | * @return stdClass[] each with properties event_name, reg_limit, and total |
311 | - */ |
|
311 | + */ |
|
312 | 312 | public function get_registrations_per_event_report( $period = '-1 month' ) { |
313 | 313 | |
314 | 314 | $date_sql = $this->convert_datetime_for_query( 'REG_date', date( "Y-m-d H:i:s", strtotime( $period )), 'Y-m-d H:i:s', 'UTC' ); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
3 | -require_once ( EE_CLASSES . 'EE_Registration.class.php' ); |
|
2 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
3 | +require_once (EE_CLASSES.'EE_Registration.class.php'); |
|
4 | 4 | /** |
5 | 5 | * |
6 | 6 | * Registration Model |
@@ -92,31 +92,31 @@ discard block |
||
92 | 92 | * Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
93 | 93 | * @return \EEM_Registration |
94 | 94 | */ |
95 | - protected function __construct( $timezone ) { |
|
96 | - $this->singular_item = __('Registration','event_espresso'); |
|
97 | - $this->plural_item = __('Registrations','event_espresso'); |
|
95 | + protected function __construct($timezone) { |
|
96 | + $this->singular_item = __('Registration', 'event_espresso'); |
|
97 | + $this->plural_item = __('Registrations', 'event_espresso'); |
|
98 | 98 | |
99 | 99 | $this->_tables = array( |
100 | - 'Registration'=>new EE_Primary_Table('esp_registration','REG_ID') |
|
100 | + 'Registration'=>new EE_Primary_Table('esp_registration', 'REG_ID') |
|
101 | 101 | ); |
102 | 102 | $this->_fields = array( |
103 | 103 | 'Registration'=>array( |
104 | - 'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID','event_espresso')), |
|
105 | - 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'), |
|
106 | - 'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID','event_espresso'), false, 0, 'Attendee'), |
|
107 | - 'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso'), false, 0, 'Transaction'), |
|
108 | - 'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso'), false, 0, 'Ticket'), |
|
109 | - 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'), |
|
110 | - 'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred','event_espresso'), false, time(), $timezone ), |
|
111 | - 'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Registration\'s share of the transaction total','event_espresso'), false, 0), |
|
112 | - 'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration','event_espresso'), false, 0), |
|
113 | - 'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration','event_espresso'), false, ''), |
|
114 | - 'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration','event_espresso'), false, ''), |
|
115 | - 'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration','event_espresso'), false, ''), |
|
116 | - 'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ','event_espresso'), true, 1), |
|
117 | - 'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group','event_espresso'), false, 1), |
|
118 | - 'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending','event_espresso'), false, false), |
|
119 | - 'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false ) |
|
104 | + 'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso')), |
|
105 | + 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'), |
|
106 | + 'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID', 'event_espresso'), false, 0, 'Attendee'), |
|
107 | + 'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso'), false, 0, 'Transaction'), |
|
108 | + 'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso'), false, 0, 'Ticket'), |
|
109 | + 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'), |
|
110 | + 'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred', 'event_espresso'), false, time(), $timezone), |
|
111 | + 'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Registration\'s share of the transaction total', 'event_espresso'), false, 0), |
|
112 | + 'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration', 'event_espresso'), false, 0), |
|
113 | + 'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration', 'event_espresso'), false, ''), |
|
114 | + 'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration', 'event_espresso'), false, ''), |
|
115 | + 'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration', 'event_espresso'), false, ''), |
|
116 | + 'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ', 'event_espresso'), true, 1), |
|
117 | + 'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group', 'event_espresso'), false, 1), |
|
118 | + 'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending', 'event_espresso'), false, false), |
|
119 | + 'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false) |
|
120 | 120 | ) |
121 | 121 | ); |
122 | 122 | $this->_model_relations = array( |
@@ -128,12 +128,12 @@ discard block |
||
128 | 128 | 'Answer'=>new EE_Has_Many_Relation(), |
129 | 129 | 'Checkin'=>new EE_Has_Many_Relation(), |
130 | 130 | 'Registration_Payment' => new EE_Has_Many_Relation(), |
131 | - 'Payment'=>new EE_HABTM_Relation( 'Registration_Payment' ), |
|
132 | - 'Message' => new EE_Has_Many_Any_Relation( false ) //allow deletes even if there are messages in the queue related |
|
131 | + 'Payment'=>new EE_HABTM_Relation('Registration_Payment'), |
|
132 | + 'Message' => new EE_Has_Many_Any_Relation(false) //allow deletes even if there are messages in the queue related |
|
133 | 133 | ); |
134 | 134 | $this->_model_chain_to_wp_user = 'Event'; |
135 | 135 | |
136 | - parent::__construct( $timezone ); |
|
136 | + parent::__construct($timezone); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | |
@@ -166,9 +166,9 @@ discard block |
||
166 | 166 | * @param bool $translated If true will return the values as singular localized strings |
167 | 167 | * @return array |
168 | 168 | */ |
169 | - public static function reg_status_array( $exclude = array(), $translated = FALSE ) { |
|
170 | - EEM_Registration::instance()->_get_registration_status_array( $exclude ); |
|
171 | - return $translated ? EEM_Status::instance()->localized_status( self::$_reg_status, FALSE, 'sentence') : self::$_reg_status; |
|
169 | + public static function reg_status_array($exclude = array(), $translated = FALSE) { |
|
170 | + EEM_Registration::instance()->_get_registration_status_array($exclude); |
|
171 | + return $translated ? EEM_Status::instance()->localized_status(self::$_reg_status, FALSE, 'sentence') : self::$_reg_status; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -179,19 +179,19 @@ discard block |
||
179 | 179 | * @param array $exclude |
180 | 180 | * @return array |
181 | 181 | */ |
182 | - private function _get_registration_status_array( $exclude = array() ) { |
|
182 | + private function _get_registration_status_array($exclude = array()) { |
|
183 | 183 | //in the very rare circumstance that we are deleting a model's table's data |
184 | 184 | //and the table hasn't actually been created, this could have an error |
185 | 185 | /** @type WPDB $wpdb */ |
186 | 186 | global $wpdb; |
187 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
188 | - if( EEH_Activation::table_exists( $wpdb->prefix . 'esp_status' ) ){ |
|
189 | - $SQL = 'SELECT STS_ID, STS_code FROM '. $wpdb->prefix . 'esp_status WHERE STS_type = "registration"'; |
|
190 | - $results = $wpdb->get_results( $SQL ); |
|
187 | + EE_Registry::instance()->load_helper('Activation'); |
|
188 | + if (EEH_Activation::table_exists($wpdb->prefix.'esp_status')) { |
|
189 | + $SQL = 'SELECT STS_ID, STS_code FROM '.$wpdb->prefix.'esp_status WHERE STS_type = "registration"'; |
|
190 | + $results = $wpdb->get_results($SQL); |
|
191 | 191 | self::$_reg_status = array(); |
192 | - foreach ( $results as $status ) { |
|
193 | - if ( ! in_array( $status->STS_ID, $exclude )) { |
|
194 | - self::$_reg_status[ $status->STS_ID ] = $status->STS_code; |
|
192 | + foreach ($results as $status) { |
|
193 | + if ( ! in_array($status->STS_ID, $exclude)) { |
|
194 | + self::$_reg_status[$status->STS_ID] = $status->STS_code; |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | } |
@@ -206,15 +206,15 @@ discard block |
||
206 | 206 | * @param array $where_params Array of query_params as described in the comments for EEM_Base::get_all() |
207 | 207 | * @return wpdb results array |
208 | 208 | */ |
209 | - public function get_reg_months_and_years( $where_params ) { |
|
209 | + public function get_reg_months_and_years($where_params) { |
|
210 | 210 | $query_params[0] = $where_params; |
211 | 211 | $query_params['group_by'] = array('reg_year', 'reg_month'); |
212 | - $query_params['order_by'] = array( 'REG_date' => 'DESC' ); |
|
212 | + $query_params['order_by'] = array('REG_date' => 'DESC'); |
|
213 | 213 | $columns_to_select = array( |
214 | 214 | 'reg_year' => array('YEAR(REG_date)', '%s'), |
215 | 215 | 'reg_month' => array('MONTHNAME(REG_date)', '%s') |
216 | 216 | ); |
217 | - return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select ); |
|
217 | + return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | * @param int $ATT_ID |
227 | 227 | * @return EE_Registration[] |
228 | 228 | */ |
229 | - public function get_all_registrations_for_attendee( $ATT_ID = 0 ) { |
|
230 | - if ( ! $ATT_ID ) { |
|
229 | + public function get_all_registrations_for_attendee($ATT_ID = 0) { |
|
230 | + if ( ! $ATT_ID) { |
|
231 | 231 | return FALSE; |
232 | 232 | } |
233 | - return $this->get_all( array( array( 'ATT_ID' => $ATT_ID ))); |
|
233 | + return $this->get_all(array(array('ATT_ID' => $ATT_ID))); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | * @param string $REG_url_link |
242 | 242 | * @return EE_Registration |
243 | 243 | */ |
244 | - public function get_registration_for_reg_url_link($REG_url_link){ |
|
245 | - if(!$REG_url_link){ |
|
244 | + public function get_registration_for_reg_url_link($REG_url_link) { |
|
245 | + if ( ! $REG_url_link) { |
|
246 | 246 | return false; |
247 | 247 | } |
248 | 248 | return $this->get_one(array(array('REG_url_link'=>$REG_url_link))); |
@@ -260,13 +260,13 @@ discard block |
||
260 | 260 | * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
261 | 261 | * @return mixed array on success, FALSE on fail |
262 | 262 | */ |
263 | - public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) { |
|
263 | + public function get_registration_for_transaction_attendee($TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0) { |
|
264 | 264 | return $this->get_one(array( |
265 | 265 | array( |
266 | 266 | 'TXN_ID'=>$TXN_ID, |
267 | 267 | 'ATT_ID'=>$ATT_ID |
268 | 268 | ), |
269 | - 'limit'=>array( min( ( $att_nmbr-1 ), 0 ), 1 ) |
|
269 | + 'limit'=>array(min(($att_nmbr - 1), 0), 1) |
|
270 | 270 | )); |
271 | 271 | } |
272 | 272 | |
@@ -278,17 +278,17 @@ discard block |
||
278 | 278 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
279 | 279 | * @return stdClass[] with properties regDate and total |
280 | 280 | */ |
281 | - public function get_registrations_per_day_report( $period = '-1 month' ) { |
|
281 | + public function get_registrations_per_day_report($period = '-1 month') { |
|
282 | 282 | |
283 | - $sql_date = $this->convert_datetime_for_query( 'REG_date', date("Y-m-d H:i:s", strtotime($period) ), 'Y-m-d H:i:s', 'UTC' ); |
|
284 | - $where = array( 'REG_date' => array( '>=', $sql_date ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ); |
|
283 | + $sql_date = $this->convert_datetime_for_query('REG_date', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC'); |
|
284 | + $where = array('REG_date' => array('>=', $sql_date), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)); |
|
285 | 285 | |
286 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_day_report' ) ) { |
|
286 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_day_report')) { |
|
287 | 287 | $where['Event.EVT_wp_user'] = get_current_user_id(); |
288 | 288 | } |
289 | 289 | |
290 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
291 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'REG_date' ); |
|
290 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
291 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'REG_date'); |
|
292 | 292 | |
293 | 293 | $results = $this->_get_all_wpdb_results( |
294 | 294 | array( |
@@ -298,8 +298,8 @@ discard block |
||
298 | 298 | ), |
299 | 299 | OBJECT, |
300 | 300 | array( |
301 | - 'regDate'=>array( 'DATE(' . $query_interval . ')','%s'), |
|
302 | - 'total'=>array('count(REG_ID)','%d') |
|
301 | + 'regDate'=>array('DATE('.$query_interval.')', '%s'), |
|
302 | + 'total'=>array('count(REG_ID)', '%d') |
|
303 | 303 | )); |
304 | 304 | return $results; |
305 | 305 | } |
@@ -314,23 +314,23 @@ discard block |
||
314 | 314 | * @return stdClass[] with properties Registration_REG_date and a column for each registration status as the STS_ID |
315 | 315 | * (i.e. RAP) |
316 | 316 | */ |
317 | - public function get_registrations_per_day_and_per_status_report( $period = '-1 month' ) { |
|
317 | + public function get_registrations_per_day_and_per_status_report($period = '-1 month') { |
|
318 | 318 | global $wpdb; |
319 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
319 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
320 | 320 | $event_table = $wpdb->posts; |
321 | - $sql_date = date("Y-m-d H:i:s", strtotime($period) ); |
|
321 | + $sql_date = date("Y-m-d H:i:s", strtotime($period)); |
|
322 | 322 | |
323 | 323 | //prepare the query interval for displaying offset |
324 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
325 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'dates.REG_date' ); |
|
324 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
325 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'dates.REG_date'); |
|
326 | 326 | |
327 | 327 | //inner date query |
328 | 328 | $inner_date_query = "SELECT DISTINCT REG_date from $registration_table "; |
329 | 329 | $inner_where = " WHERE"; |
330 | 330 | //exclude events not authored by user if permissions in effect |
331 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
331 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
332 | 332 | $inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID"; |
333 | - $inner_where .= " post_author = " . get_current_user_id() . " AND"; |
|
333 | + $inner_where .= " post_author = ".get_current_user_id()." AND"; |
|
334 | 334 | } |
335 | 335 | $inner_where .= " REG_date >= '$sql_date'"; |
336 | 336 | $inner_date_query .= $inner_where; |
@@ -342,8 +342,8 @@ discard block |
||
342 | 342 | $select_parts = array(); |
343 | 343 | |
344 | 344 | //loop through registration stati to do parts for each status. |
345 | - foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) { |
|
346 | - if ( $STS_ID === EEM_Registration::status_id_incomplete ) { |
|
345 | + foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) { |
|
346 | + if ($STS_ID === EEM_Registration::status_id_incomplete) { |
|
347 | 347 | continue; |
348 | 348 | } |
349 | 349 | $select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID"; |
@@ -351,14 +351,14 @@ discard block |
||
351 | 351 | } |
352 | 352 | |
353 | 353 | //setup the selects |
354 | - $select .= implode(', ', $select_parts ); |
|
354 | + $select .= implode(', ', $select_parts); |
|
355 | 355 | $select .= " FROM ($inner_date_query) AS dates LEFT JOIN "; |
356 | 356 | |
357 | 357 | //setup the joins |
358 | - $join .= implode( " LEFT JOIN ", $join_parts ); |
|
358 | + $join .= implode(" LEFT JOIN ", $join_parts); |
|
359 | 359 | |
360 | 360 | //now let's put it all together |
361 | - $query = $select . $join . ' GROUP BY Registration_REG_date'; |
|
361 | + $query = $select.$join.' GROUP BY Registration_REG_date'; |
|
362 | 362 | |
363 | 363 | //and execute it |
364 | 364 | $results = $wpdb->get_results( |
@@ -379,23 +379,23 @@ discard block |
||
379 | 379 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
380 | 380 | * @return stdClass[] each with properties event_name, reg_limit, and total |
381 | 381 | */ |
382 | - public function get_registrations_per_event_report( $period = '-1 month' ) { |
|
382 | + public function get_registrations_per_event_report($period = '-1 month') { |
|
383 | 383 | |
384 | - $date_sql = $this->convert_datetime_for_query( 'REG_date', date( "Y-m-d H:i:s", strtotime( $period )), 'Y-m-d H:i:s', 'UTC' ); |
|
385 | - $where = array( 'REG_date' => array( '>=', $date_sql ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ); |
|
384 | + $date_sql = $this->convert_datetime_for_query('REG_date', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC'); |
|
385 | + $where = array('REG_date' => array('>=', $date_sql), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)); |
|
386 | 386 | |
387 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
387 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
388 | 388 | $where['Event.EVT_wp_user'] = get_current_user_id(); |
389 | 389 | } |
390 | 390 | $results = $this->_get_all_wpdb_results(array( |
391 | 391 | $where, |
392 | 392 | 'group_by'=>'Event.EVT_name', |
393 | 393 | 'order_by'=>'Event.EVT_name', |
394 | - 'limit'=>array(0,24)), |
|
394 | + 'limit'=>array(0, 24)), |
|
395 | 395 | OBJECT, |
396 | 396 | array( |
397 | - 'event_name'=>array('Event_CPT.post_title','%s'), |
|
398 | - 'total'=>array('COUNT(REG_ID)','%s') |
|
397 | + 'event_name'=>array('Event_CPT.post_title', '%s'), |
|
398 | + 'total'=>array('COUNT(REG_ID)', '%s') |
|
399 | 399 | ) |
400 | 400 | ); |
401 | 401 | |
@@ -413,19 +413,19 @@ discard block |
||
413 | 413 | * @return stdClass[] with properties `Registration_Event` and a column for each registration status as the STS_ID |
414 | 414 | * (i.e. RAP) |
415 | 415 | */ |
416 | - public function get_registrations_per_event_and_per_status_report( $period = '-1 month' ) { |
|
416 | + public function get_registrations_per_event_and_per_status_report($period = '-1 month') { |
|
417 | 417 | global $wpdb; |
418 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
418 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
419 | 419 | $event_table = $wpdb->posts; |
420 | - $sql_date = date("Y-m-d H:i:s", strtotime($period) ); |
|
420 | + $sql_date = date("Y-m-d H:i:s", strtotime($period)); |
|
421 | 421 | |
422 | 422 | //inner date query |
423 | 423 | $inner_date_query = "SELECT DISTINCT EVT_ID, REG_date from $registration_table "; |
424 | 424 | $inner_where = " WHERE"; |
425 | 425 | //exclude events not authored by user if permissions in effect |
426 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
426 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
427 | 427 | $inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID"; |
428 | - $inner_where .= " post_author = " . get_current_user_id() . " AND"; |
|
428 | + $inner_where .= " post_author = ".get_current_user_id()." AND"; |
|
429 | 429 | } |
430 | 430 | $inner_where .= " REG_date >= '$sql_date'"; |
431 | 431 | $inner_date_query .= $inner_where; |
@@ -437,8 +437,8 @@ discard block |
||
437 | 437 | $select_parts = array(); |
438 | 438 | |
439 | 439 | //loop through registration stati to do parts for each status. |
440 | - foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) { |
|
441 | - if ( $STS_ID === EEM_Registration::status_id_incomplete ) { |
|
440 | + foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) { |
|
441 | + if ($STS_ID === EEM_Registration::status_id_incomplete) { |
|
442 | 442 | continue; |
443 | 443 | } |
444 | 444 | $select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID"; |
@@ -446,14 +446,14 @@ discard block |
||
446 | 446 | } |
447 | 447 | |
448 | 448 | //setup the selects |
449 | - $select .= implode( ', ', $select_parts ); |
|
449 | + $select .= implode(', ', $select_parts); |
|
450 | 450 | $select .= " FROM ($inner_date_query) AS dates LEFT JOIN $event_table as Event ON Event.ID = dates.EVT_ID LEFT JOIN "; |
451 | 451 | |
452 | 452 | //setup remaining joins |
453 | - $join .= implode( " LEFT JOIN ", $join_parts ); |
|
453 | + $join .= implode(" LEFT JOIN ", $join_parts); |
|
454 | 454 | |
455 | 455 | //now put it all together |
456 | - $query = $select . $join . ' GROUP BY Registration_Event'; |
|
456 | + $query = $select.$join.' GROUP BY Registration_Event'; |
|
457 | 457 | |
458 | 458 | //and execute |
459 | 459 | $results = $wpdb->get_results( |
@@ -469,11 +469,11 @@ discard block |
||
469 | 469 | * @param int $TXN_ID |
470 | 470 | * @return EE_Registration |
471 | 471 | */ |
472 | - public function get_primary_registration_for_transaction_ID( $TXN_ID = 0){ |
|
473 | - if( ! $TXN_ID ){ |
|
472 | + public function get_primary_registration_for_transaction_ID($TXN_ID = 0) { |
|
473 | + if ( ! $TXN_ID) { |
|
474 | 474 | return false; |
475 | 475 | } |
476 | - return $this->get_one(array(array('TXN_ID'=>$TXN_ID,'REG_count'=> EEM_Registration::PRIMARY_REGISTRANT_COUNT))); |
|
476 | + return $this->get_one(array(array('TXN_ID'=>$TXN_ID, 'REG_count'=> EEM_Registration::PRIMARY_REGISTRANT_COUNT))); |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | |
@@ -485,11 +485,11 @@ discard block |
||
485 | 485 | * @param boolean $for_incomplete_payments |
486 | 486 | * @return int |
487 | 487 | */ |
488 | - public function get_event_registration_count ( $EVT_ID, $for_incomplete_payments = FALSE ) { |
|
488 | + public function get_event_registration_count($EVT_ID, $for_incomplete_payments = FALSE) { |
|
489 | 489 | // we only count approved registrations towards registration limits |
490 | - $query_params = array( array( 'EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved ) ); |
|
491 | - if( $for_incomplete_payments ){ |
|
492 | - $query_params[0]['Transaction.STS_ID']=array('!=', EEM_Transaction::complete_status_code); |
|
490 | + $query_params = array(array('EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved)); |
|
491 | + if ($for_incomplete_payments) { |
|
492 | + $query_params[0]['Transaction.STS_ID'] = array('!=', EEM_Transaction::complete_status_code); |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | return $this->count($query_params); |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | /** @type WPDB $wpdb */ |
506 | 506 | global $wpdb; |
507 | 507 | return $wpdb->query( |
508 | - 'DELETE r FROM ' . $this->table() . ' r LEFT JOIN ' . EEM_Transaction::instance()->table() . ' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' ); |
|
508 | + 'DELETE r FROM '.$this->table().' r LEFT JOIN '.EEM_Transaction::instance()->table().' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' ); |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | /** |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | * @param boolean $checked_in whether to count registrations checked IN or OUT |
516 | 516 | * @return int |
517 | 517 | */ |
518 | - public function count_registrations_checked_into_datetime( $DTT_ID, $checked_in = true) { |
|
518 | + public function count_registrations_checked_into_datetime($DTT_ID, $checked_in = true) { |
|
519 | 519 | return $this->count( |
520 | 520 | array( |
521 | 521 | array( |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | * @param boolean $checked_in whether to count registrations checked IN or OUT |
534 | 534 | * @return int |
535 | 535 | */ |
536 | - public function count_registrations_checked_into_event( $EVT_ID, $checked_in = true ) { |
|
536 | + public function count_registrations_checked_into_event($EVT_ID, $checked_in = true) { |
|
537 | 537 | return $this->count( |
538 | 538 | array( |
539 | 539 | array( |
@@ -556,15 +556,15 @@ discard block |
||
556 | 556 | * @param array $attendee_ids |
557 | 557 | * @return EE_Registration[] |
558 | 558 | */ |
559 | - public function get_latest_registration_for_each_of_given_contacts( $attendee_ids = array() ) { |
|
559 | + public function get_latest_registration_for_each_of_given_contacts($attendee_ids = array()) { |
|
560 | 560 | //first do a native wp_query to get the latest REG_ID's matching these attendees. |
561 | 561 | global $wpdb; |
562 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
562 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
563 | 563 | $attendee_table = $wpdb->posts; |
564 | - $attendee_ids = is_array( $attendee_ids ) |
|
565 | - ? array_map( 'absint', $attendee_ids ) |
|
566 | - : array( (int) $attendee_ids ); |
|
567 | - $attendee_ids = implode( ',', $attendee_ids ); |
|
564 | + $attendee_ids = is_array($attendee_ids) |
|
565 | + ? array_map('absint', $attendee_ids) |
|
566 | + : array((int) $attendee_ids); |
|
567 | + $attendee_ids = implode(',', $attendee_ids); |
|
568 | 568 | |
569 | 569 | |
570 | 570 | //first we do a query to get the registration ids |
@@ -589,24 +589,24 @@ discard block |
||
589 | 589 | ARRAY_A |
590 | 590 | ); |
591 | 591 | |
592 | - if ( empty( $registration_ids ) ) { |
|
592 | + if (empty($registration_ids)) { |
|
593 | 593 | return array(); |
594 | 594 | } |
595 | 595 | |
596 | 596 | $ids_for_model_query = array(); |
597 | 597 | //let's flatten the ids so they can be used in the model query. |
598 | - foreach ( $registration_ids as $registration_id ) { |
|
599 | - if ( isset( $registration_id['registration_id'] ) ) { |
|
598 | + foreach ($registration_ids as $registration_id) { |
|
599 | + if (isset($registration_id['registration_id'])) { |
|
600 | 600 | $ids_for_model_query[] = $registration_id['registration_id']; |
601 | 601 | } |
602 | 602 | } |
603 | 603 | |
604 | 604 | //construct query |
605 | 605 | $_where = array( |
606 | - 'REG_ID' => array( 'IN', $ids_for_model_query ) |
|
606 | + 'REG_ID' => array('IN', $ids_for_model_query) |
|
607 | 607 | ); |
608 | 608 | |
609 | - return $this->get_all( array( $_where ) ); |
|
609 | + return $this->get_all(array($_where)); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This file contains the EE_Newsletter_message_type class. |
|
4 | - * @package Event Espresso |
|
5 | - * @subpackage helpers |
|
6 | - * @since 4.3.0 |
|
7 | - */ |
|
3 | + * This file contains the EE_Newsletter_message_type class. |
|
4 | + * @package Event Espresso |
|
5 | + * @subpackage helpers |
|
6 | + * @since 4.3.0 |
|
7 | + */ |
|
8 | 8 | if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
9 | 9 | |
10 | 10 | /** |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | |
23 | 23 | public function __construct() { |
24 | 24 | $this->name = 'newsletter'; |
25 | - $this->description = __( 'Newsletter message types are triggered manually by the admin for sending mass email to select groups of registrants.', 'event_espresso' ); |
|
25 | + $this->description = __('Newsletter message types are triggered manually by the admin for sending mass email to select groups of registrants.', 'event_espresso'); |
|
26 | 26 | $this->label = array( |
27 | - 'singular' => __( 'newsletter', 'event_espresso' ), |
|
28 | - 'plural' => __( 'newsletters', 'event_espresso' ) |
|
27 | + 'singular' => __('newsletter', 'event_espresso'), |
|
28 | + 'plural' => __('newsletters', 'event_espresso') |
|
29 | 29 | ); |
30 | 30 | $this->_master_templates = array( |
31 | 31 | 'email' => 'registration', |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | |
52 | - protected function _get_data_for_context( $context, EE_Registration $registration, $id ) { |
|
52 | + protected function _get_data_for_context($context, EE_Registration $registration, $id) { |
|
53 | 53 | //newsletter message type data handler is 'Registrations' and it expects an array of EE_Registration objects. |
54 | - return array( $registration ); |
|
54 | + return array($registration); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -64,15 +64,15 @@ discard block |
||
64 | 64 | |
65 | 65 | protected function _set_contexts() { |
66 | 66 | $this->_context_label = array( |
67 | - 'label' => __( 'recipient', 'event_espresso' ), |
|
68 | - 'plural' => __( 'recipients', 'event_espresso' ), |
|
69 | - 'description' => __( 'Recipient\'s are who will receive the message.', 'event_espresso' ) |
|
67 | + 'label' => __('recipient', 'event_espresso'), |
|
68 | + 'plural' => __('recipients', 'event_espresso'), |
|
69 | + 'description' => __('Recipient\'s are who will receive the message.', 'event_espresso') |
|
70 | 70 | ); |
71 | 71 | |
72 | 72 | $this->_contexts = array( |
73 | 73 | 'attendee' => array( |
74 | - 'label' => __( 'Registrant', 'event_espresso' ), |
|
75 | - 'description' => __( 'This template goes to selected registrants.', 'event_espresso' ) |
|
74 | + 'label' => __('Registrant', 'event_espresso'), |
|
75 | + 'description' => __('This template goes to selected registrants.', 'event_espresso') |
|
76 | 76 | ) |
77 | 77 | ); |
78 | 78 | } |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | 'newsletter', |
99 | 99 | ); |
100 | 100 | |
101 | - foreach ( $this->_valid_shortcodes as $context => $shortcodes ) { |
|
102 | - foreach ( $shortcodes as $key => $shortcode ) { |
|
103 | - if ( ! in_array( $shortcode, $included_shortcodes ) ) { |
|
104 | - unset( $this->_valid_shortcodes[ $context ][ $key ] ); |
|
101 | + foreach ($this->_valid_shortcodes as $context => $shortcodes) { |
|
102 | + foreach ($shortcodes as $key => $shortcode) { |
|
103 | + if ( ! in_array($shortcode, $included_shortcodes)) { |
|
104 | + unset($this->_valid_shortcodes[$context][$key]); |
|
105 | 105 | } |
106 | 106 | } |
107 | - $this->_valid_shortcodes[ $context ][] = 'newsletter'; |
|
107 | + $this->_valid_shortcodes[$context][] = 'newsletter'; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | } |
@@ -118,44 +118,44 @@ discard block |
||
118 | 118 | $addressee = array(); |
119 | 119 | |
120 | 120 | //looping through registrations |
121 | - foreach ( $this->_data->registrations as $reg_id => $details ) { |
|
121 | + foreach ($this->_data->registrations as $reg_id => $details) { |
|
122 | 122 | //set $attendee array to blank on each loop |
123 | 123 | $aee = array(); |
124 | 124 | |
125 | 125 | //need to get the attendee from this registration. |
126 | - $attendee = isset( $details['att_obj'] ) && $details['att_obj'] instanceof EE_Attendee |
|
126 | + $attendee = isset($details['att_obj']) && $details['att_obj'] instanceof EE_Attendee |
|
127 | 127 | ? $details['att_obj'] |
128 | 128 | : null; |
129 | 129 | |
130 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
130 | + if ( ! $attendee instanceof EE_Attendee) { |
|
131 | 131 | continue; |
132 | 132 | } |
133 | 133 | |
134 | 134 | //set $aee from attendee object |
135 | 135 | $aee['att_obj'] = $attendee; |
136 | - $aee['reg_objs'] = isset( $this->_data->attendees[ $attendee->ID() ]['reg_objs'] ) |
|
137 | - ? $this->_data->attendees[ $attendee->ID() ]['reg_objs'] |
|
136 | + $aee['reg_objs'] = isset($this->_data->attendees[$attendee->ID()]['reg_objs']) |
|
137 | + ? $this->_data->attendees[$attendee->ID()]['reg_objs'] |
|
138 | 138 | : array(); |
139 | 139 | $aee['attendee_email'] = $attendee->email(); |
140 | - $aee['tkt_objs'] = isset( $this->_data->attendees[ $attendee->ID() ]['tkt_objs'] ) |
|
141 | - ? $this->_data->attendees[ $attendee->ID() ]['tkt_objs'] |
|
140 | + $aee['tkt_objs'] = isset($this->_data->attendees[$attendee->ID()]['tkt_objs']) |
|
141 | + ? $this->_data->attendees[$attendee->ID()]['tkt_objs'] |
|
142 | 142 | : array(); |
143 | 143 | |
144 | - if ( isset( $this->_data->attendees[ $attendee->ID() ]['evt_objs'] ) ) { |
|
145 | - $aee['evt_objs'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs']; |
|
146 | - $aee['events'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs']; |
|
144 | + if (isset($this->_data->attendees[$attendee->ID()]['evt_objs'])) { |
|
145 | + $aee['evt_objs'] = $this->_data->attendees[$attendee->ID()]['evt_objs']; |
|
146 | + $aee['events'] = $this->_data->attendees[$attendee->ID()]['evt_objs']; |
|
147 | 147 | } else { |
148 | 148 | $aee['evt_objs'] = $aee['events'] = array(); |
149 | 149 | } |
150 | 150 | |
151 | - $aee['reg_obj'] = isset( $details['reg_obj'] ) |
|
151 | + $aee['reg_obj'] = isset($details['reg_obj']) |
|
152 | 152 | ? $details['reg_obj'] |
153 | 153 | : null; |
154 | 154 | $aee['attendees'] = $this->_data->attendees; |
155 | 155 | |
156 | 156 | //merge in the primary attendee data |
157 | - $aee = array_merge( $this->_default_addressee_data, $aee ); |
|
158 | - $addressee[] = new EE_Messages_Addressee( $aee ); |
|
157 | + $aee = array_merge($this->_default_addressee_data, $aee); |
|
158 | + $addressee[] = new EE_Messages_Addressee($aee); |
|
159 | 159 | } |
160 | 160 | return $addressee; |
161 | 161 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * This prepares data for message types that send messages for multiple registrations (that could span multiple transactions) |
@@ -20,13 +20,13 @@ discard block |
||
20 | 20 | * @throws EE_Error |
21 | 21 | * @access protected |
22 | 22 | */ |
23 | - public function __construct( $data = array() ) { |
|
23 | + public function __construct($data = array()) { |
|
24 | 24 | |
25 | 25 | //validate that the first element in the array is an EE_Registration object. |
26 | - if ( ! reset( $data ) instanceof EE_Registration ) { |
|
27 | - throw new EE_Error( __( 'The EE_Message_Registrations_incoming_data class expects an array of EE_Registration objects.', 'event_espresso' ) ); |
|
26 | + if ( ! reset($data) instanceof EE_Registration) { |
|
27 | + throw new EE_Error(__('The EE_Message_Registrations_incoming_data class expects an array of EE_Registration objects.', 'event_espresso')); |
|
28 | 28 | } |
29 | - parent::__construct( $data ); |
|
29 | + parent::__construct($data); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | + exit( 'No direct script access allowed' ); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | /** |
5 | 7 | * This prepares data for message types that send messages for multiple registrations (that could span multiple transactions) |
@@ -347,7 +347,7 @@ |
||
347 | 347 | $total_ticket_count++; |
348 | 348 | $tickets[ $ticket->ID() ]['ticket'] = $ticket; |
349 | 349 | $tickets[ $ticket->ID() ]['count'] = is_array( $tickets[ $ticket->ID() ] ) |
350 | - && isset( $tickets[ $ticket->ID() ]['count'] ) |
|
350 | + && isset( $tickets[ $ticket->ID() ]['count'] ) |
|
351 | 351 | ? $tickets[ $ticket->ID() ]['count'] + 1 |
352 | 352 | : 1; |
353 | 353 | $tickets[ $ticket->ID() ]['att_objs'][ $reg->attendee_ID() ] = $reg->attendee(); |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | * @param mixed $data incoming data object|array. Suggested that child classes use type hinting for expected |
267 | 267 | * data object. But here parent will be generic because we don't know what's coming in. |
268 | 268 | */ |
269 | - public function __construct( $data ) { |
|
269 | + public function __construct($data) { |
|
270 | 270 | $this->_data = $data; |
271 | 271 | $this->_setup_data(); |
272 | 272 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * |
289 | 289 | * @return mixed The prepped data for db |
290 | 290 | */ |
291 | - static public function convert_data_for_persistent_storage( $data ) { |
|
291 | + static public function convert_data_for_persistent_storage($data) { |
|
292 | 292 | return $data; |
293 | 293 | } |
294 | 294 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * |
305 | 305 | * @return mixed |
306 | 306 | */ |
307 | - static public function convert_data_from_persistent_storage( $data ) { |
|
307 | + static public function convert_data_from_persistent_storage($data) { |
|
308 | 308 | return $data; |
309 | 309 | } |
310 | 310 | |
@@ -331,8 +331,8 @@ discard block |
||
331 | 331 | protected function _assemble_data() { |
332 | 332 | //verify that reg_objs is set |
333 | 333 | if ( |
334 | - ! is_array( $this->reg_objs ) |
|
335 | - && ! reset( $this->reg_objs ) instanceof EE_Registration |
|
334 | + ! is_array($this->reg_objs) |
|
335 | + && ! reset($this->reg_objs) instanceof EE_Registration |
|
336 | 336 | ) { |
337 | 337 | throw new EE_Error( |
338 | 338 | __( |
@@ -347,82 +347,82 @@ discard block |
||
347 | 347 | $answers = $questions = $attendees = $line_items = $registrations = array(); |
348 | 348 | $total_ticket_count = 0; |
349 | 349 | |
350 | - if ( ! empty( $this->reg_objs ) ) { |
|
350 | + if ( ! empty($this->reg_objs)) { |
|
351 | 351 | $event_attendee_count = array(); |
352 | - foreach ( $this->reg_objs as $reg ) { |
|
352 | + foreach ($this->reg_objs as $reg) { |
|
353 | 353 | //account for filtered registrations by status. |
354 | - if ( ! empty( $this->filtered_reg_status ) && $this->filtered_reg_status !== $reg->status_ID() ) { |
|
354 | + if ( ! empty($this->filtered_reg_status) && $this->filtered_reg_status !== $reg->status_ID()) { |
|
355 | 355 | continue; |
356 | 356 | } |
357 | 357 | |
358 | 358 | $evt_id = $reg->event_ID(); |
359 | 359 | /** @type EE_Ticket $ticket */ |
360 | - $ticket = $reg->get_first_related( 'Ticket' ); |
|
360 | + $ticket = $reg->get_first_related('Ticket'); |
|
361 | 361 | $relateddatetime = $ticket->datetimes(); |
362 | 362 | $total_ticket_count++; |
363 | - $tickets[ $ticket->ID() ]['ticket'] = $ticket; |
|
364 | - $tickets[ $ticket->ID() ]['count'] = is_array( $tickets[ $ticket->ID() ] ) |
|
365 | - && isset( $tickets[ $ticket->ID() ]['count'] ) |
|
366 | - ? $tickets[ $ticket->ID() ]['count'] + 1 |
|
363 | + $tickets[$ticket->ID()]['ticket'] = $ticket; |
|
364 | + $tickets[$ticket->ID()]['count'] = is_array($tickets[$ticket->ID()]) |
|
365 | + && isset($tickets[$ticket->ID()]['count']) |
|
366 | + ? $tickets[$ticket->ID()]['count'] + 1 |
|
367 | 367 | : 1; |
368 | - $tickets[ $ticket->ID() ]['att_objs'][ $reg->attendee_ID() ] = $reg->attendee(); |
|
369 | - $tickets[ $ticket->ID() ]['dtt_objs'] = $relateddatetime; |
|
370 | - $tickets[ $ticket->ID() ]['reg_objs'][ $reg->ID() ] = $reg; |
|
368 | + $tickets[$ticket->ID()]['att_objs'][$reg->attendee_ID()] = $reg->attendee(); |
|
369 | + $tickets[$ticket->ID()]['dtt_objs'] = $relateddatetime; |
|
370 | + $tickets[$ticket->ID()]['reg_objs'][$reg->ID()] = $reg; |
|
371 | 371 | $event = $reg->event(); |
372 | - $tickets[ $ticket->ID() ]['EE_Event'] = $event; |
|
373 | - $evtcache[ $evt_id ] = $event; |
|
374 | - $eventsetup[ $evt_id ]['reg_objs'][ $reg->ID() ] = $reg; |
|
375 | - $eventsetup[ $evt_id ]['tkt_objs'][ $ticket->ID() ] = $ticket; |
|
376 | - $eventsetup[ $evt_id ]['att_objs'][ $reg->attendee_ID() ] = $reg->attendee(); |
|
377 | - $event_attendee_count[ $evt_id ] = isset( $event_attendee_count[ $evt_id ] ) |
|
378 | - ? $event_attendee_count[ $evt_id ] + 1 |
|
372 | + $tickets[$ticket->ID()]['EE_Event'] = $event; |
|
373 | + $evtcache[$evt_id] = $event; |
|
374 | + $eventsetup[$evt_id]['reg_objs'][$reg->ID()] = $reg; |
|
375 | + $eventsetup[$evt_id]['tkt_objs'][$ticket->ID()] = $ticket; |
|
376 | + $eventsetup[$evt_id]['att_objs'][$reg->attendee_ID()] = $reg->attendee(); |
|
377 | + $event_attendee_count[$evt_id] = isset($event_attendee_count[$evt_id]) |
|
378 | + ? $event_attendee_count[$evt_id] + 1 |
|
379 | 379 | : 0; |
380 | - $attendees[ $reg->attendee_ID() ]['line_ref'][] = $evt_id; |
|
381 | - $attendees[ $reg->attendee_ID() ]['att_obj'] = $reg->attendee(); |
|
382 | - $attendees[ $reg->attendee_ID() ]['reg_objs'][ $reg->ID() ] = $reg; |
|
380 | + $attendees[$reg->attendee_ID()]['line_ref'][] = $evt_id; |
|
381 | + $attendees[$reg->attendee_ID()]['att_obj'] = $reg->attendee(); |
|
382 | + $attendees[$reg->attendee_ID()]['reg_objs'][$reg->ID()] = $reg; |
|
383 | 383 | //$attendees[ $reg->attendee_ID() ]['registration_id'] = $reg->ID(); |
384 | - $attendees[ $reg->attendee_ID() ]['attendee_email'] = $reg->attendee() instanceof EE_Attendee |
|
384 | + $attendees[$reg->attendee_ID()]['attendee_email'] = $reg->attendee() instanceof EE_Attendee |
|
385 | 385 | ? $reg->attendee()->email() |
386 | 386 | : ''; |
387 | - $attendees[ $reg->attendee_ID() ]['tkt_objs'][ $ticket->ID() ] = $ticket; |
|
388 | - $attendees[ $reg->attendee_ID() ]['evt_objs'][ $evt_id ] = $event; |
|
387 | + $attendees[$reg->attendee_ID()]['tkt_objs'][$ticket->ID()] = $ticket; |
|
388 | + $attendees[$reg->attendee_ID()]['evt_objs'][$evt_id] = $event; |
|
389 | 389 | |
390 | 390 | //registrations |
391 | - $registrations[ $reg->ID() ]['tkt_obj'] = $ticket; |
|
392 | - $registrations[ $reg->ID() ]['evt_obj'] = $event; |
|
393 | - $registrations[ $reg->ID() ]['reg_obj'] = $reg; |
|
394 | - $registrations[ $reg->ID() ]['att_obj'] = $reg->attendee(); |
|
391 | + $registrations[$reg->ID()]['tkt_obj'] = $ticket; |
|
392 | + $registrations[$reg->ID()]['evt_obj'] = $event; |
|
393 | + $registrations[$reg->ID()]['reg_obj'] = $reg; |
|
394 | + $registrations[$reg->ID()]['att_obj'] = $reg->attendee(); |
|
395 | 395 | |
396 | 396 | //set up answer objects |
397 | - $rel_ans = $reg->get_many_related( 'Answer' ); |
|
398 | - foreach ( $rel_ans as $ansid => $answer ) { |
|
399 | - if ( ! isset( $questions[ $ansid ] ) ) { |
|
400 | - $questions[ $ansid ] = $answer->get_first_related( 'Question' ); |
|
397 | + $rel_ans = $reg->get_many_related('Answer'); |
|
398 | + foreach ($rel_ans as $ansid => $answer) { |
|
399 | + if ( ! isset($questions[$ansid])) { |
|
400 | + $questions[$ansid] = $answer->get_first_related('Question'); |
|
401 | 401 | } |
402 | - $answers[ $ansid ] = $answer; |
|
403 | - $registrations[ $reg->ID() ]['ans_objs'][ $ansid ] = $answer; |
|
402 | + $answers[$ansid] = $answer; |
|
403 | + $registrations[$reg->ID()]['ans_objs'][$ansid] = $answer; |
|
404 | 404 | } |
405 | 405 | |
406 | - foreach ( $relateddatetime as $dtt_id => $datetime ) { |
|
407 | - $eventsetup[ $evt_id ]['dtt_objs'][ $dtt_id ] = $datetime; |
|
408 | - $registrations[ $reg->ID() ]['dtt_objs'][ $dtt_id ] = $datetime; |
|
406 | + foreach ($relateddatetime as $dtt_id => $datetime) { |
|
407 | + $eventsetup[$evt_id]['dtt_objs'][$dtt_id] = $datetime; |
|
408 | + $registrations[$reg->ID()]['dtt_objs'][$dtt_id] = $datetime; |
|
409 | 409 | |
410 | - if ( isset( $datetimes[ $dtt_id ] ) ) { |
|
410 | + if (isset($datetimes[$dtt_id])) { |
|
411 | 411 | continue; //already have this info in the datetimes array. |
412 | 412 | } |
413 | 413 | |
414 | - $datetimes[ $dtt_id ]['tkt_objs'][] = $ticket; |
|
415 | - $datetimes[ $dtt_id ]['datetime'] = $datetime; |
|
416 | - $datetimes[ $dtt_id ]['evt_objs'][ $evt_id ] = $event; |
|
417 | - $datetimes[ $dtt_id ]['reg_objs'][ $reg->ID() ] = $reg; |
|
414 | + $datetimes[$dtt_id]['tkt_objs'][] = $ticket; |
|
415 | + $datetimes[$dtt_id]['datetime'] = $datetime; |
|
416 | + $datetimes[$dtt_id]['evt_objs'][$evt_id] = $event; |
|
417 | + $datetimes[$dtt_id]['reg_objs'][$reg->ID()] = $reg; |
|
418 | 418 | } |
419 | 419 | } |
420 | 420 | |
421 | 421 | //let's loop through the unique event=>reg items and setup data on them |
422 | 422 | |
423 | - if ( ! empty( $eventsetup ) ) { |
|
424 | - foreach ( $eventsetup as $evt_id => $items ) { |
|
425 | - if ( $this->txn instanceof EE_Transaction ) { |
|
423 | + if ( ! empty($eventsetup)) { |
|
424 | + foreach ($eventsetup as $evt_id => $items) { |
|
425 | + if ($this->txn instanceof EE_Transaction) { |
|
426 | 426 | $ticket_line_items_for_event = EEM_Line_Item::instance()->get_all( |
427 | 427 | array( |
428 | 428 | array( |
@@ -435,25 +435,25 @@ discard block |
||
435 | 435 | } else { |
436 | 436 | $ticket_line_items_for_event = array(); |
437 | 437 | } |
438 | - $events[ $evt_id ] = array( |
|
438 | + $events[$evt_id] = array( |
|
439 | 439 | 'ID' => $evt_id, |
440 | - 'event' => $evtcache[ $evt_id ], |
|
441 | - 'name' => $evtcache[ $evt_id ] instanceof EE_Event ? $evtcache[ $evt_id ]->name() : '', |
|
442 | - 'total_attendees' => $event_attendee_count[ $evt_id ], |
|
440 | + 'event' => $evtcache[$evt_id], |
|
441 | + 'name' => $evtcache[$evt_id] instanceof EE_Event ? $evtcache[$evt_id]->name() : '', |
|
442 | + 'total_attendees' => $event_attendee_count[$evt_id], |
|
443 | 443 | 'reg_objs' => $items['reg_objs'], |
444 | 444 | 'tkt_objs' => $items['tkt_objs'], |
445 | 445 | 'att_objs' => $items['att_objs'], |
446 | - 'dtt_objs' => isset( $items['dtt_objs'] ) ? $items['dtt_objs'] : array(), |
|
446 | + 'dtt_objs' => isset($items['dtt_objs']) ? $items['dtt_objs'] : array(), |
|
447 | 447 | 'line_items' => $ticket_line_items_for_event, |
448 | 448 | ); |
449 | 449 | |
450 | 450 | //make sure the tickets have the line items setup for them. |
451 | - foreach ( $ticket_line_items_for_event as $line_id => $line_item ) { |
|
452 | - if ( $line_item instanceof EE_Line_Item ) { |
|
453 | - $tickets[ $line_item->ticket()->ID() ]['line_item'] = $line_item; |
|
454 | - $tickets[ $line_item->ticket()->ID() ]['sub_line_items'] = $line_item->children(); |
|
455 | - $line_items[ $line_item->ID() ]['children'] = $line_item->children(); |
|
456 | - $line_items[ $line_item->ID() ]['EE_Ticket'] = $line_item->ticket(); |
|
451 | + foreach ($ticket_line_items_for_event as $line_id => $line_item) { |
|
452 | + if ($line_item instanceof EE_Line_Item) { |
|
453 | + $tickets[$line_item->ticket()->ID()]['line_item'] = $line_item; |
|
454 | + $tickets[$line_item->ticket()->ID()]['sub_line_items'] = $line_item->children(); |
|
455 | + $line_items[$line_item->ID()]['children'] = $line_item->children(); |
|
456 | + $line_items[$line_item->ID()]['EE_Ticket'] = $line_item->ticket(); |
|
457 | 457 | } |
458 | 458 | } |
459 | 459 | } |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | $this->total_ticket_count = $total_ticket_count; |
476 | 476 | $this->registrations = $registrations; |
477 | 477 | |
478 | - if ( $this->txn instanceof EE_Transaction ) { |
|
478 | + if ($this->txn instanceof EE_Transaction) { |
|
479 | 479 | $this->tax_line_items = $this->txn->tax_items(); |
480 | 480 | $this->additional_line_items = $this->txn->non_ticket_line_items(); |
481 | 481 | $this->payments = $this->txn->payments(); |
@@ -485,10 +485,10 @@ discard block |
||
485 | 485 | //let's get just the primary_attendee_data! First we get the primary registration object. |
486 | 486 | $primary_reg = $this->txn->primary_registration(); |
487 | 487 | // verify |
488 | - if ( $primary_reg instanceof EE_Registration ) { |
|
488 | + if ($primary_reg instanceof EE_Registration) { |
|
489 | 489 | |
490 | 490 | // get attendee object |
491 | - if ( $primary_reg->attendee() instanceof EE_Attendee ) { |
|
491 | + if ($primary_reg->attendee() instanceof EE_Attendee) { |
|
492 | 492 | |
493 | 493 | //now we can setup the primary_attendee_data array |
494 | 494 | $this->primary_attendee_data = array( |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -37,20 +37,20 @@ discard block |
||
37 | 37 | protected $_reports_template_data = array(); |
38 | 38 | |
39 | 39 | |
40 | - public function __construct( $routing = TRUE ) { |
|
41 | - parent::__construct( $routing ); |
|
42 | - define( 'REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/'); |
|
43 | - define( 'REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/'); |
|
44 | - define( 'REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/'); |
|
40 | + public function __construct($routing = TRUE) { |
|
41 | + parent::__construct($routing); |
|
42 | + define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'registrations/templates/'); |
|
43 | + define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'registrations/assets/'); |
|
44 | + define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registrations/assets/'); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
48 | 48 | protected function _extend_page_config() { |
49 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations'; |
|
49 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations'; |
|
50 | 50 | |
51 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
52 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) ? ! is_array( $this->_req_data['ATT_ID'] ) : 0; |
|
53 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
51 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
52 | + $att_id = ! empty($this->_req_data['ATT_ID']) ? ! is_array($this->_req_data['ATT_ID']) : 0; |
|
53 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
54 | 54 | |
55 | 55 | $new_page_routes = array( |
56 | 56 | 'reports' => array( |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ) |
90 | 90 | ); |
91 | 91 | |
92 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
92 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
93 | 93 | |
94 | 94 | $new_page_config = array( |
95 | 95 | 'reports' => array( |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | 'filename' => 'registrations_event_checkin_other' |
135 | 135 | ) |
136 | 136 | ), |
137 | - 'help_tour' => array( 'Event_Checkin_Help_Tour' ), |
|
138 | - 'qtips' => array('Registration_List_Table_Tips' ), |
|
137 | + 'help_tour' => array('Event_Checkin_Help_Tour'), |
|
138 | + 'qtips' => array('Registration_List_Table_Tips'), |
|
139 | 139 | 'list_table' => 'EE_Event_Registrations_List_Table', |
140 | 140 | 'metaboxes' => array(), |
141 | 141 | 'require_nonce' => FALSE |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | ), |
154 | 154 | ); |
155 | 155 | |
156 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
156 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
157 | 157 | $this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table'; |
158 | 158 | $this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table'; |
159 | 159 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | protected function _ajax_hooks() { |
164 | 164 | parent::_ajax_hooks(); |
165 | - add_action( 'wp_ajax_get_newsletter_form_content', array( $this, 'get_newsletter_form_content' ) ); |
|
165 | + add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content')); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
@@ -172,20 +172,20 @@ discard block |
||
172 | 172 | |
173 | 173 | //if newsletter message type is active then let's add filter and load js for it. |
174 | 174 | EE_Registry::instance()->load_helper('MSG_Template'); |
175 | - if ( EEH_MSG_Template::is_mt_active('newsletter') ) { |
|
175 | + if (EEH_MSG_Template::is_mt_active('newsletter')) { |
|
176 | 176 | //enqueue newsletter js |
177 | - wp_enqueue_script( 'ee-newsletter-trigger', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
178 | - wp_enqueue_style( 'ee-newsletter-trigger-css', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION ); |
|
177 | + wp_enqueue_script('ee-newsletter-trigger', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE); |
|
178 | + wp_enqueue_style('ee-newsletter-trigger-css', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION); |
|
179 | 179 | //hook in buttons for newsletter message type trigger. |
180 | - add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array( $this, 'add_newsletter_action_buttons'), 10 ); |
|
180 | + add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_newsletter_action_buttons'), 10); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | 184 | |
185 | 185 | |
186 | 186 | public function load_scripts_styles_reports() { |
187 | - wp_register_script( 'ee-reg-reports-js', REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js', array( 'google-charts' ), EVENT_ESPRESSO_VERSION, true ); |
|
188 | - wp_enqueue_script( 'ee-reg-reports-js' ); |
|
187 | + wp_register_script('ee-reg-reports-js', REG_CAF_ASSETS_URL.'ee-registration-admin-reports.js', array('google-charts'), EVENT_ESPRESSO_VERSION, true); |
|
188 | + wp_enqueue_script('ee-reg-reports-js'); |
|
189 | 189 | $this->_registration_reports_js_setup(); |
190 | 190 | } |
191 | 191 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | 'slug' => 'all', |
218 | 218 | 'label' => __('All', 'event_espresso'), |
219 | 219 | 'count' => 0, |
220 | - 'bulk_action' => !isset( $this->_req_data['event_id'] ) ? array() : array( |
|
220 | + 'bulk_action' => ! isset($this->_req_data['event_id']) ? array() : array( |
|
221 | 221 | 'toggle_checkin_status' => __('Toggle Check-In', 'event_espresso'), |
222 | 222 | //'trash_registrations' => __('Trash Registrations', 'event_espresso') |
223 | 223 | ) |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | 'slug' => 'all', |
236 | 236 | 'label' => __('All', 'event_espresso'), |
237 | 237 | 'count' => 0, |
238 | - 'bulk_action' => array( 'delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso') ) |
|
238 | + 'bulk_action' => array('delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso')) |
|
239 | 239 | ), |
240 | 240 | ); |
241 | 241 | } |
@@ -251,20 +251,20 @@ discard block |
||
251 | 251 | */ |
252 | 252 | public function get_newsletter_form_content() { |
253 | 253 | //do a nonce check cause we're not coming in from an normal route here. |
254 | - $nonce = isset( $this->_req_data['get_newsletter_form_content_nonce'] ) ? sanitize_text_field( $this->_req_data['get_newsletter_form_content_nonce'] ) : ''; |
|
254 | + $nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field($this->_req_data['get_newsletter_form_content_nonce']) : ''; |
|
255 | 255 | $nonce_ref = 'get_newsletter_form_content_nonce'; |
256 | 256 | |
257 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
257 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
258 | 258 | //let's get the mtp for the incoming MTP_ ID |
259 | - if ( !isset( $this->_req_data['GRP_ID'] ) ) { |
|
260 | - EE_Error::add_error( __('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
259 | + if ( ! isset($this->_req_data['GRP_ID'])) { |
|
260 | + EE_Error::add_error(__('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
261 | 261 | $this->_template_args['success'] = FALSE; |
262 | 262 | $this->_template_args['error'] = TRUE; |
263 | 263 | $this->_return_json(); |
264 | 264 | } |
265 | - $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['GRP_ID'] ); |
|
266 | - if ( ! $MTPG instanceof EE_Message_Template_Group ) { |
|
267 | - EE_Error::add_error( sprintf( __('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID'] ), __FILE__, __FUNCTION__, __LINE__ ); |
|
265 | + $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']); |
|
266 | + if ( ! $MTPG instanceof EE_Message_Template_Group) { |
|
267 | + EE_Error::add_error(sprintf(__('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID']), __FILE__, __FUNCTION__, __LINE__); |
|
268 | 268 | $this->_template_args['success'] = FALSE; |
269 | 269 | $this->_template_args['error'] = TRUE; |
270 | 270 | $this->_return_json(); |
@@ -273,11 +273,11 @@ discard block |
||
273 | 273 | $MTPs = $MTPG->context_templates(); |
274 | 274 | $MTPs = $MTPs['attendee']; |
275 | 275 | $template_fields = array(); |
276 | - foreach ( $MTPs as $MTP ) { |
|
276 | + foreach ($MTPs as $MTP) { |
|
277 | 277 | $field = $MTP->get('MTP_template_field'); |
278 | - if ( $field == 'content' ) { |
|
278 | + if ($field == 'content') { |
|
279 | 279 | $content = $MTP->get('MTP_content'); |
280 | - if ( !empty( $content['newsletter_content'] ) ) { |
|
280 | + if ( ! empty($content['newsletter_content'])) { |
|
281 | 281 | $template_fields['newsletter_content'] = $content['newsletter_content']; |
282 | 282 | } |
283 | 283 | continue; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $this->_template_args['data'] = array( |
291 | 291 | 'batch_message_from' => isset($template_fields['from']) ? $template_fields['from'] : '', |
292 | 292 | 'batch_message_subject' => isset($template_fields['subject']) ? $template_fields['subject'] : '', |
293 | - 'batch_message_content' => isset( $template_fields['newsletter_content'] ) ? $template_fields['newsletter_content'] : '' |
|
293 | + 'batch_message_content' => isset($template_fields['newsletter_content']) ? $template_fields['newsletter_content'] : '' |
|
294 | 294 | ); |
295 | 295 | $this->_return_json(); |
296 | 296 | } |
@@ -306,8 +306,8 @@ discard block |
||
306 | 306 | * @param EE_Admin_List_Table $list_table |
307 | 307 | * @return string html string for extra buttons |
308 | 308 | */ |
309 | - public function add_newsletter_action_buttons( EE_Admin_List_Table $list_table ) { |
|
310 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_newsletter_selected_send' ) ) { |
|
309 | + public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table) { |
|
310 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_newsletter_selected_send')) { |
|
311 | 311 | return ''; |
312 | 312 | } |
313 | 313 | |
@@ -316,13 +316,13 @@ discard block |
||
316 | 316 | 'event_registrations', |
317 | 317 | 'default' |
318 | 318 | ); |
319 | - if ( $this->_current_page == 'espresso_registrations' && in_array( $this->_req_action, $routes_to_add_to ) ) { |
|
320 | - if ( ( $this->_req_action == 'event_registrations' && empty( $this->_req_data['event_id'] ) ) || ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ) ) { |
|
319 | + if ($this->_current_page == 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) { |
|
320 | + if (($this->_req_action == 'event_registrations' && empty($this->_req_data['event_id'])) || (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash')) { |
|
321 | 321 | echo ''; |
322 | 322 | } else { |
323 | - $button_text = sprintf( __('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>' ); |
|
324 | - echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>' . $button_text . '</button>'; |
|
325 | - add_action('admin_footer', array( $this, 'newsletter_send_form_skeleton') ); |
|
323 | + $button_text = sprintf(__('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>'); |
|
324 | + echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>'.$button_text.'</button>'; |
|
325 | + add_action('admin_footer', array($this, 'newsletter_send_form_skeleton')); |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | } |
@@ -334,38 +334,38 @@ discard block |
||
334 | 334 | $list_table = $this->_list_table_object; |
335 | 335 | $codes = array(); |
336 | 336 | //need to templates for the newsletter message type for the template selector. |
337 | - $values[] = array( 'text' => __('Select Template to Use', 'event_espresso'), 'id' => 0 ); |
|
338 | - $mtps = EEM_Message_Template_Group::instance()->get_all( array( array( 'MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email' ) ) ); |
|
339 | - foreach ( $mtps as $mtp ) { |
|
337 | + $values[] = array('text' => __('Select Template to Use', 'event_espresso'), 'id' => 0); |
|
338 | + $mtps = EEM_Message_Template_Group::instance()->get_all(array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email'))); |
|
339 | + foreach ($mtps as $mtp) { |
|
340 | 340 | $name = $mtp->name(); |
341 | 341 | $values[] = array( |
342 | - 'text' => empty( $name ) ? __('Global', 'event_espresso') : $name, |
|
342 | + 'text' => empty($name) ? __('Global', 'event_espresso') : $name, |
|
343 | 343 | 'id' => $mtp->ID() |
344 | 344 | ); |
345 | 345 | } |
346 | 346 | |
347 | 347 | //need to get a list of shortcodes that are available for the newsletter message type. |
348 | 348 | EE_Registry::instance()->load_helper('MSG_Template'); |
349 | - $shortcodes = EEH_MSG_Template::get_shortcodes( 'newsletter', 'email', array(), 'attendee', FALSE ); |
|
350 | - foreach ( $shortcodes as $field => $shortcode_array ) { |
|
351 | - $codes[$field] = implode(', ', array_keys($shortcode_array ) ); |
|
349 | + $shortcodes = EEH_MSG_Template::get_shortcodes('newsletter', 'email', array(), 'attendee', FALSE); |
|
350 | + foreach ($shortcodes as $field => $shortcode_array) { |
|
351 | + $codes[$field] = implode(', ', array_keys($shortcode_array)); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | $shortcodes = $codes; |
355 | 355 | |
356 | - $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php'; |
|
356 | + $form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php'; |
|
357 | 357 | $form_template_args = array( |
358 | 358 | 'form_action' => admin_url('admin.php?page=espresso_registrations'), |
359 | 359 | 'form_route' => 'newsletter_selected_send', |
360 | 360 | 'form_nonce_name' => 'newsletter_selected_send_nonce', |
361 | - 'form_nonce' => wp_create_nonce( 'newsletter_selected_send_nonce' ), |
|
361 | + 'form_nonce' => wp_create_nonce('newsletter_selected_send_nonce'), |
|
362 | 362 | 'redirect_back_to' => $this->_req_action, |
363 | - 'ajax_nonce' => wp_create_nonce( 'get_newsletter_form_content_nonce'), |
|
364 | - 'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values ), |
|
363 | + 'ajax_nonce' => wp_create_nonce('get_newsletter_form_content_nonce'), |
|
364 | + 'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values), |
|
365 | 365 | 'shortcodes' => $shortcodes, |
366 | 366 | 'id_type' => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration' |
367 | 367 | ); |
368 | - EEH_Template::display_template( $form_template, $form_template_args ); |
|
368 | + EEH_Template::display_template($form_template, $form_template_args); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | protected function _newsletter_selected_send() { |
381 | 381 | $success = TRUE; |
382 | 382 | //first we need to make sure we have a GRP_ID so we know what template we're sending and updating! |
383 | - if ( empty( $this->_req_data['newsletter_mtp_selected'] ) ) { |
|
383 | + if (empty($this->_req_data['newsletter_mtp_selected'])) { |
|
384 | 384 | EE_Error::add_error( |
385 | 385 | __( |
386 | 386 | 'In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | $success = FALSE; |
392 | 392 | } |
393 | 393 | |
394 | - if ( $success ) { |
|
394 | + if ($success) { |
|
395 | 395 | //update Message template in case there are any changes |
396 | 396 | $Message_Template_Group = EEM_Message_Template_Group::instance()->get_one_by_ID( |
397 | 397 | $this->_req_data['newsletter_mtp_selected'] |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $Message_Templates = $Message_Template_Group instanceof EE_Message_Template_Group |
400 | 400 | ? $Message_Template_Group->context_templates() |
401 | 401 | : array(); |
402 | - if ( empty( $Message_Templates ) ) { |
|
402 | + if (empty($Message_Templates)) { |
|
403 | 403 | EE_Error::add_error( |
404 | 404 | __( |
405 | 405 | 'Unable to retrieve message template fields from the db. Messages not sent.', |
@@ -410,25 +410,25 @@ discard block |
||
410 | 410 | } |
411 | 411 | |
412 | 412 | //let's just update the specific fields |
413 | - foreach ( $Message_Templates['attendee'] as $Message_Template ) { |
|
414 | - if ( $Message_Template instanceof EE_Message_Template ) { |
|
415 | - $field = $Message_Template->get( 'MTP_template_field' ); |
|
416 | - $content = $Message_Template->get( 'MTP_content' ); |
|
413 | + foreach ($Message_Templates['attendee'] as $Message_Template) { |
|
414 | + if ($Message_Template instanceof EE_Message_Template) { |
|
415 | + $field = $Message_Template->get('MTP_template_field'); |
|
416 | + $content = $Message_Template->get('MTP_content'); |
|
417 | 417 | $new_content = $content; |
418 | - switch ( $field ) { |
|
418 | + switch ($field) { |
|
419 | 419 | case 'from' : |
420 | - $new_content = ! empty( $this->_req_data['batch_message']['from'] ) |
|
420 | + $new_content = ! empty($this->_req_data['batch_message']['from']) |
|
421 | 421 | ? $this->_req_data['batch_message']['from'] |
422 | 422 | : $content; |
423 | 423 | break; |
424 | 424 | case 'subject' : |
425 | - $new_content = ! empty( $this->_req_data['batch_message']['subject'] ) |
|
425 | + $new_content = ! empty($this->_req_data['batch_message']['subject']) |
|
426 | 426 | ? $this->_req_data['batch_message']['subject'] |
427 | 427 | : $content; |
428 | 428 | break; |
429 | 429 | case 'content' : |
430 | 430 | $new_content = $content; |
431 | - $new_content['newsletter_content'] = ! empty( $this->_req_data['batch_message']['content'] ) |
|
431 | + $new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content']) |
|
432 | 432 | ? $this->_req_data['batch_message']['content'] |
433 | 433 | : $content['newsletter_content']; |
434 | 434 | break; |
@@ -436,35 +436,35 @@ discard block |
||
436 | 436 | continue; |
437 | 437 | break; |
438 | 438 | } |
439 | - $Message_Template->set( 'MTP_content', $new_content ); |
|
439 | + $Message_Template->set('MTP_content', $new_content); |
|
440 | 440 | $Message_Template->save(); |
441 | 441 | } |
442 | 442 | } |
443 | 443 | |
444 | 444 | //great fields are updated! now let's make sure we just have contact objects (EE_Attendee). |
445 | - $id_type = ! empty( $this->_req_data['batch_message']['id_type'] ) |
|
445 | + $id_type = ! empty($this->_req_data['batch_message']['id_type']) |
|
446 | 446 | ? $this->_req_data['batch_message']['id_type'] |
447 | 447 | : 'registration'; |
448 | 448 | |
449 | 449 | //id_type will affect how we assemble the ids. |
450 | - $ids = ! empty( $this->_req_data['batch_message']['ids'] ) |
|
451 | - ? json_decode( stripslashes($this->_req_data['batch_message']['ids']) ) |
|
450 | + $ids = ! empty($this->_req_data['batch_message']['ids']) |
|
451 | + ? json_decode(stripslashes($this->_req_data['batch_message']['ids'])) |
|
452 | 452 | : array(); |
453 | 453 | |
454 | 454 | $registrations_used_for_contact_data = array(); |
455 | 455 | //using switch because eventually we'll have other contexts that will be used for generating messages. |
456 | - switch ( $id_type ) { |
|
456 | + switch ($id_type) { |
|
457 | 457 | case 'registration' : |
458 | 458 | $registrations_used_for_contact_data = EEM_Registration::instance()->get_all( |
459 | 459 | array( |
460 | 460 | array( |
461 | - 'REG_ID' => array( 'IN', $ids ) |
|
461 | + 'REG_ID' => array('IN', $ids) |
|
462 | 462 | ) |
463 | 463 | ) |
464 | 464 | ); |
465 | 465 | break; |
466 | 466 | case 'contact' : |
467 | - $registrations_used_for_contact_data = EEM_Registration::instance()->get_latest_registration_for_each_of_given_contacts( $ids ); |
|
467 | + $registrations_used_for_contact_data = EEM_Registration::instance()->get_latest_registration_for_each_of_given_contacts($ids); |
|
468 | 468 | break; |
469 | 469 | } |
470 | 470 | do_action( |
@@ -475,8 +475,8 @@ discard block |
||
475 | 475 | //kept for backward compat, internally we no longer use this action. |
476 | 476 | //@deprecated 4.8.36.rc.002 |
477 | 477 | $contacts = $id_type == 'registration' |
478 | - ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids( $ids ) |
|
479 | - : EEM_Attendee::instance()->get_all( array( array( 'ATT_ID' => array('in', $ids ) ) ) ); |
|
478 | + ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids) |
|
479 | + : EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids)))); |
|
480 | 480 | do_action( |
481 | 481 | 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', |
482 | 482 | $contacts, |
@@ -484,11 +484,11 @@ discard block |
||
484 | 484 | ); |
485 | 485 | } |
486 | 486 | $query_args = array( |
487 | - 'action' => !empty( $this->_req_data['redirect_back_to'] ) |
|
487 | + 'action' => ! empty($this->_req_data['redirect_back_to']) |
|
488 | 488 | ? $this->_req_data['redirect_back_to'] |
489 | 489 | : 'default' |
490 | 490 | ); |
491 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
491 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | |
@@ -510,8 +510,8 @@ discard block |
||
510 | 510 | * @return void |
511 | 511 | */ |
512 | 512 | protected function _registration_reports() { |
513 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
|
514 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_reports_template_data, true ); |
|
513 | + $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php'; |
|
514 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_reports_template_data, true); |
|
515 | 515 | // the final template wrapper |
516 | 516 | $this->display_admin_page_with_no_sidebar(); |
517 | 517 | |
@@ -524,29 +524,29 @@ discard block |
||
524 | 524 | * |
525 | 525 | * @return string |
526 | 526 | */ |
527 | - private function _registrations_per_day_report( $period = '-1 month' ) { |
|
527 | + private function _registrations_per_day_report($period = '-1 month') { |
|
528 | 528 | $report_ID = 'reg-admin-registrations-per-day-report-dv'; |
529 | 529 | |
530 | - $results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report( $period ); |
|
531 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
530 | + $results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period); |
|
531 | + EE_Registry::instance()->load_helper('Template'); |
|
532 | 532 | |
533 | 533 | $results = (array) $results; |
534 | 534 | $regs = array(); |
535 | 535 | $subtitle = ''; |
536 | 536 | |
537 | - if( $results ) { |
|
537 | + if ($results) { |
|
538 | 538 | $column_titles = array(); |
539 | 539 | $tracker = 0; |
540 | - foreach ( $results as $result ) { |
|
540 | + foreach ($results as $result) { |
|
541 | 541 | $report_column_values = array(); |
542 | - foreach( $result as $property_name => $property_value ) { |
|
542 | + foreach ($result as $property_name => $property_value) { |
|
543 | 543 | $property_value = $property_name == 'Registration_REG_date' ? $property_value : (int) $property_value; |
544 | 544 | $report_column_values[] = $property_value; |
545 | - if ( $tracker === 0 ) { |
|
546 | - if ( $property_name == 'Registration_REG_date' ) { |
|
547 | - $column_titles[] = __( 'Date (only days with registrations are shown)', 'event_espresso' ); |
|
545 | + if ($tracker === 0) { |
|
546 | + if ($property_name == 'Registration_REG_date') { |
|
547 | + $column_titles[] = __('Date (only days with registrations are shown)', 'event_espresso'); |
|
548 | 548 | } else { |
549 | - $column_titles[] = EEH_Template::pretty_status( $property_name, false, 'sentence' ); |
|
549 | + $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence'); |
|
550 | 550 | } |
551 | 551 | } |
552 | 552 | } |
@@ -555,37 +555,37 @@ discard block |
||
555 | 555 | } |
556 | 556 | |
557 | 557 | //make sure the column_titles is pushed to the beginning of the array |
558 | - array_unshift( $regs, $column_titles ); |
|
558 | + array_unshift($regs, $column_titles); |
|
559 | 559 | //setup the date range. |
560 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
561 | - $DateTimeZone = new DateTimeZone( EEH_DTT_Helper::get_timezone() ); |
|
562 | - $beginning_date = new DateTime( "now " . $period, $DateTimeZone ); |
|
563 | - $ending_date = new DateTime( "now", $DateTimeZone ); |
|
560 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
561 | + $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone()); |
|
562 | + $beginning_date = new DateTime("now ".$period, $DateTimeZone); |
|
563 | + $ending_date = new DateTime("now", $DateTimeZone); |
|
564 | 564 | $subtitle = sprintf( |
565 | - _x( 'For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso' ), |
|
566 | - $beginning_date->format( 'Y-m-d' ), |
|
567 | - $ending_date->format( 'Y-m-d' ) |
|
565 | + _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'), |
|
566 | + $beginning_date->format('Y-m-d'), |
|
567 | + $ending_date->format('Y-m-d') |
|
568 | 568 | ); |
569 | 569 | } |
570 | 570 | |
571 | - $report_title = __( 'Total Registrations per Day', 'event_espresso' ); |
|
571 | + $report_title = __('Total Registrations per Day', 'event_espresso'); |
|
572 | 572 | |
573 | 573 | $report_params = array( |
574 | 574 | 'title' => $report_title, |
575 | 575 | 'subtitle' => $subtitle, |
576 | 576 | 'id' => $report_ID, |
577 | 577 | 'regs' => $regs, |
578 | - 'noResults' => empty( $regs ), |
|
578 | + 'noResults' => empty($regs), |
|
579 | 579 | 'noRegsMsg' => sprintf( |
580 | 580 | __( |
581 | 581 | '%sThere are currently no registration records in the last month for this report.%s', |
582 | 582 | 'event_espresso' |
583 | 583 | ), |
584 | - '<h2>' . $report_title . '</h2><p>', |
|
584 | + '<h2>'.$report_title.'</h2><p>', |
|
585 | 585 | '</p>' |
586 | 586 | ), |
587 | 587 | ); |
588 | - wp_localize_script( 'ee-reg-reports-js', 'regPerDay', $report_params ); |
|
588 | + wp_localize_script('ee-reg-reports-js', 'regPerDay', $report_params); |
|
589 | 589 | |
590 | 590 | return $report_ID; |
591 | 591 | } |
@@ -597,30 +597,30 @@ discard block |
||
597 | 597 | * |
598 | 598 | * @return string |
599 | 599 | */ |
600 | - private function _registrations_per_event_report( $period = '-1 month' ) { |
|
600 | + private function _registrations_per_event_report($period = '-1 month') { |
|
601 | 601 | |
602 | 602 | $report_ID = 'reg-admin-registrations-per-event-report-dv'; |
603 | 603 | |
604 | - $results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report( $period ); |
|
605 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
604 | + $results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period); |
|
605 | + EE_Registry::instance()->load_helper('Template'); |
|
606 | 606 | |
607 | 607 | $results = (array) $results; |
608 | 608 | $regs = array(); |
609 | 609 | $subtitle = ''; |
610 | 610 | |
611 | - if ( $results ) { |
|
611 | + if ($results) { |
|
612 | 612 | $column_titles = array(); |
613 | 613 | $tracker = 0; |
614 | - foreach ( $results as $result ) { |
|
614 | + foreach ($results as $result) { |
|
615 | 615 | $report_column_values = array(); |
616 | - foreach( $result as $property_name => $property_value ) { |
|
617 | - $property_value = $property_name == 'Registration_Event' ? wp_trim_words( $property_value, 4, '...' ) : (int) $property_value; |
|
616 | + foreach ($result as $property_name => $property_value) { |
|
617 | + $property_value = $property_name == 'Registration_Event' ? wp_trim_words($property_value, 4, '...') : (int) $property_value; |
|
618 | 618 | $report_column_values[] = $property_value; |
619 | - if ( $tracker === 0 ) { |
|
620 | - if ( $property_name == 'Registration_Event' ) { |
|
621 | - $column_titles[] = __( 'Event', 'event_espresso' ); |
|
619 | + if ($tracker === 0) { |
|
620 | + if ($property_name == 'Registration_Event') { |
|
621 | + $column_titles[] = __('Event', 'event_espresso'); |
|
622 | 622 | } else { |
623 | - $column_titles[] = EEH_Template::pretty_status( $property_name, false, 'sentence' ); |
|
623 | + $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence'); |
|
624 | 624 | } |
625 | 625 | } |
626 | 626 | } |
@@ -629,38 +629,38 @@ discard block |
||
629 | 629 | } |
630 | 630 | |
631 | 631 | //make sure the column_titles is pushed to the beginning of the array |
632 | - array_unshift( $regs, $column_titles ); |
|
632 | + array_unshift($regs, $column_titles); |
|
633 | 633 | |
634 | 634 | //setup the date range. |
635 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
636 | - $DateTimeZone = new DateTimeZone( EEH_DTT_Helper::get_timezone() ); |
|
637 | - $beginning_date = new DateTime( "now " . $period, $DateTimeZone ); |
|
638 | - $ending_date = new DateTime( "now", $DateTimeZone ); |
|
635 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
636 | + $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone()); |
|
637 | + $beginning_date = new DateTime("now ".$period, $DateTimeZone); |
|
638 | + $ending_date = new DateTime("now", $DateTimeZone); |
|
639 | 639 | $subtitle = sprintf( |
640 | - _x( 'For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso' ), |
|
641 | - $beginning_date->format( 'Y-m-d' ), |
|
642 | - $ending_date->format( 'Y-m-d' ) |
|
640 | + _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'), |
|
641 | + $beginning_date->format('Y-m-d'), |
|
642 | + $ending_date->format('Y-m-d') |
|
643 | 643 | ); |
644 | 644 | } |
645 | 645 | |
646 | - $report_title = __( 'Total Registrations per Event', 'event_espresso' ); |
|
646 | + $report_title = __('Total Registrations per Event', 'event_espresso'); |
|
647 | 647 | |
648 | 648 | $report_params = array( |
649 | 649 | 'title' => $report_title, |
650 | 650 | 'subtitle' => $subtitle, |
651 | 651 | 'id' => $report_ID, |
652 | 652 | 'regs' => $regs, |
653 | - 'noResults' => empty( $regs ), |
|
653 | + 'noResults' => empty($regs), |
|
654 | 654 | 'noRegsMsg' => sprintf( |
655 | 655 | __( |
656 | 656 | '%sThere are currently no registration records in the last month for this report.%s', |
657 | 657 | 'event_espresso' |
658 | 658 | ), |
659 | - '<h2>' . $report_title . '</h2><p>', |
|
659 | + '<h2>'.$report_title.'</h2><p>', |
|
660 | 660 | '</p>' |
661 | 661 | ), |
662 | 662 | ); |
663 | - wp_localize_script( 'ee-reg-reports-js', 'regPerEvent', $report_params ); |
|
663 | + wp_localize_script('ee-reg-reports-js', 'regPerEvent', $report_params); |
|
664 | 664 | |
665 | 665 | return $report_ID; |
666 | 666 | } |
@@ -674,8 +674,8 @@ discard block |
||
674 | 674 | * @return void |
675 | 675 | */ |
676 | 676 | protected function _registration_checkin_list_table() { |
677 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
678 | - $reg_id = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : null; |
|
677 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
678 | + $reg_id = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : null; |
|
679 | 679 | $reg = EEM_Registration::instance()->get_one_by_ID($reg_id); |
680 | 680 | $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $reg->event_ID()), 'add-new-h2'); |
681 | 681 | |
@@ -689,15 +689,15 @@ discard block |
||
689 | 689 | 'desc' => __('This indicates the attendee has been checked out', 'event_espresso') |
690 | 690 | ) |
691 | 691 | ); |
692 | - $this->_template_args['after_list_table'] = $this->_display_legend( $legend_items ); |
|
692 | + $this->_template_args['after_list_table'] = $this->_display_legend($legend_items); |
|
693 | 693 | |
694 | 694 | |
695 | - $dtt_id = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
696 | - $go_back_url = !empty( $reg_id ) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id ), $this->_admin_base_url ) : ''; |
|
695 | + $dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
696 | + $go_back_url = ! empty($reg_id) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id), $this->_admin_base_url) : ''; |
|
697 | 697 | |
698 | - $this->_template_args['before_list_table'] = !empty( $reg_id ) && !empty( $dtt_id ) ? '<h2>' . sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">' . EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name() . '</span>', '<span id="checkin-dtt"><a href="' . $go_back_url . '">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time() . ' - ' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time() . '</a></span>', '<span id="checkin-event-name">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name') . '</span>' ) . '</h2>' : ''; |
|
699 | - $this->_template_args['list_table_hidden_fields'] = !empty( $reg_id ) ? '<input type="hidden" name="_REGID" value="' . $reg_id . '">' : ''; |
|
700 | - $this->_template_args['list_table_hidden_fields'] .= !empty( $dtt_id ) ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : ''; |
|
698 | + $this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id) ? '<h2>'.sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">'.EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name().'</span>', '<span id="checkin-dtt"><a href="'.$go_back_url.'">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time().' - '.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time().'</a></span>', '<span id="checkin-event-name">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name').'</span>').'</h2>' : ''; |
|
699 | + $this->_template_args['list_table_hidden_fields'] = ! empty($reg_id) ? '<input type="hidden" name="_REGID" value="'.$reg_id.'">' : ''; |
|
700 | + $this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id) ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : ''; |
|
701 | 701 | |
702 | 702 | $this->display_admin_list_table_page_with_no_sidebar(); |
703 | 703 | } |
@@ -710,24 +710,24 @@ discard block |
||
710 | 710 | */ |
711 | 711 | public function toggle_checkin_status() { |
712 | 712 | //first make sure we have the necessary data |
713 | - if ( !isset( $this->_req_data['_regid'] ) ) { |
|
714 | - EE_Error::add_error( __('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
713 | + if ( ! isset($this->_req_data['_regid'])) { |
|
714 | + EE_Error::add_error(__('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
715 | 715 | $this->_template_args['success'] = FALSE; |
716 | 716 | $this->_template_args['error'] = TRUE; |
717 | 717 | $this->_return_json(); |
718 | 718 | }; |
719 | 719 | |
720 | 720 | //do a nonce check cause we're not coming in from an normal route here. |
721 | - $nonce = isset( $this->_req_data['checkinnonce'] ) ? sanitize_text_field( $this->_req_data['checkinnonce'] ) : ''; |
|
721 | + $nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce']) : ''; |
|
722 | 722 | $nonce_ref = 'checkin_nonce'; |
723 | 723 | |
724 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
724 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
725 | 725 | |
726 | 726 | //beautiful! Made it this far so let's get the status. |
727 | 727 | $new_status = $this->_toggle_checkin_status(); |
728 | 728 | |
729 | 729 | //setup new class to return via ajax |
730 | - $this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-' . $new_status; |
|
730 | + $this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-'.$new_status; |
|
731 | 731 | $this->_template_args['success'] = TRUE; |
732 | 732 | $this->_return_json(); |
733 | 733 | } |
@@ -747,32 +747,32 @@ discard block |
||
747 | 747 | //first let's get the query args out of the way for the redirect |
748 | 748 | $query_args = array( |
749 | 749 | 'action' => 'event_registrations', |
750 | - 'event_id' => isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL, |
|
751 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL |
|
750 | + 'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL, |
|
751 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL |
|
752 | 752 | ); |
753 | 753 | $new_status = FALSE; |
754 | 754 | |
755 | 755 | // bulk action check in toggle |
756 | - if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) { |
|
756 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
757 | 757 | // cycle thru checkboxes |
758 | - while ( list( $REG_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
759 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
758 | + while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) { |
|
759 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
760 | 760 | $new_status = $this->_toggle_checkin($REG_ID, $DTT_ID); |
761 | 761 | } |
762 | 762 | |
763 | - } elseif ( isset( $this->_req_data['_regid'] ) ) { |
|
763 | + } elseif (isset($this->_req_data['_regid'])) { |
|
764 | 764 | //coming from ajax request |
765 | - $DTT_ID = isset( $this->_req_data['dttid'] ) ? $this->_req_data['dttid'] : NULL; |
|
765 | + $DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : NULL; |
|
766 | 766 | $query_args['DTT_ID'] = $DTT_ID; |
767 | 767 | $new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID); |
768 | 768 | } else { |
769 | - EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
769 | + EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
770 | 770 | } |
771 | 771 | |
772 | - if ( defined('DOING_AJAX' ) ) |
|
772 | + if (defined('DOING_AJAX')) |
|
773 | 773 | return $new_status; |
774 | 774 | |
775 | - $this->_redirect_after_action( FALSE,'', '', $query_args, TRUE ); |
|
775 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
776 | 776 | |
777 | 777 | } |
778 | 778 | |
@@ -788,11 +788,11 @@ discard block |
||
788 | 788 | */ |
789 | 789 | private function _toggle_checkin($REG_ID, $DTT_ID) { |
790 | 790 | $REG = EEM_Registration::instance()->get_one_by_ID($REG_ID); |
791 | - $new_status = $REG->toggle_checkin_status( $DTT_ID ); |
|
792 | - if ( $new_status !== FALSE ) { |
|
793 | - EE_Error::add_success($REG->get_checkin_msg($DTT_ID) ); |
|
791 | + $new_status = $REG->toggle_checkin_status($DTT_ID); |
|
792 | + if ($new_status !== FALSE) { |
|
793 | + EE_Error::add_success($REG->get_checkin_msg($DTT_ID)); |
|
794 | 794 | } else { |
795 | - EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__ ); |
|
795 | + EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__); |
|
796 | 796 | $new_status = FALSE; |
797 | 797 | } |
798 | 798 | return $new_status; |
@@ -808,28 +808,28 @@ discard block |
||
808 | 808 | protected function _delete_checkin_rows() { |
809 | 809 | $query_args = array( |
810 | 810 | 'action' => 'registration_checkins', |
811 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0, |
|
812 | - '_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0 |
|
811 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
|
812 | + '_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0 |
|
813 | 813 | ); |
814 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
815 | - while ( list( $CHK_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
814 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
815 | + while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) { |
|
816 | 816 | $errors = 0; |
817 | - if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID ) ) { |
|
817 | + if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) { |
|
818 | 818 | $errors++; |
819 | 819 | } |
820 | 820 | } |
821 | 821 | } else { |
822 | - EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
823 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
822 | + EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
823 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
824 | 824 | } |
825 | 825 | |
826 | - if ( $errors > 0 ) { |
|
827 | - EE_Error::add_error( sprintf( __('There were %d records that did not delete successfully', 'event_espresso'), $errors ), __FILE__, __FUNCTION__, __LINE__ ); |
|
826 | + if ($errors > 0) { |
|
827 | + EE_Error::add_error(sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors), __FILE__, __FUNCTION__, __LINE__); |
|
828 | 828 | } else { |
829 | - EE_Error::add_success( __('Records were successfully deleted', 'event_espresso') ); |
|
829 | + EE_Error::add_success(__('Records were successfully deleted', 'event_espresso')); |
|
830 | 830 | } |
831 | 831 | |
832 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
832 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
833 | 833 | } |
834 | 834 | |
835 | 835 | |
@@ -841,20 +841,20 @@ discard block |
||
841 | 841 | protected function _delete_checkin_row() { |
842 | 842 | $query_args = array( |
843 | 843 | 'action' => 'registration_checkins', |
844 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0, |
|
845 | - '_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0 |
|
844 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
|
845 | + '_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0 |
|
846 | 846 | ); |
847 | 847 | |
848 | - if ( !empty( $this->_req_data['CHK_ID'] ) ) { |
|
849 | - if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'] ) ) { |
|
850 | - EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
848 | + if ( ! empty($this->_req_data['CHK_ID'])) { |
|
849 | + if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) { |
|
850 | + EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
851 | 851 | } else { |
852 | - EE_Error::add_success( __('Check-In record successfully deleted', 'event_espresso') ); |
|
852 | + EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso')); |
|
853 | 853 | } |
854 | 854 | } else { |
855 | - EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
855 | + EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
856 | 856 | } |
857 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
857 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
858 | 858 | } |
859 | 859 | |
860 | 860 | |
@@ -867,8 +867,8 @@ discard block |
||
867 | 867 | * @return void |
868 | 868 | */ |
869 | 869 | protected function _event_registrations_list_table() { |
870 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
871 | - $this->_admin_page_title .= isset( $this->_req_data['event_id'] ) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : ''; |
|
870 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
871 | + $this->_admin_page_title .= isset($this->_req_data['event_id']) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : ''; |
|
872 | 872 | |
873 | 873 | $legend_items = array( |
874 | 874 | 'star-icon' => array( |
@@ -892,31 +892,31 @@ discard block |
||
892 | 892 | 'desc' => __('View All Check-in Records for this Registrant', 'event_espresso') |
893 | 893 | ), |
894 | 894 | 'approved_status' => array( |
895 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
896 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
895 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
896 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
897 | 897 | ), |
898 | 898 | 'cancelled_status' => array( |
899 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
900 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
899 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
900 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
901 | 901 | ), |
902 | 902 | 'declined_status' => array( |
903 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
904 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
903 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
904 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
905 | 905 | ), |
906 | 906 | 'not_approved' => array( |
907 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
908 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
907 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
908 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
909 | 909 | ), |
910 | 910 | 'pending_status' => array( |
911 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
912 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
911 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
912 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
913 | 913 | )/**/ |
914 | 914 | ); |
915 | - $this->_template_args['after_list_table'] = $this->_display_legend( $legend_items ); |
|
915 | + $this->_template_args['after_list_table'] = $this->_display_legend($legend_items); |
|
916 | 916 | |
917 | - $event_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null; |
|
918 | - $this->_template_args['before_list_table'] = !empty( $event_id ) ? '<h2>' . sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name') ) . '</h2>' : ''; |
|
919 | - $this->_template_args['list_table_hidden_fields'] = !empty( $event_id ) ? '<input type="hidden" name="event_id" value="' . $event_id . '">' : ''; |
|
917 | + $event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null; |
|
918 | + $this->_template_args['before_list_table'] = ! empty($event_id) ? '<h2>'.sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')).'</h2>' : ''; |
|
919 | + $this->_template_args['list_table_hidden_fields'] = ! empty($event_id) ? '<input type="hidden" name="event_id" value="'.$event_id.'">' : ''; |
|
920 | 920 | |
921 | 921 | $this->display_admin_list_table_page_with_no_sidebar(); |
922 | 922 | } |
@@ -930,15 +930,15 @@ discard block |
||
930 | 930 | * @access public |
931 | 931 | * @return array |
932 | 932 | */ |
933 | - public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) { |
|
933 | + public function get_event_attendees($per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '') { |
|
934 | 934 | |
935 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
936 | - require_once(EE_MODELS . 'EEM_Attendee.model.php'); |
|
935 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
936 | + require_once(EE_MODELS.'EEM_Attendee.model.php'); |
|
937 | 937 | //$ATT_MDL = EEM_Attendee::instance(); |
938 | 938 | |
939 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
940 | - $CAT_ID = isset($this->_req_data['category_id']) ? absint( $this->_req_data['category_id'] ) : FALSE; |
|
941 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
939 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
940 | + $CAT_ID = isset($this->_req_data['category_id']) ? absint($this->_req_data['category_id']) : FALSE; |
|
941 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
942 | 942 | |
943 | 943 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby; |
944 | 944 | |
@@ -951,94 +951,94 @@ discard block |
||
951 | 951 | // $orderby = 'reg.REG_final_price'; |
952 | 952 | } |
953 | 953 | |
954 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
954 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
955 | 955 | |
956 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
957 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
956 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
957 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
958 | 958 | |
959 | 959 | |
960 | - $offset = ($current_page-1)*$per_page; |
|
961 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
962 | - $query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array())))); |
|
963 | - if ($EVT_ID){ |
|
964 | - $query_params[0]['EVT_ID']=$EVT_ID; |
|
960 | + $offset = ($current_page - 1) * $per_page; |
|
961 | + $limit = $count ? NULL : array($offset, $per_page); |
|
962 | + $query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array())))); |
|
963 | + if ($EVT_ID) { |
|
964 | + $query_params[0]['EVT_ID'] = $EVT_ID; |
|
965 | 965 | } |
966 | - if($CAT_ID){ |
|
966 | + if ($CAT_ID) { |
|
967 | 967 | throw new EE_Error("You specified a Category Id for this query. Thats odd because we are now using terms and taxonomies. So did you mean the term taxonomy id o rthe term id?"); |
968 | 968 | } |
969 | 969 | |
970 | 970 | //if DTT is included we do multiple datetimes. |
971 | - if ( $DTT_ID ) { |
|
971 | + if ($DTT_ID) { |
|
972 | 972 | $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
973 | 973 | } |
974 | 974 | |
975 | 975 | //make sure we only have default where on the current regs |
976 | 976 | $query_params['default_where_conditions'] = 'this_model_only'; |
977 | 977 | |
978 | - $status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) ); |
|
978 | + $status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)); |
|
979 | 979 | |
980 | - $query_params[0]['STS_ID']= array('IN', $status_ids_array ); |
|
980 | + $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
981 | 981 | |
982 | - if($trash){ |
|
983 | - $query_params[0]['Attendee.status']= EEM_CPT_Base::post_status_trashed; |
|
982 | + if ($trash) { |
|
983 | + $query_params[0]['Attendee.status'] = EEM_CPT_Base::post_status_trashed; |
|
984 | 984 | } |
985 | 985 | |
986 | - if ( isset( $this->_req_data['s'] ) ) { |
|
987 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
986 | + if (isset($this->_req_data['s'])) { |
|
987 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
988 | 988 | $query_params[0]['OR'] = array( |
989 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
990 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
991 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
992 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
993 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
994 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
995 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
996 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
997 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
998 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
999 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
1000 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
1001 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
1002 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
1003 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
1004 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ) |
|
989 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
990 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
991 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
992 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
993 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
994 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
995 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
996 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
997 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
998 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
999 | + 'REG_final_price' => array('LIKE', $sstr), |
|
1000 | + 'REG_code' => array('LIKE', $sstr), |
|
1001 | + 'REG_count' => array('LIKE', $sstr), |
|
1002 | + 'REG_group_size' => array('LIKE', $sstr), |
|
1003 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
1004 | + 'Ticket.TKT_description' => array('LIKE', $sstr) |
|
1005 | 1005 | ); |
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | $query_params['order_by'][$orderby] = $sort; |
1009 | 1009 | $query_params['limit'] = $limit; |
1010 | - $query_params['force_join'] = array('Attendee');//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration |
|
1011 | - if($count){ |
|
1012 | - $registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only' )); |
|
1013 | - }else{ |
|
1010 | + $query_params['force_join'] = array('Attendee'); //force join to attendee model so that it gets cached, because we're going to need the attendee for each registration |
|
1011 | + if ($count) { |
|
1012 | + $registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only')); |
|
1013 | + } else { |
|
1014 | 1014 | $registrations = EEM_Registration::instance()->get_all($query_params); |
1015 | 1015 | |
1016 | 1016 | |
1017 | 1017 | // $registrations = EEM_Registration::instance(); |
1018 | 1018 | // $all_attendees = EEM_Attendee::instance()->get_event_attendees( $EVT_ID, $CAT_ID, $reg_status, $trash, $orderby, $sort, $limit, $output ); |
1019 | - if ( isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration ) { |
|
1019 | + if (isset($registrations[0]) && $registrations[0] instanceof EE_Registration) { |
|
1020 | 1020 | //EEH_Debug_Tools::printr( $all_attendees[0], '$all_attendees[0] <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1021 | 1021 | // name |
1022 | 1022 | $first_registration = $registrations[0]; |
1023 | 1023 | $event_obj = $first_registration->event_obj(); |
1024 | - if($event_obj){ |
|
1024 | + if ($event_obj) { |
|
1025 | 1025 | $event_name = $first_registration->event_obj()->name(); |
1026 | - $event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?';//$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1026 | + $event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?'; //$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1027 | 1027 | // edit event link |
1028 | - if ( $event_name != '' ) { |
|
1029 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1030 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1031 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1028 | + if ($event_name != '') { |
|
1029 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1030 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1031 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1032 | 1032 | } |
1033 | 1033 | |
1034 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1035 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
1034 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1035 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
1036 | 1036 | |
1037 | 1037 | $this->_template_args['before_admin_page_content'] = ' |
1038 | 1038 | <div id="admin-page-header"> |
1039 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1040 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1041 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1039 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1040 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1041 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1042 | 1042 | </div> |
1043 | 1043 | '; |
1044 | 1044 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return EED_Module |
70 | 70 | */ |
71 | 71 | public static function instance() { |
72 | - return parent::get_instance( __CLASS__ ); |
|
72 | + return parent::get_instance(__CLASS__); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function set_hooks() { |
86 | 86 | //actions |
87 | - add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 ); |
|
88 | - add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 2 ); |
|
87 | + add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2); |
|
88 | + add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 2); |
|
89 | 89 | //filters |
90 | - add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
91 | - add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
90 | + add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
91 | + add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
92 | 92 | //register routes |
93 | 93 | self::_register_routes(); |
94 | 94 | } |
@@ -101,16 +101,16 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public static function set_hooks_admin() { |
103 | 103 | //actions |
104 | - add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 ); |
|
105 | - add_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array( 'EED_Messages', 'payment_reminder' ), 10 ); |
|
106 | - add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 3 ); |
|
107 | - add_action( 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations', array( 'EED_Messages', 'send_newsletter_message' ), 10, 2 ); |
|
108 | - add_action( 'AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array( 'EED_Messages', 'cancelled_registration' ), 10 ); |
|
109 | - add_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', array( 'EED_Messages', 'process_admin_payment' ), 10, 1 ); |
|
104 | + add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2); |
|
105 | + add_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array('EED_Messages', 'payment_reminder'), 10); |
|
106 | + add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 3); |
|
107 | + add_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations', array('EED_Messages', 'send_newsletter_message'), 10, 2); |
|
108 | + add_action('AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array('EED_Messages', 'cancelled_registration'), 10); |
|
109 | + add_action('AHEE__EE_Admin_Page___process_admin_payment_notification', array('EED_Messages', 'process_admin_payment'), 10, 1); |
|
110 | 110 | //filters |
111 | - add_filter( 'FHEE__EE_Admin_Page___process_resend_registration__success', array( 'EED_Messages', 'process_resend' ), 10, 2 ); |
|
112 | - add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
113 | - add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
111 | + add_filter('FHEE__EE_Admin_Page___process_resend_registration__success', array('EED_Messages', 'process_resend'), 10, 2); |
|
112 | + add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
113 | + add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | * @return void |
125 | 125 | */ |
126 | 126 | protected static function _register_routes() { |
127 | - EE_Config::register_route( 'msg_url_trigger', 'Messages', 'run' ); |
|
128 | - EE_Config::register_route( 'msg_cron_trigger', 'Messages', 'run_cron' ); |
|
129 | - EE_Config::register_route( 'msg_browser_trigger', 'Messages', 'browser_trigger' ); |
|
130 | - EE_Config::register_route( 'msg_browser_error_trigger', 'Messages', 'browser_error_trigger' ); |
|
131 | - do_action( 'AHEE__EED_Messages___register_routes' ); |
|
127 | + EE_Config::register_route('msg_url_trigger', 'Messages', 'run'); |
|
128 | + EE_Config::register_route('msg_cron_trigger', 'Messages', 'run_cron'); |
|
129 | + EE_Config::register_route('msg_browser_trigger', 'Messages', 'browser_trigger'); |
|
130 | + EE_Config::register_route('msg_browser_error_trigger', 'Messages', 'browser_error_trigger'); |
|
131 | + do_action('AHEE__EED_Messages___register_routes'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -139,18 +139,18 @@ discard block |
||
139 | 139 | * @since 4.9.0 |
140 | 140 | * @param WP $WP |
141 | 141 | */ |
142 | - public function browser_trigger( $WP ) { |
|
142 | + public function browser_trigger($WP) { |
|
143 | 143 | //ensure controller is loaded |
144 | 144 | self::_load_controller(); |
145 | - $token = EE_Registry::instance()->REQ->get( 'token' ); |
|
145 | + $token = EE_Registry::instance()->REQ->get('token'); |
|
146 | 146 | try { |
147 | - $mtg = new EE_Message_Generated_From_Token( $token, 'html', self::$_message_resource_manager ); |
|
148 | - self::$_MSG_PROCESSOR->generate_and_send_now( $mtg ); |
|
149 | - } catch( EE_Error $e ) { |
|
150 | - $error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' ); |
|
147 | + $mtg = new EE_Message_Generated_From_Token($token, 'html', self::$_message_resource_manager); |
|
148 | + self::$_MSG_PROCESSOR->generate_and_send_now($mtg); |
|
149 | + } catch (EE_Error $e) { |
|
150 | + $error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso'); |
|
151 | 151 | // add specific message for developers if WP_DEBUG in on |
152 | - $error_msg .= '||' . $e->getMessage(); |
|
153 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
152 | + $error_msg .= '||'.$e->getMessage(); |
|
153 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
@@ -166,20 +166,20 @@ discard block |
||
166 | 166 | * @since 4.9.0 |
167 | 167 | * @param $WP |
168 | 168 | */ |
169 | - public function browser_error_trigger( $WP ) { |
|
170 | - $token = EE_Registry::instance()->REQ->get( 'token' ); |
|
171 | - if ( $token ) { |
|
172 | - $message = EEM_Message::instance()->get_one_by_token( $token ); |
|
173 | - if ( $message instanceof EE_Message ) { |
|
174 | - header( 'HTTP/1.1 200 OK' ); |
|
175 | - $error_msg = nl2br( $message->error_message() ); |
|
169 | + public function browser_error_trigger($WP) { |
|
170 | + $token = EE_Registry::instance()->REQ->get('token'); |
|
171 | + if ($token) { |
|
172 | + $message = EEM_Message::instance()->get_one_by_token($token); |
|
173 | + if ($message instanceof EE_Message) { |
|
174 | + header('HTTP/1.1 200 OK'); |
|
175 | + $error_msg = nl2br($message->error_message()); |
|
176 | 176 | ?> |
177 | 177 | <!DOCTYPE html> |
178 | 178 | <html> |
179 | 179 | <head></head> |
180 | 180 | <body> |
181 | - <?php echo empty( $error_msg ) |
|
182 | - ? esc_html__( 'Unfortunately, we were unable to capture the error message for this message.', 'event_espresso' ) |
|
181 | + <?php echo empty($error_msg) |
|
182 | + ? esc_html__('Unfortunately, we were unable to capture the error message for this message.', 'event_espresso') |
|
183 | 183 | : wp_kses( |
184 | 184 | $error_msg, |
185 | 185 | array( |
@@ -214,19 +214,19 @@ discard block |
||
214 | 214 | * @throws EE_Error |
215 | 215 | * @return void |
216 | 216 | */ |
217 | - public function run( $WP ) { |
|
217 | + public function run($WP) { |
|
218 | 218 | //ensure controller is loaded |
219 | 219 | self::_load_controller(); |
220 | 220 | // attempt to process message |
221 | 221 | try { |
222 | 222 | /** @type EE_Message_To_Generate_From_Request $message_to_generate */ |
223 | - $message_to_generate = EE_Registry::instance()->load_lib( 'Message_To_Generate_From_Request' ); |
|
224 | - self::$_MSG_PROCESSOR->generate_and_send_now( $message_to_generate ); |
|
225 | - } catch ( EE_Error $e ) { |
|
226 | - $error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' ); |
|
223 | + $message_to_generate = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request'); |
|
224 | + self::$_MSG_PROCESSOR->generate_and_send_now($message_to_generate); |
|
225 | + } catch (EE_Error $e) { |
|
226 | + $error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso'); |
|
227 | 227 | // add specific message for developers if WP_DEBUG in on |
228 | - $error_msg .= '||' . $e->getMessage(); |
|
229 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
228 | + $error_msg .= '||'.$e->getMessage(); |
|
229 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | |
@@ -235,30 +235,30 @@ discard block |
||
235 | 235 | * This is triggered by the 'msg_cron_trigger' route. |
236 | 236 | * @param WP $WP |
237 | 237 | */ |
238 | - public function run_cron( $WP ) { |
|
238 | + public function run_cron($WP) { |
|
239 | 239 | self::_load_controller(); |
240 | 240 | //get required vars |
241 | - $cron_type = EE_Registry::instance()->REQ->get( 'type' ); |
|
242 | - $nonce = EE_Registry::instance()->REQ->get( '_nonce' ); |
|
243 | - header( 'HTTP/1.1 200 OK' ); |
|
241 | + $cron_type = EE_Registry::instance()->REQ->get('type'); |
|
242 | + $nonce = EE_Registry::instance()->REQ->get('_nonce'); |
|
243 | + header('HTTP/1.1 200 OK'); |
|
244 | 244 | |
245 | 245 | //now let's verify nonce, if not valid exit immediately |
246 | - if ( ! wp_verify_nonce( $nonce, 'EE_Messages_Scheduler_' . $cron_type ) ) { |
|
246 | + if ( ! wp_verify_nonce($nonce, 'EE_Messages_Scheduler_'.$cron_type)) { |
|
247 | 247 | /** |
248 | 248 | * trigger error so this gets in the error logs. This is important because it happens on a non-user request. |
249 | 249 | */ |
250 | - trigger_error( esc_attr__( 'Invalid Nonce', 'event_espresso' ) ); |
|
250 | + trigger_error(esc_attr__('Invalid Nonce', 'event_espresso')); |
|
251 | 251 | } |
252 | 252 | |
253 | - $method = 'batch_' . $cron_type . '_from_queue'; |
|
254 | - if ( method_exists( self::$_MSG_PROCESSOR, $method ) ) { |
|
253 | + $method = 'batch_'.$cron_type.'_from_queue'; |
|
254 | + if (method_exists(self::$_MSG_PROCESSOR, $method)) { |
|
255 | 255 | self::$_MSG_PROCESSOR->$method(); |
256 | 256 | } else { |
257 | 257 | //no matching task |
258 | 258 | /** |
259 | 259 | * trigger error so this gets in the error logs. This is important because it happens on a non user request. |
260 | 260 | */ |
261 | - trigger_error( esc_attr( sprintf( __( 'There is no task corresponding to this route %s', 'event_espresso' ), $cron_type ) ) ); |
|
261 | + trigger_error(esc_attr(sprintf(__('There is no task corresponding to this route %s', 'event_espresso'), $cron_type))); |
|
262 | 262 | } |
263 | 263 | exit(); |
264 | 264 | } |
@@ -276,9 +276,9 @@ discard block |
||
276 | 276 | * |
277 | 277 | * @return EE_Messages_Template_Pack |
278 | 278 | */ |
279 | - public static function get_template_pack( $template_pack_name ) { |
|
280 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
281 | - return EEH_MSG_Template::get_template_pack( $template_pack_name ); |
|
279 | + public static function get_template_pack($template_pack_name) { |
|
280 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
281 | + return EEH_MSG_Template::get_template_pack($template_pack_name); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
@@ -292,14 +292,14 @@ discard block |
||
292 | 292 | * @return EE_Messages_Template_Pack[] |
293 | 293 | */ |
294 | 294 | public static function get_template_packs() { |
295 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
295 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
296 | 296 | |
297 | 297 | //for backward compat, let's make sure this returns in the same format as originally. |
298 | 298 | $template_pack_collection = EEH_MSG_Template::get_template_pack_collection(); |
299 | 299 | $template_pack_collection->rewind(); |
300 | 300 | $template_packs = array(); |
301 | - while ( $template_pack_collection->valid() ) { |
|
302 | - $template_packs[ $template_pack_collection->current()->dbref ] = $template_pack_collection->current(); |
|
301 | + while ($template_pack_collection->valid()) { |
|
302 | + $template_packs[$template_pack_collection->current()->dbref] = $template_pack_collection->current(); |
|
303 | 303 | $template_pack_collection->next(); |
304 | 304 | } |
305 | 305 | return $template_packs; |
@@ -315,15 +315,15 @@ discard block |
||
315 | 315 | * @return void |
316 | 316 | */ |
317 | 317 | public static function set_autoloaders() { |
318 | - if ( empty( self::$_MSG_PATHS ) ) { |
|
318 | + if (empty(self::$_MSG_PATHS)) { |
|
319 | 319 | self::_set_messages_paths(); |
320 | - EE_Registry::instance()->load_helper( 'Autoloader' ); |
|
321 | - foreach ( self::$_MSG_PATHS as $path ) { |
|
322 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $path ); |
|
320 | + EE_Registry::instance()->load_helper('Autoloader'); |
|
321 | + foreach (self::$_MSG_PATHS as $path) { |
|
322 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($path); |
|
323 | 323 | } |
324 | 324 | // add aliases |
325 | - EEH_Autoloader::add_alias( 'EE_messages', 'EE_messages' ); |
|
326 | - EEH_Autoloader::add_alias( 'EE_messenger', 'EE_messenger' ); |
|
325 | + EEH_Autoloader::add_alias('EE_messages', 'EE_messages'); |
|
326 | + EEH_Autoloader::add_alias('EE_messenger', 'EE_messenger'); |
|
327 | 327 | } |
328 | 328 | } |
329 | 329 | |
@@ -351,10 +351,10 @@ discard block |
||
351 | 351 | 'shortcodes', |
352 | 352 | ); |
353 | 353 | $paths = array(); |
354 | - foreach ( $dir_ref as $index => $dir ) { |
|
355 | - $paths[ $index ] = EE_LIBRARIES . $dir; |
|
354 | + foreach ($dir_ref as $index => $dir) { |
|
355 | + $paths[$index] = EE_LIBRARIES.$dir; |
|
356 | 356 | } |
357 | - self::$_MSG_PATHS = apply_filters( 'FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths ); |
|
357 | + self::$_MSG_PATHS = apply_filters('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | |
@@ -365,12 +365,12 @@ discard block |
||
365 | 365 | * @return void |
366 | 366 | */ |
367 | 367 | protected static function _load_controller() { |
368 | - if ( ! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor ) { |
|
369 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
368 | + if ( ! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor) { |
|
369 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
370 | 370 | self::set_autoloaders(); |
371 | - self::$_EEMSG = EE_Registry::instance()->load_lib( 'messages' ); |
|
372 | - self::$_MSG_PROCESSOR = EE_Registry::instance()->load_lib( 'Messages_Processor' ); |
|
373 | - self::$_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
371 | + self::$_EEMSG = EE_Registry::instance()->load_lib('messages'); |
|
372 | + self::$_MSG_PROCESSOR = EE_Registry::instance()->load_lib('Messages_Processor'); |
|
373 | + self::$_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
@@ -379,10 +379,10 @@ discard block |
||
379 | 379 | /** |
380 | 380 | * @param EE_Transaction $transaction |
381 | 381 | */ |
382 | - public static function payment_reminder( EE_Transaction $transaction ) { |
|
382 | + public static function payment_reminder(EE_Transaction $transaction) { |
|
383 | 383 | self::_load_controller(); |
384 | - $data = array( $transaction, null ); |
|
385 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'payment_reminder', $data ); |
|
384 | + $data = array($transaction, null); |
|
385 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers('payment_reminder', $data); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -393,14 +393,14 @@ discard block |
||
393 | 393 | * @param EE_Payment object |
394 | 394 | * @return void |
395 | 395 | */ |
396 | - public static function payment( EE_Transaction $transaction, EE_Payment $payment ) { |
|
396 | + public static function payment(EE_Transaction $transaction, EE_Payment $payment) { |
|
397 | 397 | self::_load_controller(); |
398 | - $data = array( $transaction, $payment ); |
|
399 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
400 | - $message_type = EEH_MSG_Template::convert_payment_status_to_message_type( $payment->STS_ID() ); |
|
398 | + $data = array($transaction, $payment); |
|
399 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
400 | + $message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID()); |
|
401 | 401 | //if payment amount is less than 0 then switch to payment_refund message type. |
402 | 402 | $message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type; |
403 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( $message_type, $data ); |
|
403 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | |
@@ -408,10 +408,10 @@ discard block |
||
408 | 408 | /** |
409 | 409 | * @param EE_Transaction $transaction |
410 | 410 | */ |
411 | - public static function cancelled_registration( EE_Transaction $transaction ) { |
|
411 | + public static function cancelled_registration(EE_Transaction $transaction) { |
|
412 | 412 | self::_load_controller(); |
413 | - $data = array( $transaction, null ); |
|
414 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'cancelled_registration', $data ); |
|
413 | + $data = array($transaction, null); |
|
414 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers('cancelled_registration', $data); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | |
@@ -424,14 +424,14 @@ discard block |
||
424 | 424 | * @param array $extra_details |
425 | 425 | * @return void |
426 | 426 | */ |
427 | - public static function maybe_registration( EE_Registration $registration, $extra_details = array() ) { |
|
427 | + public static function maybe_registration(EE_Registration $registration, $extra_details = array()) { |
|
428 | 428 | |
429 | - if ( ! self::_verify_registration_notification_send( $registration, $extra_details ) ) { |
|
429 | + if ( ! self::_verify_registration_notification_send($registration, $extra_details)) { |
|
430 | 430 | //no messages please |
431 | 431 | return; |
432 | 432 | } |
433 | 433 | |
434 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
434 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
435 | 435 | |
436 | 436 | //get all registrations so we make sure we send messages for the right status. |
437 | 437 | $all_registrations = $registration->transaction()->registrations(); |
@@ -442,22 +442,22 @@ discard block |
||
442 | 442 | $mtgs = array(); |
443 | 443 | |
444 | 444 | //loop through registrations and trigger messages once per status. |
445 | - foreach ( $all_registrations as $reg ) { |
|
445 | + foreach ($all_registrations as $reg) { |
|
446 | 446 | |
447 | 447 | //already triggered? |
448 | - if ( in_array( $reg->status_ID(), $statuses_sent ) ) { |
|
448 | + if (in_array($reg->status_ID(), $statuses_sent)) { |
|
449 | 449 | continue; |
450 | 450 | } |
451 | 451 | |
452 | - $message_type = EEH_MSG_Template::convert_reg_status_to_message_type( $reg->status_ID() ); |
|
453 | - $mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers( $message_type, array( $registration->transaction(), null, $reg->status_ID() ) ); |
|
452 | + $message_type = EEH_MSG_Template::convert_reg_status_to_message_type($reg->status_ID()); |
|
453 | + $mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers($message_type, array($registration->transaction(), null, $reg->status_ID())); |
|
454 | 454 | $statuses_sent[] = $reg->status_ID(); |
455 | 455 | } |
456 | 456 | |
457 | - $mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers( 'registration_summary', array( $registration->transaction(), null ) ); |
|
457 | + $mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers('registration_summary', array($registration->transaction(), null)); |
|
458 | 458 | |
459 | 459 | //batch queue and initiate request |
460 | - self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist( $mtgs ); |
|
460 | + self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($mtgs); |
|
461 | 461 | self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority(); |
462 | 462 | } |
463 | 463 | |
@@ -472,39 +472,39 @@ discard block |
||
472 | 472 | * |
473 | 473 | * @return bool true = send away, false = nope halt the presses. |
474 | 474 | */ |
475 | - protected static function _verify_registration_notification_send( EE_Registration $registration, $extra_details = array() ) { |
|
475 | + protected static function _verify_registration_notification_send(EE_Registration $registration, $extra_details = array()) { |
|
476 | 476 | //self::log( |
477 | 477 | // __CLASS__, __FUNCTION__, __LINE__, |
478 | 478 | // $registration->transaction(), |
479 | 479 | // array( '$extra_details' => $extra_details ) |
480 | 480 | //); |
481 | 481 | // currently only using this to send messages for the primary registrant |
482 | - if ( ! $registration->is_primary_registrant() ) { |
|
482 | + if ( ! $registration->is_primary_registrant()) { |
|
483 | 483 | return false; |
484 | 484 | } |
485 | 485 | // first we check if we're in admin and not doing front ajax |
486 | - if ( is_admin() && ! EE_FRONT_AJAX ) { |
|
486 | + if (is_admin() && ! EE_FRONT_AJAX) { |
|
487 | 487 | //make sure appropriate admin params are set for sending messages |
488 | - if ( empty( $_REQUEST['txn_reg_status_change']['send_notifications'] ) || ! absint( $_REQUEST['txn_reg_status_change']['send_notifications'] ) ) { |
|
488 | + if (empty($_REQUEST['txn_reg_status_change']['send_notifications']) || ! absint($_REQUEST['txn_reg_status_change']['send_notifications'])) { |
|
489 | 489 | //no messages sent please. |
490 | 490 | return false; |
491 | 491 | } |
492 | 492 | } else { |
493 | 493 | // frontend request (either regular or via AJAX) |
494 | 494 | // TXN is NOT finalized ? |
495 | - if ( ! isset( $extra_details['finalized'] ) || $extra_details['finalized'] === false ) { |
|
495 | + if ( ! isset($extra_details['finalized']) || $extra_details['finalized'] === false) { |
|
496 | 496 | return false; |
497 | 497 | } |
498 | 498 | // return visit but nothing changed ??? |
499 | 499 | if ( |
500 | - isset( $extra_details['revisit'], $extra_details['status_updates'] ) && |
|
500 | + isset($extra_details['revisit'], $extra_details['status_updates']) && |
|
501 | 501 | $extra_details['revisit'] && ! $extra_details['status_updates'] |
502 | 502 | ) { |
503 | 503 | return false; |
504 | 504 | } |
505 | 505 | // NOT sending messages && reg status is something other than "Not-Approved" |
506 | 506 | if ( |
507 | - ! apply_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', false ) && |
|
507 | + ! apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false) && |
|
508 | 508 | $registration->status_ID() !== EEM_Registration::status_id_not_approved |
509 | 509 | ) { |
510 | 510 | return false; |
@@ -526,10 +526,10 @@ discard block |
||
526 | 526 | * |
527 | 527 | * @return array |
528 | 528 | */ |
529 | - protected static function _get_reg_status_array( $reg_status = '' ) { |
|
530 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
531 | - return EEH_MSG_Template::convert_reg_status_to_message_type( $reg_status ) |
|
532 | - ? EEH_MSG_Template::convert_reg_status_to_message_type( $reg_status ) |
|
529 | + protected static function _get_reg_status_array($reg_status = '') { |
|
530 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
531 | + return EEH_MSG_Template::convert_reg_status_to_message_type($reg_status) |
|
532 | + ? EEH_MSG_Template::convert_reg_status_to_message_type($reg_status) |
|
533 | 533 | : EEH_MSG_Template::reg_status_to_message_type_array(); |
534 | 534 | } |
535 | 535 | |
@@ -545,10 +545,10 @@ discard block |
||
545 | 545 | * |
546 | 546 | * @return string|bool The payment message type slug matching the status or false if no match. |
547 | 547 | */ |
548 | - protected static function _get_payment_message_type( $payment_status ) { |
|
549 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
550 | - return EEH_MSG_Template::convert_payment_status_to_message_type( $payment_status ) |
|
551 | - ? EEH_MSG_Template::convert_payment_status_to_message_type( $payment_status ) |
|
548 | + protected static function _get_payment_message_type($payment_status) { |
|
549 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
550 | + return EEH_MSG_Template::convert_payment_status_to_message_type($payment_status) |
|
551 | + ? EEH_MSG_Template::convert_payment_status_to_message_type($payment_status) |
|
552 | 552 | : false; |
553 | 553 | } |
554 | 554 | |
@@ -562,33 +562,33 @@ discard block |
||
562 | 562 | * @param array $req_data This is the $_POST & $_GET data sent from EE_Admin Pages |
563 | 563 | * @return bool success/fail |
564 | 564 | */ |
565 | - public static function process_resend( $req_data ) { |
|
565 | + public static function process_resend($req_data) { |
|
566 | 566 | self::_load_controller(); |
567 | 567 | |
568 | 568 | //if $msgID in this request then skip to the new resend_message |
569 | - if ( EE_Registry::instance()->REQ->get( 'MSG_ID' ) ) { |
|
569 | + if (EE_Registry::instance()->REQ->get('MSG_ID')) { |
|
570 | 570 | return self::resend_message(); |
571 | 571 | } |
572 | 572 | |
573 | 573 | //make sure any incoming request data is set on the REQ so that it gets picked up later. |
574 | 574 | $req_data = (array) $req_data; |
575 | - foreach( $req_data as $request_key => $request_value ) { |
|
576 | - EE_Registry::instance()->REQ->set( $request_key, $request_value ); |
|
575 | + foreach ($req_data as $request_key => $request_value) { |
|
576 | + EE_Registry::instance()->REQ->set($request_key, $request_value); |
|
577 | 577 | } |
578 | 578 | |
579 | - if ( ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request() ) { |
|
579 | + if ( ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request()) { |
|
580 | 580 | return false; |
581 | 581 | } |
582 | 582 | |
583 | 583 | try { |
584 | - self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist( $messages_to_send ); |
|
584 | + self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($messages_to_send); |
|
585 | 585 | self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority(); |
586 | - } catch( EE_Error $e ) { |
|
587 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
586 | + } catch (EE_Error $e) { |
|
587 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
588 | 588 | return false; |
589 | 589 | } |
590 | 590 | EE_Error::add_success( |
591 | - __( 'Messages have been successfully queued for generation and sending.', 'event_espresso' ) |
|
591 | + __('Messages have been successfully queued for generation and sending.', 'event_espresso') |
|
592 | 592 | ); |
593 | 593 | return true; //everything got queued. |
594 | 594 | } |
@@ -601,17 +601,17 @@ discard block |
||
601 | 601 | public static function resend_message() { |
602 | 602 | self::_load_controller(); |
603 | 603 | |
604 | - $msgID = EE_Registry::instance()->REQ->get( 'MSG_ID' ); |
|
605 | - if ( ! $msgID ) { |
|
606 | - EE_Error::add_error( __( 'Something went wrong because there is no "MSG_ID" value in the request', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
604 | + $msgID = EE_Registry::instance()->REQ->get('MSG_ID'); |
|
605 | + if ( ! $msgID) { |
|
606 | + EE_Error::add_error(__('Something went wrong because there is no "MSG_ID" value in the request', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
607 | 607 | return false; |
608 | 608 | } |
609 | 609 | |
610 | - self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send( (array) $msgID ); |
|
610 | + self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send((array) $msgID); |
|
611 | 611 | |
612 | 612 | //setup success message. |
613 | - $count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_resend ); |
|
614 | - EE_Error::add_success( sprintf( |
|
613 | + $count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend); |
|
614 | + EE_Error::add_success(sprintf( |
|
615 | 615 | _n( |
616 | 616 | 'There was %d message queued for resending.', |
617 | 617 | 'There were %d messages queued for resending.', |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | 'event_espresso' |
620 | 620 | ), |
621 | 621 | $count_ready_for_resend |
622 | - ) ); |
|
622 | + )); |
|
623 | 623 | return true; |
624 | 624 | } |
625 | 625 | |
@@ -632,13 +632,13 @@ discard block |
||
632 | 632 | * @param EE_Payment $payment EE_payment object |
633 | 633 | * @return bool success/fail |
634 | 634 | */ |
635 | - public static function process_admin_payment( EE_Payment $payment ) { |
|
636 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
635 | + public static function process_admin_payment(EE_Payment $payment) { |
|
636 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
637 | 637 | //we need to get the transaction object |
638 | 638 | $transaction = $payment->transaction(); |
639 | - if ( $transaction instanceof EE_Transaction ) { |
|
640 | - $data = array( $transaction, $payment ); |
|
641 | - $message_type = EEH_MSG_Template::convert_payment_status_to_message_type( $payment->STS_ID() ); |
|
639 | + if ($transaction instanceof EE_Transaction) { |
|
640 | + $data = array($transaction, $payment); |
|
641 | + $message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID()); |
|
642 | 642 | |
643 | 643 | //if payment amount is less than 0 then switch to payment_refund message type. |
644 | 644 | $message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type; |
@@ -648,17 +648,17 @@ discard block |
||
648 | 648 | |
649 | 649 | self::_load_controller(); |
650 | 650 | |
651 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( $message_type, $data ); |
|
651 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data); |
|
652 | 652 | |
653 | 653 | //get count of queued for generation |
654 | - $count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_incomplete ); |
|
654 | + $count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete); |
|
655 | 655 | |
656 | - if ( $count_to_generate > 0 ) { |
|
657 | - add_filter( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true' ); |
|
656 | + if ($count_to_generate > 0) { |
|
657 | + add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true'); |
|
658 | 658 | return true; |
659 | 659 | } else { |
660 | - $count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::instance()->stati_indicating_failed_sending() ); |
|
661 | - EE_Error::add_error( sprintf( |
|
660 | + $count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::instance()->stati_indicating_failed_sending()); |
|
661 | + EE_Error::add_error(sprintf( |
|
662 | 662 | _n( |
663 | 663 | 'The payment notification generation failed.', |
664 | 664 | '%d payment notifications failed being sent.', |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | 'event_espresso' |
667 | 667 | ), |
668 | 668 | $count_failed |
669 | - ), __FILE__, __FUNCTION__, __LINE__ ); |
|
669 | + ), __FILE__, __FUNCTION__, __LINE__); |
|
670 | 670 | return false; |
671 | 671 | } |
672 | 672 | } else { |
@@ -689,11 +689,11 @@ discard block |
||
689 | 689 | * @param int $grp_id a specific message template group id. |
690 | 690 | * @return void |
691 | 691 | */ |
692 | - public static function send_newsletter_message( $registrations, $grp_id ) { |
|
692 | + public static function send_newsletter_message($registrations, $grp_id) { |
|
693 | 693 | //make sure mtp is id and set it in the EE_Request Handler later messages setup. |
694 | - EE_Registry::instance()->REQ->set( 'GRP_ID', (int) $grp_id ); |
|
694 | + EE_Registry::instance()->REQ->set('GRP_ID', (int) $grp_id); |
|
695 | 695 | self::_load_controller(); |
696 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'newsletter', $registrations ); |
|
696 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers('newsletter', $registrations); |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | |
@@ -708,10 +708,10 @@ discard block |
||
708 | 708 | * @param string $message_type |
709 | 709 | * @return string |
710 | 710 | */ |
711 | - public static function registration_message_trigger_url( $registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice' ) { |
|
712 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
711 | + public static function registration_message_trigger_url($registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice') { |
|
712 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
713 | 713 | // whitelist $messenger |
714 | - switch ( $messenger ) { |
|
714 | + switch ($messenger) { |
|
715 | 715 | case 'pdf' : |
716 | 716 | $sending_messenger = 'pdf'; |
717 | 717 | $generating_messenger = 'html'; |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | break; |
724 | 724 | } |
725 | 725 | // whitelist $message_type |
726 | - switch ( $message_type ) { |
|
726 | + switch ($message_type) { |
|
727 | 727 | case 'receipt' : |
728 | 728 | $message_type = 'receipt'; |
729 | 729 | break; |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | break; |
734 | 734 | } |
735 | 735 | // verify that both the messenger AND the message type are active |
736 | - if ( EEH_MSG_Template::is_messenger_active( $sending_messenger ) && EEH_MSG_Template::is_mt_active( $message_type ) ) { |
|
736 | + if (EEH_MSG_Template::is_messenger_active($sending_messenger) && EEH_MSG_Template::is_mt_active($message_type)) { |
|
737 | 737 | //need to get the correct message template group for this (i.e. is there a custom invoice for the event this registration is registered for?) |
738 | 738 | $template_query_params = array( |
739 | 739 | 'MTP_is_active' => true, |
@@ -742,16 +742,16 @@ discard block |
||
742 | 742 | 'Event.EVT_ID' => $registration->event_ID() |
743 | 743 | ); |
744 | 744 | //get the message template group. |
745 | - $msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ) ); |
|
745 | + $msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params)); |
|
746 | 746 | //if we don't have an EE_Message_Template_Group then return |
747 | - if ( ! $msg_template_group instanceof EE_Message_Template_Group ) { |
|
747 | + if ( ! $msg_template_group instanceof EE_Message_Template_Group) { |
|
748 | 748 | // remove EVT_ID from query params so that global templates get picked up |
749 | - unset( $template_query_params['Event.EVT_ID'] ); |
|
749 | + unset($template_query_params['Event.EVT_ID']); |
|
750 | 750 | //get global template as the fallback |
751 | - $msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ) ); |
|
751 | + $msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params)); |
|
752 | 752 | } |
753 | 753 | //if we don't have an EE_Message_Template_Group then return |
754 | - if ( ! $msg_template_group instanceof EE_Message_Template_Group ) { |
|
754 | + if ( ! $msg_template_group instanceof EE_Message_Template_Group) { |
|
755 | 755 | return ''; |
756 | 756 | } |
757 | 757 | // generate the URL |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | * @param bool $send true we will do a test send using the messenger delivery, false we just do a regular preview |
781 | 781 | * @return string The body of the message. |
782 | 782 | */ |
783 | - public static function preview_message( $type, $context, $messenger, $send = false ) { |
|
783 | + public static function preview_message($type, $context, $messenger, $send = false) { |
|
784 | 784 | self::_load_controller(); |
785 | 785 | $mtg = new EE_Message_To_Generate( |
786 | 786 | $messenger, |
@@ -789,8 +789,8 @@ discard block |
||
789 | 789 | $context, |
790 | 790 | true |
791 | 791 | ); |
792 | - $generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview( $mtg ); |
|
793 | - if ( $generated_preview_queue instanceof EE_Messages_Queue ) { |
|
792 | + $generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview($mtg); |
|
793 | + if ($generated_preview_queue instanceof EE_Messages_Queue) { |
|
794 | 794 | return $generated_preview_queue->get_queue()->current()->content(); |
795 | 795 | } else { |
796 | 796 | return $generated_preview_queue; |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | * |
818 | 818 | * @return bool success or fail. |
819 | 819 | */ |
820 | - public static function send_message_with_messenger_only( $messenger, $message_type, EE_Messages_Queue $queue, $custom_subject = '' ) { |
|
820 | + public static function send_message_with_messenger_only($messenger, $message_type, EE_Messages_Queue $queue, $custom_subject = '') { |
|
821 | 821 | self::_load_controller(); |
822 | 822 | /** @type EE_Message_To_Generate_From_Queue $message_to_generate */ |
823 | 823 | $message_to_generate = EE_Registry::instance()->load_lib( |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | $custom_subject, |
830 | 830 | ) |
831 | 831 | ); |
832 | - return self::$_MSG_PROCESSOR->queue_for_sending( $message_to_generate ); |
|
832 | + return self::$_MSG_PROCESSOR->queue_for_sending($message_to_generate); |
|
833 | 833 | } |
834 | 834 | |
835 | 835 | |
@@ -842,22 +842,22 @@ discard block |
||
842 | 842 | * @param array $message_ids An array of message ids |
843 | 843 | * @return bool | EE_Messages_Queue false if nothing was generated, EE_Messages_Queue containing generated messages. |
844 | 844 | */ |
845 | - public static function generate_now( $message_ids ) { |
|
845 | + public static function generate_now($message_ids) { |
|
846 | 846 | self::_load_controller(); |
847 | 847 | $messages = EEM_Message::instance()->get_all( |
848 | 848 | array( |
849 | 849 | 0 => array( |
850 | - 'MSG_ID' => array( 'IN', $message_ids ), |
|
850 | + 'MSG_ID' => array('IN', $message_ids), |
|
851 | 851 | 'STS_ID' => EEM_Message::status_incomplete, |
852 | 852 | ) |
853 | 853 | ) |
854 | 854 | ); |
855 | 855 | |
856 | - $generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue( $messages ); |
|
856 | + $generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue($messages); |
|
857 | 857 | |
858 | - if ( ! $generated_queue instanceof EE_Messages_Queue ) { |
|
858 | + if ( ! $generated_queue instanceof EE_Messages_Queue) { |
|
859 | 859 | EE_Error::add_error( |
860 | - __( 'The messages were not generated. This is usually because there is already a batch being generated on a separate request. You can wait a minute or two and try again.', 'event_espresso' ), |
|
860 | + __('The messages were not generated. This is usually because there is already a batch being generated on a separate request. You can wait a minute or two and try again.', 'event_espresso'), |
|
861 | 861 | __FILE__, __FUNCTION__, __LINE__ |
862 | 862 | ); |
863 | 863 | } |
@@ -876,28 +876,28 @@ discard block |
||
876 | 876 | * |
877 | 877 | * @return bool | EE_Messages_Queue false if no messages sent. |
878 | 878 | */ |
879 | - public static function send_now( $message_ids ) { |
|
879 | + public static function send_now($message_ids) { |
|
880 | 880 | self::_load_controller(); |
881 | 881 | $messages = EEM_Message::instance()->get_all( |
882 | 882 | array( |
883 | 883 | 0 => array( |
884 | - 'MSG_ID' => array( 'IN', $message_ids ), |
|
885 | - 'STS_ID' => array( 'IN', array( EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry ) ) |
|
884 | + 'MSG_ID' => array('IN', $message_ids), |
|
885 | + 'STS_ID' => array('IN', array(EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry)) |
|
886 | 886 | ) |
887 | 887 | ) |
888 | 888 | ); |
889 | 889 | |
890 | - $sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue( $messages ); |
|
890 | + $sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue($messages); |
|
891 | 891 | |
892 | - if ( ! $sent_queue instanceof EE_Messages_Queue ) { |
|
892 | + if ( ! $sent_queue instanceof EE_Messages_Queue) { |
|
893 | 893 | EE_Error::add_error( |
894 | - __( 'The messages were not sent. This is usually because there is already a batch being sent on a separate request. You can wait a minute or two and try again.', 'event_espresso' ), |
|
894 | + __('The messages were not sent. This is usually because there is already a batch being sent on a separate request. You can wait a minute or two and try again.', 'event_espresso'), |
|
895 | 895 | __FILE__, __FUNCTION__, __LINE__ |
896 | 896 | ); |
897 | 897 | } else { |
898 | 898 | //can count how many sent by using the messages in the queue |
899 | - $sent_count = $sent_queue->count_STS_in_queue( EEM_Message::instance()->stati_indicating_sent() ); |
|
900 | - if ( $sent_count > 0 ) { |
|
899 | + $sent_count = $sent_queue->count_STS_in_queue(EEM_Message::instance()->stati_indicating_sent()); |
|
900 | + if ($sent_count > 0) { |
|
901 | 901 | EE_Error::add_success( |
902 | 902 | sprintf( |
903 | 903 | _n( |
@@ -912,8 +912,8 @@ discard block |
||
912 | 912 | } else { |
913 | 913 | EE_Error::overwrite_errors(); |
914 | 914 | EE_Error::add_error( |
915 | - __( 'No message was sent because of problems with sending. Either all the messages you selected were not a sendable message, they were ALREADY sent on a different scheduled task, or there was an error. |
|
916 | - If there was an error, you can look at the messages in the message activity list table for any error messages.', 'event_espresso' ), |
|
915 | + __('No message was sent because of problems with sending. Either all the messages you selected were not a sendable message, they were ALREADY sent on a different scheduled task, or there was an error. |
|
916 | + If there was an error, you can look at the messages in the message activity list table for any error messages.', 'event_espresso'), |
|
917 | 917 | __FILE__, __FUNCTION__, __LINE__ |
918 | 918 | ); |
919 | 919 | } |
@@ -934,13 +934,13 @@ discard block |
||
934 | 934 | * |
935 | 935 | * @return bool true means messages were successfully queued for resending, false means none were queued for resending. |
936 | 936 | */ |
937 | - public static function queue_for_resending( $message_ids ) { |
|
937 | + public static function queue_for_resending($message_ids) { |
|
938 | 938 | self::_load_controller(); |
939 | - self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send( $message_ids ); |
|
939 | + self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send($message_ids); |
|
940 | 940 | |
941 | 941 | //get queue and count |
942 | - $queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_resend ); |
|
943 | - if ( $queue_count > 0 ) { |
|
942 | + $queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend); |
|
943 | + if ($queue_count > 0) { |
|
944 | 944 | EE_Error::add_success( |
945 | 945 | sprintf( |
946 | 946 | _n( |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | ); |
955 | 955 | } else { |
956 | 956 | EE_Error::add_error( |
957 | - __( 'No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.', 'event_espresso' ), |
|
957 | + __('No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.', 'event_espresso'), |
|
958 | 958 | __FILE__, __FUNCTION__, __LINE__ |
959 | 959 | ); |
960 | 960 | } |
@@ -976,17 +976,17 @@ discard block |
||
976 | 976 | * @param array $info |
977 | 977 | * @param bool $display_request |
978 | 978 | */ |
979 | - protected static function log( $class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false ) { |
|
980 | - EE_Registry::instance()->load_helper( 'Debug_Tools' ); |
|
981 | - if ( WP_DEBUG && false ) { |
|
982 | - if ( $transaction instanceof EE_Transaction ) { |
|
979 | + protected static function log($class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false) { |
|
980 | + EE_Registry::instance()->load_helper('Debug_Tools'); |
|
981 | + if (WP_DEBUG && false) { |
|
982 | + if ($transaction instanceof EE_Transaction) { |
|
983 | 983 | // don't serialize objects |
984 | - $info = EEH_Debug_Tools::strip_objects( $info ); |
|
984 | + $info = EEH_Debug_Tools::strip_objects($info); |
|
985 | 985 | $info['TXN_status'] = $transaction->status_ID(); |
986 | 986 | $info['TXN_reg_steps'] = $transaction->reg_steps(); |
987 | - if ( $transaction->ID() ) { |
|
988 | - $index = 'EE_Transaction: ' . $transaction->ID(); |
|
989 | - EEH_Debug_Tools::log( $class, $func, $line, $info, $display_request, $index ); |
|
987 | + if ($transaction->ID()) { |
|
988 | + $index = 'EE_Transaction: '.$transaction->ID(); |
|
989 | + EEH_Debug_Tools::log($class, $func, $line, $info, $display_request, $index); |
|
990 | 990 | } |
991 | 991 | } |
992 | 992 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | <tbody> |
22 | 22 | <tr> |
23 | 23 | <th> |
24 | - <label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info');?> |
|
24 | + <label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info'); ?> |
|
25 | 25 | </th> |
26 | 26 | <td> |
27 | 27 | <input type="text" class="regular-text" id="QST_display_text" name="QST_display_text" value="<?php $question->f('QST_display_text')?>"/> |
@@ -31,23 +31,23 @@ discard block |
||
31 | 31 | |
32 | 32 | <tr> |
33 | 33 | <th> |
34 | - <label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info');?> |
|
34 | + <label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info'); ?> |
|
35 | 35 | </th> |
36 | 36 | <td> |
37 | 37 | <?php |
38 | - $disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : ''; |
|
39 | - $id = ! empty( $QST_system ) ? '_disabled' : ''; |
|
38 | + $disabled = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
39 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
40 | 40 | ?> |
41 | 41 | <input type="text" class="regular-text" id="QST_admin_label<?php echo $id?>" name="QST_admin_label<?php echo $id?>" value="<?php $question->f('QST_admin_label')?>"<?php echo $disabled?>/> |
42 | 42 | <input class="QST_order" type="hidden" id="QST_order<?php echo $id; ?>" name = "QST_order<?php echo $id; ?>" value="<?php echo $question->get('QST_order'); ?>" /> |
43 | - <?php if ( ! empty( $QST_system )) { ?> |
|
43 | + <?php if ( ! empty($QST_system)) { ?> |
|
44 | 44 | <input type="hidden" id="QST_admin_label" name="QST_admin_label" value="<?php echo $question->admin_label()?>"/> |
45 | 45 | <?php } ?> |
46 | 46 | <br/> |
47 | 47 | <p class="description"> |
48 | - <?php if ( ! empty( $QST_system )) { ?> |
|
48 | + <?php if ( ! empty($QST_system)) { ?> |
|
49 | 49 | <span class="description" style="color:#D54E21;"> |
50 | - <?php _e('System question! This field cannot be changed.','event_espresso')?> |
|
50 | + <?php _e('System question! This field cannot be changed.', 'event_espresso')?> |
|
51 | 51 | </span> |
52 | 52 | <?php } ?> |
53 | 53 | |
@@ -57,21 +57,21 @@ discard block |
||
57 | 57 | |
58 | 58 | <tr> |
59 | 59 | <th> |
60 | - <label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info');?> |
|
60 | + <label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info'); ?> |
|
61 | 61 | </th> |
62 | 62 | <td> |
63 | 63 | <?php |
64 | - $disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : ''; |
|
65 | - $id = ! empty( $QST_system ) ? '_disabled' : ''; |
|
64 | + $disabled = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
65 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
66 | 66 | $admin_only = $question->get('QST_admin_only'); |
67 | - $checked = !empty( $admin_only ) ? ' checked="checked"' : ''; |
|
67 | + $checked = ! empty($admin_only) ? ' checked="checked"' : ''; |
|
68 | 68 | ?> |
69 | 69 | <input class="QST_admin_only" type="checkbox" id="QST_admin_only<?php echo $id; ?>" name = "QST_admin_only<?php echo $id; ?>" value="1"<?php echo $disabled; echo $checked; ?>/> |
70 | 70 | <br/> |
71 | 71 | <p class="description"> |
72 | - <?php if ( ! empty( $QST_system )) { ?> |
|
72 | + <?php if ( ! empty($QST_system)) { ?> |
|
73 | 73 | <span class="description" style="color:#D54E21;"> |
74 | - <?php _e('System question! This field cannot be changed.','event_espresso')?> |
|
74 | + <?php _e('System question! This field cannot be changed.', 'event_espresso')?> |
|
75 | 75 | </span> |
76 | 76 | <?php } ?> |
77 | 77 | |
@@ -81,21 +81,21 @@ discard block |
||
81 | 81 | |
82 | 82 | <tr> |
83 | 83 | <th> |
84 | - <label for="QST_type"><?php echo $fields['QST_type']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info');?> |
|
84 | + <label for="QST_type"><?php echo $fields['QST_type']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info'); ?> |
|
85 | 85 | </th> |
86 | 86 | <td> |
87 | 87 | <?php |
88 | - $disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : ''; |
|
89 | - $id = ! empty( $QST_system ) ? '_disabled' : ''; |
|
90 | - echo EEH_Form_Fields::select_input( 'QST_type' . $id, $question_types, $question->type(), 'id="QST_type' . $id . '"' . $disabled ); |
|
91 | - if( ! empty( $QST_system ) ) { ?> |
|
88 | + $disabled = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
89 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
90 | + echo EEH_Form_Fields::select_input('QST_type'.$id, $question_types, $question->type(), 'id="QST_type'.$id.'"'.$disabled); |
|
91 | + if ( ! empty($QST_system)) { ?> |
|
92 | 92 | <input type="hidden" id="QST_type" name="QST_type" value="<?php echo $question->type()?>"/> |
93 | 93 | <?php |
94 | - $explanatory_text = __('System question! This field cannot be changed.','event_espresso'); |
|
95 | - }else{ |
|
96 | - $explanatory_text = __('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.','event_espresso'); |
|
94 | + $explanatory_text = __('System question! This field cannot be changed.', 'event_espresso'); |
|
95 | + } else { |
|
96 | + $explanatory_text = __('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.', 'event_espresso'); |
|
97 | 97 | } |
98 | - if ( ! empty( $QST_system ) || $has_answers ) { ?> |
|
98 | + if ( ! empty($QST_system) || $has_answers) { ?> |
|
99 | 99 | <p><span class="description" style="color:#D54E21;"> |
100 | 100 | <?php echo $explanatory_text; ?> |
101 | 101 | </span></p> |
@@ -108,22 +108,22 @@ discard block |
||
108 | 108 | <tr id="text_input_question_options"> |
109 | 109 | <th> |
110 | 110 | <label> |
111 | - <?php _e( 'Maximum Allowed Response Size', 'event_espresso' );?> |
|
111 | + <?php _e('Maximum Allowed Response Size', 'event_espresso'); ?> |
|
112 | 112 | </label> |
113 | 113 | </th> |
114 | 114 | <td> |
115 | - <input id="QST_max" name="QST_max" type="number" <?php echo $max_max === EE_INF ? '' : "max='$max_max'";?> value="<?php $question->f( 'QST_max' );?>" min="1"> |
|
115 | + <input id="QST_max" name="QST_max" type="number" <?php echo $max_max === EE_INF ? '' : "max='$max_max'"; ?> value="<?php $question->f('QST_max'); ?>" min="1"> |
|
116 | 116 | <p> |
117 | 117 | <span class="description"> |
118 | - <?php _e( 'Maximum number of characters allowed when answering this question', 'event_espresso' );?> |
|
118 | + <?php _e('Maximum number of characters allowed when answering this question', 'event_espresso'); ?> |
|
119 | 119 | </span> |
120 | 120 | </p> |
121 | - <?php if ( $QST_system ) { ?> |
|
121 | + <?php if ($QST_system) { ?> |
|
122 | 122 | <p> |
123 | 123 | <span class="description" style="color:#D54E21;"> |
124 | 124 | <?php printf( |
125 | - __( 'System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso' ), |
|
126 | - $max_max );?> |
|
125 | + __('System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso'), |
|
126 | + $max_max ); ?> |
|
127 | 127 | </span> |
128 | 128 | </p> |
129 | 129 | <?php } ?> |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | <tr id="question_options"> |
133 | 133 | <th> |
134 | 134 | <label> |
135 | - <?php _e('Answer Options','event_espresso')?> |
|
135 | + <?php _e('Answer Options', 'event_espresso')?> |
|
136 | 136 | </label> |
137 | 137 | </th> |
138 | 138 | <td> |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | <thead> |
142 | 142 | <tr> |
143 | 143 | <th class="option-value-header"> |
144 | - <?php _e('Value','event_espresso')?> |
|
144 | + <?php _e('Value', 'event_espresso')?> |
|
145 | 145 | </th> |
146 | 146 | <th class="option-desc-header"> |
147 | - <?php _e('Description (optional, only shown on registration form)','event_espresso')?> |
|
147 | + <?php _e('Description (optional, only shown on registration form)', 'event_espresso')?> |
|
148 | 148 | </th> |
149 | 149 | <th> |
150 | 150 | </th> |
@@ -167,17 +167,17 @@ discard block |
||
167 | 167 | </tr> |
168 | 168 | |
169 | 169 | <?php |
170 | - $count=0; |
|
170 | + $count = 0; |
|
171 | 171 | $question_options = $question->options(); |
172 | - if ( ! empty( $question_options )) { |
|
173 | - foreach( $question_options as $option_id => $option ) { |
|
174 | - $disabled = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : ''; |
|
172 | + if ( ! empty($question_options)) { |
|
173 | + foreach ($question_options as $option_id => $option) { |
|
174 | + $disabled = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : ''; |
|
175 | 175 | ?> |
176 | 176 | <tr class="question-option ee-options-sortable"> |
177 | 177 | <td class="option-value-cell"> |
178 | 178 | <input type="hidden" class="QSO_order" name="question_options[<?php echo $count; ?>][QSO_order]" value="<?php echo $count; ?>"> |
179 | 179 | <input type="text" class="option-value regular-text" name="question_options[<?php echo $count?>][QSO_value]" value="<?php $option->f('QSO_value')?>"<?php echo $disabled; ?>> |
180 | - <?php if ( $has_answers ) : ?> |
|
180 | + <?php if ($has_answers) : ?> |
|
181 | 181 | <input type="hidden" name="question_options[<?php echo $count; ?>][QSO_value]" value="<?php echo $option->f('QSO_value'); ?>" > |
182 | 182 | <?php endif; ?> |
183 | 183 | </td> |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | <input type="text" class="option-desc regular-text" name="question_options[<?php echo $count?>][QSO_desc]" value="<?php $option->f('QSO_desc')?>"> |
186 | 186 | </td> |
187 | 187 | <td> |
188 | - <?php if ( ! $option->system() ) { ?> |
|
188 | + <?php if ( ! $option->system()) { ?> |
|
189 | 189 | <span class="dashicons clickable dashicons-post-trash ee-icon-size-18 remove-option remove-item"></span> |
190 | 190 | <?php } ?> |
191 | 191 | <span class="dashicons dashicons-image-flip-vertical sortable-drag-handle ee-icon-size-18"></span> |
@@ -224,13 +224,13 @@ discard block |
||
224 | 224 | </table> |
225 | 225 | |
226 | 226 | <a id="new-question-option" class="button" style="margin:0 0 1em 3px;"> |
227 | - <?php _e('Add Another Answer Option','event_espresso')?> |
|
227 | + <?php _e('Add Another Answer Option', 'event_espresso')?> |
|
228 | 228 | </a><br/> |
229 | 229 | |
230 | 230 | <p class="description"> |
231 | - <?php _e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.','event_espresso')?> |
|
231 | + <?php _e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.', 'event_espresso')?> |
|
232 | 232 | </p> |
233 | - <?php if ( $has_answers ) : ?> |
|
233 | + <?php if ($has_answers) : ?> |
|
234 | 234 | <p class="description" style="color:#D54E21;"> |
235 | 235 | <?php _e('Answer values that are uneditable are this way because there are registrations in the database that have answers for this question. If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes. This will ensure that the existing registrations that chose the original answer will preserve that answer.', 'event_espresso'); ?> |
236 | 236 | </p> |
@@ -241,32 +241,32 @@ discard block |
||
241 | 241 | |
242 | 242 | <tr> |
243 | 243 | <th> |
244 | - <label for="QST_required"><?php echo $fields['QST_required']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info');?> |
|
244 | + <label for="QST_required"><?php echo $fields['QST_required']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info'); ?> |
|
245 | 245 | </th> |
246 | 246 | <td> |
247 | 247 | <?php |
248 | - $system_required = array( 'fname', 'email' ); |
|
249 | - $disabled = in_array( $QST_system, $system_required ) ? ' disabled="disabled"' : ''; |
|
248 | + $system_required = array('fname', 'email'); |
|
249 | + $disabled = in_array($QST_system, $system_required) ? ' disabled="disabled"' : ''; |
|
250 | 250 | $required_on = $question->get('QST_admin_only'); |
251 | 251 | $show_required_msg = $required_on ? '' : ' display:none;'; |
252 | - $disabled = $required_on || ! empty( $disabled ) ? ' disabled="disabled"' : ''; |
|
253 | - $id = ! empty( $disabled ) && in_array( $QST_system, $system_required) ? '_disabled' : ''; |
|
254 | - $requiredOptions=array( |
|
255 | - array('text'=>'Optional','id'=>0), |
|
256 | - array('text'=>'Required','id'=>1) |
|
252 | + $disabled = $required_on || ! empty($disabled) ? ' disabled="disabled"' : ''; |
|
253 | + $id = ! empty($disabled) && in_array($QST_system, $system_required) ? '_disabled' : ''; |
|
254 | + $requiredOptions = array( |
|
255 | + array('text'=>'Optional', 'id'=>0), |
|
256 | + array('text'=>'Required', 'id'=>1) |
|
257 | 257 | ); |
258 | - echo EEH_Form_Fields::select_input('QST_required' . $id, $requiredOptions, $question->required(), 'id="QST_required' . $id . '"' . $disabled ); |
|
258 | + echo EEH_Form_Fields::select_input('QST_required'.$id, $requiredOptions, $question->required(), 'id="QST_required'.$id.'"'.$disabled); |
|
259 | 259 | ?> |
260 | 260 | <p><span id="required_toggled_on" class="description" style="color:#D54E21;<?php echo $show_required_msg; ?>"> |
261 | - <?php _e('Required is set to optional, and this field is disabled, because the question is Admin-Only.','event_espresso')?> |
|
261 | + <?php _e('Required is set to optional, and this field is disabled, because the question is Admin-Only.', 'event_espresso')?> |
|
262 | 262 | </span></p> |
263 | 263 | <p><span id="required_toggled_off" class="description" style="color:#D54E21; display: none;"> |
264 | - <?php _e('Required option field is no longer disabled because the question is not Admin-Only','event_espresso')?> |
|
264 | + <?php _e('Required option field is no longer disabled because the question is not Admin-Only', 'event_espresso')?> |
|
265 | 265 | </span></p> |
266 | - <?php if ( ! empty( $disabled ) && in_array( $QST_system, $system_required ) ) { ?> |
|
266 | + <?php if ( ! empty($disabled) && in_array($QST_system, $system_required)) { ?> |
|
267 | 267 | <input type="hidden" id="QST_required" name="QST_required" value="1"/> |
268 | 268 | <p><span class="description" style="color:#D54E21;"> |
269 | - <?php _e('System question! This field cannot be changed.','event_espresso')?> |
|
269 | + <?php _e('System question! This field cannot be changed.', 'event_espresso')?> |
|
270 | 270 | </span></p> |
271 | 271 | <?php } ?> |
272 | 272 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | |
276 | 276 | <tr> |
277 | 277 | <th> |
278 | - <label for="QST_required_text"><?php _e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info');?> |
|
278 | + <label for="QST_required_text"><?php _e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info'); ?> |
|
279 | 279 | </th> |
280 | 280 | <td> |
281 | 281 | <input type="text" class="regular-text" id="QST_required_text" name="QST_required_text" value="<?php $question->f('QST_required_text')?>"/> |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Taxes class |
@@ -32,20 +32,20 @@ discard block |
||
32 | 32 | * @param EE_Ticket $ticket incoming EE_Ticket |
33 | 33 | * @return float total taxes to apply to ticket. |
34 | 34 | */ |
35 | - public static function get_total_taxes_for_admin( EE_Ticket $ticket ) { |
|
35 | + public static function get_total_taxes_for_admin(EE_Ticket $ticket) { |
|
36 | 36 | $tax = 0; |
37 | 37 | $total_tax = 0; |
38 | 38 | //This first checks to see if the given ticket is taxable. |
39 | - if ( ! $ticket->get( 'TKT_taxable' ) ) |
|
39 | + if ( ! $ticket->get('TKT_taxable')) |
|
40 | 40 | return $tax; |
41 | 41 | //get subtotal (notice we're only retrieving a subtotal if there isn't one given) |
42 | - $subtotal = self::get_subtotal_for_admin( $ticket ); |
|
42 | + $subtotal = self::get_subtotal_for_admin($ticket); |
|
43 | 43 | //get taxes |
44 | 44 | $taxes = self::get_taxes_for_admin(); |
45 | 45 | //apply taxes to subtotal |
46 | - foreach ( $taxes as $tax ) { |
|
46 | + foreach ($taxes as $tax) { |
|
47 | 47 | //assuming taxes are not cumulative |
48 | - $total_tax += $subtotal * $tax->get( 'PRC_amount' ) / 100; |
|
48 | + $total_tax += $subtotal * $tax->get('PRC_amount') / 100; |
|
49 | 49 | } |
50 | 50 | return $total_tax; |
51 | 51 | } |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public static function get_total_taxes_percentage() { |
59 | 59 | $total_tax_percent = 0; |
60 | - foreach( self::get_taxes_for_admin() as $tax_price ) { |
|
61 | - $total_tax_percent += $tax_price->get( 'PRC_amount' ); |
|
60 | + foreach (self::get_taxes_for_admin() as $tax_price) { |
|
61 | + $total_tax_percent += $tax_price->get('PRC_amount'); |
|
62 | 62 | } |
63 | 63 | return $total_tax_percent; |
64 | 64 | } |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | * @param EE_Ticket $ticket |
70 | 70 | * @return float |
71 | 71 | */ |
72 | - public static function get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
72 | + public static function get_subtotal_for_admin(EE_Ticket $ticket) { |
|
73 | 73 | $TKT_ID = $ticket->ID(); |
74 | - return isset( self::$_subtotal[ $TKT_ID ] ) ? self::$_subtotal[ $TKT_ID ] : self::_get_subtotal_for_admin( $ticket ); |
|
74 | + return isset(self::$_subtotal[$TKT_ID]) ? self::$_subtotal[$TKT_ID] : self::_get_subtotal_for_admin($ticket); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -81,29 +81,29 @@ discard block |
||
81 | 81 | * @param EE_Ticket $ticket |
82 | 82 | * @return float subtotal calculated from all EE_Price[] on Ticket. |
83 | 83 | */ |
84 | - private static function _get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
84 | + private static function _get_subtotal_for_admin(EE_Ticket $ticket) { |
|
85 | 85 | $subtotal = 0; |
86 | 86 | //get all prices |
87 | - $prices = $ticket->get_many_related( 'Price', array( 'default_where_conditions' => 'none', 'order_by' => array( 'PRC_order' => 'ASC' ) ) ); |
|
87 | + $prices = $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))); |
|
88 | 88 | //let's loop through them (base price is always the first item) |
89 | - foreach ( $prices as $price ) { |
|
90 | - if ( $price instanceof EE_Price ) { |
|
89 | + foreach ($prices as $price) { |
|
90 | + if ($price instanceof EE_Price) { |
|
91 | 91 | $price_type = $price->type_obj(); |
92 | - if ( $price_type instanceof EE_Price_Type ) { |
|
93 | - switch ( $price->type_obj()->base_type() ) { |
|
92 | + if ($price_type instanceof EE_Price_Type) { |
|
93 | + switch ($price->type_obj()->base_type()) { |
|
94 | 94 | case 1: // base price |
95 | 95 | case 3: // surcharges |
96 | - $subtotal += $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 : $price->get( 'PRC_amount' ); |
|
96 | + $subtotal += $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 : $price->get('PRC_amount'); |
|
97 | 97 | break; |
98 | 98 | case 2: // discounts |
99 | - $subtotal -= $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 : $price->get( 'PRC_amount' ); |
|
99 | + $subtotal -= $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 : $price->get('PRC_amount'); |
|
100 | 100 | break; |
101 | 101 | } |
102 | 102 | } |
103 | 103 | } |
104 | 104 | } |
105 | 105 | $TKT_ID = $ticket->ID(); |
106 | - self::$_subtotal = array( $TKT_ID => $subtotal ); |
|
106 | + self::$_subtotal = array($TKT_ID => $subtotal); |
|
107 | 107 | return $subtotal; |
108 | 108 | } |
109 | 109 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @return EE_Price[] EE_Price objects that have PRT_ID == 4 |
115 | 115 | */ |
116 | 116 | public static function get_taxes_for_admin() { |
117 | - self::$_default_taxes = ! empty( self::$_default_taxes ) ? self::$_default_taxes : EE_Registry::instance()->load_model( 'Price' )->get_all( array( array( 'Price_Type.PBT_ID' => 4 ) ) ); |
|
117 | + self::$_default_taxes = ! empty(self::$_default_taxes) ? self::$_default_taxes : EE_Registry::instance()->load_model('Price')->get_all(array(array('Price_Type.PBT_ID' => 4))); |
|
118 | 118 | return self::$_default_taxes; |
119 | 119 | } |
120 | 120 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | /** |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * date_format and the second value is the time format |
36 | 36 | * @return EE_Event |
37 | 37 | */ |
38 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
39 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
40 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
38 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
39 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
40 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * the website will be used. |
49 | 49 | * @return EE_Event |
50 | 50 | */ |
51 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
52 | - return new self( $props_n_values, TRUE, $timezone ); |
|
51 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
52 | + return new self($props_n_values, TRUE, $timezone); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | * @param mixed $field_value |
62 | 62 | * @param bool $use_default |
63 | 63 | */ |
64 | - public function set( $field_name, $field_value, $use_default = false ) { |
|
65 | - switch ( $field_name ) { |
|
64 | + public function set($field_name, $field_value, $use_default = false) { |
|
65 | + switch ($field_name) { |
|
66 | 66 | case 'status' : |
67 | - $this->set_status( $field_value, $use_default ); |
|
67 | + $this->set_status($field_value, $use_default); |
|
68 | 68 | break; |
69 | 69 | default : |
70 | - parent::set( $field_name, $field_value, $use_default ); |
|
70 | + parent::set($field_name, $field_value, $use_default); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
@@ -86,29 +86,29 @@ discard block |
||
86 | 86 | * @return bool|void |
87 | 87 | * @throws \EE_Error |
88 | 88 | */ |
89 | - public function set_status( $new_status = null, $use_default = false ) { |
|
89 | + public function set_status($new_status = null, $use_default = false) { |
|
90 | 90 | // get current Event status |
91 | 91 | $old_status = $this->status(); |
92 | 92 | // if status has changed |
93 | - if ( $old_status != $new_status ) { |
|
93 | + if ($old_status != $new_status) { |
|
94 | 94 | // TO sold_out |
95 | - if ( $new_status == EEM_Event::sold_out ) { |
|
95 | + if ($new_status == EEM_Event::sold_out) { |
|
96 | 96 | // save the previous event status so that we can revert if the event is no longer sold out |
97 | - $this->add_post_meta( '_previous_event_status', $old_status ); |
|
98 | - do_action( 'AHEE__EE_Event__set_status__to_sold_out', $this, $old_status, $new_status ); |
|
97 | + $this->add_post_meta('_previous_event_status', $old_status); |
|
98 | + do_action('AHEE__EE_Event__set_status__to_sold_out', $this, $old_status, $new_status); |
|
99 | 99 | // OR FROM sold_out |
100 | - } else if ( $old_status == EEM_Event::sold_out ) { |
|
101 | - $this->delete_post_meta( '_previous_event_status' ); |
|
102 | - do_action( 'AHEE__EE_Event__set_status__from_sold_out', $this, $old_status, $new_status ); |
|
100 | + } else if ($old_status == EEM_Event::sold_out) { |
|
101 | + $this->delete_post_meta('_previous_event_status'); |
|
102 | + do_action('AHEE__EE_Event__set_status__from_sold_out', $this, $old_status, $new_status); |
|
103 | 103 | } |
104 | 104 | // update status |
105 | - parent::set( 'status', $new_status, $use_default ); |
|
106 | - do_action( 'AHEE__EE_Event__set_status__after_update', $this ); |
|
105 | + parent::set('status', $new_status, $use_default); |
|
106 | + do_action('AHEE__EE_Event__set_status__after_update', $this); |
|
107 | 107 | return true; |
108 | 108 | } else { |
109 | 109 | // even though the old value matches the new value, it's still good to |
110 | 110 | // allow the parent set method to have a say |
111 | - parent::set( 'status', $new_status, $use_default ); |
|
111 | + parent::set('status', $new_status, $use_default); |
|
112 | 112 | return true; |
113 | 113 | } |
114 | 114 | } |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | * @param array $query_params like EEM_Base::get_all |
122 | 122 | * @return EE_Datetime[] |
123 | 123 | */ |
124 | - public function datetimes( $query_params = array() ) { |
|
125 | - return $this->get_many_related( 'Datetime', $query_params ); |
|
124 | + public function datetimes($query_params = array()) { |
|
125 | + return $this->get_many_related('Datetime', $query_params); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @return EE_Datetime[] |
134 | 134 | */ |
135 | 135 | public function datetimes_in_chronological_order() { |
136 | - return $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) ); |
|
136 | + return $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC'))); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | * @param null $limit |
150 | 150 | * @return \EE_Datetime[] |
151 | 151 | */ |
152 | - public function datetimes_ordered( $show_expired = true, $show_deleted = false, $limit = null ) { |
|
153 | - return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_event_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted, $limit ); |
|
152 | + public function datetimes_ordered($show_expired = true, $show_deleted = false, $limit = null) { |
|
153 | + return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_event_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted, $limit); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @return EE_Datetime |
161 | 161 | */ |
162 | 162 | public function first_datetime() { |
163 | - return $this->get_first_related( 'Datetime' ); |
|
163 | + return $this->get_first_related('Datetime'); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | * @param bool $try_to_exclude_deleted |
172 | 172 | * @return EE_Datetime |
173 | 173 | */ |
174 | - public function primary_datetime( $try_to_exclude_expired = TRUE, $try_to_exclude_deleted = TRUE ) { |
|
175 | - if ( !empty ( $this->_Primary_Datetime ) ) { |
|
174 | + public function primary_datetime($try_to_exclude_expired = TRUE, $try_to_exclude_deleted = TRUE) { |
|
175 | + if ( ! empty ($this->_Primary_Datetime)) { |
|
176 | 176 | return $this->_Primary_Datetime; |
177 | 177 | } |
178 | - $this->_Primary_Datetime = EEM_Datetime::instance( $this->_timezone )->get_primary_datetime_for_event( $this->ID(), $try_to_exclude_expired, $try_to_exclude_deleted ); |
|
178 | + $this->_Primary_Datetime = EEM_Datetime::instance($this->_timezone)->get_primary_datetime_for_event($this->ID(), $try_to_exclude_expired, $try_to_exclude_deleted); |
|
179 | 179 | return $this->_Primary_Datetime; |
180 | 180 | } |
181 | 181 | |
@@ -186,30 +186,30 @@ discard block |
||
186 | 186 | * @param array $query_params like EEM_Base::get_all |
187 | 187 | * @return EE_Ticket[] |
188 | 188 | */ |
189 | - public function tickets( $query_params = array() ) { |
|
189 | + public function tickets($query_params = array()) { |
|
190 | 190 | //first get all datetimes |
191 | 191 | $datetimes = $this->datetimes_ordered(); |
192 | - if ( ! $datetimes ) { |
|
192 | + if ( ! $datetimes) { |
|
193 | 193 | return array(); |
194 | 194 | } |
195 | 195 | |
196 | 196 | $datetime_ids = array(); |
197 | - foreach ( $datetimes as $datetime ) { |
|
197 | + foreach ($datetimes as $datetime) { |
|
198 | 198 | $datetime_ids[] = $datetime->ID(); |
199 | 199 | } |
200 | 200 | |
201 | - $where_params = array( 'Datetime.DTT_ID' => array( 'IN', $datetime_ids ) ); |
|
201 | + $where_params = array('Datetime.DTT_ID' => array('IN', $datetime_ids)); |
|
202 | 202 | |
203 | 203 | //if incoming $query_params has where conditions let's merge but not override existing. |
204 | - if ( is_array( $query_params ) && isset( $query_params[0]) ) { |
|
205 | - $where_params = array_merge( $query_params[0], $where_params ); |
|
206 | - unset( $query_params[0] ); |
|
204 | + if (is_array($query_params) && isset($query_params[0])) { |
|
205 | + $where_params = array_merge($query_params[0], $where_params); |
|
206 | + unset($query_params[0]); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | //now add $where_params to $query_params |
210 | 210 | $query_params[0] = $where_params; |
211 | 211 | |
212 | - return EEM_Ticket::instance()->get_all( $query_params ); |
|
212 | + return EEM_Ticket::instance()->get_all($query_params); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @return bool |
219 | 219 | */ |
220 | 220 | function additional_limit() { |
221 | - return $this->get( 'EVT_additional_limit' ); |
|
221 | + return $this->get('EVT_additional_limit'); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * @return bool |
228 | 228 | */ |
229 | 229 | function allow_overflow() { |
230 | - return $this->get( 'EVT_allow_overflow' ); |
|
230 | + return $this->get('EVT_allow_overflow'); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * @return bool |
237 | 237 | */ |
238 | 238 | function created() { |
239 | - return $this->get( 'EVT_created' ); |
|
239 | + return $this->get('EVT_created'); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @return bool |
246 | 246 | */ |
247 | 247 | function description() { |
248 | - return $this->get( 'EVT_desc' ); |
|
248 | + return $this->get('EVT_desc'); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @return string of html |
256 | 256 | */ |
257 | 257 | function description_filtered() { |
258 | - return $this->get_pretty( 'EVT_desc' ); |
|
258 | + return $this->get_pretty('EVT_desc'); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * @return bool |
265 | 265 | */ |
266 | 266 | function display_description() { |
267 | - return $this->get( 'EVT_display_desc' ); |
|
267 | + return $this->get('EVT_display_desc'); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @return bool |
274 | 274 | */ |
275 | 275 | function display_ticket_selector() { |
276 | - return (bool)$this->get( 'EVT_display_ticket_selector' ); |
|
276 | + return (bool) $this->get('EVT_display_ticket_selector'); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * @return bool |
283 | 283 | */ |
284 | 284 | function external_url() { |
285 | - return $this->get( 'EVT_external_URL' ); |
|
285 | + return $this->get('EVT_external_URL'); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * @return bool |
292 | 292 | */ |
293 | 293 | function member_only() { |
294 | - return $this->get( 'EVT_member_only' ); |
|
294 | + return $this->get('EVT_member_only'); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @return bool |
301 | 301 | */ |
302 | 302 | function phone() { |
303 | - return $this->get( 'EVT_phone' ); |
|
303 | + return $this->get('EVT_phone'); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * @return bool |
310 | 310 | */ |
311 | 311 | function modified() { |
312 | - return $this->get( 'EVT_modified' ); |
|
312 | + return $this->get('EVT_modified'); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * @return bool |
319 | 319 | */ |
320 | 320 | function name() { |
321 | - return $this->get( 'EVT_name' ); |
|
321 | + return $this->get('EVT_name'); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | * @return bool |
328 | 328 | */ |
329 | 329 | function order() { |
330 | - return $this->get( 'EVT_order' ); |
|
330 | + return $this->get('EVT_order'); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
@@ -336,8 +336,8 @@ discard block |
||
336 | 336 | * @return bool|string |
337 | 337 | */ |
338 | 338 | function default_registration_status() { |
339 | - $event_default_registration_status = $this->get( 'EVT_default_registration_status' ); |
|
340 | - return !empty( $event_default_registration_status ) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID; |
|
339 | + $event_default_registration_status = $this->get('EVT_default_registration_status'); |
|
340 | + return ! empty($event_default_registration_status) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID; |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | * @param bool $not_full_desc |
349 | 349 | * @return bool|string |
350 | 350 | */ |
351 | - function short_description( $num_words = 55, $more = NULL, $not_full_desc = FALSE ) { |
|
352 | - $short_desc = $this->get( 'EVT_short_desc' ); |
|
353 | - if ( !empty( $short_desc ) || $not_full_desc ) { |
|
351 | + function short_description($num_words = 55, $more = NULL, $not_full_desc = FALSE) { |
|
352 | + $short_desc = $this->get('EVT_short_desc'); |
|
353 | + if ( ! empty($short_desc) || $not_full_desc) { |
|
354 | 354 | return $short_desc; |
355 | 355 | } |
356 | 356 | else { |
357 | - $full_desc = $this->get( 'EVT_desc' ); |
|
358 | - return wp_trim_words( $full_desc, $num_words, $more ); |
|
357 | + $full_desc = $this->get('EVT_desc'); |
|
358 | + return wp_trim_words($full_desc, $num_words, $more); |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | * @return bool |
366 | 366 | */ |
367 | 367 | function slug() { |
368 | - return $this->get( 'EVT_slug' ); |
|
368 | + return $this->get('EVT_slug'); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | * @return bool |
375 | 375 | */ |
376 | 376 | function timezone_string() { |
377 | - return $this->get( 'EVT_timezone_string' ); |
|
377 | + return $this->get('EVT_timezone_string'); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | * @return bool |
384 | 384 | */ |
385 | 385 | function visible_on() { |
386 | - return $this->get( 'EVT_visible_on' ); |
|
386 | + return $this->get('EVT_visible_on'); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | * @return int |
393 | 393 | */ |
394 | 394 | function wp_user() { |
395 | - return $this->get( 'EVT_wp_user' ); |
|
395 | + return $this->get('EVT_wp_user'); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | * @return bool |
402 | 402 | */ |
403 | 403 | function donations() { |
404 | - return $this->get( 'EVT_donations' ); |
|
404 | + return $this->get('EVT_donations'); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | |
@@ -409,8 +409,8 @@ discard block |
||
409 | 409 | /** |
410 | 410 | * @param $limit |
411 | 411 | */ |
412 | - function set_additional_limit( $limit ) { |
|
413 | - $this->set( 'EVT_additional_limit', $limit ); |
|
412 | + function set_additional_limit($limit) { |
|
413 | + $this->set('EVT_additional_limit', $limit); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | /** |
419 | 419 | * @param $created |
420 | 420 | */ |
421 | - function set_created( $created ) { |
|
422 | - $this->set( 'EVT_created', $created ); |
|
421 | + function set_created($created) { |
|
422 | + $this->set('EVT_created', $created); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | /** |
428 | 428 | * @param $desc |
429 | 429 | */ |
430 | - function set_description( $desc ) { |
|
431 | - $this->set( 'EVT_desc', $desc ); |
|
430 | + function set_description($desc) { |
|
431 | + $this->set('EVT_desc', $desc); |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | |
@@ -436,8 +436,8 @@ discard block |
||
436 | 436 | /** |
437 | 437 | * @param $display_desc |
438 | 438 | */ |
439 | - function set_display_description( $display_desc ) { |
|
440 | - $this->set( 'EVT_display_desc', $display_desc ); |
|
439 | + function set_display_description($display_desc) { |
|
440 | + $this->set('EVT_display_desc', $display_desc); |
|
441 | 441 | } |
442 | 442 | |
443 | 443 | |
@@ -445,8 +445,8 @@ discard block |
||
445 | 445 | /** |
446 | 446 | * @param $display_ticket_selector |
447 | 447 | */ |
448 | - function set_display_ticket_selector( $display_ticket_selector ) { |
|
449 | - $this->set( 'EVT_display_ticket_selector', $display_ticket_selector ); |
|
448 | + function set_display_ticket_selector($display_ticket_selector) { |
|
449 | + $this->set('EVT_display_ticket_selector', $display_ticket_selector); |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | |
@@ -454,8 +454,8 @@ discard block |
||
454 | 454 | /** |
455 | 455 | * @param $external_url |
456 | 456 | */ |
457 | - function set_external_url( $external_url ) { |
|
458 | - $this->set( 'EVT_external_URL', $external_url ); |
|
457 | + function set_external_url($external_url) { |
|
458 | + $this->set('EVT_external_URL', $external_url); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | |
@@ -463,8 +463,8 @@ discard block |
||
463 | 463 | /** |
464 | 464 | * @param $member_only |
465 | 465 | */ |
466 | - function set_member_only( $member_only ) { |
|
467 | - $this->set( 'EVT_member_only', $member_only ); |
|
466 | + function set_member_only($member_only) { |
|
467 | + $this->set('EVT_member_only', $member_only); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | |
@@ -472,8 +472,8 @@ discard block |
||
472 | 472 | /** |
473 | 473 | * @param $event_phone |
474 | 474 | */ |
475 | - function set_event_phone( $event_phone ) { |
|
476 | - $this->set( 'EVT_phone', $event_phone ); |
|
475 | + function set_event_phone($event_phone) { |
|
476 | + $this->set('EVT_phone', $event_phone); |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | |
@@ -481,8 +481,8 @@ discard block |
||
481 | 481 | /** |
482 | 482 | * @param $modified |
483 | 483 | */ |
484 | - function set_modified( $modified ) { |
|
485 | - $this->set( 'EVT_modified', $modified ); |
|
484 | + function set_modified($modified) { |
|
485 | + $this->set('EVT_modified', $modified); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | |
@@ -490,8 +490,8 @@ discard block |
||
490 | 490 | /** |
491 | 491 | * @param $name |
492 | 492 | */ |
493 | - function set_name( $name ) { |
|
494 | - $this->set( 'EVT_name', $name ); |
|
493 | + function set_name($name) { |
|
494 | + $this->set('EVT_name', $name); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | |
@@ -499,8 +499,8 @@ discard block |
||
499 | 499 | /** |
500 | 500 | * @param $order |
501 | 501 | */ |
502 | - function set_order( $order ) { |
|
503 | - $this->set( 'EVT_order', $order ); |
|
502 | + function set_order($order) { |
|
503 | + $this->set('EVT_order', $order); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | |
@@ -508,8 +508,8 @@ discard block |
||
508 | 508 | /** |
509 | 509 | * @param $short_desc |
510 | 510 | */ |
511 | - function set_short_description( $short_desc ) { |
|
512 | - $this->set( 'EVT_short_desc', $short_desc ); |
|
511 | + function set_short_description($short_desc) { |
|
512 | + $this->set('EVT_short_desc', $short_desc); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | |
@@ -517,8 +517,8 @@ discard block |
||
517 | 517 | /** |
518 | 518 | * @param $slug |
519 | 519 | */ |
520 | - function set_slug( $slug ) { |
|
521 | - $this->set( 'EVT_slug', $slug ); |
|
520 | + function set_slug($slug) { |
|
521 | + $this->set('EVT_slug', $slug); |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | |
@@ -526,8 +526,8 @@ discard block |
||
526 | 526 | /** |
527 | 527 | * @param $timezone_string |
528 | 528 | */ |
529 | - function set_timezone_string( $timezone_string ) { |
|
530 | - $this->set( 'EVT_timezone_string', $timezone_string ); |
|
529 | + function set_timezone_string($timezone_string) { |
|
530 | + $this->set('EVT_timezone_string', $timezone_string); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | |
@@ -535,8 +535,8 @@ discard block |
||
535 | 535 | /** |
536 | 536 | * @param $visible_on |
537 | 537 | */ |
538 | - function set_visible_on( $visible_on ) { |
|
539 | - $this->set( 'EVT_visible_on', $visible_on ); |
|
538 | + function set_visible_on($visible_on) { |
|
539 | + $this->set('EVT_visible_on', $visible_on); |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | /** |
545 | 545 | * @param $wp_user |
546 | 546 | */ |
547 | - function set_wp_user( $wp_user ) { |
|
548 | - $this->set( 'EVT_wp_user', $wp_user ); |
|
547 | + function set_wp_user($wp_user) { |
|
548 | + $this->set('EVT_wp_user', $wp_user); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | |
@@ -553,8 +553,8 @@ discard block |
||
553 | 553 | /** |
554 | 554 | * @param $default_registration_status |
555 | 555 | */ |
556 | - function set_default_registration_status( $default_registration_status ) { |
|
557 | - $this->set( 'EVT_default_registration_status', $default_registration_status ); |
|
556 | + function set_default_registration_status($default_registration_status) { |
|
557 | + $this->set('EVT_default_registration_status', $default_registration_status); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | |
@@ -562,8 +562,8 @@ discard block |
||
562 | 562 | /** |
563 | 563 | * @param $donations |
564 | 564 | */ |
565 | - function set_donations( $donations ) { |
|
566 | - $this->set( 'EVT_donations', $donations ); |
|
565 | + function set_donations($donations) { |
|
566 | + $this->set('EVT_donations', $donations); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | |
@@ -573,8 +573,8 @@ discard block |
||
573 | 573 | * @param EE_Venue /int $venue_id_or_obj |
574 | 574 | * @return EE_Venue |
575 | 575 | */ |
576 | - function add_venue( $venue_id_or_obj ) { |
|
577 | - return $this->_add_relation_to( $venue_id_or_obj, 'Venue' ); |
|
576 | + function add_venue($venue_id_or_obj) { |
|
577 | + return $this->_add_relation_to($venue_id_or_obj, 'Venue'); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | |
@@ -584,8 +584,8 @@ discard block |
||
584 | 584 | * @param EE_Venue /int $venue_id_or_obj |
585 | 585 | * @return EE_Venue |
586 | 586 | */ |
587 | - function remove_venue( $venue_id_or_obj ) { |
|
588 | - return $this->_remove_relation_to( $venue_id_or_obj, 'Venue' ); |
|
587 | + function remove_venue($venue_id_or_obj) { |
|
588 | + return $this->_remove_relation_to($venue_id_or_obj, 'Venue'); |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | |
@@ -595,8 +595,8 @@ discard block |
||
595 | 595 | * @param array $query_params like EEM_Base::get_all's $query_params |
596 | 596 | * @return EE_Venue[] |
597 | 597 | */ |
598 | - function venues( $query_params = array() ) { |
|
599 | - return $this->get_many_related( 'Venue', $query_params ); |
|
598 | + function venues($query_params = array()) { |
|
599 | + return $this->get_many_related('Venue', $query_params); |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | */ |
609 | 609 | private function _has_ID_and_is_published() { |
610 | 610 | // first check if event id is present and not NULL, then check if this event is published (or any of the equivalent "published" statuses) |
611 | - return ( $this->ID() && $this->ID() !== NULL && ( $this->status() == 'publish' || $this->status() == EEM_Event::sold_out || $this->status() == EEM_Event::postponed || $this->status() == EEM_Event::cancelled ) ) ? TRUE : FALSE; |
|
611 | + return ($this->ID() && $this->ID() !== NULL && ($this->status() == 'publish' || $this->status() == EEM_Event::sold_out || $this->status() == EEM_Event::postponed || $this->status() == EEM_Event::cancelled)) ? TRUE : FALSE; |
|
612 | 612 | } |
613 | 613 | |
614 | 614 | |
@@ -620,21 +620,21 @@ discard block |
||
620 | 620 | */ |
621 | 621 | public function is_upcoming() { |
622 | 622 | // check if event id is present and if this event is published |
623 | - if ( $this->is_inactive() ) { |
|
623 | + if ($this->is_inactive()) { |
|
624 | 624 | return FALSE; |
625 | 625 | } |
626 | 626 | // set initial value |
627 | 627 | $upcoming = FALSE; |
628 | 628 | //next let's get all datetimes and loop through them |
629 | 629 | $datetimes = $this->datetimes_in_chronological_order(); |
630 | - foreach ( $datetimes as $datetime ) { |
|
631 | - if ( $datetime instanceof EE_Datetime ) { |
|
630 | + foreach ($datetimes as $datetime) { |
|
631 | + if ($datetime instanceof EE_Datetime) { |
|
632 | 632 | //if this dtt is expired then we continue cause one of the other datetimes might be upcoming. |
633 | - if ( $datetime->is_expired() ) { |
|
633 | + if ($datetime->is_expired()) { |
|
634 | 634 | continue; |
635 | 635 | } |
636 | 636 | //if this dtt is active then we return false. |
637 | - if ( $datetime->is_active() ) { |
|
637 | + if ($datetime->is_active()) { |
|
638 | 638 | return FALSE; |
639 | 639 | } |
640 | 640 | //otherwise let's check upcoming status |
@@ -651,21 +651,21 @@ discard block |
||
651 | 651 | */ |
652 | 652 | public function is_active() { |
653 | 653 | // check if event id is present and if this event is published |
654 | - if ( $this->is_inactive() ) { |
|
654 | + if ($this->is_inactive()) { |
|
655 | 655 | return FALSE; |
656 | 656 | } |
657 | 657 | // set initial value |
658 | 658 | $active = FALSE; |
659 | 659 | //next let's get all datetimes and loop through them |
660 | 660 | $datetimes = $this->datetimes_in_chronological_order(); |
661 | - foreach ( $datetimes as $datetime ) { |
|
662 | - if ( $datetime instanceof EE_Datetime ) { |
|
661 | + foreach ($datetimes as $datetime) { |
|
662 | + if ($datetime instanceof EE_Datetime) { |
|
663 | 663 | //if this dtt is expired then we continue cause one of the other datetimes might be active. |
664 | - if ( $datetime->is_expired() ) { |
|
664 | + if ($datetime->is_expired()) { |
|
665 | 665 | continue; |
666 | 666 | } |
667 | 667 | //if this dtt is upcoming then we return false. |
668 | - if ( $datetime->is_upcoming() ) { |
|
668 | + if ($datetime->is_upcoming()) { |
|
669 | 669 | return FALSE; |
670 | 670 | } |
671 | 671 | //otherwise let's check active status |
@@ -682,17 +682,17 @@ discard block |
||
682 | 682 | */ |
683 | 683 | public function is_expired() { |
684 | 684 | // check if event id is present and if this event is published |
685 | - if ( $this->is_inactive() ) { |
|
685 | + if ($this->is_inactive()) { |
|
686 | 686 | return FALSE; |
687 | 687 | } |
688 | 688 | // set initial value |
689 | 689 | $expired = FALSE; |
690 | 690 | //first let's get all datetimes and loop through them |
691 | 691 | $datetimes = $this->datetimes_in_chronological_order(); |
692 | - foreach ( $datetimes as $datetime ) { |
|
693 | - if ( $datetime instanceof EE_Datetime ) { |
|
692 | + foreach ($datetimes as $datetime) { |
|
693 | + if ($datetime instanceof EE_Datetime) { |
|
694 | 694 | //if this dtt is upcoming or active then we return false. |
695 | - if ( $datetime->is_upcoming() || $datetime->is_active() ) { |
|
695 | + if ($datetime->is_upcoming() || $datetime->is_active()) { |
|
696 | 696 | return FALSE; |
697 | 697 | } |
698 | 698 | //otherwise let's check active status |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | */ |
710 | 710 | public function is_inactive() { |
711 | 711 | // check if event id is present and if this event is published |
712 | - if ( $this->_has_ID_and_is_published() ) { |
|
712 | + if ($this->_has_ID_and_is_published()) { |
|
713 | 713 | return FALSE; |
714 | 714 | } |
715 | 715 | return TRUE; |
@@ -727,37 +727,37 @@ discard block |
||
727 | 727 | */ |
728 | 728 | public function perform_sold_out_status_check() { |
729 | 729 | // get all unexpired untrashed tickets |
730 | - $tickets = $this->tickets( array( |
|
730 | + $tickets = $this->tickets(array( |
|
731 | 731 | array( |
732 | - 'TKT_end_date' => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ), |
|
732 | + 'TKT_end_date' => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')), |
|
733 | 733 | 'TKT_deleted' => false |
734 | 734 | ) |
735 | 735 | )); |
736 | 736 | // if all the tickets are just expired, then don't update the event status to sold out |
737 | - if ( empty( $tickets )) { |
|
737 | + if (empty($tickets)) { |
|
738 | 738 | return true; |
739 | 739 | } |
740 | 740 | // set initial value |
741 | 741 | $spaces_remaining = 0; |
742 | - foreach( $tickets as $ticket ) { |
|
743 | - if ( $ticket instanceof EE_Ticket ) { |
|
744 | - $spaces_remaining += $ticket->qty( 'saleable' ); |
|
742 | + foreach ($tickets as $ticket) { |
|
743 | + if ($ticket instanceof EE_Ticket) { |
|
744 | + $spaces_remaining += $ticket->qty('saleable'); |
|
745 | 745 | } |
746 | 746 | } |
747 | - if ( $spaces_remaining === 0 ) { |
|
748 | - $this->set_status( EEM_Event::sold_out ); |
|
749 | - if ( !is_admin() || ( is_admin() && defined( 'DOING_AJAX' ) ) ) { |
|
747 | + if ($spaces_remaining === 0) { |
|
748 | + $this->set_status(EEM_Event::sold_out); |
|
749 | + if ( ! is_admin() || (is_admin() && defined('DOING_AJAX'))) { |
|
750 | 750 | $this->save(); |
751 | 751 | } |
752 | 752 | $sold_out = TRUE; |
753 | 753 | } else { |
754 | 754 | $sold_out = FALSE; |
755 | 755 | // was event previously marked as sold out ? |
756 | - if ( $this->status() == EEM_Event::sold_out ) { |
|
756 | + if ($this->status() == EEM_Event::sold_out) { |
|
757 | 757 | // revert status to previous value, if it was set |
758 | - $previous_event_status = $this->get_post_meta( '_previous_event_status', true ); |
|
759 | - if ( $previous_event_status ) { |
|
760 | - $this->set_status( $previous_event_status ); |
|
758 | + $previous_event_status = $this->get_post_meta('_previous_event_status', true); |
|
759 | + if ($previous_event_status) { |
|
760 | + $this->set_status($previous_event_status); |
|
761 | 761 | } |
762 | 762 | } |
763 | 763 | } |
@@ -781,15 +781,15 @@ discard block |
||
781 | 781 | */ |
782 | 782 | public function spaces_remaining_for_sale() { |
783 | 783 | //first get total available spaces including consideration for tickets that have already sold. |
784 | - $spaces_available = $this->total_available_spaces( true ); |
|
784 | + $spaces_available = $this->total_available_spaces(true); |
|
785 | 785 | |
786 | 786 | //if total available = 0, then exit right away because that means everything is expired. |
787 | - if ( $spaces_available === 0 ) { |
|
787 | + if ($spaces_available === 0) { |
|
788 | 788 | return 0; |
789 | 789 | } |
790 | 790 | |
791 | 791 | //subtract total approved registrations from spaces available to get how many are remaining. |
792 | - $spots_taken = EEM_Registration::instance()->count( array( array( 'EVT_ID' => $this->ID(), 'STS_ID' => EEM_Registration::status_id_approved ) ), 'REG_ID', true ); |
|
792 | + $spots_taken = EEM_Registration::instance()->count(array(array('EVT_ID' => $this->ID(), 'STS_ID' => EEM_Registration::status_id_approved)), 'REG_ID', true); |
|
793 | 793 | $spaces_remaining = $spaces_available - $spots_taken; |
794 | 794 | |
795 | 795 | return $spaces_remaining > 0 ? $spaces_remaining : 0; |
@@ -822,29 +822,29 @@ discard block |
||
822 | 822 | * |
823 | 823 | * @return int|float (Note: if EE_INF is returned its considered a float by PHP) |
824 | 824 | */ |
825 | - public function total_available_spaces( $current_total_available = false ) { |
|
825 | + public function total_available_spaces($current_total_available = false) { |
|
826 | 826 | $spaces_available = 0; |
827 | 827 | |
828 | 828 | //first get all tickets on the event and include expired tickets |
829 | - $tickets = $this->tickets( array( 'default_where_conditions' => 'none' ) ); |
|
829 | + $tickets = $this->tickets(array('default_where_conditions' => 'none')); |
|
830 | 830 | $ticket_sums = array(); |
831 | 831 | $datetime_limits = array(); |
832 | 832 | |
833 | 833 | //loop through tickets and normalize them |
834 | - foreach ( $tickets as $ticket ) { |
|
835 | - $datetimes = $ticket->datetimes( array( 'order_by' => array( 'DTT_reg_limit' => 'ASC' ) ) ); |
|
834 | + foreach ($tickets as $ticket) { |
|
835 | + $datetimes = $ticket->datetimes(array('order_by' => array('DTT_reg_limit' => 'ASC'))); |
|
836 | 836 | |
837 | - if ( empty( $datetimes ) ) { |
|
837 | + if (empty($datetimes)) { |
|
838 | 838 | continue; |
839 | 839 | } |
840 | 840 | |
841 | 841 | //first datetime should be the lowest datetime |
842 | - $least_datetime = reset( $datetimes ); |
|
842 | + $least_datetime = reset($datetimes); |
|
843 | 843 | |
844 | 844 | //lets reset the ticket quantity to be the lower of either the lowest datetime reg limit or the ticket quantity |
845 | 845 | //IF datetimes sold (and we're not doing current live total available, then use spaces remaining for datetime, not reg_limit. |
846 | - if ( $current_total_available ) { |
|
847 | - if ( $ticket->is_remaining() ) { |
|
846 | + if ($current_total_available) { |
|
847 | + if ($ticket->is_remaining()) { |
|
848 | 848 | $remaining = $ticket->remaining(); |
849 | 849 | } else { |
850 | 850 | $spaces_available += $ticket->sold(); |
@@ -852,23 +852,23 @@ discard block |
||
852 | 852 | continue; |
853 | 853 | } |
854 | 854 | } else { |
855 | - $remaining = min( $ticket->qty(), $least_datetime->reg_limit() ); |
|
855 | + $remaining = min($ticket->qty(), $least_datetime->reg_limit()); |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | //if $ticket_limit == infinity then let's drop out right away and just return that because any infinity amount trumps all other "available" amounts. |
859 | - if ( $remaining === EE_INF ) { |
|
859 | + if ($remaining === EE_INF) { |
|
860 | 860 | return EE_INF; |
861 | 861 | } |
862 | 862 | |
863 | 863 | //multiply normalized $tkt quantity by the number of datetimes on the ticket as the "sum" |
864 | 864 | //also include the sum of all the datetime reg limits on the ticket for breaking ties. |
865 | - $ticket_sums[$ticket->ID()]['sum'] = $remaining * count( $datetimes ); |
|
865 | + $ticket_sums[$ticket->ID()]['sum'] = $remaining * count($datetimes); |
|
866 | 866 | $ticket_sums[$ticket->ID()]['datetime_sums'] = 0; |
867 | - foreach ( $datetimes as $datetime ) { |
|
868 | - if ( $datetime->reg_limit() === EE_INF ) { |
|
867 | + foreach ($datetimes as $datetime) { |
|
868 | + if ($datetime->reg_limit() === EE_INF) { |
|
869 | 869 | $ticket_sums[$ticket->ID()]['datetime_sums'] = EE_INF; |
870 | 870 | } else { |
871 | - $ticket_sums[ $ticket->ID() ]['datetime_sums'] += $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit(); |
|
871 | + $ticket_sums[$ticket->ID()]['datetime_sums'] += $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit(); |
|
872 | 872 | } |
873 | 873 | $datetime_limits[$datetime->ID()] = $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit(); |
874 | 874 | } |
@@ -879,74 +879,74 @@ discard block |
||
879 | 879 | //ticket quantity by the number of datetimes on the ticket). For tie-breakers, then the next sort is based on the |
880 | 880 | //ticket with the greatest sum of all remaining datetime->spaces_remaining() ( or $datetime->reg_limit() if not |
881 | 881 | //$current_total_available ) for the datetimes on the ticket. |
882 | - usort( $ticket_sums, function( $a, $b ) { |
|
883 | - if ( $a['sum'] == $b['sum'] ) { |
|
884 | - if ( $a['datetime_sums'] == $b['datetime_sums'] ) { |
|
882 | + usort($ticket_sums, function($a, $b) { |
|
883 | + if ($a['sum'] == $b['sum']) { |
|
884 | + if ($a['datetime_sums'] == $b['datetime_sums']) { |
|
885 | 885 | return 0; |
886 | 886 | } |
887 | 887 | |
888 | 888 | return $a['datetime_sums'] < $b['datetime_sums'] ? 1 : -1; |
889 | 889 | } |
890 | - return ( $a['sum'] < $b['sum'] ) ? -1 : 1; |
|
890 | + return ($a['sum'] < $b['sum']) ? -1 : 1; |
|
891 | 891 | }); |
892 | 892 | |
893 | 893 | //now let's loop through the sorted tickets and simulate sellouts |
894 | - foreach ( $ticket_sums as $ticket_info ) { |
|
895 | - if ( $ticket_info['ticket'] instanceof EE_Ticket ) { |
|
894 | + foreach ($ticket_sums as $ticket_info) { |
|
895 | + if ($ticket_info['ticket'] instanceof EE_Ticket) { |
|
896 | 896 | |
897 | - $datetimes = $ticket_info['ticket']->datetimes( array( 'order_by' => array( 'DTT_reg_limit' => 'ASC' ) ) ); |
|
897 | + $datetimes = $ticket_info['ticket']->datetimes(array('order_by' => array('DTT_reg_limit' => 'ASC'))); |
|
898 | 898 | //need to sort these $datetimes by remaining (only if $current_total_available) |
899 | 899 | //setup datetimes for simulation |
900 | 900 | $ticket_datetimes_remaining = array(); |
901 | - foreach( $datetimes as $datetime ) { |
|
901 | + foreach ($datetimes as $datetime) { |
|
902 | 902 | $ticket_datetimes_remaining[$datetime->ID()]['rem'] = $datetime_limits[$datetime->ID()]; |
903 | 903 | $ticket_datetimes_remaining[$datetime->ID()]['datetime'] = $datetime; |
904 | 904 | } |
905 | - usort( $ticket_datetimes_remaining, function( $a, $b ) { |
|
906 | - if ( $a['rem'] == $b['rem'] ) { |
|
905 | + usort($ticket_datetimes_remaining, function($a, $b) { |
|
906 | + if ($a['rem'] == $b['rem']) { |
|
907 | 907 | return 0; |
908 | 908 | } |
909 | - return ( $a['rem'] < $b['rem'] ) ? -1 : 1; |
|
909 | + return ($a['rem'] < $b['rem']) ? -1 : 1; |
|
910 | 910 | }); |
911 | 911 | |
912 | 912 | |
913 | 913 | //get the remaining on the first datetime (which should be the one with the least remaining) and that is |
914 | 914 | //what we add to the spaces_available running total. Then we need to decrease the remaining on our datetime tracker. |
915 | - $lowest_datetime = reset( $ticket_datetimes_remaining ); |
|
915 | + $lowest_datetime = reset($ticket_datetimes_remaining); |
|
916 | 916 | |
917 | 917 | //need to get the lower of; what the remaining is on the lowest datetime, and the remaining on the ticket. |
918 | 918 | // If this ends up being 0 (because of previous tickets in our simulation selling out), then it has already |
919 | 919 | // been tracked on $spaces available and this ticket is now sold out for the simulation, so we can continue |
920 | 920 | // to the next ticket. |
921 | - if ( $current_total_available ) { |
|
922 | - $remaining = min( $lowest_datetime['rem'], $ticket_info['ticket']->remaining() ); |
|
921 | + if ($current_total_available) { |
|
922 | + $remaining = min($lowest_datetime['rem'], $ticket_info['ticket']->remaining()); |
|
923 | 923 | } else { |
924 | - $remaining = min( $lowest_datetime['rem'], $ticket_info['ticket']->qty() ); |
|
924 | + $remaining = min($lowest_datetime['rem'], $ticket_info['ticket']->qty()); |
|
925 | 925 | } |
926 | 926 | |
927 | 927 | //if $remaining is infinite that means that all datetimes on this ticket are infinite but we've made it here because all |
928 | 928 | //tickets have a quantity. So we don't have to track datetimes, we can just use ticket quantities for total |
929 | 929 | //available. |
930 | - if ( $remaining === EE_INF ) { |
|
930 | + if ($remaining === EE_INF) { |
|
931 | 931 | $spaces_available += $ticket_info['ticket']->qty(); |
932 | 932 | continue; |
933 | 933 | } |
934 | 934 | |
935 | 935 | //if ticket has sold amounts then we also need to add that (but only if doing live counts) |
936 | - if ( $current_total_available ) { |
|
936 | + if ($current_total_available) { |
|
937 | 937 | $spaces_available += $ticket_info['ticket']->sold(); |
938 | 938 | } |
939 | 939 | |
940 | - if ( $remaining <= 0 ) { |
|
940 | + if ($remaining <= 0) { |
|
941 | 941 | continue; |
942 | 942 | } else { |
943 | 943 | $spaces_available += $remaining; |
944 | 944 | } |
945 | 945 | |
946 | 946 | //loop through the datetimes and sell them out! |
947 | - foreach ( $ticket_datetimes_remaining as $datetime_info ) { |
|
948 | - if ( $datetime_info['datetime'] instanceof EE_Datetime ) { |
|
949 | - $datetime_limits[ $datetime_info['datetime']->ID() ] += - $remaining; |
|
947 | + foreach ($ticket_datetimes_remaining as $datetime_info) { |
|
948 | + if ($datetime_info['datetime'] instanceof EE_Datetime) { |
|
949 | + $datetime_limits[$datetime_info['datetime']->ID()] += - $remaining; |
|
950 | 950 | } |
951 | 951 | } |
952 | 952 | } |
@@ -962,8 +962,8 @@ discard block |
||
962 | 962 | * @param bool $actual whether or not to perform calculations to not only figure the actual status but also to flip the status if necessary to sold out If false, we just check the existing status of the event |
963 | 963 | * @return boolean |
964 | 964 | */ |
965 | - public function is_sold_out( $actual = FALSE ) { |
|
966 | - if ( ! $actual ) { |
|
965 | + public function is_sold_out($actual = FALSE) { |
|
966 | + if ( ! $actual) { |
|
967 | 967 | return $this->status() == EEM_Event::sold_out; |
968 | 968 | } |
969 | 969 | else { |
@@ -1008,30 +1008,30 @@ discard block |
||
1008 | 1008 | * |
1009 | 1009 | * @return bool | string - based on EE_Datetime active constants or FALSE if error. |
1010 | 1010 | */ |
1011 | - public function get_active_status( $reset = false ) { |
|
1011 | + public function get_active_status($reset = false) { |
|
1012 | 1012 | // if the active status has already been set, then just use that value (unless we are resetting it) |
1013 | - if ( ! empty( $this->_active_status ) && ! $reset ) { |
|
1013 | + if ( ! empty($this->_active_status) && ! $reset) { |
|
1014 | 1014 | return $this->_active_status; |
1015 | 1015 | } |
1016 | 1016 | //first check if event id is present on this object |
1017 | - if ( ! $this->ID() ) { |
|
1017 | + if ( ! $this->ID()) { |
|
1018 | 1018 | return false; |
1019 | 1019 | } |
1020 | 1020 | |
1021 | - $where_params_for_event = array( array( 'EVT_ID' => $this->ID() ) ); |
|
1021 | + $where_params_for_event = array(array('EVT_ID' => $this->ID())); |
|
1022 | 1022 | |
1023 | 1023 | //if event is published: |
1024 | - if ( $this->status() === 'publish' ) { |
|
1024 | + if ($this->status() === 'publish') { |
|
1025 | 1025 | //active? |
1026 | - if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::active, $where_params_for_event ) > 0 ) { |
|
1026 | + if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::active, $where_params_for_event) > 0) { |
|
1027 | 1027 | $this->_active_status = EE_Datetime::active; |
1028 | 1028 | } else { |
1029 | 1029 | //upcoming? |
1030 | - if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::upcoming, $where_params_for_event ) > 0 ) { |
|
1030 | + if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::upcoming, $where_params_for_event) > 0) { |
|
1031 | 1031 | $this->_active_status = EE_Datetime::upcoming; |
1032 | 1032 | } else { |
1033 | 1033 | //expired? |
1034 | - if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::expired, $where_params_for_event ) > 0 ) { |
|
1034 | + if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::expired, $where_params_for_event) > 0) { |
|
1035 | 1035 | $this->_active_status = EE_Datetime::expired; |
1036 | 1036 | } else { |
1037 | 1037 | //it would be odd if things make it this far because it basically means there are no datetime's |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | } |
1043 | 1043 | } else { |
1044 | 1044 | //the event is not published, so let's just set it's active status according to its' post status |
1045 | - switch ( $this->status() ) { |
|
1045 | + switch ($this->status()) { |
|
1046 | 1046 | case EEM_Event::sold_out : |
1047 | 1047 | $this->_active_status = EE_Datetime::sold_out; |
1048 | 1048 | break; |
@@ -1068,10 +1068,10 @@ discard block |
||
1068 | 1068 | * @param boolean $echo whether to return (FALSE), or echo out the result (TRUE) |
1069 | 1069 | * @return mixed void|string |
1070 | 1070 | */ |
1071 | - public function pretty_active_status( $echo = TRUE ) { |
|
1071 | + public function pretty_active_status($echo = TRUE) { |
|
1072 | 1072 | $active_status = $this->get_active_status(); |
1073 | - $status = '<span class="ee-status event-active-status-' . $active_status . '">' . EEH_Template::pretty_status( $active_status, FALSE, 'sentence' ) . '</span>'; |
|
1074 | - if ( $echo ) { |
|
1073 | + $status = '<span class="ee-status event-active-status-'.$active_status.'">'.EEH_Template::pretty_status($active_status, FALSE, 'sentence').'</span>'; |
|
1074 | + if ($echo) { |
|
1075 | 1075 | echo $status; |
1076 | 1076 | return ''; |
1077 | 1077 | } |
@@ -1085,12 +1085,12 @@ discard block |
||
1085 | 1085 | */ |
1086 | 1086 | public function get_number_of_tickets_sold() { |
1087 | 1087 | $tkt_sold = 0; |
1088 | - if ( !$this->ID() ) { |
|
1088 | + if ( ! $this->ID()) { |
|
1089 | 1089 | return 0; |
1090 | 1090 | } |
1091 | 1091 | $datetimes = $this->datetimes(); |
1092 | - foreach ( $datetimes as $datetime ) { |
|
1093 | - if ( $datetime instanceof EE_Datetime ) { |
|
1092 | + foreach ($datetimes as $datetime) { |
|
1093 | + if ($datetime instanceof EE_Datetime) { |
|
1094 | 1094 | $tkt_sold += $datetime->sold(); |
1095 | 1095 | } |
1096 | 1096 | } |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | * @return int |
1106 | 1106 | */ |
1107 | 1107 | public function get_count_of_all_registrations() { |
1108 | - return EEM_Event::instance()->count_related( $this, 'Registration' ); |
|
1108 | + return EEM_Event::instance()->count_related($this, 'Registration'); |
|
1109 | 1109 | } |
1110 | 1110 | |
1111 | 1111 | |
@@ -1115,9 +1115,9 @@ discard block |
||
1115 | 1115 | * @return EE_Ticket |
1116 | 1116 | */ |
1117 | 1117 | public function get_ticket_with_earliest_start_time() { |
1118 | - $where[ 'Datetime.EVT_ID' ] = $this->ID(); |
|
1119 | - $query_params = array( $where, 'order_by' => array( 'TKT_start_date' => 'ASC' ) ); |
|
1120 | - return EE_Registry::instance()->load_model( 'Ticket' )->get_one( $query_params ); |
|
1118 | + $where['Datetime.EVT_ID'] = $this->ID(); |
|
1119 | + $query_params = array($where, 'order_by' => array('TKT_start_date' => 'ASC')); |
|
1120 | + return EE_Registry::instance()->load_model('Ticket')->get_one($query_params); |
|
1121 | 1121 | } |
1122 | 1122 | |
1123 | 1123 | |
@@ -1127,9 +1127,9 @@ discard block |
||
1127 | 1127 | * @return EE_Ticket |
1128 | 1128 | */ |
1129 | 1129 | public function get_ticket_with_latest_end_time() { |
1130 | - $where[ 'Datetime.EVT_ID' ] = $this->ID(); |
|
1131 | - $query_params = array( $where, 'order_by' => array( 'TKT_end_date' => 'DESC' ) ); |
|
1132 | - return EE_Registry::instance()->load_model( 'Ticket' )->get_one( $query_params ); |
|
1130 | + $where['Datetime.EVT_ID'] = $this->ID(); |
|
1131 | + $query_params = array($where, 'order_by' => array('TKT_end_date' => 'DESC')); |
|
1132 | + return EE_Registry::instance()->load_model('Ticket')->get_one($query_params); |
|
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | |
@@ -1141,11 +1141,11 @@ discard block |
||
1141 | 1141 | public function tickets_on_sale() { |
1142 | 1142 | $earliest_ticket = $this->get_ticket_with_earliest_start_time(); |
1143 | 1143 | $latest_ticket = $this->get_ticket_with_latest_end_time(); |
1144 | - if ( !$latest_ticket instanceof EE_Ticket && !$earliest_ticket instanceof EE_Ticket ) { |
|
1144 | + if ( ! $latest_ticket instanceof EE_Ticket && ! $earliest_ticket instanceof EE_Ticket) { |
|
1145 | 1145 | return FALSE; |
1146 | 1146 | } |
1147 | 1147 | //check on sale for these two tickets. |
1148 | - if ( $latest_ticket->is_on_sale() || $earliest_ticket->is_on_sale() ) { |
|
1148 | + if ($latest_ticket->is_on_sale() || $earliest_ticket->is_on_sale()) { |
|
1149 | 1149 | return TRUE; |
1150 | 1150 | } |
1151 | 1151 | return FALSE; |
@@ -1159,7 +1159,7 @@ discard block |
||
1159 | 1159 | * @return string |
1160 | 1160 | */ |
1161 | 1161 | public function get_permalink() { |
1162 | - if ( $this->external_url() ) { |
|
1162 | + if ($this->external_url()) { |
|
1163 | 1163 | return $this->external_url(); |
1164 | 1164 | } |
1165 | 1165 | else { |
@@ -1174,10 +1174,10 @@ discard block |
||
1174 | 1174 | * @param array $query_params like EEM_Base::get_all |
1175 | 1175 | * @return EE_Term |
1176 | 1176 | */ |
1177 | - public function first_event_category( $query_params = array() ) { |
|
1178 | - $query_params[ 0 ][ 'Term_Taxonomy.taxonomy' ] = 'espresso_event_categories'; |
|
1179 | - $query_params[ 0 ][ 'Term_Taxonomy.Event.EVT_ID' ] = $this->ID(); |
|
1180 | - return EEM_Term::instance()->get_one( $query_params ); |
|
1177 | + public function first_event_category($query_params = array()) { |
|
1178 | + $query_params[0]['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
|
1179 | + $query_params[0]['Term_Taxonomy.Event.EVT_ID'] = $this->ID(); |
|
1180 | + return EEM_Term::instance()->get_one($query_params); |
|
1181 | 1181 | } |
1182 | 1182 | |
1183 | 1183 | |
@@ -1187,10 +1187,10 @@ discard block |
||
1187 | 1187 | * @param array $query_params |
1188 | 1188 | * @return EE_Term[] |
1189 | 1189 | */ |
1190 | - public function get_all_event_categories( $query_params = array() ) { |
|
1191 | - $query_params[ 0 ][ 'Term_Taxonomy.taxonomy' ] = 'espresso_event_categories'; |
|
1192 | - $query_params[ 0 ][ 'Term_Taxonomy.Event.EVT_ID' ] = $this->ID(); |
|
1193 | - return EEM_Term::instance()->get_all( $query_params ); |
|
1190 | + public function get_all_event_categories($query_params = array()) { |
|
1191 | + $query_params[0]['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
|
1192 | + $query_params[0]['Term_Taxonomy.Event.EVT_ID'] = $this->ID(); |
|
1193 | + return EEM_Term::instance()->get_all($query_params); |
|
1194 | 1194 | } |
1195 | 1195 | |
1196 | 1196 | /** |
@@ -1198,8 +1198,8 @@ discard block |
||
1198 | 1198 | * @param array $query_params @see EEM_Base::get_all |
1199 | 1199 | * @return EE_Question_Group[] |
1200 | 1200 | */ |
1201 | - public function question_groups($query_params = array()){ |
|
1202 | - $query_params = ! empty( $query_params ) ? $query_params : array( 'order_by' => array( 'QSG_order' => 'ASC' )); |
|
1201 | + public function question_groups($query_params = array()) { |
|
1202 | + $query_params = ! empty($query_params) ? $query_params : array('order_by' => array('QSG_order' => 'ASC')); |
|
1203 | 1203 | return $this->get_many_related('Question_Group', $query_params); |
1204 | 1204 | } |
1205 | 1205 | |
@@ -1239,12 +1239,12 @@ discard block |
||
1239 | 1239 | */ |
1240 | 1240 | public function get_admin_edit_link() { |
1241 | 1241 | EE_Registry::instance()->load_helper('URL'); |
1242 | - return EEH_URL::add_query_args_and_nonce( array( |
|
1242 | + return EEH_URL::add_query_args_and_nonce(array( |
|
1243 | 1243 | 'page' => 'espresso_events', |
1244 | 1244 | 'action' => 'edit', |
1245 | 1245 | 'post' => $this->ID() |
1246 | 1246 | ), |
1247 | - admin_url( 'admin.php' ) |
|
1247 | + admin_url('admin.php') |
|
1248 | 1248 | ); |
1249 | 1249 | } |
1250 | 1250 | |
@@ -1257,11 +1257,11 @@ discard block |
||
1257 | 1257 | */ |
1258 | 1258 | public function get_admin_settings_link() { |
1259 | 1259 | EE_Registry::instance()->load_helper('URL'); |
1260 | - return EEH_URL::add_query_args_and_nonce( array( |
|
1260 | + return EEH_URL::add_query_args_and_nonce(array( |
|
1261 | 1261 | 'page' => 'espresso_events', |
1262 | 1262 | 'action' => 'default_event_settings' |
1263 | 1263 | ), |
1264 | - admin_url( 'admin.php' ) |
|
1264 | + admin_url('admin.php') |
|
1265 | 1265 | ); |
1266 | 1266 | } |
1267 | 1267 | |
@@ -1277,11 +1277,11 @@ discard block |
||
1277 | 1277 | public function get_admin_overview_link() { |
1278 | 1278 | |
1279 | 1279 | EE_Registry::instance()->load_helper('URL'); |
1280 | - return EEH_URL::add_query_args_and_nonce( array( |
|
1280 | + return EEH_URL::add_query_args_and_nonce(array( |
|
1281 | 1281 | 'page' => 'espresso_events', |
1282 | 1282 | 'action' => 'default' |
1283 | 1283 | ), |
1284 | - admin_url( 'admin.php' ) |
|
1284 | + admin_url('admin.php') |
|
1285 | 1285 | ); |
1286 | 1286 | } |
1287 | 1287 |