@@ -106,32 +106,32 @@ discard block |
||
106 | 106 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). |
107 | 107 | * 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) |
108 | 108 | */ |
109 | - protected function __construct( $timezone = null ) { |
|
110 | - $this->_table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
|
111 | - $this->singular_item = __('Registration','event_espresso'); |
|
112 | - $this->plural_item = __('Registrations','event_espresso'); |
|
109 | + protected function __construct($timezone = null) { |
|
110 | + $this->_table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true); |
|
111 | + $this->singular_item = __('Registration', 'event_espresso'); |
|
112 | + $this->plural_item = __('Registrations', 'event_espresso'); |
|
113 | 113 | |
114 | 114 | $this->_tables = array( |
115 | - 'Registration'=>new EE_Primary_Table('esp_registration','REG_ID') |
|
115 | + 'Registration'=>new EE_Primary_Table('esp_registration', 'REG_ID') |
|
116 | 116 | ); |
117 | 117 | $this->_fields = array( |
118 | 118 | 'Registration'=>array( |
119 | - 'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID','event_espresso')), |
|
120 | - 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'), |
|
121 | - 'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID','event_espresso'), false, 0, 'Attendee'), |
|
122 | - 'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso'), false, 0, 'Transaction'), |
|
123 | - 'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso'), false, 0, 'Ticket'), |
|
124 | - 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'), |
|
125 | - 'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred','event_espresso'), false, EE_Datetime_Field::now, $timezone ), |
|
126 | - 'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Registration\'s share of the transaction total','event_espresso'), false, 0), |
|
127 | - 'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration','event_espresso'), false, 0), |
|
128 | - 'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration','event_espresso'), false, ''), |
|
129 | - 'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration','event_espresso'), false, ''), |
|
130 | - 'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration','event_espresso'), false, ''), |
|
131 | - 'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ','event_espresso'), true, 1), |
|
132 | - 'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group','event_espresso'), false, 1), |
|
133 | - 'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending','event_espresso'), false, false), |
|
134 | - 'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false ) |
|
119 | + 'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso')), |
|
120 | + 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'), |
|
121 | + 'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID', 'event_espresso'), false, 0, 'Attendee'), |
|
122 | + 'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso'), false, 0, 'Transaction'), |
|
123 | + 'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso'), false, 0, 'Ticket'), |
|
124 | + 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'), |
|
125 | + 'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred', 'event_espresso'), false, EE_Datetime_Field::now, $timezone), |
|
126 | + 'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Registration\'s share of the transaction total', 'event_espresso'), false, 0), |
|
127 | + 'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration', 'event_espresso'), false, 0), |
|
128 | + 'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration', 'event_espresso'), false, ''), |
|
129 | + 'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration', 'event_espresso'), false, ''), |
|
130 | + 'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration', 'event_espresso'), false, ''), |
|
131 | + 'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ', 'event_espresso'), true, 1), |
|
132 | + 'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group', 'event_espresso'), false, 1), |
|
133 | + 'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending', 'event_espresso'), false, false), |
|
134 | + 'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false) |
|
135 | 135 | ) |
136 | 136 | ); |
137 | 137 | $this->_model_relations = array( |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | 'Answer'=>new EE_Has_Many_Relation(), |
144 | 144 | 'Checkin'=>new EE_Has_Many_Relation(), |
145 | 145 | 'Registration_Payment' => new EE_Has_Many_Relation(), |
146 | - 'Payment'=>new EE_HABTM_Relation( 'Registration_Payment' ), |
|
147 | - 'Message' => new EE_Has_Many_Any_Relation( false ) //allow deletes even if there are messages in the queue related |
|
146 | + 'Payment'=>new EE_HABTM_Relation('Registration_Payment'), |
|
147 | + 'Message' => new EE_Has_Many_Any_Relation(false) //allow deletes even if there are messages in the queue related |
|
148 | 148 | ); |
149 | 149 | $this->_model_chain_to_wp_user = 'Event'; |
150 | 150 | |
151 | - parent::__construct( $timezone ); |
|
151 | + parent::__construct($timezone); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | * @param bool $translated If true will return the values as singular localized strings |
244 | 244 | * @return array |
245 | 245 | */ |
246 | - public static function reg_status_array( $exclude = array(), $translated = FALSE ) { |
|
247 | - EEM_Registration::instance()->_get_registration_status_array( $exclude ); |
|
248 | - return $translated ? EEM_Status::instance()->localized_status( self::$_reg_status, FALSE, 'sentence') : self::$_reg_status; |
|
246 | + public static function reg_status_array($exclude = array(), $translated = FALSE) { |
|
247 | + EEM_Registration::instance()->_get_registration_status_array($exclude); |
|
248 | + return $translated ? EEM_Status::instance()->localized_status(self::$_reg_status, FALSE, 'sentence') : self::$_reg_status; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -256,18 +256,18 @@ discard block |
||
256 | 256 | * @param array $exclude |
257 | 257 | * @return array |
258 | 258 | */ |
259 | - private function _get_registration_status_array( $exclude = array() ) { |
|
259 | + private function _get_registration_status_array($exclude = array()) { |
|
260 | 260 | //in the very rare circumstance that we are deleting a model's table's data |
261 | 261 | //and the table hasn't actually been created, this could have an error |
262 | 262 | /** @type WPDB $wpdb */ |
263 | 263 | global $wpdb; |
264 | - if( $this->_get_table_analysis()->tableExists( $wpdb->prefix . 'esp_status' ) ){ |
|
265 | - $SQL = 'SELECT STS_ID, STS_code FROM '. $wpdb->prefix . 'esp_status WHERE STS_type = "registration"'; |
|
266 | - $results = $wpdb->get_results( $SQL ); |
|
264 | + if ($this->_get_table_analysis()->tableExists($wpdb->prefix.'esp_status')) { |
|
265 | + $SQL = 'SELECT STS_ID, STS_code FROM '.$wpdb->prefix.'esp_status WHERE STS_type = "registration"'; |
|
266 | + $results = $wpdb->get_results($SQL); |
|
267 | 267 | self::$_reg_status = array(); |
268 | - foreach ( $results as $status ) { |
|
269 | - if ( ! in_array( $status->STS_ID, $exclude )) { |
|
270 | - self::$_reg_status[ $status->STS_ID ] = $status->STS_code; |
|
268 | + foreach ($results as $status) { |
|
269 | + if ( ! in_array($status->STS_ID, $exclude)) { |
|
270 | + self::$_reg_status[$status->STS_ID] = $status->STS_code; |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 | } |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | * @throws \EE_Error |
281 | 281 | */ |
282 | 282 | protected function _get_table_analysis() { |
283 | - if( $this->_table_analysis instanceof TableAnalysis ) { |
|
283 | + if ($this->_table_analysis instanceof TableAnalysis) { |
|
284 | 284 | return $this->_table_analysis; |
285 | 285 | } else { |
286 | 286 | throw new \EE_Error( |
287 | 287 | sprintf( |
288 | - __( 'Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
289 | - get_class( $this ) |
|
288 | + __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
289 | + get_class($this) |
|
290 | 290 | ) |
291 | 291 | ); |
292 | 292 | } |
@@ -301,15 +301,15 @@ discard block |
||
301 | 301 | * @return array |
302 | 302 | * @throws \EE_Error |
303 | 303 | */ |
304 | - public function get_reg_months_and_years( $where_params ) { |
|
304 | + public function get_reg_months_and_years($where_params) { |
|
305 | 305 | $query_params[0] = $where_params; |
306 | 306 | $query_params['group_by'] = array('reg_year', 'reg_month'); |
307 | - $query_params['order_by'] = array( 'REG_date' => 'DESC' ); |
|
307 | + $query_params['order_by'] = array('REG_date' => 'DESC'); |
|
308 | 308 | $columns_to_select = array( |
309 | 309 | 'reg_year' => array('YEAR(REG_date)', '%s'), |
310 | 310 | 'reg_month' => array('MONTHNAME(REG_date)', '%s') |
311 | 311 | ); |
312 | - return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select ); |
|
312 | + return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | |
@@ -321,11 +321,11 @@ discard block |
||
321 | 321 | * @param int $ATT_ID |
322 | 322 | * @return EE_Registration[] |
323 | 323 | */ |
324 | - public function get_all_registrations_for_attendee( $ATT_ID = 0 ) { |
|
325 | - if ( ! $ATT_ID ) { |
|
324 | + public function get_all_registrations_for_attendee($ATT_ID = 0) { |
|
325 | + if ( ! $ATT_ID) { |
|
326 | 326 | return FALSE; |
327 | 327 | } |
328 | - return $this->get_all( array( array( 'ATT_ID' => $ATT_ID ))); |
|
328 | + return $this->get_all(array(array('ATT_ID' => $ATT_ID))); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | |
@@ -336,8 +336,8 @@ discard block |
||
336 | 336 | * @param string $REG_url_link |
337 | 337 | * @return EE_Registration |
338 | 338 | */ |
339 | - public function get_registration_for_reg_url_link($REG_url_link){ |
|
340 | - if(!$REG_url_link){ |
|
339 | + public function get_registration_for_reg_url_link($REG_url_link) { |
|
340 | + if ( ! $REG_url_link) { |
|
341 | 341 | return false; |
342 | 342 | } |
343 | 343 | return $this->get_one(array(array('REG_url_link'=>$REG_url_link))); |
@@ -355,13 +355,13 @@ discard block |
||
355 | 355 | * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
356 | 356 | * @return mixed array on success, FALSE on fail |
357 | 357 | */ |
358 | - public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) { |
|
358 | + public function get_registration_for_transaction_attendee($TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0) { |
|
359 | 359 | return $this->get_one(array( |
360 | 360 | array( |
361 | 361 | 'TXN_ID'=>$TXN_ID, |
362 | 362 | 'ATT_ID'=>$ATT_ID |
363 | 363 | ), |
364 | - 'limit'=>array( min( ( $att_nmbr-1 ), 0 ), 1 ) |
|
364 | + 'limit'=>array(min(($att_nmbr - 1), 0), 1) |
|
365 | 365 | )); |
366 | 366 | } |
367 | 367 | |
@@ -373,16 +373,16 @@ discard block |
||
373 | 373 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
374 | 374 | * @return stdClass[] with properties regDate and total |
375 | 375 | */ |
376 | - public function get_registrations_per_day_report( $period = '-1 month' ) { |
|
376 | + public function get_registrations_per_day_report($period = '-1 month') { |
|
377 | 377 | |
378 | - $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' ); |
|
379 | - $where = array( 'REG_date' => array( '>=', $sql_date ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ); |
|
378 | + $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'); |
|
379 | + $where = array('REG_date' => array('>=', $sql_date), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)); |
|
380 | 380 | |
381 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_day_report' ) ) { |
|
381 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_day_report')) { |
|
382 | 382 | $where['Event.EVT_wp_user'] = get_current_user_id(); |
383 | 383 | } |
384 | 384 | |
385 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'REG_date' ); |
|
385 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'REG_date'); |
|
386 | 386 | |
387 | 387 | $results = $this->_get_all_wpdb_results( |
388 | 388 | array( |
@@ -392,8 +392,8 @@ discard block |
||
392 | 392 | ), |
393 | 393 | OBJECT, |
394 | 394 | array( |
395 | - 'regDate'=>array( 'DATE(' . $query_interval . ')','%s'), |
|
396 | - 'total'=>array('count(REG_ID)','%d') |
|
395 | + 'regDate'=>array('DATE('.$query_interval.')', '%s'), |
|
396 | + 'total'=>array('count(REG_ID)', '%d') |
|
397 | 397 | )); |
398 | 398 | return $results; |
399 | 399 | } |
@@ -408,22 +408,22 @@ discard block |
||
408 | 408 | * @return stdClass[] with properties Registration_REG_date and a column for each registration status as the STS_ID |
409 | 409 | * (i.e. RAP) |
410 | 410 | */ |
411 | - public function get_registrations_per_day_and_per_status_report( $period = '-1 month' ) { |
|
411 | + public function get_registrations_per_day_and_per_status_report($period = '-1 month') { |
|
412 | 412 | global $wpdb; |
413 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
413 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
414 | 414 | $event_table = $wpdb->posts; |
415 | - $sql_date = date("Y-m-d H:i:s", strtotime($period) ); |
|
415 | + $sql_date = date("Y-m-d H:i:s", strtotime($period)); |
|
416 | 416 | |
417 | 417 | //prepare the query interval for displaying offset |
418 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'dates.REG_date' ); |
|
418 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'dates.REG_date'); |
|
419 | 419 | |
420 | 420 | //inner date query |
421 | 421 | $inner_date_query = "SELECT DISTINCT REG_date from $registration_table "; |
422 | 422 | $inner_where = " WHERE"; |
423 | 423 | //exclude events not authored by user if permissions in effect |
424 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
424 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
425 | 425 | $inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID"; |
426 | - $inner_where .= " post_author = " . get_current_user_id() . " AND"; |
|
426 | + $inner_where .= " post_author = ".get_current_user_id()." AND"; |
|
427 | 427 | } |
428 | 428 | $inner_where .= " REG_date >= '$sql_date'"; |
429 | 429 | $inner_date_query .= $inner_where; |
@@ -435,8 +435,8 @@ discard block |
||
435 | 435 | $select_parts = array(); |
436 | 436 | |
437 | 437 | //loop through registration stati to do parts for each status. |
438 | - foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) { |
|
439 | - if ( $STS_ID === EEM_Registration::status_id_incomplete ) { |
|
438 | + foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) { |
|
439 | + if ($STS_ID === EEM_Registration::status_id_incomplete) { |
|
440 | 440 | continue; |
441 | 441 | } |
442 | 442 | $select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID"; |
@@ -444,14 +444,14 @@ discard block |
||
444 | 444 | } |
445 | 445 | |
446 | 446 | //setup the selects |
447 | - $select .= implode(', ', $select_parts ); |
|
447 | + $select .= implode(', ', $select_parts); |
|
448 | 448 | $select .= " FROM ($inner_date_query) AS dates LEFT JOIN "; |
449 | 449 | |
450 | 450 | //setup the joins |
451 | - $join .= implode( " LEFT JOIN ", $join_parts ); |
|
451 | + $join .= implode(" LEFT JOIN ", $join_parts); |
|
452 | 452 | |
453 | 453 | //now let's put it all together |
454 | - $query = $select . $join . ' GROUP BY Registration_REG_date'; |
|
454 | + $query = $select.$join.' GROUP BY Registration_REG_date'; |
|
455 | 455 | |
456 | 456 | //and execute it |
457 | 457 | $results = $wpdb->get_results( |
@@ -472,23 +472,23 @@ discard block |
||
472 | 472 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
473 | 473 | * @return stdClass[] each with properties event_name, reg_limit, and total |
474 | 474 | */ |
475 | - public function get_registrations_per_event_report( $period = '-1 month' ) { |
|
475 | + public function get_registrations_per_event_report($period = '-1 month') { |
|
476 | 476 | |
477 | - $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' ); |
|
478 | - $where = array( 'REG_date' => array( '>=', $date_sql ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ); |
|
477 | + $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'); |
|
478 | + $where = array('REG_date' => array('>=', $date_sql), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)); |
|
479 | 479 | |
480 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
480 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
481 | 481 | $where['Event.EVT_wp_user'] = get_current_user_id(); |
482 | 482 | } |
483 | 483 | $results = $this->_get_all_wpdb_results(array( |
484 | 484 | $where, |
485 | 485 | 'group_by'=>'Event.EVT_name', |
486 | 486 | 'order_by'=>'Event.EVT_name', |
487 | - 'limit'=>array(0,24)), |
|
487 | + 'limit'=>array(0, 24)), |
|
488 | 488 | OBJECT, |
489 | 489 | array( |
490 | - 'event_name'=>array('Event_CPT.post_title','%s'), |
|
491 | - 'total'=>array('COUNT(REG_ID)','%s') |
|
490 | + 'event_name'=>array('Event_CPT.post_title', '%s'), |
|
491 | + 'total'=>array('COUNT(REG_ID)', '%s') |
|
492 | 492 | ) |
493 | 493 | ); |
494 | 494 | |
@@ -506,19 +506,19 @@ discard block |
||
506 | 506 | * @return stdClass[] with properties `Registration_Event` and a column for each registration status as the STS_ID |
507 | 507 | * (i.e. RAP) |
508 | 508 | */ |
509 | - public function get_registrations_per_event_and_per_status_report( $period = '-1 month' ) { |
|
509 | + public function get_registrations_per_event_and_per_status_report($period = '-1 month') { |
|
510 | 510 | global $wpdb; |
511 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
511 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
512 | 512 | $event_table = $wpdb->posts; |
513 | - $sql_date = date("Y-m-d H:i:s", strtotime($period) ); |
|
513 | + $sql_date = date("Y-m-d H:i:s", strtotime($period)); |
|
514 | 514 | |
515 | 515 | //inner date query |
516 | 516 | $inner_date_query = "SELECT DISTINCT EVT_ID, REG_date from $registration_table "; |
517 | 517 | $inner_where = " WHERE"; |
518 | 518 | //exclude events not authored by user if permissions in effect |
519 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
519 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
520 | 520 | $inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID"; |
521 | - $inner_where .= " post_author = " . get_current_user_id() . " AND"; |
|
521 | + $inner_where .= " post_author = ".get_current_user_id()." AND"; |
|
522 | 522 | } |
523 | 523 | $inner_where .= " REG_date >= '$sql_date'"; |
524 | 524 | $inner_date_query .= $inner_where; |
@@ -530,8 +530,8 @@ discard block |
||
530 | 530 | $select_parts = array(); |
531 | 531 | |
532 | 532 | //loop through registration stati to do parts for each status. |
533 | - foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) { |
|
534 | - if ( $STS_ID === EEM_Registration::status_id_incomplete ) { |
|
533 | + foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) { |
|
534 | + if ($STS_ID === EEM_Registration::status_id_incomplete) { |
|
535 | 535 | continue; |
536 | 536 | } |
537 | 537 | $select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID"; |
@@ -539,14 +539,14 @@ discard block |
||
539 | 539 | } |
540 | 540 | |
541 | 541 | //setup the selects |
542 | - $select .= implode( ', ', $select_parts ); |
|
542 | + $select .= implode(', ', $select_parts); |
|
543 | 543 | $select .= " FROM ($inner_date_query) AS dates LEFT JOIN $event_table as Event ON Event.ID = dates.EVT_ID LEFT JOIN "; |
544 | 544 | |
545 | 545 | //setup remaining joins |
546 | - $join .= implode( " LEFT JOIN ", $join_parts ); |
|
546 | + $join .= implode(" LEFT JOIN ", $join_parts); |
|
547 | 547 | |
548 | 548 | //now put it all together |
549 | - $query = $select . $join . ' GROUP BY Registration_Event'; |
|
549 | + $query = $select.$join.' GROUP BY Registration_Event'; |
|
550 | 550 | |
551 | 551 | //and execute |
552 | 552 | $results = $wpdb->get_results( |
@@ -562,11 +562,11 @@ discard block |
||
562 | 562 | * @param int $TXN_ID |
563 | 563 | * @return EE_Registration |
564 | 564 | */ |
565 | - public function get_primary_registration_for_transaction_ID( $TXN_ID = 0){ |
|
566 | - if( ! $TXN_ID ){ |
|
565 | + public function get_primary_registration_for_transaction_ID($TXN_ID = 0) { |
|
566 | + if ( ! $TXN_ID) { |
|
567 | 567 | return false; |
568 | 568 | } |
569 | - return $this->get_one(array(array('TXN_ID'=>$TXN_ID,'REG_count'=> EEM_Registration::PRIMARY_REGISTRANT_COUNT))); |
|
569 | + return $this->get_one(array(array('TXN_ID'=>$TXN_ID, 'REG_count'=> EEM_Registration::PRIMARY_REGISTRANT_COUNT))); |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | |
@@ -578,11 +578,11 @@ discard block |
||
578 | 578 | * @param boolean $for_incomplete_payments |
579 | 579 | * @return int |
580 | 580 | */ |
581 | - public function get_event_registration_count ( $EVT_ID, $for_incomplete_payments = FALSE ) { |
|
581 | + public function get_event_registration_count($EVT_ID, $for_incomplete_payments = FALSE) { |
|
582 | 582 | // we only count approved registrations towards registration limits |
583 | - $query_params = array( array( 'EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved ) ); |
|
584 | - if( $for_incomplete_payments ){ |
|
585 | - $query_params[0]['Transaction.STS_ID']=array('!=', EEM_Transaction::complete_status_code); |
|
583 | + $query_params = array(array('EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved)); |
|
584 | + if ($for_incomplete_payments) { |
|
585 | + $query_params[0]['Transaction.STS_ID'] = array('!=', EEM_Transaction::complete_status_code); |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | return $this->count($query_params); |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | /** @type WPDB $wpdb */ |
599 | 599 | global $wpdb; |
600 | 600 | return $wpdb->query( |
601 | - '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' ); |
|
601 | + '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' ); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | /** |
@@ -608,17 +608,17 @@ discard block |
||
608 | 608 | * @param boolean $checked_in whether to count registrations checked IN or OUT |
609 | 609 | * @return int |
610 | 610 | */ |
611 | - public function count_registrations_checked_into_datetime( $DTT_ID, $checked_in = true) { |
|
611 | + public function count_registrations_checked_into_datetime($DTT_ID, $checked_in = true) { |
|
612 | 612 | global $wpdb; |
613 | 613 | //subquery to get latest checkin |
614 | 614 | $query = $wpdb->prepare( |
615 | 615 | 'SELECT ' |
616 | 616 | . 'COUNT( DISTINCT checkins.REG_ID ) ' |
617 | - . 'FROM ' . EEM_Checkin::instance()->table() . ' AS checkins INNER JOIN' |
|
617 | + . 'FROM '.EEM_Checkin::instance()->table().' AS checkins INNER JOIN' |
|
618 | 618 | . '( SELECT ' |
619 | 619 | . 'max( CHK_timestamp ) AS latest_checkin, ' |
620 | 620 | . 'REG_ID AS REG_ID ' |
621 | - . 'FROM ' . EEM_Checkin::instance()->table() . ' ' |
|
621 | + . 'FROM '.EEM_Checkin::instance()->table().' ' |
|
622 | 622 | . 'WHERE DTT_ID=%d ' |
623 | 623 | . 'GROUP BY REG_ID' |
624 | 624 | . ') AS most_recent_checkin_per_reg ' |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | $DTT_ID, |
630 | 630 | $checked_in |
631 | 631 | ); |
632 | - return (int)$wpdb->get_var( $query ); |
|
632 | + return (int) $wpdb->get_var($query); |
|
633 | 633 | } |
634 | 634 | |
635 | 635 | /** |
@@ -639,18 +639,18 @@ discard block |
||
639 | 639 | * @param boolean $checked_in whether to count registrations checked IN or OUT |
640 | 640 | * @return int |
641 | 641 | */ |
642 | - public function count_registrations_checked_into_event( $EVT_ID, $checked_in = true ) { |
|
642 | + public function count_registrations_checked_into_event($EVT_ID, $checked_in = true) { |
|
643 | 643 | global $wpdb; |
644 | 644 | //subquery to get latest checkin |
645 | 645 | $query = $wpdb->prepare( |
646 | 646 | 'SELECT ' |
647 | 647 | . 'COUNT( DISTINCT checkins.REG_ID ) ' |
648 | - . 'FROM ' . EEM_Checkin::instance()->table() . ' AS checkins INNER JOIN' |
|
648 | + . 'FROM '.EEM_Checkin::instance()->table().' AS checkins INNER JOIN' |
|
649 | 649 | . '( SELECT ' |
650 | 650 | . 'max( CHK_timestamp ) AS latest_checkin, ' |
651 | 651 | . 'REG_ID AS REG_ID ' |
652 | - . 'FROM ' . EEM_Checkin::instance()->table() . ' AS c ' |
|
653 | - . 'INNER JOIN ' . EEM_Datetime::instance()->table() . ' AS d ' |
|
652 | + . 'FROM '.EEM_Checkin::instance()->table().' AS c ' |
|
653 | + . 'INNER JOIN '.EEM_Datetime::instance()->table().' AS d ' |
|
654 | 654 | . 'ON c.DTT_ID=d.DTT_ID ' |
655 | 655 | . 'WHERE d.EVT_ID=%d ' |
656 | 656 | . 'GROUP BY REG_ID' |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | $EVT_ID, |
663 | 663 | $checked_in |
664 | 664 | ); |
665 | - return (int)$wpdb->get_var( $query ); |
|
665 | + return (int) $wpdb->get_var($query); |
|
666 | 666 | } |
667 | 667 | |
668 | 668 | |
@@ -677,15 +677,15 @@ discard block |
||
677 | 677 | * @param array $attendee_ids |
678 | 678 | * @return EE_Registration[] |
679 | 679 | */ |
680 | - public function get_latest_registration_for_each_of_given_contacts( $attendee_ids = array() ) { |
|
680 | + public function get_latest_registration_for_each_of_given_contacts($attendee_ids = array()) { |
|
681 | 681 | //first do a native wp_query to get the latest REG_ID's matching these attendees. |
682 | 682 | global $wpdb; |
683 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
683 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
684 | 684 | $attendee_table = $wpdb->posts; |
685 | - $attendee_ids = is_array( $attendee_ids ) |
|
686 | - ? array_map( 'absint', $attendee_ids ) |
|
687 | - : array( (int) $attendee_ids ); |
|
688 | - $attendee_ids = implode( ',', $attendee_ids ); |
|
685 | + $attendee_ids = is_array($attendee_ids) |
|
686 | + ? array_map('absint', $attendee_ids) |
|
687 | + : array((int) $attendee_ids); |
|
688 | + $attendee_ids = implode(',', $attendee_ids); |
|
689 | 689 | |
690 | 690 | |
691 | 691 | //first we do a query to get the registration ids |
@@ -710,24 +710,24 @@ discard block |
||
710 | 710 | ARRAY_A |
711 | 711 | ); |
712 | 712 | |
713 | - if ( empty( $registration_ids ) ) { |
|
713 | + if (empty($registration_ids)) { |
|
714 | 714 | return array(); |
715 | 715 | } |
716 | 716 | |
717 | 717 | $ids_for_model_query = array(); |
718 | 718 | //let's flatten the ids so they can be used in the model query. |
719 | - foreach ( $registration_ids as $registration_id ) { |
|
720 | - if ( isset( $registration_id['registration_id'] ) ) { |
|
719 | + foreach ($registration_ids as $registration_id) { |
|
720 | + if (isset($registration_id['registration_id'])) { |
|
721 | 721 | $ids_for_model_query[] = $registration_id['registration_id']; |
722 | 722 | } |
723 | 723 | } |
724 | 724 | |
725 | 725 | //construct query |
726 | 726 | $_where = array( |
727 | - 'REG_ID' => array( 'IN', $ids_for_model_query ) |
|
727 | + 'REG_ID' => array('IN', $ids_for_model_query) |
|
728 | 728 | ); |
729 | 729 | |
730 | - return $this->get_all( array( $_where ) ); |
|
730 | + return $this->get_all(array($_where)); |
|
731 | 731 | } |
732 | 732 | |
733 | 733 |
@@ -1,7 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | use EventEspresso\core\services\database\TableAnalysis; |
3 | 3 | |
4 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | +} |
|
5 | 7 | /** |
6 | 8 | * |
7 | 9 | * Registration Model |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | use EventEspresso\core\services\database\TableAnalysis; |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ){ |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | } |
6 | 6 | /** |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | //define some page related constants |
30 | - define( 'EE_PAYMENTS_PG_SLUG', 'espresso_payment_settings' ); |
|
31 | - define( 'EE_PAYMENTS_ADMIN_URL', admin_url( 'admin.php?page=' . EE_PAYMENTS_PG_SLUG )); |
|
32 | - define( 'EE_PAYMENTS_ADMIN', EE_ADMIN_PAGES . 'payments' . DS ); |
|
33 | - define( 'EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN . 'templates' . DS ); |
|
34 | - define( 'EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL . 'payments/assets/' ); |
|
35 | - $this->_table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
|
30 | + define('EE_PAYMENTS_PG_SLUG', 'espresso_payment_settings'); |
|
31 | + define('EE_PAYMENTS_ADMIN_URL', admin_url('admin.php?page='.EE_PAYMENTS_PG_SLUG)); |
|
32 | + define('EE_PAYMENTS_ADMIN', EE_ADMIN_PAGES.'payments'.DS); |
|
33 | + define('EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN.'templates'.DS); |
|
34 | + define('EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL.'payments/assets/'); |
|
35 | + $this->_table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true); |
|
36 | 36 | //check that there are active gateways on all admin page loads. but dont do it just yet |
37 | 37 | // echo "constructing payments admin page";die; |
38 | - add_action('admin_notices',array($this,'check_payment_gateway_setup')); |
|
38 | + add_action('admin_notices', array($this, 'check_payment_gateway_setup')); |
|
39 | 39 | parent::__construct(); |
40 | 40 | } |
41 | 41 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
59 | 59 | 'parent_slug' => 'espresso_events', |
60 | 60 | 'menu_slug' => EE_PAYMENTS_PG_SLUG, |
61 | - 'menu_label' => __( 'Payment Methods', 'event_espresso' ), |
|
61 | + 'menu_label' => __('Payment Methods', 'event_espresso'), |
|
62 | 62 | 'capability' => 'ee_manage_gateways', |
63 | 63 | 'admin_init_page' => $this, |
64 | 64 | ) |
@@ -72,25 +72,25 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @throws \EE_Error |
74 | 74 | */ |
75 | - public function check_payment_gateway_setup(){ |
|
75 | + public function check_payment_gateway_setup() { |
|
76 | 76 | //ONLY do this check if models can query |
77 | 77 | //and avoid a bug where when we nuke EE4's data that this causes a fatal error |
78 | 78 | //because the tables are deleted just before this request runs. see https://events.codebasehq.com/projects/event-espresso/tickets/7539 |
79 | 79 | if ( |
80 | 80 | ! EE_Maintenance_Mode::instance()->models_can_query() |
81 | - || ! $this->_get_table_analysis()->tableExists( EEM_Payment_Method::instance()->table() ) |
|
81 | + || ! $this->_get_table_analysis()->tableExists(EEM_Payment_Method::instance()->table()) |
|
82 | 82 | ) { |
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
86 | 86 | |
87 | 87 | // ensure Payment_Method model is loaded |
88 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
89 | - $actives = EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ); |
|
90 | - if( $actives < 1 ){ |
|
88 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
89 | + $actives = EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart); |
|
90 | + if ($actives < 1) { |
|
91 | 91 | $url = EE_Admin_Page::add_query_args_and_nonce(array(), EE_PAYMENTS_ADMIN_URL); |
92 | 92 | echo '<div class="error"> |
93 | - <p>'. sprintf(__("There are no Active Payment Methods setup for Event Espresso. Please %s activate at least one.%s", "event_espresso"),"<a href='$url'>","</a>").'</p> |
|
93 | + <p>'. sprintf(__("There are no Active Payment Methods setup for Event Espresso. Please %s activate at least one.%s", "event_espresso"), "<a href='$url'>", "</a>").'</p> |
|
94 | 94 | </div>'; |
95 | 95 | } |
96 | 96 | } |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | * @throws \EE_Error |
102 | 102 | */ |
103 | 103 | protected function _get_table_analysis() { |
104 | - if( $this->_table_analysis instanceof TableAnalysis ) { |
|
104 | + if ($this->_table_analysis instanceof TableAnalysis) { |
|
105 | 105 | return $this->_table_analysis; |
106 | 106 | } else { |
107 | 107 | throw new \EE_Error( |
108 | 108 | sprintf( |
109 | - __( 'Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
110 | - get_class( $this ) |
|
109 | + __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
110 | + get_class($this) |
|
111 | 111 | ) |
112 | 112 | ); |
113 | 113 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public static function instance() { |
123 | 123 | // check if class object is instantiated, and instantiated properly |
124 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
124 | + if ( ! self::$_instance instanceof EE_Config) { |
|
125 | 125 | self::$_instance = new self(); |
126 | 126 | } |
127 | 127 | return self::$_instance; |
@@ -141,20 +141,20 @@ discard block |
||
141 | 141 | * site was put into maintenance mode) |
142 | 142 | * @return EE_Config |
143 | 143 | */ |
144 | - public static function reset( $hard_reset = false, $reinstantiate = true ) { |
|
145 | - if ( $hard_reset ) { |
|
144 | + public static function reset($hard_reset = false, $reinstantiate = true) { |
|
145 | + if ($hard_reset) { |
|
146 | 146 | self::$_instance->_addon_option_names = array(); |
147 | 147 | self::$_instance->_initialize_config(); |
148 | 148 | self::$_instance->update_espresso_config(); |
149 | 149 | } |
150 | - if ( self::$_instance instanceof EE_Config ) { |
|
150 | + if (self::$_instance instanceof EE_Config) { |
|
151 | 151 | self::$_instance->update_addon_option_names(); |
152 | 152 | } |
153 | 153 | self::$_instance = null; |
154 | 154 | //we don't need to reset the static properties imo because those should |
155 | 155 | //only change when a module is added or removed. Currently we don't |
156 | 156 | //support removing a module during a request when it previously existed |
157 | - if ( $reinstantiate ) { |
|
157 | + if ($reinstantiate) { |
|
158 | 158 | return self::instance(); |
159 | 159 | } else { |
160 | 160 | return null; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @access private |
170 | 170 | */ |
171 | 171 | private function __construct() { |
172 | - do_action( 'AHEE__EE_Config__construct__begin', $this ); |
|
172 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
173 | 173 | // setup empty config classes |
174 | 174 | $this->_initialize_config(); |
175 | 175 | // load existing EE site settings |
@@ -179,17 +179,17 @@ discard block |
||
179 | 179 | // register shortcodes and modules |
180 | 180 | add_action( |
181 | 181 | 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
182 | - array( $this, 'register_shortcodes_and_modules' ), |
|
182 | + array($this, 'register_shortcodes_and_modules'), |
|
183 | 183 | 999 |
184 | 184 | ); |
185 | 185 | // initialize shortcodes and modules |
186 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) ); |
|
186 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
187 | 187 | // register widgets |
188 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
188 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
189 | 189 | // shutdown |
190 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
190 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
191 | 191 | // construct__end hook |
192 | - do_action( 'AHEE__EE_Config__construct__end', $this ); |
|
192 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
193 | 193 | // hardcoded hack |
194 | 194 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
195 | 195 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @return string current theme set. |
203 | 203 | */ |
204 | 204 | public static function get_current_theme() { |
205 | - return isset( self::$_instance->template_settings->current_espresso_theme ) |
|
205 | + return isset(self::$_instance->template_settings->current_espresso_theme) |
|
206 | 206 | ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
207 | 207 | } |
208 | 208 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | private function _initialize_config() { |
218 | 218 | EE_Config::trim_log(); |
219 | 219 | //set defaults |
220 | - $this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() ); |
|
220 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
221 | 221 | $this->addons = new stdClass(); |
222 | 222 | // set _module_route_map |
223 | 223 | EE_Config::$_module_route_map = array(); |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | */ |
238 | 238 | private function _load_core_config() { |
239 | 239 | // load_core_config__start hook |
240 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
240 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
241 | 241 | $espresso_config = $this->get_espresso_config(); |
242 | - foreach ( $espresso_config as $config => $settings ) { |
|
242 | + foreach ($espresso_config as $config => $settings) { |
|
243 | 243 | // load_core_config__start hook |
244 | 244 | $settings = apply_filters( |
245 | 245 | 'FHEE__EE_Config___load_core_config__config_settings', |
@@ -247,22 +247,22 @@ discard block |
||
247 | 247 | $config, |
248 | 248 | $this |
249 | 249 | ); |
250 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
251 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
250 | + if (is_object($settings) && property_exists($this, $config)) { |
|
251 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
252 | 252 | //call configs populate method to ensure any defaults are set for empty values. |
253 | - if ( method_exists( $settings, 'populate' ) ) { |
|
253 | + if (method_exists($settings, 'populate')) { |
|
254 | 254 | $this->{$config}->populate(); |
255 | 255 | } |
256 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
256 | + if (method_exists($settings, 'do_hooks')) { |
|
257 | 257 | $this->{$config}->do_hooks(); |
258 | 258 | } |
259 | 259 | } |
260 | 260 | } |
261 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) { |
|
261 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
262 | 262 | $this->update_espresso_config(); |
263 | 263 | } |
264 | 264 | // load_core_config__end hook |
265 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
265 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -277,23 +277,23 @@ discard block |
||
277 | 277 | $this->core = $this->core instanceof EE_Core_Config |
278 | 278 | ? $this->core |
279 | 279 | : new EE_Core_Config(); |
280 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
280 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
281 | 281 | $this->organization = $this->organization instanceof EE_Organization_Config |
282 | 282 | ? $this->organization |
283 | 283 | : new EE_Organization_Config(); |
284 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
284 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
285 | 285 | $this->currency = $this->currency instanceof EE_Currency_Config |
286 | 286 | ? $this->currency |
287 | 287 | : new EE_Currency_Config(); |
288 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
288 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
289 | 289 | $this->registration = $this->registration instanceof EE_Registration_Config |
290 | 290 | ? $this->registration |
291 | 291 | : new EE_Registration_Config(); |
292 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
292 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
293 | 293 | $this->admin = $this->admin instanceof EE_Admin_Config |
294 | 294 | ? $this->admin |
295 | 295 | : new EE_Admin_Config(); |
296 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
296 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
297 | 297 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
298 | 298 | ? $this->template_settings |
299 | 299 | : new EE_Template_Config(); |
@@ -304,15 +304,15 @@ discard block |
||
304 | 304 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
305 | 305 | ? $this->map_settings |
306 | 306 | : new EE_Map_Config(); |
307 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
307 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
308 | 308 | $this->environment = $this->environment instanceof EE_Environment_Config |
309 | 309 | ? $this->environment |
310 | 310 | : new EE_Environment_Config(); |
311 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
311 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
312 | 312 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
313 | 313 | ? $this->gateway |
314 | 314 | : new EE_Gateway_Config(); |
315 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
315 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | // grab espresso configuration |
328 | 328 | return apply_filters( |
329 | 329 | 'FHEE__EE_Config__get_espresso_config__CFG', |
330 | - get_option( EE_Config::OPTION_NAME, array() ) |
|
330 | + get_option(EE_Config::OPTION_NAME, array()) |
|
331 | 331 | ); |
332 | 332 | } |
333 | 333 | |
@@ -341,12 +341,12 @@ discard block |
||
341 | 341 | * @param $old_value |
342 | 342 | * @param $value |
343 | 343 | */ |
344 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
344 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
345 | 345 | // make sure we're checking the ee config |
346 | - if ( $option === EE_Config::OPTION_NAME ) { |
|
346 | + if ($option === EE_Config::OPTION_NAME) { |
|
347 | 347 | // run a loose comparison of the old value against the new value for type and properties, |
348 | 348 | // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
349 | - if ( $value != $old_value ) { |
|
349 | + if ($value != $old_value) { |
|
350 | 350 | // if they are NOT the same, then remove the hook, |
351 | 351 | // which means the subsequent update results will be based solely on the update query results |
352 | 352 | // the reason we do this is because, as stated above, |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | // the string it sees in the db looks the same as the new one it has been passed!!! |
362 | 362 | // This results in the query returning an "affected rows" value of ZERO, |
363 | 363 | // which gets returned immediately by WP update_option and looks like an error. |
364 | - remove_action( 'update_option', array( $this, 'check_config_updated' ) ); |
|
364 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | } |
@@ -375,11 +375,11 @@ discard block |
||
375 | 375 | */ |
376 | 376 | protected function _reset_espresso_addon_config() { |
377 | 377 | $this->_addon_option_names = array(); |
378 | - foreach ( $this->addons as $addon_name => $addon_config_obj ) { |
|
379 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
380 | - $config_class = get_class( $addon_config_obj ); |
|
381 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
382 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, false ); |
|
378 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
379 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
380 | + $config_class = get_class($addon_config_obj); |
|
381 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
382 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
383 | 383 | } |
384 | 384 | $this->addons->{$addon_name} = null; |
385 | 385 | } |
@@ -395,22 +395,22 @@ discard block |
||
395 | 395 | * @param bool $add_error |
396 | 396 | * @return bool |
397 | 397 | */ |
398 | - public function update_espresso_config( $add_success = false, $add_error = true ) { |
|
398 | + public function update_espresso_config($add_success = false, $add_error = true) { |
|
399 | 399 | // don't allow config updates during WP heartbeats |
400 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
400 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
401 | 401 | return false; |
402 | 402 | } |
403 | 403 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
404 | 404 | //$clone = clone( self::$_instance ); |
405 | 405 | //self::$_instance = NULL; |
406 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this ); |
|
406 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
407 | 407 | $this->_reset_espresso_addon_config(); |
408 | 408 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
409 | 409 | // but BEFORE the actual update occurs |
410 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
410 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
411 | 411 | // now update "ee_config" |
412 | - $saved = update_option( EE_Config::OPTION_NAME, $this ); |
|
413 | - EE_Config::log( EE_Config::OPTION_NAME ); |
|
412 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
413 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
414 | 414 | // if not saved... check if the hook we just added still exists; |
415 | 415 | // if it does, it means one of two things: |
416 | 416 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -421,17 +421,17 @@ discard block |
||
421 | 421 | // but just means no update occurred, so don't display an error to the user. |
422 | 422 | // BUT... if update_option returns FALSE, AND the hook is missing, |
423 | 423 | // then it means that something truly went wrong |
424 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved; |
|
424 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
425 | 425 | // remove our action since we don't want it in the system anymore |
426 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
427 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
426 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
427 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
428 | 428 | //self::$_instance = $clone; |
429 | 429 | //unset( $clone ); |
430 | 430 | // if config remains the same or was updated successfully |
431 | - if ( $saved ) { |
|
432 | - if ( $add_success ) { |
|
431 | + if ($saved) { |
|
432 | + if ($add_success) { |
|
433 | 433 | EE_Error::add_success( |
434 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
434 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
435 | 435 | __FILE__, |
436 | 436 | __FUNCTION__, |
437 | 437 | __LINE__ |
@@ -439,9 +439,9 @@ discard block |
||
439 | 439 | } |
440 | 440 | return true; |
441 | 441 | } else { |
442 | - if ( $add_error ) { |
|
442 | + if ($add_error) { |
|
443 | 443 | EE_Error::add_error( |
444 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
444 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
445 | 445 | __FILE__, |
446 | 446 | __FUNCTION__, |
447 | 447 | __LINE__ |
@@ -470,16 +470,16 @@ discard block |
||
470 | 470 | $name = '', |
471 | 471 | $config_class = '', |
472 | 472 | $config_obj = null, |
473 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
473 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
474 | 474 | $display_errors = true |
475 | 475 | ) { |
476 | 476 | try { |
477 | - foreach ( $tests_to_run as $test ) { |
|
478 | - switch ( $test ) { |
|
477 | + foreach ($tests_to_run as $test) { |
|
478 | + switch ($test) { |
|
479 | 479 | // TEST #1 : check that section was set |
480 | 480 | case 1 : |
481 | - if ( empty( $section ) ) { |
|
482 | - if ( $display_errors ) { |
|
481 | + if (empty($section)) { |
|
482 | + if ($display_errors) { |
|
483 | 483 | throw new EE_Error( |
484 | 484 | sprintf( |
485 | 485 | __( |
@@ -495,11 +495,11 @@ discard block |
||
495 | 495 | break; |
496 | 496 | // TEST #2 : check that settings section exists |
497 | 497 | case 2 : |
498 | - if ( ! isset( $this->{$section} ) ) { |
|
499 | - if ( $display_errors ) { |
|
498 | + if ( ! isset($this->{$section} )) { |
|
499 | + if ($display_errors) { |
|
500 | 500 | throw new EE_Error( |
501 | 501 | sprintf( |
502 | - __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
502 | + __('The "%s" configuration section does not exist.', 'event_espresso'), |
|
503 | 503 | $section |
504 | 504 | ) |
505 | 505 | ); |
@@ -510,9 +510,9 @@ discard block |
||
510 | 510 | // TEST #3 : check that section is the proper format |
511 | 511 | case 3 : |
512 | 512 | if ( |
513 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
513 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
514 | 514 | ) { |
515 | - if ( $display_errors ) { |
|
515 | + if ($display_errors) { |
|
516 | 516 | throw new EE_Error( |
517 | 517 | sprintf( |
518 | 518 | __( |
@@ -528,8 +528,8 @@ discard block |
||
528 | 528 | break; |
529 | 529 | // TEST #4 : check that config section name has been set |
530 | 530 | case 4 : |
531 | - if ( empty( $name ) ) { |
|
532 | - if ( $display_errors ) { |
|
531 | + if (empty($name)) { |
|
532 | + if ($display_errors) { |
|
533 | 533 | throw new EE_Error( |
534 | 534 | __( |
535 | 535 | 'No name has been provided for the specific configuration section.', |
@@ -542,8 +542,8 @@ discard block |
||
542 | 542 | break; |
543 | 543 | // TEST #5 : check that a config class name has been set |
544 | 544 | case 5 : |
545 | - if ( empty( $config_class ) ) { |
|
546 | - if ( $display_errors ) { |
|
545 | + if (empty($config_class)) { |
|
546 | + if ($display_errors) { |
|
547 | 547 | throw new EE_Error( |
548 | 548 | __( |
549 | 549 | 'No class name has been provided for the specific configuration section.', |
@@ -556,8 +556,8 @@ discard block |
||
556 | 556 | break; |
557 | 557 | // TEST #6 : verify config class is accessible |
558 | 558 | case 6 : |
559 | - if ( ! class_exists( $config_class ) ) { |
|
560 | - if ( $display_errors ) { |
|
559 | + if ( ! class_exists($config_class)) { |
|
560 | + if ($display_errors) { |
|
561 | 561 | throw new EE_Error( |
562 | 562 | sprintf( |
563 | 563 | __( |
@@ -573,11 +573,11 @@ discard block |
||
573 | 573 | break; |
574 | 574 | // TEST #7 : check that config has even been set |
575 | 575 | case 7 : |
576 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
577 | - if ( $display_errors ) { |
|
576 | + if ( ! isset($this->{$section}->{$name} )) { |
|
577 | + if ($display_errors) { |
|
578 | 578 | throw new EE_Error( |
579 | 579 | sprintf( |
580 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
580 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
581 | 581 | $section, |
582 | 582 | $name |
583 | 583 | ) |
@@ -586,13 +586,13 @@ discard block |
||
586 | 586 | return false; |
587 | 587 | } else { |
588 | 588 | // and make sure it's not serialized |
589 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
589 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
590 | 590 | } |
591 | 591 | break; |
592 | 592 | // TEST #8 : check that config is the requested type |
593 | 593 | case 8 : |
594 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
595 | - if ( $display_errors ) { |
|
594 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
595 | + if ($display_errors) { |
|
596 | 596 | throw new EE_Error( |
597 | 597 | sprintf( |
598 | 598 | __( |
@@ -610,12 +610,12 @@ discard block |
||
610 | 610 | break; |
611 | 611 | // TEST #9 : verify config object |
612 | 612 | case 9 : |
613 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
614 | - if ( $display_errors ) { |
|
613 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
614 | + if ($display_errors) { |
|
615 | 615 | throw new EE_Error( |
616 | 616 | sprintf( |
617 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
618 | - print_r( $config_obj, true ) |
|
617 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
618 | + print_r($config_obj, true) |
|
619 | 619 | ) |
620 | 620 | ); |
621 | 621 | } |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | break; |
625 | 625 | } |
626 | 626 | } |
627 | - } catch ( EE_Error $e ) { |
|
627 | + } catch (EE_Error $e) { |
|
628 | 628 | $e->get_error(); |
629 | 629 | } |
630 | 630 | // you have successfully run the gauntlet |
@@ -641,8 +641,8 @@ discard block |
||
641 | 641 | * @param string $name |
642 | 642 | * @return string |
643 | 643 | */ |
644 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
645 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
644 | + private function _generate_config_option_name($section = '', $name = '') { |
|
645 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | |
@@ -656,10 +656,10 @@ discard block |
||
656 | 656 | * @param string $name |
657 | 657 | * @return string |
658 | 658 | */ |
659 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
660 | - return ! empty( $config_class ) |
|
659 | + private function _set_config_class($config_class = '', $name = '') { |
|
660 | + return ! empty($config_class) |
|
661 | 661 | ? $config_class |
662 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
662 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
663 | 663 | } |
664 | 664 | |
665 | 665 | |
@@ -674,36 +674,36 @@ discard block |
||
674 | 674 | * @param EE_Config_Base $config_obj |
675 | 675 | * @return EE_Config_Base |
676 | 676 | */ |
677 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
677 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
678 | 678 | // ensure config class is set to something |
679 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
679 | + $config_class = $this->_set_config_class($config_class, $name); |
|
680 | 680 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
681 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
681 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
682 | 682 | return null; |
683 | 683 | } |
684 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
684 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
685 | 685 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
686 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
687 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
686 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
687 | + $this->_addon_option_names[$config_option_name] = $config_class; |
|
688 | 688 | $this->update_addon_option_names(); |
689 | 689 | } |
690 | 690 | // verify the incoming config object but suppress errors |
691 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
691 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
692 | 692 | $config_obj = new $config_class(); |
693 | 693 | } |
694 | - if ( get_option( $config_option_name ) ) { |
|
695 | - EE_Config::log( $config_option_name ); |
|
696 | - update_option( $config_option_name, $config_obj ); |
|
694 | + if (get_option($config_option_name)) { |
|
695 | + EE_Config::log($config_option_name); |
|
696 | + update_option($config_option_name, $config_obj); |
|
697 | 697 | $this->{$section}->{$name} = $config_obj; |
698 | 698 | return $this->{$section}->{$name}; |
699 | 699 | } else { |
700 | 700 | // create a wp-option for this config |
701 | - if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) { |
|
702 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
701 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
702 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
703 | 703 | return $this->{$section}->{$name}; |
704 | 704 | } else { |
705 | 705 | EE_Error::add_error( |
706 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
706 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
707 | 707 | __FILE__, |
708 | 708 | __FUNCTION__, |
709 | 709 | __LINE__ |
@@ -726,46 +726,46 @@ discard block |
||
726 | 726 | * @param bool $throw_errors |
727 | 727 | * @return bool |
728 | 728 | */ |
729 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
729 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
730 | 730 | // don't allow config updates during WP heartbeats |
731 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
731 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
732 | 732 | return false; |
733 | 733 | } |
734 | - $config_obj = maybe_unserialize( $config_obj ); |
|
734 | + $config_obj = maybe_unserialize($config_obj); |
|
735 | 735 | // get class name of the incoming object |
736 | - $config_class = get_class( $config_obj ); |
|
736 | + $config_class = get_class($config_obj); |
|
737 | 737 | // run tests 1-5 and 9 to verify config |
738 | 738 | if ( ! $this->_verify_config_params( |
739 | 739 | $section, |
740 | 740 | $name, |
741 | 741 | $config_class, |
742 | 742 | $config_obj, |
743 | - array( 1, 2, 3, 4, 7, 9 ) |
|
743 | + array(1, 2, 3, 4, 7, 9) |
|
744 | 744 | ) |
745 | 745 | ) { |
746 | 746 | return false; |
747 | 747 | } |
748 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
748 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
749 | 749 | // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
750 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
750 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
751 | 751 | // save new config to db |
752 | - if( $this->set_config( $section, $name, $config_class, $config_obj ) ) { |
|
752 | + if ($this->set_config($section, $name, $config_class, $config_obj)) { |
|
753 | 753 | return true; |
754 | 754 | } |
755 | 755 | } else { |
756 | 756 | // first check if the record already exists |
757 | - $existing_config = get_option( $config_option_name ); |
|
758 | - $config_obj = serialize( $config_obj ); |
|
757 | + $existing_config = get_option($config_option_name); |
|
758 | + $config_obj = serialize($config_obj); |
|
759 | 759 | // just return if db record is already up to date (NOT type safe comparison) |
760 | - if ( $existing_config == $config_obj ) { |
|
760 | + if ($existing_config == $config_obj) { |
|
761 | 761 | $this->{$section}->{$name} = $config_obj; |
762 | 762 | return true; |
763 | - } else if ( update_option( $config_option_name, $config_obj ) ) { |
|
764 | - EE_Config::log( $config_option_name ); |
|
763 | + } else if (update_option($config_option_name, $config_obj)) { |
|
764 | + EE_Config::log($config_option_name); |
|
765 | 765 | // update wp-option for this config class |
766 | 766 | $this->{$section}->{$name} = $config_obj; |
767 | 767 | return true; |
768 | - } elseif ( $throw_errors ) { |
|
768 | + } elseif ($throw_errors) { |
|
769 | 769 | EE_Error::add_error( |
770 | 770 | sprintf( |
771 | 771 | __( |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | 'event_espresso' |
774 | 774 | ), |
775 | 775 | $config_class, |
776 | - 'EE_Config->' . $section . '->' . $name |
|
776 | + 'EE_Config->'.$section.'->'.$name |
|
777 | 777 | ), |
778 | 778 | __FILE__, |
779 | 779 | __FUNCTION__, |
@@ -795,34 +795,34 @@ discard block |
||
795 | 795 | * @param string $config_class |
796 | 796 | * @return mixed EE_Config_Base | NULL |
797 | 797 | */ |
798 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
798 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
799 | 799 | // ensure config class is set to something |
800 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
800 | + $config_class = $this->_set_config_class($config_class, $name); |
|
801 | 801 | // run tests 1-4, 6 and 7 to verify that all params have been set |
802 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
802 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
803 | 803 | return null; |
804 | 804 | } |
805 | 805 | // now test if the requested config object exists, but suppress errors |
806 | - if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) { |
|
806 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
807 | 807 | // config already exists, so pass it back |
808 | 808 | return $this->{$section}->{$name}; |
809 | 809 | } |
810 | 810 | // load config option from db if it exists |
811 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) ); |
|
811 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
812 | 812 | // verify the newly retrieved config object, but suppress errors |
813 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
813 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
814 | 814 | // config is good, so set it and pass it back |
815 | 815 | $this->{$section}->{$name} = $config_obj; |
816 | 816 | return $this->{$section}->{$name}; |
817 | 817 | } |
818 | 818 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
819 | - $config_obj = $this->set_config( $section, $name, $config_class ); |
|
819 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
820 | 820 | // verify the newly created config object |
821 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) { |
|
821 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
822 | 822 | return $this->{$section}->{$name}; |
823 | 823 | } else { |
824 | 824 | EE_Error::add_error( |
825 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
825 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
826 | 826 | __FILE__, |
827 | 827 | __FUNCTION__, |
828 | 828 | __LINE__ |
@@ -840,11 +840,11 @@ discard block |
||
840 | 840 | * @param string $config_option_name |
841 | 841 | * @return mixed EE_Config_Base | FALSE |
842 | 842 | */ |
843 | - public function get_config_option( $config_option_name = '' ) { |
|
843 | + public function get_config_option($config_option_name = '') { |
|
844 | 844 | // retrieve the wp-option for this config class. |
845 | - $config_option = maybe_unserialize( get_option( $config_option_name, array() ) ); |
|
846 | - if ( empty( $config_option ) ) { |
|
847 | - EE_Config::log( $config_option_name . '-NOT-FOUND' ); |
|
845 | + $config_option = maybe_unserialize(get_option($config_option_name, array())); |
|
846 | + if (empty($config_option)) { |
|
847 | + EE_Config::log($config_option_name.'-NOT-FOUND'); |
|
848 | 848 | } |
849 | 849 | return $config_option; |
850 | 850 | } |
@@ -856,17 +856,17 @@ discard block |
||
856 | 856 | * |
857 | 857 | * @param string $config_option_name |
858 | 858 | */ |
859 | - public static function log( $config_option_name = '' ) { |
|
860 | - if ( ! empty( $config_option_name ) ) { |
|
861 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
859 | + public static function log($config_option_name = '') { |
|
860 | + if ( ! empty($config_option_name)) { |
|
861 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
862 | 862 | //copy incoming $_REQUEST and sanitize it so we can save it |
863 | 863 | $_request = $_REQUEST; |
864 | - array_walk_recursive( $_request, 'sanitize_text_field' ); |
|
865 | - $config_log[ (string) microtime( true ) ] = array( |
|
864 | + array_walk_recursive($_request, 'sanitize_text_field'); |
|
865 | + $config_log[(string) microtime(true)] = array( |
|
866 | 866 | 'config_name' => $config_option_name, |
867 | 867 | 'request' => $_request, |
868 | 868 | ); |
869 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
869 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
870 | 870 | } |
871 | 871 | } |
872 | 872 | |
@@ -877,12 +877,12 @@ discard block |
||
877 | 877 | * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
878 | 878 | */ |
879 | 879 | public static function trim_log() { |
880 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
881 | - $log_length = count( $config_log ); |
|
882 | - if ( $log_length > EE_Config::LOG_LENGTH ) { |
|
883 | - ksort( $config_log ); |
|
884 | - $config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true ); |
|
885 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
880 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
881 | + $log_length = count($config_log); |
|
882 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
883 | + ksort($config_log); |
|
884 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
885 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
886 | 886 | } |
887 | 887 | } |
888 | 888 | |
@@ -897,14 +897,14 @@ discard block |
||
897 | 897 | * @return string |
898 | 898 | */ |
899 | 899 | public static function get_page_for_posts() { |
900 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
901 | - if ( ! $page_for_posts ) { |
|
900 | + $page_for_posts = get_option('page_for_posts'); |
|
901 | + if ( ! $page_for_posts) { |
|
902 | 902 | return 'posts'; |
903 | 903 | } |
904 | 904 | /** @type WPDB $wpdb */ |
905 | 905 | global $wpdb; |
906 | 906 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
907 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) ); |
|
907 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
908 | 908 | } |
909 | 909 | |
910 | 910 | |
@@ -960,17 +960,17 @@ discard block |
||
960 | 960 | ) |
961 | 961 | ) { |
962 | 962 | // grab list of installed widgets |
963 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
963 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
964 | 964 | // filter list of modules to register |
965 | 965 | $widgets_to_register = apply_filters( |
966 | 966 | 'FHEE__EE_Config__register_widgets__widgets_to_register', |
967 | 967 | $widgets_to_register |
968 | 968 | ); |
969 | - if ( ! empty( $widgets_to_register ) ) { |
|
969 | + if ( ! empty($widgets_to_register)) { |
|
970 | 970 | // cycle thru widget folders |
971 | - foreach ( $widgets_to_register as $widget_path ) { |
|
971 | + foreach ($widgets_to_register as $widget_path) { |
|
972 | 972 | // add to list of installed widget modules |
973 | - EE_Config::register_ee_widget( $widget_path ); |
|
973 | + EE_Config::register_ee_widget($widget_path); |
|
974 | 974 | } |
975 | 975 | } |
976 | 976 | // filter list of installed modules |
@@ -990,57 +990,57 @@ discard block |
||
990 | 990 | * @param string $widget_path - full path up to and including widget folder |
991 | 991 | * @return void |
992 | 992 | */ |
993 | - public static function register_ee_widget( $widget_path = null ) { |
|
994 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
993 | + public static function register_ee_widget($widget_path = null) { |
|
994 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
995 | 995 | $widget_ext = '.widget.php'; |
996 | 996 | // make all separators match |
997 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
997 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
998 | 998 | // does the file path INCLUDE the actual file name as part of the path ? |
999 | - if ( strpos( $widget_path, $widget_ext ) !== false ) { |
|
999 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
1000 | 1000 | // grab and shortcode file name from directory name and break apart at dots |
1001 | - $file_name = explode( '.', basename( $widget_path ) ); |
|
1001 | + $file_name = explode('.', basename($widget_path)); |
|
1002 | 1002 | // take first segment from file name pieces and remove class prefix if it exists |
1003 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
1003 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
1004 | 1004 | // sanitize shortcode directory name |
1005 | - $widget = sanitize_key( $widget ); |
|
1005 | + $widget = sanitize_key($widget); |
|
1006 | 1006 | // now we need to rebuild the shortcode path |
1007 | - $widget_path = explode( DS, $widget_path ); |
|
1007 | + $widget_path = explode(DS, $widget_path); |
|
1008 | 1008 | // remove last segment |
1009 | - array_pop( $widget_path ); |
|
1009 | + array_pop($widget_path); |
|
1010 | 1010 | // glue it back together |
1011 | - $widget_path = implode( DS, $widget_path ); |
|
1011 | + $widget_path = implode(DS, $widget_path); |
|
1012 | 1012 | } else { |
1013 | 1013 | // grab and sanitize widget directory name |
1014 | - $widget = sanitize_key( basename( $widget_path ) ); |
|
1014 | + $widget = sanitize_key(basename($widget_path)); |
|
1015 | 1015 | } |
1016 | 1016 | // create classname from widget directory name |
1017 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) ); |
|
1017 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1018 | 1018 | // add class prefix |
1019 | - $widget_class = 'EEW_' . $widget; |
|
1019 | + $widget_class = 'EEW_'.$widget; |
|
1020 | 1020 | // does the widget exist ? |
1021 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) { |
|
1021 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
1022 | 1022 | $msg = sprintf( |
1023 | 1023 | __( |
1024 | 1024 | 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', |
1025 | 1025 | 'event_espresso' |
1026 | 1026 | ), |
1027 | 1027 | $widget_class, |
1028 | - $widget_path . DS . $widget_class . $widget_ext |
|
1028 | + $widget_path.DS.$widget_class.$widget_ext |
|
1029 | 1029 | ); |
1030 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1030 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1031 | 1031 | return; |
1032 | 1032 | } |
1033 | 1033 | // load the widget class file |
1034 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
1034 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
1035 | 1035 | // verify that class exists |
1036 | - if ( ! class_exists( $widget_class ) ) { |
|
1037 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
1038 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1036 | + if ( ! class_exists($widget_class)) { |
|
1037 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1038 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1039 | 1039 | return; |
1040 | 1040 | } |
1041 | - register_widget( $widget_class ); |
|
1041 | + register_widget($widget_class); |
|
1042 | 1042 | // add to array of registered widgets |
1043 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
1043 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | |
@@ -1053,17 +1053,17 @@ discard block |
||
1053 | 1053 | */ |
1054 | 1054 | private function _register_shortcodes() { |
1055 | 1055 | // grab list of installed shortcodes |
1056 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1056 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1057 | 1057 | // filter list of modules to register |
1058 | 1058 | $shortcodes_to_register = apply_filters( |
1059 | 1059 | 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
1060 | 1060 | $shortcodes_to_register |
1061 | 1061 | ); |
1062 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1062 | + if ( ! empty($shortcodes_to_register)) { |
|
1063 | 1063 | // cycle thru shortcode folders |
1064 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1064 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1065 | 1065 | // add to list of installed shortcode modules |
1066 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1066 | + EE_Config::register_shortcode($shortcode_path); |
|
1067 | 1067 | } |
1068 | 1068 | } |
1069 | 1069 | // filter list of installed modules |
@@ -1082,64 +1082,64 @@ discard block |
||
1082 | 1082 | * @param string $shortcode_path - full path up to and including shortcode folder |
1083 | 1083 | * @return bool |
1084 | 1084 | */ |
1085 | - public static function register_shortcode( $shortcode_path = null ) { |
|
1086 | - do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path ); |
|
1085 | + public static function register_shortcode($shortcode_path = null) { |
|
1086 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1087 | 1087 | $shortcode_ext = '.shortcode.php'; |
1088 | 1088 | // make all separators match |
1089 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1089 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1090 | 1090 | // does the file path INCLUDE the actual file name as part of the path ? |
1091 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) { |
|
1091 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
1092 | 1092 | // grab shortcode file name from directory name and break apart at dots |
1093 | - $shortcode_file = explode( '.', basename( $shortcode_path ) ); |
|
1093 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1094 | 1094 | // take first segment from file name pieces and remove class prefix if it exists |
1095 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 |
|
1096 | - ? substr( $shortcode_file[0], 4 ) |
|
1095 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
1096 | + ? substr($shortcode_file[0], 4) |
|
1097 | 1097 | : $shortcode_file[0]; |
1098 | 1098 | // sanitize shortcode directory name |
1099 | - $shortcode = sanitize_key( $shortcode ); |
|
1099 | + $shortcode = sanitize_key($shortcode); |
|
1100 | 1100 | // now we need to rebuild the shortcode path |
1101 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1101 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1102 | 1102 | // remove last segment |
1103 | - array_pop( $shortcode_path ); |
|
1103 | + array_pop($shortcode_path); |
|
1104 | 1104 | // glue it back together |
1105 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1105 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1106 | 1106 | } else { |
1107 | 1107 | // we need to generate the filename based off of the folder name |
1108 | 1108 | // grab and sanitize shortcode directory name |
1109 | - $shortcode = sanitize_key( basename( $shortcode_path ) ); |
|
1110 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1109 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1110 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1111 | 1111 | } |
1112 | 1112 | // create classname from shortcode directory or file name |
1113 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) ); |
|
1113 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1114 | 1114 | // add class prefix |
1115 | - $shortcode_class = 'EES_' . $shortcode; |
|
1115 | + $shortcode_class = 'EES_'.$shortcode; |
|
1116 | 1116 | // does the shortcode exist ? |
1117 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) { |
|
1117 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1118 | 1118 | $msg = sprintf( |
1119 | 1119 | __( |
1120 | 1120 | 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', |
1121 | 1121 | 'event_espresso' |
1122 | 1122 | ), |
1123 | 1123 | $shortcode_class, |
1124 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1124 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1125 | 1125 | ); |
1126 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1126 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1127 | 1127 | return false; |
1128 | 1128 | } |
1129 | 1129 | // load the shortcode class file |
1130 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1130 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1131 | 1131 | // verify that class exists |
1132 | - if ( ! class_exists( $shortcode_class ) ) { |
|
1132 | + if ( ! class_exists($shortcode_class)) { |
|
1133 | 1133 | $msg = sprintf( |
1134 | - __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), |
|
1134 | + __('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
1135 | 1135 | $shortcode_class |
1136 | 1136 | ); |
1137 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1137 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1138 | 1138 | return false; |
1139 | 1139 | } |
1140 | - $shortcode = strtoupper( $shortcode ); |
|
1140 | + $shortcode = strtoupper($shortcode); |
|
1141 | 1141 | // add to array of registered shortcodes |
1142 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1142 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1143 | 1143 | return true; |
1144 | 1144 | } |
1145 | 1145 | |
@@ -1153,22 +1153,22 @@ discard block |
||
1153 | 1153 | */ |
1154 | 1154 | private function _register_modules() { |
1155 | 1155 | // grab list of installed modules |
1156 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1156 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1157 | 1157 | // filter list of modules to register |
1158 | 1158 | $modules_to_register = apply_filters( |
1159 | 1159 | 'FHEE__EE_Config__register_modules__modules_to_register', |
1160 | 1160 | $modules_to_register |
1161 | 1161 | ); |
1162 | - if ( ! empty( $modules_to_register ) ) { |
|
1162 | + if ( ! empty($modules_to_register)) { |
|
1163 | 1163 | // loop through folders |
1164 | - foreach ( $modules_to_register as $module_path ) { |
|
1164 | + foreach ($modules_to_register as $module_path) { |
|
1165 | 1165 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1166 | 1166 | if ( |
1167 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1168 | - && $module_path !== EE_MODULES . 'gateways' |
|
1167 | + $module_path !== EE_MODULES.'zzz-copy-this-module-template' |
|
1168 | + && $module_path !== EE_MODULES.'gateways' |
|
1169 | 1169 | ) { |
1170 | 1170 | // add to list of installed modules |
1171 | - EE_Config::register_module( $module_path ); |
|
1171 | + EE_Config::register_module($module_path); |
|
1172 | 1172 | } |
1173 | 1173 | } |
1174 | 1174 | } |
@@ -1188,39 +1188,39 @@ discard block |
||
1188 | 1188 | * @param string $module_path - full path up to and including module folder |
1189 | 1189 | * @return bool |
1190 | 1190 | */ |
1191 | - public static function register_module( $module_path = null ) { |
|
1192 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1191 | + public static function register_module($module_path = null) { |
|
1192 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1193 | 1193 | $module_ext = '.module.php'; |
1194 | 1194 | // make all separators match |
1195 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1195 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1196 | 1196 | // does the file path INCLUDE the actual file name as part of the path ? |
1197 | - if ( strpos( $module_path, $module_ext ) !== false ) { |
|
1197 | + if (strpos($module_path, $module_ext) !== false) { |
|
1198 | 1198 | // grab and shortcode file name from directory name and break apart at dots |
1199 | - $module_file = explode( '.', basename( $module_path ) ); |
|
1199 | + $module_file = explode('.', basename($module_path)); |
|
1200 | 1200 | // now we need to rebuild the shortcode path |
1201 | - $module_path = explode( DS, $module_path ); |
|
1201 | + $module_path = explode(DS, $module_path); |
|
1202 | 1202 | // remove last segment |
1203 | - array_pop( $module_path ); |
|
1203 | + array_pop($module_path); |
|
1204 | 1204 | // glue it back together |
1205 | - $module_path = implode( DS, $module_path ) . DS; |
|
1205 | + $module_path = implode(DS, $module_path).DS; |
|
1206 | 1206 | // take first segment from file name pieces and sanitize it |
1207 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1207 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1208 | 1208 | // ensure class prefix is added |
1209 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1209 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1210 | 1210 | } else { |
1211 | 1211 | // we need to generate the filename based off of the folder name |
1212 | 1212 | // grab and sanitize module name |
1213 | - $module = strtolower( basename( $module_path ) ); |
|
1214 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module ); |
|
1213 | + $module = strtolower(basename($module_path)); |
|
1214 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1215 | 1215 | // like trailingslashit() |
1216 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1216 | + $module_path = rtrim($module_path, DS).DS; |
|
1217 | 1217 | // create classname from module directory name |
1218 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) ); |
|
1218 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1219 | 1219 | // add class prefix |
1220 | - $module_class = 'EED_' . $module; |
|
1220 | + $module_class = 'EED_'.$module; |
|
1221 | 1221 | } |
1222 | 1222 | // does the module exist ? |
1223 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) { |
|
1223 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1224 | 1224 | $msg = sprintf( |
1225 | 1225 | __( |
1226 | 1226 | 'The requested %s module file could not be found or is not readable due to file permissions.', |
@@ -1228,19 +1228,19 @@ discard block |
||
1228 | 1228 | ), |
1229 | 1229 | $module |
1230 | 1230 | ); |
1231 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1231 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1232 | 1232 | return false; |
1233 | 1233 | } |
1234 | 1234 | // load the module class file |
1235 | - require_once( $module_path . $module_class . $module_ext ); |
|
1235 | + require_once($module_path.$module_class.$module_ext); |
|
1236 | 1236 | // verify that class exists |
1237 | - if ( ! class_exists( $module_class ) ) { |
|
1238 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1239 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1237 | + if ( ! class_exists($module_class)) { |
|
1238 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1239 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1240 | 1240 | return false; |
1241 | 1241 | } |
1242 | 1242 | // add to array of registered modules |
1243 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1243 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1244 | 1244 | do_action( |
1245 | 1245 | 'AHEE__EE_Config__register_module__complete', |
1246 | 1246 | $module_class, |
@@ -1260,26 +1260,26 @@ discard block |
||
1260 | 1260 | */ |
1261 | 1261 | private function _initialize_shortcodes() { |
1262 | 1262 | // cycle thru shortcode folders |
1263 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1263 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1264 | 1264 | // add class prefix |
1265 | - $shortcode_class = 'EES_' . $shortcode; |
|
1265 | + $shortcode_class = 'EES_'.$shortcode; |
|
1266 | 1266 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1267 | 1267 | // which set hooks ? |
1268 | - if ( is_admin() ) { |
|
1268 | + if (is_admin()) { |
|
1269 | 1269 | // fire immediately |
1270 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' ) ); |
|
1270 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1271 | 1271 | } else { |
1272 | 1272 | // delay until other systems are online |
1273 | 1273 | add_action( |
1274 | 1274 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1275 | - array( $shortcode_class, 'set_hooks' ) |
|
1275 | + array($shortcode_class, 'set_hooks') |
|
1276 | 1276 | ); |
1277 | 1277 | // convert classname to UPPERCASE and create WP shortcode. |
1278 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1278 | + $shortcode_tag = strtoupper($shortcode); |
|
1279 | 1279 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1280 | - if ( ! shortcode_exists( $shortcode_tag ) ) { |
|
1280 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1281 | 1281 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1282 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) ); |
|
1282 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1283 | 1283 | } |
1284 | 1284 | } |
1285 | 1285 | } |
@@ -1296,17 +1296,17 @@ discard block |
||
1296 | 1296 | */ |
1297 | 1297 | private function _initialize_modules() { |
1298 | 1298 | // cycle thru shortcode folders |
1299 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1299 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1300 | 1300 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1301 | 1301 | // which set hooks ? |
1302 | - if ( is_admin() ) { |
|
1302 | + if (is_admin()) { |
|
1303 | 1303 | // fire immediately |
1304 | - call_user_func( array( $module_class, 'set_hooks_admin' ) ); |
|
1304 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1305 | 1305 | } else { |
1306 | 1306 | // delay until other systems are online |
1307 | 1307 | add_action( |
1308 | 1308 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1309 | - array( $module_class, 'set_hooks' ) |
|
1309 | + array($module_class, 'set_hooks') |
|
1310 | 1310 | ); |
1311 | 1311 | } |
1312 | 1312 | } |
@@ -1324,29 +1324,29 @@ discard block |
||
1324 | 1324 | * @param string $key - url param key indicating a route is being called |
1325 | 1325 | * @return bool |
1326 | 1326 | */ |
1327 | - public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) { |
|
1328 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1329 | - $module = str_replace( 'EED_', '', $module ); |
|
1330 | - $module_class = 'EED_' . $module; |
|
1331 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) { |
|
1332 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1333 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1327 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') { |
|
1328 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1329 | + $module = str_replace('EED_', '', $module); |
|
1330 | + $module_class = 'EED_'.$module; |
|
1331 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1332 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1333 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1334 | 1334 | return false; |
1335 | 1335 | } |
1336 | - if ( empty( $route ) ) { |
|
1337 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1338 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1336 | + if (empty($route)) { |
|
1337 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1338 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1339 | 1339 | return false; |
1340 | 1340 | } |
1341 | - if ( ! method_exists( 'EED_' . $module, $method_name ) ) { |
|
1341 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1342 | 1342 | $msg = sprintf( |
1343 | - __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), |
|
1343 | + __('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1344 | 1344 | $route |
1345 | 1345 | ); |
1346 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1346 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1347 | 1347 | return false; |
1348 | 1348 | } |
1349 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1349 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1350 | 1350 | return true; |
1351 | 1351 | } |
1352 | 1352 | |
@@ -1360,11 +1360,11 @@ discard block |
||
1360 | 1360 | * @param string $key - url param key indicating a route is being called |
1361 | 1361 | * @return string |
1362 | 1362 | */ |
1363 | - public static function get_route( $route = null, $key = 'ee' ) { |
|
1364 | - do_action( 'AHEE__EE_Config__get_route__begin', $route ); |
|
1365 | - $route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route ); |
|
1366 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) { |
|
1367 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1363 | + public static function get_route($route = null, $key = 'ee') { |
|
1364 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1365 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1366 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1367 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1368 | 1368 | } |
1369 | 1369 | return null; |
1370 | 1370 | } |
@@ -1394,49 +1394,49 @@ discard block |
||
1394 | 1394 | * @param string $key - url param key indicating a route is being called |
1395 | 1395 | * @return bool |
1396 | 1396 | */ |
1397 | - public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) { |
|
1398 | - do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward ); |
|
1399 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1397 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') { |
|
1398 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1399 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1400 | 1400 | $msg = sprintf( |
1401 | - __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), |
|
1401 | + __('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1402 | 1402 | $route |
1403 | 1403 | ); |
1404 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1404 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1405 | 1405 | return false; |
1406 | 1406 | } |
1407 | - if ( empty( $forward ) ) { |
|
1408 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1409 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1407 | + if (empty($forward)) { |
|
1408 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1409 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1410 | 1410 | return false; |
1411 | 1411 | } |
1412 | - if ( is_array( $forward ) ) { |
|
1413 | - if ( ! isset( $forward[1] ) ) { |
|
1412 | + if (is_array($forward)) { |
|
1413 | + if ( ! isset($forward[1])) { |
|
1414 | 1414 | $msg = sprintf( |
1415 | - __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), |
|
1415 | + __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1416 | 1416 | $route |
1417 | 1417 | ); |
1418 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1418 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1419 | 1419 | return false; |
1420 | 1420 | } |
1421 | - if ( ! method_exists( $forward[0], $forward[1] ) ) { |
|
1421 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1422 | 1422 | $msg = sprintf( |
1423 | - __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1423 | + __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1424 | 1424 | $forward[1], |
1425 | 1425 | $route |
1426 | 1426 | ); |
1427 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1427 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1428 | 1428 | return false; |
1429 | 1429 | } |
1430 | - } else if ( ! function_exists( $forward ) ) { |
|
1430 | + } else if ( ! function_exists($forward)) { |
|
1431 | 1431 | $msg = sprintf( |
1432 | - __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1432 | + __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1433 | 1433 | $forward, |
1434 | 1434 | $route |
1435 | 1435 | ); |
1436 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1436 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1437 | 1437 | return false; |
1438 | 1438 | } |
1439 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1439 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1440 | 1440 | return true; |
1441 | 1441 | } |
1442 | 1442 | |
@@ -1452,12 +1452,12 @@ discard block |
||
1452 | 1452 | * @param string $key - url param key indicating a route is being called |
1453 | 1453 | * @return string |
1454 | 1454 | */ |
1455 | - public static function get_forward( $route = null, $status = 0, $key = 'ee' ) { |
|
1456 | - do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status ); |
|
1457 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) { |
|
1455 | + public static function get_forward($route = null, $status = 0, $key = 'ee') { |
|
1456 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1457 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1458 | 1458 | return apply_filters( |
1459 | 1459 | 'FHEE__EE_Config__get_forward', |
1460 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1460 | + EE_Config::$_module_forward_map[$key][$route][$status], |
|
1461 | 1461 | $route, |
1462 | 1462 | $status |
1463 | 1463 | ); |
@@ -1479,17 +1479,17 @@ discard block |
||
1479 | 1479 | * @param string $key - url param key indicating a route is being called |
1480 | 1480 | * @return bool |
1481 | 1481 | */ |
1482 | - public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) { |
|
1483 | - do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view ); |
|
1484 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1482 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') { |
|
1483 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1484 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1485 | 1485 | $msg = sprintf( |
1486 | - __( 'The module route %s for this view has not been registered.', 'event_espresso' ), |
|
1486 | + __('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1487 | 1487 | $route |
1488 | 1488 | ); |
1489 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1489 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1490 | 1490 | return false; |
1491 | 1491 | } |
1492 | - if ( ! is_readable( $view ) ) { |
|
1492 | + if ( ! is_readable($view)) { |
|
1493 | 1493 | $msg = sprintf( |
1494 | 1494 | __( |
1495 | 1495 | 'The %s view file could not be found or is not readable due to file permissions.', |
@@ -1497,10 +1497,10 @@ discard block |
||
1497 | 1497 | ), |
1498 | 1498 | $view |
1499 | 1499 | ); |
1500 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1500 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1501 | 1501 | return false; |
1502 | 1502 | } |
1503 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1503 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1504 | 1504 | return true; |
1505 | 1505 | } |
1506 | 1506 | |
@@ -1516,12 +1516,12 @@ discard block |
||
1516 | 1516 | * @param string $key - url param key indicating a route is being called |
1517 | 1517 | * @return string |
1518 | 1518 | */ |
1519 | - public static function get_view( $route = null, $status = 0, $key = 'ee' ) { |
|
1520 | - do_action( 'AHEE__EE_Config__get_view__begin', $route, $status ); |
|
1521 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) { |
|
1519 | + public static function get_view($route = null, $status = 0, $key = 'ee') { |
|
1520 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1521 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1522 | 1522 | return apply_filters( |
1523 | 1523 | 'FHEE__EE_Config__get_view', |
1524 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1524 | + EE_Config::$_module_view_map[$key][$route][$status], |
|
1525 | 1525 | $route, |
1526 | 1526 | $status |
1527 | 1527 | ); |
@@ -1532,7 +1532,7 @@ discard block |
||
1532 | 1532 | |
1533 | 1533 | |
1534 | 1534 | public function update_addon_option_names() { |
1535 | - update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names ); |
|
1535 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1536 | 1536 | } |
1537 | 1537 | |
1538 | 1538 | |
@@ -1560,22 +1560,22 @@ discard block |
||
1560 | 1560 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1561 | 1561 | * @throws \EE_Error |
1562 | 1562 | */ |
1563 | - public function get_pretty( $property ) { |
|
1564 | - if ( ! property_exists( $this, $property ) ) { |
|
1563 | + public function get_pretty($property) { |
|
1564 | + if ( ! property_exists($this, $property)) { |
|
1565 | 1565 | throw new EE_Error( |
1566 | 1566 | sprintf( |
1567 | 1567 | __( |
1568 | 1568 | '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
1569 | 1569 | 'event_espresso' |
1570 | 1570 | ), |
1571 | - get_class( $this ), |
|
1571 | + get_class($this), |
|
1572 | 1572 | $property |
1573 | 1573 | ) |
1574 | 1574 | ); |
1575 | 1575 | } |
1576 | 1576 | //just handling escaping of strings for now. |
1577 | - if ( is_string( $this->{$property} ) ) { |
|
1578 | - return stripslashes( $this->{$property} ); |
|
1577 | + if (is_string($this->{$property} )) { |
|
1578 | + return stripslashes($this->{$property} ); |
|
1579 | 1579 | } |
1580 | 1580 | return $this->{$property}; |
1581 | 1581 | } |
@@ -1584,17 +1584,17 @@ discard block |
||
1584 | 1584 | |
1585 | 1585 | public function populate() { |
1586 | 1586 | //grab defaults via a new instance of this class. |
1587 | - $class_name = get_class( $this ); |
|
1587 | + $class_name = get_class($this); |
|
1588 | 1588 | $defaults = new $class_name; |
1589 | 1589 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1590 | 1590 | //default from our $defaults object. |
1591 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1592 | - if ( $this->{$property} === null ) { |
|
1591 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1592 | + if ($this->{$property} === null) { |
|
1593 | 1593 | $this->{$property} = $value; |
1594 | 1594 | } |
1595 | 1595 | } |
1596 | 1596 | //cleanup |
1597 | - unset( $defaults ); |
|
1597 | + unset($defaults); |
|
1598 | 1598 | } |
1599 | 1599 | |
1600 | 1600 | |
@@ -1610,7 +1610,7 @@ discard block |
||
1610 | 1610 | * @param $a |
1611 | 1611 | * @return bool |
1612 | 1612 | */ |
1613 | - public function __isset( $a ) { |
|
1613 | + public function __isset($a) { |
|
1614 | 1614 | return false; |
1615 | 1615 | } |
1616 | 1616 | |
@@ -1622,7 +1622,7 @@ discard block |
||
1622 | 1622 | * @param $a |
1623 | 1623 | * @return bool |
1624 | 1624 | */ |
1625 | - public function __unset( $a ) { |
|
1625 | + public function __unset($a) { |
|
1626 | 1626 | return false; |
1627 | 1627 | } |
1628 | 1628 | |
@@ -1732,7 +1732,7 @@ discard block |
||
1732 | 1732 | $this->current_blog_id = get_current_blog_id(); |
1733 | 1733 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1734 | 1734 | $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin(); |
1735 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true; |
|
1735 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1736 | 1736 | $this->post_shortcodes = array(); |
1737 | 1737 | $this->module_route_map = array(); |
1738 | 1738 | $this->module_forward_map = array(); |
@@ -1748,9 +1748,9 @@ discard block |
||
1748 | 1748 | $this->thank_you_page_url = ''; |
1749 | 1749 | $this->cancel_page_url = ''; |
1750 | 1750 | //cpt slugs |
1751 | - $this->event_cpt_slug = __( 'events', 'event_espresso' ); |
|
1751 | + $this->event_cpt_slug = __('events', 'event_espresso'); |
|
1752 | 1752 | //ueip constant check |
1753 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1753 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1754 | 1754 | $this->ee_ueip_optin = false; |
1755 | 1755 | $this->ee_ueip_has_notified = true; |
1756 | 1756 | } |
@@ -1793,11 +1793,11 @@ discard block |
||
1793 | 1793 | * @return string |
1794 | 1794 | */ |
1795 | 1795 | public function reg_page_url() { |
1796 | - if ( ! $this->reg_page_url ) { |
|
1796 | + if ( ! $this->reg_page_url) { |
|
1797 | 1797 | $this->reg_page_url = add_query_arg( |
1798 | - array( 'uts' => time() ), |
|
1799 | - get_permalink( $this->reg_page_id ) |
|
1800 | - ) . '#checkout'; |
|
1798 | + array('uts' => time()), |
|
1799 | + get_permalink($this->reg_page_id) |
|
1800 | + ).'#checkout'; |
|
1801 | 1801 | } |
1802 | 1802 | return $this->reg_page_url; |
1803 | 1803 | } |
@@ -1812,12 +1812,12 @@ discard block |
||
1812 | 1812 | * @access public |
1813 | 1813 | * @return string |
1814 | 1814 | */ |
1815 | - public function txn_page_url( $query_args = array() ) { |
|
1816 | - if ( ! $this->txn_page_url ) { |
|
1817 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1815 | + public function txn_page_url($query_args = array()) { |
|
1816 | + if ( ! $this->txn_page_url) { |
|
1817 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1818 | 1818 | } |
1819 | - if ( $query_args ) { |
|
1820 | - return add_query_arg( $query_args, $this->txn_page_url ); |
|
1819 | + if ($query_args) { |
|
1820 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1821 | 1821 | } else { |
1822 | 1822 | return $this->txn_page_url; |
1823 | 1823 | } |
@@ -1833,12 +1833,12 @@ discard block |
||
1833 | 1833 | * @access public |
1834 | 1834 | * @return string |
1835 | 1835 | */ |
1836 | - public function thank_you_page_url( $query_args = array() ) { |
|
1837 | - if ( ! $this->thank_you_page_url ) { |
|
1838 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1836 | + public function thank_you_page_url($query_args = array()) { |
|
1837 | + if ( ! $this->thank_you_page_url) { |
|
1838 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1839 | 1839 | } |
1840 | - if ( $query_args ) { |
|
1841 | - return add_query_arg( $query_args, $this->thank_you_page_url ); |
|
1840 | + if ($query_args) { |
|
1841 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1842 | 1842 | } else { |
1843 | 1843 | return $this->thank_you_page_url; |
1844 | 1844 | } |
@@ -1853,8 +1853,8 @@ discard block |
||
1853 | 1853 | * @return string |
1854 | 1854 | */ |
1855 | 1855 | public function cancel_page_url() { |
1856 | - if ( ! $this->cancel_page_url ) { |
|
1857 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1856 | + if ( ! $this->cancel_page_url) { |
|
1857 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1858 | 1858 | } |
1859 | 1859 | return $this->cancel_page_url; |
1860 | 1860 | } |
@@ -1883,22 +1883,22 @@ discard block |
||
1883 | 1883 | */ |
1884 | 1884 | protected function _get_main_ee_ueip_optin() { |
1885 | 1885 | //if this is the main site then we can just bypass our direct query. |
1886 | - if ( is_main_site() ) { |
|
1887 | - return get_option( 'ee_ueip_optin', false ); |
|
1886 | + if (is_main_site()) { |
|
1887 | + return get_option('ee_ueip_optin', false); |
|
1888 | 1888 | } |
1889 | 1889 | |
1890 | 1890 | //is this already cached for this request? If so use it. |
1891 | - if ( ! empty( EE_Core_Config::$ee_ueip_option ) ) { |
|
1891 | + if ( ! empty(EE_Core_Config::$ee_ueip_option)) { |
|
1892 | 1892 | return EE_Core_Config::$ee_ueip_option; |
1893 | 1893 | } |
1894 | 1894 | |
1895 | 1895 | global $wpdb; |
1896 | 1896 | $current_network_main_site = is_multisite() ? get_current_site() : null; |
1897 | - $current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1897 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1898 | 1898 | $option = 'ee_ueip_optin'; |
1899 | 1899 | |
1900 | 1900 | //set correct table for query |
1901 | - $table_name = $wpdb->get_blog_prefix( $current_main_site_id ) . 'options'; |
|
1901 | + $table_name = $wpdb->get_blog_prefix($current_main_site_id).'options'; |
|
1902 | 1902 | |
1903 | 1903 | |
1904 | 1904 | //rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because |
@@ -1906,20 +1906,20 @@ discard block |
||
1906 | 1906 | //re-constructed on the blog switch. Note, we are still executing any core wp filters on this option retrieval. |
1907 | 1907 | //this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog |
1908 | 1908 | //for the purpose of caching. |
1909 | - $pre = apply_filters( 'pre_option_' . $option, false, $option ); |
|
1910 | - if ( false !== $pre ) { |
|
1909 | + $pre = apply_filters('pre_option_'.$option, false, $option); |
|
1910 | + if (false !== $pre) { |
|
1911 | 1911 | EE_Core_Config::$ee_ueip_option = $pre; |
1912 | 1912 | return EE_Core_Config::$ee_ueip_option; |
1913 | 1913 | } |
1914 | 1914 | |
1915 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option ) ); |
|
1916 | - if ( is_object( $row ) ) { |
|
1915 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option)); |
|
1916 | + if (is_object($row)) { |
|
1917 | 1917 | $value = $row->option_value; |
1918 | 1918 | } else { //option does not exist so use default. |
1919 | - return apply_filters( 'default_option_' . $option, false, $option ); |
|
1919 | + return apply_filters('default_option_'.$option, false, $option); |
|
1920 | 1920 | } |
1921 | 1921 | |
1922 | - EE_Core_Config::$ee_ueip_option = apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option ); |
|
1922 | + EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option); |
|
1923 | 1923 | return EE_Core_Config::$ee_ueip_option; |
1924 | 1924 | } |
1925 | 1925 | |
@@ -1935,7 +1935,7 @@ discard block |
||
1935 | 1935 | //reset all url properties |
1936 | 1936 | $this->_reset_urls(); |
1937 | 1937 | //return what to save to db |
1938 | - return array_keys( get_object_vars( $this ) ); |
|
1938 | + return array_keys(get_object_vars($this)); |
|
1939 | 1939 | } |
1940 | 1940 | |
1941 | 1941 | } |
@@ -2082,14 +2082,14 @@ discard block |
||
2082 | 2082 | */ |
2083 | 2083 | public function __construct() { |
2084 | 2084 | // set default organization settings |
2085 | - $this->name = get_bloginfo( 'name' ); |
|
2085 | + $this->name = get_bloginfo('name'); |
|
2086 | 2086 | $this->address_1 = '123 Onna Road'; |
2087 | 2087 | $this->address_2 = 'PO Box 123'; |
2088 | 2088 | $this->city = 'Inna City'; |
2089 | 2089 | $this->STA_ID = 4; |
2090 | 2090 | $this->CNT_ISO = 'US'; |
2091 | 2091 | $this->zip = '12345'; |
2092 | - $this->email = get_bloginfo( 'admin_email' ); |
|
2092 | + $this->email = get_bloginfo('admin_email'); |
|
2093 | 2093 | $this->phone = ''; |
2094 | 2094 | $this->vat = '123456789'; |
2095 | 2095 | $this->logo_url = ''; |
@@ -2177,46 +2177,46 @@ discard block |
||
2177 | 2177 | * @param string $CNT_ISO |
2178 | 2178 | * @throws \EE_Error |
2179 | 2179 | */ |
2180 | - public function __construct( $CNT_ISO = '' ) { |
|
2180 | + public function __construct($CNT_ISO = '') { |
|
2181 | 2181 | /** @var \EventEspresso\core\services\database\TableAnalysis $table_analysis */ |
2182 | - $table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
|
2182 | + $table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true); |
|
2183 | 2183 | // get country code from organization settings or use default |
2184 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
|
2184 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2185 | 2185 | && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
2186 | 2186 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2187 | 2187 | : ''; |
2188 | 2188 | // but override if requested |
2189 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
2189 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2190 | 2190 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
2191 | 2191 | if ( |
2192 | - ! empty( $CNT_ISO ) |
|
2192 | + ! empty($CNT_ISO) |
|
2193 | 2193 | && EE_Maintenance_Mode::instance()->models_can_query() |
2194 | - && $table_analysis->tableExists( EE_Registry::instance()->load_model( 'Country' )->table() ) |
|
2194 | + && $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table()) |
|
2195 | 2195 | ) { |
2196 | 2196 | // retrieve the country settings from the db, just in case they have been customized |
2197 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
2198 | - if ( $country instanceof EE_Country ) { |
|
2199 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2200 | - $this->name = $country->currency_name_single(); // Dollar |
|
2201 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
2202 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
2203 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2204 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2205 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2206 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2197 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2198 | + if ($country instanceof EE_Country) { |
|
2199 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2200 | + $this->name = $country->currency_name_single(); // Dollar |
|
2201 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
2202 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
2203 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2204 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2205 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2206 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2207 | 2207 | } |
2208 | 2208 | } |
2209 | 2209 | // fallback to hardcoded defaults, in case the above failed |
2210 | - if ( empty( $this->code ) ) { |
|
2210 | + if (empty($this->code)) { |
|
2211 | 2211 | // set default currency settings |
2212 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2213 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
2214 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
2215 | - $this->sign = '$'; // currency sign: $ |
|
2216 | - $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2217 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2218 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2219 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2212 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2213 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
2214 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
2215 | + $this->sign = '$'; // currency sign: $ |
|
2216 | + $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2217 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2218 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2219 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2220 | 2220 | } |
2221 | 2221 | } |
2222 | 2222 | } |
@@ -2378,7 +2378,7 @@ discard block |
||
2378 | 2378 | * @since 4.8.8.rc.019 |
2379 | 2379 | */ |
2380 | 2380 | public function do_hooks() { |
2381 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) ); |
|
2381 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2382 | 2382 | } |
2383 | 2383 | |
2384 | 2384 | |
@@ -2387,7 +2387,7 @@ discard block |
||
2387 | 2387 | * @return void |
2388 | 2388 | */ |
2389 | 2389 | public function set_default_reg_status_on_EEM_Event() { |
2390 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2390 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2391 | 2391 | } |
2392 | 2392 | |
2393 | 2393 | |
@@ -2491,10 +2491,10 @@ discard block |
||
2491 | 2491 | * @param bool $reset |
2492 | 2492 | * @return string |
2493 | 2493 | */ |
2494 | - public function log_file_name( $reset = false ) { |
|
2495 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2496 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2497 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2494 | + public function log_file_name($reset = false) { |
|
2495 | + if (empty($this->log_file_name) || $reset) { |
|
2496 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt'; |
|
2497 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2498 | 2498 | } |
2499 | 2499 | return $this->log_file_name; |
2500 | 2500 | } |
@@ -2505,10 +2505,10 @@ discard block |
||
2505 | 2505 | * @param bool $reset |
2506 | 2506 | * @return string |
2507 | 2507 | */ |
2508 | - public function debug_file_name( $reset = false ) { |
|
2509 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2510 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2511 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2508 | + public function debug_file_name($reset = false) { |
|
2509 | + if (empty($this->debug_file_name) || $reset) { |
|
2510 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt'; |
|
2511 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2512 | 2512 | } |
2513 | 2513 | return $this->debug_file_name; |
2514 | 2514 | } |
@@ -2519,7 +2519,7 @@ discard block |
||
2519 | 2519 | * @return string |
2520 | 2520 | */ |
2521 | 2521 | public function affiliate_id() { |
2522 | - return ! empty( $this->affiliate_id ) ? $this->affiliate_id : 'default'; |
|
2522 | + return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default'; |
|
2523 | 2523 | } |
2524 | 2524 | |
2525 | 2525 | |
@@ -2699,21 +2699,21 @@ discard block |
||
2699 | 2699 | $this->use_google_maps = true; |
2700 | 2700 | $this->google_map_api_key = ''; |
2701 | 2701 | // for event details pages (reg page) |
2702 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2703 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2704 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2705 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2706 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2707 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2708 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2702 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2703 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2704 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2705 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2706 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2707 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2708 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2709 | 2709 | // for event list pages |
2710 | - $this->event_list_map_width = 300; // ee_map_width |
|
2711 | - $this->event_list_map_height = 185; // ee_map_height |
|
2712 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2713 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2714 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2715 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2716 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2710 | + $this->event_list_map_width = 300; // ee_map_width |
|
2711 | + $this->event_list_map_height = 185; // ee_map_height |
|
2712 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2713 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2714 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2715 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2716 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2717 | 2717 | } |
2718 | 2718 | |
2719 | 2719 | } |
@@ -2866,7 +2866,7 @@ discard block |
||
2866 | 2866 | * @return void |
2867 | 2867 | */ |
2868 | 2868 | protected function _set_php_values() { |
2869 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2869 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2870 | 2870 | $this->php->version = phpversion(); |
2871 | 2871 | } |
2872 | 2872 | |
@@ -2885,10 +2885,10 @@ discard block |
||
2885 | 2885 | * @type string $msg Any message to be displayed. |
2886 | 2886 | * } |
2887 | 2887 | */ |
2888 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2889 | - if ( ! empty( $this->php->max_input_vars ) |
|
2890 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2891 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2888 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2889 | + if ( ! empty($this->php->max_input_vars) |
|
2890 | + && ($input_count >= $this->php->max_input_vars) |
|
2891 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
2892 | 2892 | ) { |
2893 | 2893 | return sprintf( |
2894 | 2894 | __( |
@@ -2954,7 +2954,7 @@ discard block |
||
2954 | 2954 | */ |
2955 | 2955 | public function __construct() { |
2956 | 2956 | $this->payment_settings = array(); |
2957 | - $this->active_gateways = array( 'Invoice' => false ); |
|
2957 | + $this->active_gateways = array('Invoice' => false); |
|
2958 | 2958 | } |
2959 | 2959 | } |
2960 | 2960 |
@@ -2182,7 +2182,7 @@ discard block |
||
2182 | 2182 | $table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
2183 | 2183 | // get country code from organization settings or use default |
2184 | 2184 | $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
2185 | - && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2185 | + && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2186 | 2186 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2187 | 2187 | : ''; |
2188 | 2188 | // but override if requested |
@@ -2887,8 +2887,8 @@ discard block |
||
2887 | 2887 | */ |
2888 | 2888 | public function max_input_vars_limit_check( $input_count = 0 ) { |
2889 | 2889 | if ( ! empty( $this->php->max_input_vars ) |
2890 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2891 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2890 | + && ( $input_count >= $this->php->max_input_vars ) |
|
2891 | + && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2892 | 2892 | ) { |
2893 | 2893 | return sprintf( |
2894 | 2894 | __( |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | use EventEspresso\core\services\database\TableAnalysis; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * the purpose of this file is to simply contain any action/filter hook callbacks etc for specific aspects of EE |
@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // defined some new constants related to caffeinated folder |
14 | -define( 'EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/' ); |
|
15 | -define( 'EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS ); |
|
16 | -define( 'EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries' . DS ); |
|
17 | -define( 'EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods' . DS ); |
|
14 | +define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/'); |
|
15 | +define('EE_CAF_CORE', EE_CAFF_PATH.'core'.DS); |
|
16 | +define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries'.DS); |
|
17 | +define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods'.DS); |
|
18 | 18 | |
19 | 19 | |
20 | 20 | |
@@ -35,31 +35,31 @@ discard block |
||
35 | 35 | /** |
36 | 36 | * EE_Brewing_Regular constructor. |
37 | 37 | */ |
38 | - public function __construct( TableAnalysis $table_analysis ) { |
|
38 | + public function __construct(TableAnalysis $table_analysis) { |
|
39 | 39 | $this->_table_analysis = $table_analysis; |
40 | - if ( defined( 'EE_CAFF_PATH' ) ) { |
|
40 | + if (defined('EE_CAFF_PATH')) { |
|
41 | 41 | // activation |
42 | - add_action( 'AHEE__EEH_Activation__initialize_db_content', array( $this, 'initialize_caf_db_content' ) ); |
|
42 | + add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content')); |
|
43 | 43 | // load caff init |
44 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'caffeinated_init' ) ); |
|
44 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init')); |
|
45 | 45 | // remove the "powered by" credit link from receipts and invoices |
46 | - add_filter( 'FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false' ); |
|
46 | + add_filter('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false'); |
|
47 | 47 | // add caffeinated modules |
48 | 48 | add_filter( |
49 | 49 | 'FHEE__EE_Config__register_modules__modules_to_register', |
50 | - array( $this, 'caffeinated_modules_to_register' ) |
|
50 | + array($this, 'caffeinated_modules_to_register') |
|
51 | 51 | ); |
52 | 52 | // load caff scripts |
53 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_caffeinated_scripts' ), 10 ); |
|
54 | - add_filter( 'FHEE__EE_Registry__load_helper__helper_paths', array( $this, 'caf_helper_paths' ), 10 ); |
|
53 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10); |
|
54 | + add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
55 | 55 | add_filter( |
56 | 56 | 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', |
57 | - array( $this, 'caf_payment_methods' ) |
|
57 | + array($this, 'caf_payment_methods') |
|
58 | 58 | ); |
59 | 59 | // caffeinated constructed |
60 | - do_action( 'AHEE__EE_Brewing_Regular__construct__complete' ); |
|
60 | + do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
61 | 61 | //seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer |
62 | - add_filter( 'FHEE__ee_show_affiliate_links', '__return_false' ); |
|
62 | + add_filter('FHEE__ee_show_affiliate_links', '__return_false'); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | * @param array $paths original helper paths array |
72 | 72 | * @return array new array of paths |
73 | 73 | */ |
74 | - public function caf_helper_paths( $paths ) { |
|
75 | - $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
74 | + public function caf_helper_paths($paths) { |
|
75 | + $paths[] = EE_CAF_CORE.'helpers'.DS; |
|
76 | 76 | return $paths; |
77 | 77 | } |
78 | 78 | |
@@ -89,21 +89,21 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @global wpdb $wpdb |
91 | 91 | */ |
92 | - public function initialize_caf_db_content(){ |
|
92 | + public function initialize_caf_db_content() { |
|
93 | 93 | global $wpdb; |
94 | 94 | //use same method of getting creator id as the version introducing the change |
95 | - $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id',get_current_user_id()); |
|
95 | + $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
96 | 96 | $price_type_table = $wpdb->prefix."esp_price_type"; |
97 | 97 | $price_table = $wpdb->prefix."esp_price"; |
98 | - if ( $this->_get_table_analysis()->tableExists( $price_type_table ) ) { |
|
98 | + if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
99 | 99 | |
100 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';//include trashed price types |
|
101 | - $tax_price_type_count = $wpdb->get_var( $SQL ); |
|
102 | - if ( $tax_price_type_count <= 1 ) { |
|
100 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; //include trashed price types |
|
101 | + $tax_price_type_count = $wpdb->get_var($SQL); |
|
102 | + if ($tax_price_type_count <= 1) { |
|
103 | 103 | $wpdb->insert( |
104 | 104 | $price_type_table, |
105 | 105 | array( |
106 | - 'PRT_name' => __( "Regional Tax", "event_espresso" ), |
|
106 | + 'PRT_name' => __("Regional Tax", "event_espresso"), |
|
107 | 107 | 'PBT_ID' => 4, |
108 | 108 | 'PRT_is_percent' => true, |
109 | 109 | 'PRT_order' => 60, |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | 'PRT_wp_user' => $default_creator_id, |
112 | 112 | ), |
113 | 113 | array( |
114 | - '%s',//PRT_name |
|
115 | - '%d',//PBT_id |
|
116 | - '%d',//PRT_is_percent |
|
117 | - '%d',//PRT_order |
|
118 | - '%d',//PRT_deleted |
|
114 | + '%s', //PRT_name |
|
115 | + '%d', //PBT_id |
|
116 | + '%d', //PRT_is_percent |
|
117 | + '%d', //PRT_order |
|
118 | + '%d', //PRT_deleted |
|
119 | 119 | '%d', //PRT_wp_user |
120 | 120 | ) |
121 | 121 | ); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $result = $wpdb->insert( |
124 | 124 | $price_type_table, |
125 | 125 | array( |
126 | - 'PRT_name' => __( "Federal Tax", "event_espresso" ), |
|
126 | + 'PRT_name' => __("Federal Tax", "event_espresso"), |
|
127 | 127 | 'PBT_ID' => 4, |
128 | 128 | 'PRT_is_percent' => true, |
129 | 129 | 'PRT_order' => 70, |
@@ -131,21 +131,21 @@ discard block |
||
131 | 131 | 'PRT_wp_user' => $default_creator_id, |
132 | 132 | ), |
133 | 133 | array( |
134 | - '%s',//PRT_name |
|
135 | - '%d',//PBT_id |
|
136 | - '%d',//PRT_is_percent |
|
137 | - '%d',//PRT_order |
|
138 | - '%d',//PRT_deleted |
|
134 | + '%s', //PRT_name |
|
135 | + '%d', //PBT_id |
|
136 | + '%d', //PRT_is_percent |
|
137 | + '%d', //PRT_order |
|
138 | + '%d', //PRT_deleted |
|
139 | 139 | '%d' //PRT_wp_user |
140 | 140 | ) |
141 | 141 | ); |
142 | - if ( $result ) { |
|
142 | + if ($result) { |
|
143 | 143 | $wpdb->insert( |
144 | 144 | $price_table, |
145 | 145 | array( |
146 | 146 | 'PRT_ID' => $wpdb->insert_id, |
147 | 147 | 'PRC_amount' => 15.00, |
148 | - 'PRC_name' => __( "Sales Tax", "event_espresso" ), |
|
148 | + 'PRC_name' => __("Sales Tax", "event_espresso"), |
|
149 | 149 | 'PRC_desc' => '', |
150 | 150 | 'PRC_is_default' => true, |
151 | 151 | 'PRC_overrides' => null, |
@@ -155,15 +155,15 @@ discard block |
||
155 | 155 | 'PRC_wp_user' => $default_creator_id, |
156 | 156 | ), |
157 | 157 | array( |
158 | - '%d',//PRT_id |
|
159 | - '%f',//PRC_amount |
|
160 | - '%s',//PRC_name |
|
161 | - '%s',//PRC_desc |
|
162 | - '%d',//PRC_is_default |
|
163 | - '%d',//PRC_overrides |
|
164 | - '%d',//PRC_deleted |
|
165 | - '%d',//PRC_order |
|
166 | - '%d',//PRC_parent |
|
158 | + '%d', //PRT_id |
|
159 | + '%f', //PRC_amount |
|
160 | + '%s', //PRC_name |
|
161 | + '%s', //PRC_desc |
|
162 | + '%d', //PRC_is_default |
|
163 | + '%d', //PRC_overrides |
|
164 | + '%d', //PRC_deleted |
|
165 | + '%d', //PRC_order |
|
166 | + '%d', //PRC_parent |
|
167 | 167 | '%d' //PRC_wp_user |
168 | 168 | ) |
169 | 169 | ); |
@@ -181,11 +181,11 @@ discard block |
||
181 | 181 | * @param array $modules_to_register |
182 | 182 | * @return array |
183 | 183 | */ |
184 | - public function caffeinated_modules_to_register( $modules_to_register = array() ) { |
|
185 | - if ( is_readable( EE_CAFF_PATH . 'modules' ) ) { |
|
186 | - $caffeinated_modules_to_register = glob( EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR ); |
|
187 | - if ( is_array( $caffeinated_modules_to_register ) && ! empty( $caffeinated_modules_to_register ) ) { |
|
188 | - $modules_to_register = array_merge( $modules_to_register, $caffeinated_modules_to_register ); |
|
184 | + public function caffeinated_modules_to_register($modules_to_register = array()) { |
|
185 | + if (is_readable(EE_CAFF_PATH.'modules')) { |
|
186 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules'.DS.'*', GLOB_ONLYDIR); |
|
187 | + if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
188 | + $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | return $modules_to_register; |
@@ -195,12 +195,12 @@ discard block |
||
195 | 195 | |
196 | 196 | public function caffeinated_init() { |
197 | 197 | // EE_Register_CPTs hooks |
198 | - add_filter( 'FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array( $this, 'filter_taxonomies' ), 10 ); |
|
199 | - add_filter( 'FHEE__EE_Register_CPTs__get_CPTs__cpts', array( $this, 'filter_cpts' ), 10 ); |
|
200 | - add_filter( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', array( $this, 'nav_metabox_items' ), 10 ); |
|
201 | - EE_Registry::instance()->load_file( EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), false ); |
|
198 | + add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array($this, 'filter_taxonomies'), 10); |
|
199 | + add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array($this, 'filter_cpts'), 10); |
|
200 | + add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array($this, 'nav_metabox_items'), 10); |
|
201 | + EE_Registry::instance()->load_file(EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), false); |
|
202 | 202 | // caffeinated_init__complete hook |
203 | - do_action( 'AHEE__EE_Brewing_Regular__caffeinated_init__complete' ); |
|
203 | + do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * @param array $taxonomy_array |
218 | 218 | * @return array |
219 | 219 | */ |
220 | - public function filter_taxonomies( array $taxonomy_array ) { |
|
220 | + public function filter_taxonomies(array $taxonomy_array) { |
|
221 | 221 | $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = true; |
222 | 222 | return $taxonomy_array; |
223 | 223 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * @param array $cpt_array |
229 | 229 | * @return mixed |
230 | 230 | */ |
231 | - public function filter_cpts( array $cpt_array ) { |
|
231 | + public function filter_cpts(array $cpt_array) { |
|
232 | 232 | $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = true; |
233 | 233 | return $cpt_array; |
234 | 234 | } |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | * @param array $menuitems |
240 | 240 | * @return array |
241 | 241 | */ |
242 | - public function nav_metabox_items( array $menuitems ) { |
|
242 | + public function nav_metabox_items(array $menuitems) { |
|
243 | 243 | $menuitems[] = array( |
244 | - 'title' => __( 'Venue List', 'event_espresso' ), |
|
245 | - 'url' => get_post_type_archive_link( 'espresso_venues' ), |
|
246 | - 'description' => __( 'Archive page for all venues.', 'event_espresso' ), |
|
244 | + 'title' => __('Venue List', 'event_espresso'), |
|
245 | + 'url' => get_post_type_archive_link('espresso_venues'), |
|
246 | + 'description' => __('Archive page for all venues.', 'event_espresso'), |
|
247 | 247 | ); |
248 | 248 | return $menuitems; |
249 | 249 | } |
@@ -256,9 +256,9 @@ discard block |
||
256 | 256 | * @param array $payment_method_paths |
257 | 257 | * @return array values are folder paths to payment method folders |
258 | 258 | */ |
259 | - public function caf_payment_methods( $payment_method_paths ) { |
|
260 | - $caf_payment_methods_paths = glob( EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR ); |
|
261 | - $payment_method_paths = array_merge( $payment_method_paths, $caf_payment_methods_paths ); |
|
259 | + public function caf_payment_methods($payment_method_paths) { |
|
260 | + $caf_payment_methods_paths = glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR); |
|
261 | + $payment_method_paths = array_merge($payment_method_paths, $caf_payment_methods_paths); |
|
262 | 262 | return $payment_method_paths; |
263 | 263 | } |
264 | 264 | /** |
@@ -267,18 +267,18 @@ discard block |
||
267 | 267 | * @throws \EE_Error |
268 | 268 | */ |
269 | 269 | protected function _get_table_analysis() { |
270 | - if( $this->_table_analysis instanceof TableAnalysis ) { |
|
270 | + if ($this->_table_analysis instanceof TableAnalysis) { |
|
271 | 271 | return $this->_table_analysis; |
272 | 272 | } else { |
273 | 273 | throw new \EE_Error( |
274 | 274 | sprintf( |
275 | - __( 'Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
276 | - get_class( $this ) |
|
275 | + __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
276 | + get_class($this) |
|
277 | 277 | ) |
278 | 278 | ); |
279 | 279 | } |
280 | 280 | } |
281 | 281 | } |
282 | 282 | $brewing = new EE_Brewing_Regular( |
283 | - EE_Registry::instance()->create( 'TableAnalysis', array(), true ) |
|
283 | + EE_Registry::instance()->create('TableAnalysis', array(), true) |
|
284 | 284 | ); |
@@ -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,84 +347,84 @@ 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 | |
354 | 354 | if ( |
355 | - $this->_skip_registration_for_processing( $reg ) |
|
355 | + $this->_skip_registration_for_processing($reg) |
|
356 | 356 | ) { |
357 | 357 | continue; |
358 | 358 | } |
359 | 359 | |
360 | 360 | $evt_id = $reg->event_ID(); |
361 | 361 | /** @type EE_Ticket $ticket */ |
362 | - $ticket = $reg->get_first_related( 'Ticket' ); |
|
362 | + $ticket = $reg->get_first_related('Ticket'); |
|
363 | 363 | $relateddatetime = $ticket->datetimes(); |
364 | 364 | $total_ticket_count++; |
365 | - $tickets[ $ticket->ID() ]['ticket'] = $ticket; |
|
366 | - $tickets[ $ticket->ID() ]['count'] = is_array( $tickets[ $ticket->ID() ] ) |
|
367 | - && isset( $tickets[ $ticket->ID() ]['count'] ) |
|
368 | - ? $tickets[ $ticket->ID() ]['count'] + 1 |
|
365 | + $tickets[$ticket->ID()]['ticket'] = $ticket; |
|
366 | + $tickets[$ticket->ID()]['count'] = is_array($tickets[$ticket->ID()]) |
|
367 | + && isset($tickets[$ticket->ID()]['count']) |
|
368 | + ? $tickets[$ticket->ID()]['count'] + 1 |
|
369 | 369 | : 1; |
370 | - $tickets[ $ticket->ID() ]['att_objs'][ $reg->attendee_ID() ] = $reg->attendee(); |
|
371 | - $tickets[ $ticket->ID() ]['dtt_objs'] = $relateddatetime; |
|
372 | - $tickets[ $ticket->ID() ]['reg_objs'][ $reg->ID() ] = $reg; |
|
370 | + $tickets[$ticket->ID()]['att_objs'][$reg->attendee_ID()] = $reg->attendee(); |
|
371 | + $tickets[$ticket->ID()]['dtt_objs'] = $relateddatetime; |
|
372 | + $tickets[$ticket->ID()]['reg_objs'][$reg->ID()] = $reg; |
|
373 | 373 | $event = $reg->event(); |
374 | - $tickets[ $ticket->ID() ]['EE_Event'] = $event; |
|
375 | - $evtcache[ $evt_id ] = $event; |
|
376 | - $eventsetup[ $evt_id ]['reg_objs'][ $reg->ID() ] = $reg; |
|
377 | - $eventsetup[ $evt_id ]['tkt_objs'][ $ticket->ID() ] = $ticket; |
|
378 | - $eventsetup[ $evt_id ]['att_objs'][ $reg->attendee_ID() ] = $reg->attendee(); |
|
379 | - $event_attendee_count[ $evt_id ] = isset( $event_attendee_count[ $evt_id ] ) |
|
380 | - ? $event_attendee_count[ $evt_id ] + 1 |
|
374 | + $tickets[$ticket->ID()]['EE_Event'] = $event; |
|
375 | + $evtcache[$evt_id] = $event; |
|
376 | + $eventsetup[$evt_id]['reg_objs'][$reg->ID()] = $reg; |
|
377 | + $eventsetup[$evt_id]['tkt_objs'][$ticket->ID()] = $ticket; |
|
378 | + $eventsetup[$evt_id]['att_objs'][$reg->attendee_ID()] = $reg->attendee(); |
|
379 | + $event_attendee_count[$evt_id] = isset($event_attendee_count[$evt_id]) |
|
380 | + ? $event_attendee_count[$evt_id] + 1 |
|
381 | 381 | : 0; |
382 | - $attendees[ $reg->attendee_ID() ]['line_ref'][] = $evt_id; |
|
383 | - $attendees[ $reg->attendee_ID() ]['att_obj'] = $reg->attendee(); |
|
384 | - $attendees[ $reg->attendee_ID() ]['reg_objs'][ $reg->ID() ] = $reg; |
|
382 | + $attendees[$reg->attendee_ID()]['line_ref'][] = $evt_id; |
|
383 | + $attendees[$reg->attendee_ID()]['att_obj'] = $reg->attendee(); |
|
384 | + $attendees[$reg->attendee_ID()]['reg_objs'][$reg->ID()] = $reg; |
|
385 | 385 | //$attendees[ $reg->attendee_ID() ]['registration_id'] = $reg->ID(); |
386 | - $attendees[ $reg->attendee_ID() ]['attendee_email'] = $reg->attendee() instanceof EE_Attendee |
|
386 | + $attendees[$reg->attendee_ID()]['attendee_email'] = $reg->attendee() instanceof EE_Attendee |
|
387 | 387 | ? $reg->attendee()->email() |
388 | 388 | : ''; |
389 | - $attendees[ $reg->attendee_ID() ]['tkt_objs'][ $ticket->ID() ] = $ticket; |
|
390 | - $attendees[ $reg->attendee_ID() ]['evt_objs'][ $evt_id ] = $event; |
|
389 | + $attendees[$reg->attendee_ID()]['tkt_objs'][$ticket->ID()] = $ticket; |
|
390 | + $attendees[$reg->attendee_ID()]['evt_objs'][$evt_id] = $event; |
|
391 | 391 | |
392 | 392 | //registrations |
393 | - $registrations[ $reg->ID() ]['tkt_obj'] = $ticket; |
|
394 | - $registrations[ $reg->ID() ]['evt_obj'] = $event; |
|
395 | - $registrations[ $reg->ID() ]['reg_obj'] = $reg; |
|
396 | - $registrations[ $reg->ID() ]['att_obj'] = $reg->attendee(); |
|
393 | + $registrations[$reg->ID()]['tkt_obj'] = $ticket; |
|
394 | + $registrations[$reg->ID()]['evt_obj'] = $event; |
|
395 | + $registrations[$reg->ID()]['reg_obj'] = $reg; |
|
396 | + $registrations[$reg->ID()]['att_obj'] = $reg->attendee(); |
|
397 | 397 | |
398 | 398 | //set up answer objects |
399 | - $rel_ans = $reg->get_many_related( 'Answer' ); |
|
400 | - foreach ( $rel_ans as $ansid => $answer ) { |
|
401 | - if ( ! isset( $questions[ $ansid ] ) ) { |
|
402 | - $questions[ $ansid ] = $answer->get_first_related( 'Question' ); |
|
399 | + $rel_ans = $reg->get_many_related('Answer'); |
|
400 | + foreach ($rel_ans as $ansid => $answer) { |
|
401 | + if ( ! isset($questions[$ansid])) { |
|
402 | + $questions[$ansid] = $answer->get_first_related('Question'); |
|
403 | 403 | } |
404 | - $answers[ $ansid ] = $answer; |
|
405 | - $registrations[ $reg->ID() ]['ans_objs'][ $ansid ] = $answer; |
|
404 | + $answers[$ansid] = $answer; |
|
405 | + $registrations[$reg->ID()]['ans_objs'][$ansid] = $answer; |
|
406 | 406 | } |
407 | 407 | |
408 | - foreach ( $relateddatetime as $dtt_id => $datetime ) { |
|
409 | - $eventsetup[ $evt_id ]['dtt_objs'][ $dtt_id ] = $datetime; |
|
410 | - $registrations[ $reg->ID() ]['dtt_objs'][ $dtt_id ] = $datetime; |
|
408 | + foreach ($relateddatetime as $dtt_id => $datetime) { |
|
409 | + $eventsetup[$evt_id]['dtt_objs'][$dtt_id] = $datetime; |
|
410 | + $registrations[$reg->ID()]['dtt_objs'][$dtt_id] = $datetime; |
|
411 | 411 | |
412 | - if ( isset( $datetimes[ $dtt_id ] ) ) { |
|
412 | + if (isset($datetimes[$dtt_id])) { |
|
413 | 413 | continue; //already have this info in the datetimes array. |
414 | 414 | } |
415 | 415 | |
416 | - $datetimes[ $dtt_id ]['tkt_objs'][] = $ticket; |
|
417 | - $datetimes[ $dtt_id ]['datetime'] = $datetime; |
|
418 | - $datetimes[ $dtt_id ]['evt_objs'][ $evt_id ] = $event; |
|
419 | - $datetimes[ $dtt_id ]['reg_objs'][ $reg->ID() ] = $reg; |
|
416 | + $datetimes[$dtt_id]['tkt_objs'][] = $ticket; |
|
417 | + $datetimes[$dtt_id]['datetime'] = $datetime; |
|
418 | + $datetimes[$dtt_id]['evt_objs'][$evt_id] = $event; |
|
419 | + $datetimes[$dtt_id]['reg_objs'][$reg->ID()] = $reg; |
|
420 | 420 | } |
421 | 421 | } |
422 | 422 | |
423 | 423 | //let's loop through the unique event=>reg items and setup data on them |
424 | 424 | |
425 | - if ( ! empty( $eventsetup ) ) { |
|
426 | - foreach ( $eventsetup as $evt_id => $items ) { |
|
427 | - if ( $this->txn instanceof EE_Transaction ) { |
|
425 | + if ( ! empty($eventsetup)) { |
|
426 | + foreach ($eventsetup as $evt_id => $items) { |
|
427 | + if ($this->txn instanceof EE_Transaction) { |
|
428 | 428 | $ticket_line_items_for_event = EEM_Line_Item::instance()->get_all( |
429 | 429 | array( |
430 | 430 | array( |
@@ -437,25 +437,25 @@ discard block |
||
437 | 437 | } else { |
438 | 438 | $ticket_line_items_for_event = array(); |
439 | 439 | } |
440 | - $events[ $evt_id ] = array( |
|
440 | + $events[$evt_id] = array( |
|
441 | 441 | 'ID' => $evt_id, |
442 | - 'event' => $evtcache[ $evt_id ], |
|
443 | - 'name' => $evtcache[ $evt_id ] instanceof EE_Event ? $evtcache[ $evt_id ]->name() : '', |
|
444 | - 'total_attendees' => $event_attendee_count[ $evt_id ], |
|
442 | + 'event' => $evtcache[$evt_id], |
|
443 | + 'name' => $evtcache[$evt_id] instanceof EE_Event ? $evtcache[$evt_id]->name() : '', |
|
444 | + 'total_attendees' => $event_attendee_count[$evt_id], |
|
445 | 445 | 'reg_objs' => $items['reg_objs'], |
446 | 446 | 'tkt_objs' => $items['tkt_objs'], |
447 | 447 | 'att_objs' => $items['att_objs'], |
448 | - 'dtt_objs' => isset( $items['dtt_objs'] ) ? $items['dtt_objs'] : array(), |
|
448 | + 'dtt_objs' => isset($items['dtt_objs']) ? $items['dtt_objs'] : array(), |
|
449 | 449 | 'line_items' => $ticket_line_items_for_event, |
450 | 450 | ); |
451 | 451 | |
452 | 452 | //make sure the tickets have the line items setup for them. |
453 | - foreach ( $ticket_line_items_for_event as $line_id => $line_item ) { |
|
454 | - if ( $line_item instanceof EE_Line_Item ) { |
|
455 | - $tickets[ $line_item->ticket()->ID() ]['line_item'] = $line_item; |
|
456 | - $tickets[ $line_item->ticket()->ID() ]['sub_line_items'] = $line_item->children(); |
|
457 | - $line_items[ $line_item->ID() ]['children'] = $line_item->children(); |
|
458 | - $line_items[ $line_item->ID() ]['EE_Ticket'] = $line_item->ticket(); |
|
453 | + foreach ($ticket_line_items_for_event as $line_id => $line_item) { |
|
454 | + if ($line_item instanceof EE_Line_Item) { |
|
455 | + $tickets[$line_item->ticket()->ID()]['line_item'] = $line_item; |
|
456 | + $tickets[$line_item->ticket()->ID()]['sub_line_items'] = $line_item->children(); |
|
457 | + $line_items[$line_item->ID()]['children'] = $line_item->children(); |
|
458 | + $line_items[$line_item->ID()]['EE_Ticket'] = $line_item->ticket(); |
|
459 | 459 | } |
460 | 460 | } |
461 | 461 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | $this->total_ticket_count = $total_ticket_count; |
478 | 478 | $this->registrations = $registrations; |
479 | 479 | |
480 | - if ( $this->txn instanceof EE_Transaction ) { |
|
480 | + if ($this->txn instanceof EE_Transaction) { |
|
481 | 481 | $this->tax_line_items = $this->txn->tax_items(); |
482 | 482 | $this->additional_line_items = $this->txn->non_ticket_line_items(); |
483 | 483 | $this->payments = $this->txn->payments(); |
@@ -487,10 +487,10 @@ discard block |
||
487 | 487 | //let's get just the primary_attendee_data! First we get the primary registration object. |
488 | 488 | $primary_reg = $this->txn->primary_registration(); |
489 | 489 | // verify |
490 | - if ( $primary_reg instanceof EE_Registration ) { |
|
490 | + if ($primary_reg instanceof EE_Registration) { |
|
491 | 491 | |
492 | 492 | // get attendee object |
493 | - if ( $primary_reg->attendee() instanceof EE_Attendee ) { |
|
493 | + if ($primary_reg->attendee() instanceof EE_Attendee) { |
|
494 | 494 | |
495 | 495 | //now we can setup the primary_attendee_data array |
496 | 496 | $this->primary_attendee_data = array( |
@@ -534,8 +534,8 @@ discard block |
||
534 | 534 | * @return bool returning true means we DO want to skip processing. returning false means we DON'T want to skip |
535 | 535 | * processing |
536 | 536 | */ |
537 | - protected function _skip_registration_for_processing( EE_Registration $registration ) { |
|
538 | - if ( empty( $this->filtered_reg_status ) ) { |
|
537 | + protected function _skip_registration_for_processing(EE_Registration $registration) { |
|
538 | + if (empty($this->filtered_reg_status)) { |
|
539 | 539 | return false; |
540 | 540 | } |
541 | 541 |
@@ -1,6 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | |
3 | 3 | /** |
4 | 4 | * This class is used for generating EE_Message objects with given info. |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @return EE_Messages_Queue The new queue for holding generated EE_Message objects. |
118 | 118 | */ |
119 | - public function generate( $save = true ) { |
|
119 | + public function generate($save = true) { |
|
120 | 120 | //iterate through the messages in the queue, generate, and add to new queue. |
121 | 121 | $this->_generation_queue->get_message_repository()->rewind(); |
122 | - while ( $this->_generation_queue->get_message_repository()->valid() ) { |
|
122 | + while ($this->_generation_queue->get_message_repository()->valid()) { |
|
123 | 123 | //reset "current" properties |
124 | 124 | $this->_reset_current_properties(); |
125 | 125 | |
@@ -133,18 +133,18 @@ discard block |
||
133 | 133 | $this->_generation_queue->get_message_repository()->next(); |
134 | 134 | $next_msg = $this->_generation_queue->get_message_repository()->current(); |
135 | 135 | //restore pointer to current item |
136 | - $this->_generation_queue->get_message_repository()->set_current( $msg ); |
|
136 | + $this->_generation_queue->get_message_repository()->set_current($msg); |
|
137 | 137 | |
138 | 138 | //skip and delete if the current $msg is NOT incomplete (queued for generation) |
139 | - if ( $msg->STS_ID() !== EEM_Message::status_incomplete ) { |
|
139 | + if ($msg->STS_ID() !== EEM_Message::status_incomplete) { |
|
140 | 140 | //we keep this item in the db just remove from the repo. |
141 | - $this->_generation_queue->get_message_repository()->remove( $msg ); |
|
141 | + $this->_generation_queue->get_message_repository()->remove($msg); |
|
142 | 142 | //next item |
143 | - $this->_generation_queue->get_message_repository()->set_current( $next_msg ); |
|
143 | + $this->_generation_queue->get_message_repository()->set_current($next_msg); |
|
144 | 144 | continue; |
145 | 145 | } |
146 | 146 | |
147 | - if ( $this->_verify() ) { |
|
147 | + if ($this->_verify()) { |
|
148 | 148 | //let's get generating! |
149 | 149 | $this->_generate(); |
150 | 150 | } |
@@ -154,32 +154,32 @@ discard block |
||
154 | 154 | $msg->STS_ID() === EEM_Message::status_debug_only |
155 | 155 | && ! EEM_Message::debug() |
156 | 156 | ) { |
157 | - do_action( 'AHEE__EE_Messages_Generator__generate__before_debug_delete', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler ); |
|
157 | + do_action('AHEE__EE_Messages_Generator__generate__before_debug_delete', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler); |
|
158 | 158 | $this->_generation_queue->get_message_repository()->delete(); |
159 | - $this->_generation_queue->get_message_repository()->set_current( $next_msg ); |
|
159 | + $this->_generation_queue->get_message_repository()->set_current($next_msg); |
|
160 | 160 | continue; |
161 | 161 | } |
162 | 162 | |
163 | 163 | //if there are error messages then let's set the status and the error message. |
164 | - if ( $this->_error_msg ) { |
|
164 | + if ($this->_error_msg) { |
|
165 | 165 | //if the status is already debug only, then let's leave it at that. |
166 | - if ( $msg->STS_ID() !== EEM_Message::status_debug_only ) { |
|
167 | - $msg->set_STS_ID( EEM_Message::status_failed ); |
|
166 | + if ($msg->STS_ID() !== EEM_Message::status_debug_only) { |
|
167 | + $msg->set_STS_ID(EEM_Message::status_failed); |
|
168 | 168 | } |
169 | - do_action( 'AHEE__EE_Messages_Generator__generate__processing_failed_message', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler ); |
|
169 | + do_action('AHEE__EE_Messages_Generator__generate__processing_failed_message', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler); |
|
170 | 170 | $msg->set_error_message( |
171 | - __( 'Message failed to generate for the following reasons: ' ) |
|
171 | + __('Message failed to generate for the following reasons: ') |
|
172 | 172 | . "\n" |
173 | - . implode( "\n", $this->_error_msg ) |
|
173 | + . implode("\n", $this->_error_msg) |
|
174 | 174 | ); |
175 | - $msg->set_modified( time() ); |
|
175 | + $msg->set_modified(time()); |
|
176 | 176 | } else { |
177 | - do_action( 'AHEE__EE_Messages_Generator__generate__before_successful_generated_message_delete', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler ); |
|
177 | + do_action('AHEE__EE_Messages_Generator__generate__before_successful_generated_message_delete', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler); |
|
178 | 178 | //remove from db |
179 | 179 | $this->_generation_queue->get_message_repository()->delete(); |
180 | 180 | } |
181 | 181 | //next item |
182 | - $this->_generation_queue->get_message_repository()->set_current( $next_msg ); |
|
182 | + $this->_generation_queue->get_message_repository()->set_current($next_msg); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | //generation queue is ALWAYS saved to record any errors in the generation process. |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * so a EE_Extra_Meta entry could be created and attached to the EE_Message. In those cases the save flag is |
193 | 193 | * irrelevant. |
194 | 194 | */ |
195 | - if ( $save ) { |
|
195 | + if ($save) { |
|
196 | 196 | $this->_ready_queue->save(); |
197 | 197 | } |
198 | 198 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | protected function _reset_current_properties() { |
211 | 211 | $this->_verified = false; |
212 | 212 | //make sure any _data value in the current message type is reset |
213 | - if ( $this->_current_message_type instanceof EE_message_type ) { |
|
213 | + if ($this->_current_message_type instanceof EE_message_type) { |
|
214 | 214 | $this->_current_message_type->reset_data(); |
215 | 215 | } |
216 | 216 | $this->_current_messenger = $this->_current_message_type = $this->_current_data_handler = null; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | protected function _generate() { |
231 | 231 | //double check verification has run and that everything is ready to work with (saves us having to validate everything again). |
232 | - if ( ! $this->_verified ) { |
|
232 | + if ( ! $this->_verified) { |
|
233 | 233 | return false; //get out because we don't have a valid setup to work with. |
234 | 234 | } |
235 | 235 | |
@@ -239,35 +239,35 @@ discard block |
||
239 | 239 | $this->_current_data_handler, |
240 | 240 | $this->_generation_queue->get_message_repository()->current()->context() |
241 | 241 | ); |
242 | - } catch ( EE_Error $e ) { |
|
242 | + } catch (EE_Error $e) { |
|
243 | 243 | $this->_error_msg[] = $e->getMessage(); |
244 | 244 | return false; |
245 | 245 | } |
246 | 246 | |
247 | 247 | |
248 | 248 | //if no addressees then get out because there is nothing to generation (possible bad data). |
249 | - if ( ! $this->_valid_addressees( $addressees ) ) { |
|
250 | - do_action( 'AHEE__EE_Messages_Generator___generate__invalid_addressees', $this->_generation_queue->get_message_repository()->current(), $addressees, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler ); |
|
251 | - $this->_generation_queue->get_message_repository()->current()->set_STS_ID( EEM_Message::status_debug_only ); |
|
252 | - $this->_error_msg[] = __( 'This is not a critical error but an informational notice. Unable to generate messages EE_Messages_Addressee objects. There were no attendees prepared by the data handler. |
|
253 | - Sometimes this is because messages only get generated for certain registration statuses. For example, the ticket notice message type only goes to approved registrations.', 'event_espresso' ); |
|
249 | + if ( ! $this->_valid_addressees($addressees)) { |
|
250 | + do_action('AHEE__EE_Messages_Generator___generate__invalid_addressees', $this->_generation_queue->get_message_repository()->current(), $addressees, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler); |
|
251 | + $this->_generation_queue->get_message_repository()->current()->set_STS_ID(EEM_Message::status_debug_only); |
|
252 | + $this->_error_msg[] = __('This is not a critical error but an informational notice. Unable to generate messages EE_Messages_Addressee objects. There were no attendees prepared by the data handler. |
|
253 | + Sometimes this is because messages only get generated for certain registration statuses. For example, the ticket notice message type only goes to approved registrations.', 'event_espresso'); |
|
254 | 254 | return false; |
255 | 255 | } |
256 | 256 | |
257 | 257 | $message_template_group = $this->_get_message_template_group(); |
258 | 258 | |
259 | 259 | //in the unlikely event there is no EE_Message_Template_Group available, get out! |
260 | - if ( ! $message_template_group instanceof EE_Message_Template_Group ) { |
|
261 | - $this->_error_msg[] = __( 'Unable to get the Message Templates for the Message being generated. No message template group accessible.', 'event_espresso' ); |
|
260 | + if ( ! $message_template_group instanceof EE_Message_Template_Group) { |
|
261 | + $this->_error_msg[] = __('Unable to get the Message Templates for the Message being generated. No message template group accessible.', 'event_espresso'); |
|
262 | 262 | return false; |
263 | 263 | } |
264 | 264 | |
265 | 265 | //get formatted templates for using to parse and setup EE_Message objects. |
266 | - $templates = $this->_get_templates( $message_template_group ); |
|
266 | + $templates = $this->_get_templates($message_template_group); |
|
267 | 267 | |
268 | 268 | |
269 | 269 | //setup new EE_Message objects (and add to _ready_queue) |
270 | - return $this->_assemble_messages( $addressees, $templates, $message_template_group ); |
|
270 | + return $this->_assemble_messages($addressees, $templates, $message_template_group); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | |
@@ -285,18 +285,18 @@ discard block |
||
285 | 285 | //so let's use that. |
286 | 286 | $GRP_ID = $this->_generation_queue->get_message_repository()->current()->GRP_ID(); |
287 | 287 | |
288 | - if ( $GRP_ID ) { |
|
288 | + if ($GRP_ID) { |
|
289 | 289 | //attempt to retrieve from repo first |
290 | - $GRP = $this->_template_collection->get_by_ID( $GRP_ID ); |
|
291 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
292 | - return $GRP; //got it! |
|
290 | + $GRP = $this->_template_collection->get_by_ID($GRP_ID); |
|
291 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
292 | + return $GRP; //got it! |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | //nope don't have it yet. Get from DB then add to repo if its not here, then that means the current GRP_ID |
296 | 296 | //is not valid, so we'll continue on in the code assuming there's NO GRP_ID. |
297 | - $GRP = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
298 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
299 | - $this->_template_collection->add( $GRP ); |
|
297 | + $GRP = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
298 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
299 | + $this->_template_collection->add($GRP); |
|
300 | 300 | return $GRP; |
301 | 301 | } |
302 | 302 | } |
@@ -315,41 +315,41 @@ discard block |
||
315 | 315 | //in vanilla EE we're assuming there's only one event. |
316 | 316 | //However, if there are multiple events then we'll just use the default templates instead of different |
317 | 317 | // templates per event (which could create problems). |
318 | - if ( count( $this->_current_data_handler->events ) === 1 ) { |
|
319 | - foreach ( $this->_current_data_handler->events as $event ) { |
|
318 | + if (count($this->_current_data_handler->events) === 1) { |
|
319 | + foreach ($this->_current_data_handler->events as $event) { |
|
320 | 320 | $EVT_ID = $event['ID']; |
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
324 | 324 | //before going any further, let's see if its in the queue |
325 | - $GRP = $this->_template_collection->get_by_key( $this->_template_collection->get_key( $this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID ) ); |
|
325 | + $GRP = $this->_template_collection->get_by_key($this->_template_collection->get_key($this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID)); |
|
326 | 326 | |
327 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
327 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
328 | 328 | return $GRP; |
329 | 329 | } |
330 | 330 | |
331 | 331 | //nope still no GRP? |
332 | 332 | //first we get the global template in case it has an override set. |
333 | - $global_template_qa = array_merge( array( 'MTP_is_global' => true ), $template_qa ); |
|
334 | - $global_GRP = EEM_Message_Template_Group::instance()->get_one( array( $global_template_qa ) ); |
|
333 | + $global_template_qa = array_merge(array('MTP_is_global' => true), $template_qa); |
|
334 | + $global_GRP = EEM_Message_Template_Group::instance()->get_one(array($global_template_qa)); |
|
335 | 335 | |
336 | 336 | //if this is an override, then we just return it. |
337 | - if ( $global_GRP instanceof EE_Message_Template_Group && $global_GRP->get( 'MTP_is_override' ) ) { |
|
338 | - $this->_template_collection->add( $global_GRP, $EVT_ID ); |
|
337 | + if ($global_GRP instanceof EE_Message_Template_Group && $global_GRP->get('MTP_is_override')) { |
|
338 | + $this->_template_collection->add($global_GRP, $EVT_ID); |
|
339 | 339 | return $global_GRP; |
340 | 340 | } |
341 | 341 | |
342 | 342 | //STILL here? Okay that means we want to see if there is event specific group and if there is we return it, |
343 | 343 | //otherwise we return the global group we retrieved. |
344 | - if ( $EVT_ID ) { |
|
344 | + if ($EVT_ID) { |
|
345 | 345 | $template_qa['Event.EVT_ID'] = $EVT_ID; |
346 | 346 | } |
347 | 347 | |
348 | - $GRP = EEM_Message_Template_Group::instance()->get_one( array( $template_qa ) ); |
|
348 | + $GRP = EEM_Message_Template_Group::instance()->get_one(array($template_qa)); |
|
349 | 349 | $GRP = $GRP instanceof EE_Message_Template_Group ? $GRP : $global_GRP; |
350 | 350 | |
351 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
352 | - $this->_template_collection->add( $GRP, $EVT_ID ); |
|
351 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
352 | + $this->_template_collection->add($GRP, $EVT_ID); |
|
353 | 353 | return $GRP; |
354 | 354 | } |
355 | 355 | |
@@ -373,15 +373,15 @@ discard block |
||
373 | 373 | * ) |
374 | 374 | * ) |
375 | 375 | */ |
376 | - protected function _get_templates( EE_Message_Template_Group $message_template_group ) { |
|
376 | + protected function _get_templates(EE_Message_Template_Group $message_template_group) { |
|
377 | 377 | $templates = array(); |
378 | 378 | $context_templates = $message_template_group->context_templates(); |
379 | - foreach ( $context_templates as $context => $template_fields ) { |
|
380 | - foreach ( $template_fields as $template_field => $template_obj ) { |
|
381 | - if ( ! $template_obj instanceof EE_Message_Template ) { |
|
379 | + foreach ($context_templates as $context => $template_fields) { |
|
380 | + foreach ($template_fields as $template_field => $template_obj) { |
|
381 | + if ( ! $template_obj instanceof EE_Message_Template) { |
|
382 | 382 | continue; |
383 | 383 | } |
384 | - $templates[ $template_field ][ $context ] = $template_obj->get( 'MTP_content' ); |
|
384 | + $templates[$template_field][$context] = $template_obj->get('MTP_content'); |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | return $templates; |
@@ -403,21 +403,21 @@ discard block |
||
403 | 403 | * get added to the queue with EEM_Message::status_idle, unsuccessfully generated messages will get added |
404 | 404 | * to the queue as EEM_Message::status_failed. Very rarely should "false" be returned from this method. |
405 | 405 | */ |
406 | - protected function _assemble_messages( $addressees, $templates, EE_Message_Template_Group $message_template_group ) { |
|
406 | + protected function _assemble_messages($addressees, $templates, EE_Message_Template_Group $message_template_group) { |
|
407 | 407 | |
408 | 408 | //if templates are empty then get out because we can't generate anything. |
409 | - if ( ! $templates ) { |
|
410 | - $this->_error_msg[] = __( 'Unable to assemble messages because there are no templates retrieved for generating the messages with', 'event_espresso' ); |
|
409 | + if ( ! $templates) { |
|
410 | + $this->_error_msg[] = __('Unable to assemble messages because there are no templates retrieved for generating the messages with', 'event_espresso'); |
|
411 | 411 | return false; |
412 | 412 | } |
413 | 413 | |
414 | 414 | //We use this as the counter for generated messages because don't forget we may be executing this inside of a |
415 | 415 | //generation_queue. So _ready_queue may have generated EE_Message objects already. |
416 | 416 | $generated_count = 0; |
417 | - foreach ( $addressees as $context => $recipients ) { |
|
418 | - foreach ( $recipients as $recipient ) { |
|
419 | - $message = $this->_setup_message_object( $context, $recipient, $templates, $message_template_group ); |
|
420 | - if ( $message instanceof EE_Message ) { |
|
417 | + foreach ($addressees as $context => $recipients) { |
|
418 | + foreach ($recipients as $recipient) { |
|
419 | + $message = $this->_setup_message_object($context, $recipient, $templates, $message_template_group); |
|
420 | + if ($message instanceof EE_Message) { |
|
421 | 421 | $this->_ready_queue->add( |
422 | 422 | $message, |
423 | 423 | array(), |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | } |
429 | 429 | |
430 | 430 | //if the current MSG being generated is for a test send then we'll only use ONE message in the generation. |
431 | - if ( $this->_generation_queue->get_message_repository()->is_test_send() ) { |
|
431 | + if ($this->_generation_queue->get_message_repository()->is_test_send()) { |
|
432 | 432 | break 2; |
433 | 433 | } |
434 | 434 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | ) { |
458 | 458 | //stuff we already know |
459 | 459 | $transaction_id = $recipient->txn instanceof EE_Transaction ? $recipient->txn->ID() : 0; |
460 | - $transaction_id = empty( $transaction_id ) && $this->_current_data_handler->txn instanceof EE_Transaction |
|
460 | + $transaction_id = empty($transaction_id) && $this->_current_data_handler->txn instanceof EE_Transaction |
|
461 | 461 | ? $this->_current_data_handler->txn->ID() |
462 | 462 | : $transaction_id; |
463 | 463 | $message_fields = array( |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | |
471 | 471 | //recipient id and type should be on the EE_Messages_Addressee object but if this is empty, let's try to grab the |
472 | 472 | //info from the att_obj found in the EE_Messages_Addressee object. |
473 | - if ( empty( $recipient->recipient_id ) || empty( $recipient->recipient_type ) ) { |
|
473 | + if (empty($recipient->recipient_id) || empty($recipient->recipient_type)) { |
|
474 | 474 | $message_fields['MSG_recipient_ID'] = $recipient->att_obj instanceof EE_Attendee |
475 | 475 | ? $recipient->att_obj->ID() |
476 | 476 | : 0; |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | $message_fields['MSG_recipient_ID'] = $recipient->recipient_id; |
480 | 480 | $message_fields['MSG_recipient_type'] = $recipient->recipient_type; |
481 | 481 | } |
482 | - $message = EE_Message_Factory::create( $message_fields ); |
|
482 | + $message = EE_Message_Factory::create($message_fields); |
|
483 | 483 | |
484 | 484 | //grab valid shortcodes for shortcode parser |
485 | 485 | $mt_shortcodes = $this->_current_message_type->get_valid_shortcodes(); |
@@ -487,43 +487,43 @@ discard block |
||
487 | 487 | |
488 | 488 | //if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because that means this |
489 | 489 | //context is turned off) EXCEPT if we're previewing |
490 | - if ( empty( $templates['to'][ $context ] ) |
|
490 | + if (empty($templates['to'][$context]) |
|
491 | 491 | && ! $this->_generation_queue->get_message_repository()->is_preview() |
492 | - && ! $this->_current_messenger->allow_empty_to_field() ) { |
|
492 | + && ! $this->_current_messenger->allow_empty_to_field()) { |
|
493 | 493 | //we silently exit here and do NOT record a fail because the message is "turned off" by having no "to" field. |
494 | 494 | return false; |
495 | 495 | } |
496 | 496 | $error_msg = array(); |
497 | - foreach ( $templates as $field => $field_context ) { |
|
497 | + foreach ($templates as $field => $field_context) { |
|
498 | 498 | $error_msg = array(); |
499 | 499 | //let's setup the valid shortcodes for the incoming context. |
500 | - $valid_shortcodes = $mt_shortcodes[ $context ]; |
|
500 | + $valid_shortcodes = $mt_shortcodes[$context]; |
|
501 | 501 | //merge in valid shortcodes for the field. |
502 | - $shortcodes = isset($m_shortcodes[ $field ]) ? $m_shortcodes[ $field ] : $valid_shortcodes; |
|
503 | - if ( isset( $templates[ $field ][ $context ] ) ) { |
|
502 | + $shortcodes = isset($m_shortcodes[$field]) ? $m_shortcodes[$field] : $valid_shortcodes; |
|
503 | + if (isset($templates[$field][$context])) { |
|
504 | 504 | //prefix field. |
505 | - $column_name = 'MSG_' . $field; |
|
505 | + $column_name = 'MSG_'.$field; |
|
506 | 506 | try { |
507 | 507 | $content = $this->_shortcode_parser->parse_message_template( |
508 | - $templates[ $field ][ $context ], |
|
508 | + $templates[$field][$context], |
|
509 | 509 | $recipient, |
510 | 510 | $shortcodes, |
511 | 511 | $this->_current_message_type, |
512 | 512 | $this->_current_messenger, |
513 | 513 | $message ); |
514 | - $message->set_field_or_extra_meta( $column_name, $content ); |
|
515 | - } catch ( EE_Error $e ) { |
|
516 | - $error_msg[] = sprintf( __( 'There was a problem generating the content for the field %s: %s', 'event_espresso' ), $field, $e->getMessage() ); |
|
517 | - $message->set_STS_ID( EEM_Message::status_failed ); |
|
514 | + $message->set_field_or_extra_meta($column_name, $content); |
|
515 | + } catch (EE_Error $e) { |
|
516 | + $error_msg[] = sprintf(__('There was a problem generating the content for the field %s: %s', 'event_espresso'), $field, $e->getMessage()); |
|
517 | + $message->set_STS_ID(EEM_Message::status_failed); |
|
518 | 518 | } |
519 | 519 | } |
520 | 520 | } |
521 | 521 | |
522 | - if ( $message->STS_ID() === EEM_Message::status_failed ) { |
|
523 | - $error_msg = __( 'There were problems generating this message:', 'event_espresso' ) . "\n" . implode( "\n", $error_msg ); |
|
524 | - $message->set_error_message( $error_msg ); |
|
522 | + if ($message->STS_ID() === EEM_Message::status_failed) { |
|
523 | + $error_msg = __('There were problems generating this message:', 'event_espresso')."\n".implode("\n", $error_msg); |
|
524 | + $message->set_error_message($error_msg); |
|
525 | 525 | } else { |
526 | - $message->set_STS_ID( EEM_Message::status_idle ); |
|
526 | + $message->set_STS_ID(EEM_Message::status_idle); |
|
527 | 527 | } |
528 | 528 | return $message; |
529 | 529 | } |
@@ -557,14 +557,14 @@ discard block |
||
557 | 557 | * @param array $addressees Keys correspond to contexts for the message type and values are EE_Messages_Addressee[] |
558 | 558 | * @return bool |
559 | 559 | */ |
560 | - protected function _valid_addressees( $addressees ) { |
|
561 | - if ( ! $addressees || ! is_array( $addressees ) ) { |
|
560 | + protected function _valid_addressees($addressees) { |
|
561 | + if ( ! $addressees || ! is_array($addressees)) { |
|
562 | 562 | return false; |
563 | 563 | } |
564 | 564 | |
565 | - foreach ( $addressees as $addressee_array ) { |
|
566 | - foreach ( $addressee_array as $addressee ) { |
|
567 | - if ( ! $addressee instanceof EE_Messages_Addressee ) { |
|
565 | + foreach ($addressees as $addressee_array) { |
|
566 | + foreach ($addressee_array as $addressee) { |
|
567 | + if ( ! $addressee instanceof EE_Messages_Addressee) { |
|
568 | 568 | return false; |
569 | 569 | } |
570 | 570 | } |
@@ -585,19 +585,19 @@ discard block |
||
585 | 585 | protected function _validate_messenger_and_message_type() { |
586 | 586 | |
587 | 587 | //first are there any existing error messages? If so then return. |
588 | - if ( $this->_error_msg ) { |
|
588 | + if ($this->_error_msg) { |
|
589 | 589 | return false; |
590 | 590 | } |
591 | 591 | /** @type EE_Message $message */ |
592 | 592 | $message = $this->_generation_queue->get_message_repository()->current(); |
593 | 593 | try { |
594 | - $this->_current_messenger = $message->valid_messenger( true ) ? $message->messenger_object() : null; |
|
595 | - } catch ( Exception $e ) { |
|
594 | + $this->_current_messenger = $message->valid_messenger(true) ? $message->messenger_object() : null; |
|
595 | + } catch (Exception $e) { |
|
596 | 596 | $this->_error_msg[] = $e->getMessage(); |
597 | 597 | } |
598 | 598 | try { |
599 | - $this->_current_message_type = $message->valid_message_type( true ) ? $message->message_type_object() : null; |
|
600 | - } catch ( Exception $e ) { |
|
599 | + $this->_current_message_type = $message->valid_message_type(true) ? $message->message_type_object() : null; |
|
600 | + } catch (Exception $e) { |
|
601 | 601 | $this->_error_msg[] = $e->getMessage(); |
602 | 602 | } |
603 | 603 | |
@@ -609,10 +609,10 @@ discard block |
||
609 | 609 | ! $this->_generation_queue->get_message_repository()->is_preview() |
610 | 610 | && $this->_generation_queue->get_message_repository()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' ) |
611 | 611 | ) { |
612 | - $this->_error_msg[] = __( 'There is no generation data for this message. Unable to generate.' ); |
|
612 | + $this->_error_msg[] = __('There is no generation data for this message. Unable to generate.'); |
|
613 | 613 | } |
614 | 614 | |
615 | - return empty( $this->_error_msg ); |
|
615 | + return empty($this->_error_msg); |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | |
630 | 630 | //First, are there any existing error messages? If so, return because if there were errors elsewhere this can't |
631 | 631 | //be used anyways. |
632 | - if ( $this->_error_msg ) { |
|
632 | + if ($this->_error_msg) { |
|
633 | 633 | return false; |
634 | 634 | } |
635 | 635 | |
@@ -638,29 +638,29 @@ discard block |
||
638 | 638 | /** @type EE_Messages_incoming_data $data_handler_class_name - well not really... just the class name actually */ |
639 | 639 | $data_handler_class_name = $this->_generation_queue->get_message_repository()->get_data_handler() |
640 | 640 | ? $this->_generation_queue->get_message_repository()->get_data_handler() |
641 | - : 'EE_Messages_' . $this->_current_message_type->get_data_handler( $generation_data ) . '_incoming_data'; |
|
641 | + : 'EE_Messages_'.$this->_current_message_type->get_data_handler($generation_data).'_incoming_data'; |
|
642 | 642 | |
643 | 643 | //If this EE_Message is for a preview, then let's switch out to the preview data handler. |
644 | - if ( $this->_generation_queue->get_message_repository()->is_preview() ) { |
|
645 | - $data_handler_class_name = 'EE_Messages_Preview_incoming_data'; |
|
644 | + if ($this->_generation_queue->get_message_repository()->is_preview()) { |
|
645 | + $data_handler_class_name = 'EE_Messages_Preview_incoming_data'; |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | //First get the class name for the data handler (and also verifies it exists. |
649 | - if ( ! class_exists( $data_handler_class_name ) ) { |
|
649 | + if ( ! class_exists($data_handler_class_name)) { |
|
650 | 650 | $this->_error_msg[] = sprintf( |
651 | - __( 'The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes. Looking for %s.', 'event_espresso' ), |
|
651 | + __('The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes. Looking for %s.', 'event_espresso'), |
|
652 | 652 | $data_handler_class_name |
653 | 653 | ); |
654 | 654 | return false; |
655 | 655 | } |
656 | 656 | |
657 | 657 | //convert generation_data for data_handler_instantiation. |
658 | - $generation_data = $data_handler_class_name::convert_data_from_persistent_storage( $generation_data ); |
|
658 | + $generation_data = $data_handler_class_name::convert_data_from_persistent_storage($generation_data); |
|
659 | 659 | |
660 | 660 | //note, this may set error messages as well. |
661 | - $this->_set_data_handler( $generation_data, $data_handler_class_name ); |
|
661 | + $this->_set_data_handler($generation_data, $data_handler_class_name); |
|
662 | 662 | |
663 | - return empty( $this->_error_msg ); |
|
663 | + return empty($this->_error_msg); |
|
664 | 664 | } |
665 | 665 | |
666 | 666 | |
@@ -677,16 +677,16 @@ discard block |
||
677 | 677 | * |
678 | 678 | * @return void. |
679 | 679 | */ |
680 | - protected function _set_data_handler( $generating_data, $data_handler_class_name ) { |
|
680 | + protected function _set_data_handler($generating_data, $data_handler_class_name) { |
|
681 | 681 | //valid classname for the data handler. Now let's setup the key for the data handler repository to see if there |
682 | 682 | //is already a ready data handler in the repository. |
683 | - $this->_current_data_handler = $this->_data_handler_collection->get_by_key( $this->_data_handler_collection->get_key( $data_handler_class_name, $generating_data ) ); |
|
684 | - if ( ! $this->_current_data_handler instanceof EE_Messages_incoming_data ) { |
|
683 | + $this->_current_data_handler = $this->_data_handler_collection->get_by_key($this->_data_handler_collection->get_key($data_handler_class_name, $generating_data)); |
|
684 | + if ( ! $this->_current_data_handler instanceof EE_Messages_incoming_data) { |
|
685 | 685 | //no saved data_handler in the repo so let's set one up and add it to the repo. |
686 | 686 | try { |
687 | - $this->_current_data_handler = new $data_handler_class_name( $generating_data ); |
|
688 | - $this->_data_handler_collection->add( $this->_current_data_handler, $generating_data ); |
|
689 | - } catch( EE_Error $e ) { |
|
687 | + $this->_current_data_handler = new $data_handler_class_name($generating_data); |
|
688 | + $this->_data_handler_collection->add($this->_current_data_handler, $generating_data); |
|
689 | + } catch (EE_Error $e) { |
|
690 | 690 | $this->_error_msg[] = $e->get_error(); |
691 | 691 | } |
692 | 692 | } |
@@ -706,13 +706,13 @@ discard block |
||
706 | 706 | * @param bool $preview Indicate whether this is being used for a preview or not. |
707 | 707 | * @return mixed Prepped data for persisting to the queue. false is returned if unable to prep data. |
708 | 708 | */ |
709 | - protected function _prepare_data_for_queue( EE_Message_To_Generate $message_to_generate, $preview ) { |
|
709 | + protected function _prepare_data_for_queue(EE_Message_To_Generate $message_to_generate, $preview) { |
|
710 | 710 | /** @type EE_Messages_incoming_data $data_handler - well not really... just the class name actually */ |
711 | - $data_handler = $message_to_generate->get_data_handler_class_name( $preview ); |
|
712 | - if ( ! $message_to_generate->valid() ) { |
|
711 | + $data_handler = $message_to_generate->get_data_handler_class_name($preview); |
|
712 | + if ( ! $message_to_generate->valid()) { |
|
713 | 713 | return false; //unable to get the data because the info in the EE_Message_To_Generate class is invalid. |
714 | 714 | } |
715 | - return $data_handler::convert_data_for_persistent_storage( $message_to_generate->data() ); |
|
715 | + return $data_handler::convert_data_for_persistent_storage($message_to_generate->data()); |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | |
@@ -725,26 +725,26 @@ discard block |
||
725 | 725 | * @param EE_Message_To_Generate $message_to_generate |
726 | 726 | * @param bool $test_send Whether this is just a test send or not. Typically used for previews. |
727 | 727 | */ |
728 | - public function create_and_add_message_to_queue( EE_Message_To_Generate $message_to_generate, $test_send = false ) { |
|
728 | + public function create_and_add_message_to_queue(EE_Message_To_Generate $message_to_generate, $test_send = false) { |
|
729 | 729 | //prep data |
730 | - $data = $this->_prepare_data_for_queue( $message_to_generate, $message_to_generate->preview() ); |
|
730 | + $data = $this->_prepare_data_for_queue($message_to_generate, $message_to_generate->preview()); |
|
731 | 731 | |
732 | 732 | $message = $message_to_generate->get_EE_Message(); |
733 | 733 | |
734 | 734 | //is there a GRP_ID in the request? |
735 | - if ( $GRP_ID = EE_Registry::instance()->REQ->get( 'GRP_ID' ) ) { |
|
736 | - $message->set_GRP_ID( $GRP_ID ); |
|
735 | + if ($GRP_ID = EE_Registry::instance()->REQ->get('GRP_ID')) { |
|
736 | + $message->set_GRP_ID($GRP_ID); |
|
737 | 737 | } |
738 | 738 | |
739 | - if ( $data === false ) { |
|
740 | - $message->set_STS_ID( EEM_Message::status_failed ); |
|
741 | - $message->set_error_message( __( 'Unable to prepare data for persistence to the database.', 'event_espresso' ) ); |
|
739 | + if ($data === false) { |
|
740 | + $message->set_STS_ID(EEM_Message::status_failed); |
|
741 | + $message->set_error_message(__('Unable to prepare data for persistence to the database.', 'event_espresso')); |
|
742 | 742 | } else { |
743 | 743 | //make sure that the data handler is cached on the message as well |
744 | 744 | $data['data_handler_class_name'] = $message_to_generate->get_data_handler_class_name(); |
745 | 745 | } |
746 | 746 | |
747 | - $this->_generation_queue->add( $message, $data, $message_to_generate->preview(), $test_send ); |
|
747 | + $this->_generation_queue->add($message, $data, $message_to_generate->preview(), $test_send); |
|
748 | 748 | } |
749 | 749 | |
750 | 750 |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | //(all other times it gets resurrected from a wordpress option) |
14 | 14 | $stages = glob(EE_CORE.'data_migration_scripts/4_6_0_stages/*'); |
15 | 15 | $class_to_filepath = array(); |
16 | -foreach($stages as $filepath){ |
|
16 | +foreach ($stages as $filepath) { |
|
17 | 17 | $matches = array(); |
18 | - preg_match('~4_6_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
18 | + preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
19 | 19 | $class_to_filepath[$matches[1]] = $filepath; |
20 | 20 | } |
21 | 21 | //give addons a chance to autoload their stages too |
22 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages',$class_to_filepath); |
|
22 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages', $class_to_filepath); |
|
23 | 23 | EEH_Autoloader::register_autoloader($class_to_filepath); |
24 | 24 | |
25 | 25 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @since 4.6.0 |
36 | 36 | * |
37 | 37 | */ |
38 | -class EE_DMS_Core_4_6_0 extends EE_Data_Migration_Script_Base{ |
|
38 | +class EE_DMS_Core_4_6_0 extends EE_Data_Migration_Script_Base { |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * return EE_DMS_Core_4_6_0 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param TableManager $table_manager |
44 | 44 | * @param TableAnalysis $table_analysis |
45 | 45 | */ |
46 | - public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) { |
|
46 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) { |
|
47 | 47 | $this->_pretty_name = __("Data Migration to Event Espresso 4.6.0.P", "event_espresso"); |
48 | 48 | $this->_priority = 10; |
49 | 49 | $this->_migration_stages = array( |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | new EE_DMS_4_6_0_payments(), |
58 | 58 | new EE_DMS_4_6_0_invoice_settings() |
59 | 59 | ); |
60 | - parent::__construct( $table_manager, $table_analysis ); |
|
60 | + parent::__construct($table_manager, $table_analysis); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function can_migrate_from_version($version_array) { |
70 | 70 | $version_string = $version_array['Core']; |
71 | - if ( version_compare( $version_string, '4.6.0', '<=' ) && version_compare( $version_string, '4.5.0', '>=' ) ) { |
|
71 | + if (version_compare($version_string, '4.6.0', '<=') && version_compare($version_string, '4.5.0', '>=')) { |
|
72 | 72 | // echo "$version_string can be migrated from"; |
73 | 73 | return true; |
74 | - }elseif( ! $version_string ){ |
|
74 | + }elseif ( ! $version_string) { |
|
75 | 75 | // echo "no version string provided: $version_string"; |
76 | 76 | //no version string provided... this must be pre 4.3 |
77 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
78 | - }else{ |
|
77 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
78 | + } else { |
|
79 | 79 | // echo "$version_string doesnt apply"; |
80 | 80 | return false; |
81 | 81 | } |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function schema_changes_before_migration() { |
99 | 99 | //relies on 4.1's EEH_Activation::create_table |
100 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
101 | - $table_name='esp_answer'; |
|
102 | - $sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
100 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
101 | + $table_name = 'esp_answer'; |
|
102 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
103 | 103 | REG_ID INT UNSIGNED NOT NULL, |
104 | 104 | QST_ID INT UNSIGNED NOT NULL, |
105 | 105 | ANS_value TEXT NOT NULL, |
106 | 106 | PRIMARY KEY (ANS_ID)"; |
107 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
107 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
108 | 108 | |
109 | 109 | $table_name = 'esp_attendee_meta'; |
110 | 110 | $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | CNT_is_EU TINYINT(1) DEFAULT '0', |
144 | 144 | CNT_active TINYINT(1) DEFAULT '0', |
145 | 145 | PRIMARY KEY (CNT_ISO)"; |
146 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' ); |
|
146 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
147 | 147 | |
148 | 148 | $table_name = 'esp_currency'; |
149 | 149 | $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
154 | 154 | CUR_active TINYINT(1) DEFAULT '0', |
155 | 155 | PRIMARY KEY (CUR_code)"; |
156 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
156 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
157 | 157 | |
158 | 158 | |
159 | 159 | $table_name = 'esp_currency_payment_method'; |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | |
185 | 185 | |
186 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' ); |
|
186 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
187 | 187 | $table_name = 'esp_event_meta'; |
188 | 188 | $sql = " |
189 | 189 | EVTM_ID INT NOT NULL AUTO_INCREMENT, |
@@ -200,41 +200,41 @@ discard block |
||
200 | 200 | EVT_external_URL VARCHAR(200) NULL, |
201 | 201 | EVT_donations TINYINT(1) NULL, |
202 | 202 | PRIMARY KEY (EVTM_ID)"; |
203 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
203 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
204 | 204 | |
205 | 205 | |
206 | 206 | |
207 | - $table_name='esp_event_question_group'; |
|
208 | - $sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
207 | + $table_name = 'esp_event_question_group'; |
|
208 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
209 | 209 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
210 | 210 | QSG_ID INT UNSIGNED NOT NULL, |
211 | 211 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
212 | 212 | PRIMARY KEY (EQG_ID)"; |
213 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
213 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
214 | 214 | |
215 | 215 | |
216 | 216 | |
217 | - $table_name='esp_event_venue'; |
|
218 | - $sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
217 | + $table_name = 'esp_event_venue'; |
|
218 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
219 | 219 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
220 | 220 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
221 | 221 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
222 | 222 | PRIMARY KEY (EVV_ID)"; |
223 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
223 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
224 | 224 | |
225 | 225 | |
226 | 226 | |
227 | - $table_name='esp_extra_meta'; |
|
228 | - $sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
227 | + $table_name = 'esp_extra_meta'; |
|
228 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
229 | 229 | OBJ_ID INT(11) DEFAULT NULL, |
230 | 230 | EXM_type VARCHAR(45) DEFAULT NULL, |
231 | 231 | EXM_key VARCHAR(45) DEFAULT NULL, |
232 | 232 | EXM_value TEXT, |
233 | 233 | PRIMARY KEY (EXM_ID)"; |
234 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
234 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
235 | 235 | |
236 | - $table_name='esp_line_item'; |
|
237 | - $sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
236 | + $table_name = 'esp_line_item'; |
|
237 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
238 | 238 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
239 | 239 | TXN_ID INT(11) DEFAULT NULL, |
240 | 240 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | OBJ_ID INT(11) DEFAULT NULL, |
251 | 251 | OBJ_type VARCHAR(45)DEFAULT NULL, |
252 | 252 | PRIMARY KEY (LIN_ID)"; |
253 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB' ); |
|
253 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
254 | 254 | |
255 | 255 | $table_name = 'esp_log'; |
256 | 256 | $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | KEY GRP_ID (GRP_ID)"; |
274 | 274 | $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
275 | 275 | |
276 | - $this->_get_table_manager()->dropIndex( 'esp_message_template_group', 'EVT_ID' ); |
|
276 | + $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
277 | 277 | |
278 | 278 | $table_name = 'esp_message_template_group'; |
279 | 279 | $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
289 | 289 | PRIMARY KEY (GRP_ID), |
290 | 290 | KEY MTP_user_id (MTP_user_id)"; |
291 | - $this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB'); |
|
291 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
292 | 292 | |
293 | 293 | $table_name = 'esp_event_message_template'; |
294 | 294 | $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | PRIMARY KEY (EMT_ID), |
298 | 298 | KEY EVT_ID (EVT_ID), |
299 | 299 | KEY GRP_ID (GRP_ID)"; |
300 | - $this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB'); |
|
300 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
301 | 301 | |
302 | 302 | |
303 | 303 | $table_name = 'esp_payment'; |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | PRIMARY KEY (TTM_ID)"; |
366 | 366 | $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
367 | 367 | |
368 | - $table_name='esp_question'; |
|
369 | - $sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
368 | + $table_name = 'esp_question'; |
|
369 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
370 | 370 | QST_display_text TEXT NOT NULL, |
371 | 371 | QST_admin_label VARCHAR(255) NOT NULL, |
372 | 372 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -378,27 +378,27 @@ discard block |
||
378 | 378 | QST_wp_user BIGINT UNSIGNED NULL, |
379 | 379 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
380 | 380 | PRIMARY KEY (QST_ID)'; |
381 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
381 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
382 | 382 | |
383 | - $table_name='esp_question_group_question'; |
|
384 | - $sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
383 | + $table_name = 'esp_question_group_question'; |
|
384 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
385 | 385 | QSG_ID INT UNSIGNED NOT NULL, |
386 | 386 | QST_ID INT UNSIGNED NOT NULL, |
387 | 387 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
388 | 388 | PRIMARY KEY (QGQ_ID) "; |
389 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
389 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
390 | 390 | |
391 | 391 | |
392 | 392 | |
393 | - $table_name='esp_question_option'; |
|
394 | - $sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
393 | + $table_name = 'esp_question_option'; |
|
394 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
395 | 395 | QSO_value VARCHAR(255) NOT NULL, |
396 | 396 | QSO_desc TEXT NOT NULL, |
397 | 397 | QST_ID INT UNSIGNED NOT NULL, |
398 | 398 | QSO_order INT UNSIGNED NOT NULL DEFAULT 0, |
399 | 399 | QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
400 | 400 | PRIMARY KEY (QSO_ID)"; |
401 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
401 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
402 | 402 | |
403 | 403 | |
404 | 404 | |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | |
432 | 432 | |
433 | 433 | |
434 | - $table_name='esp_checkin'; |
|
435 | - $sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
434 | + $table_name = 'esp_checkin'; |
|
435 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
436 | 436 | REG_ID INT(10) UNSIGNED NOT NULL, |
437 | 437 | DTT_ID INT(10) UNSIGNED NOT NULL, |
438 | 438 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | PRC_wp_user BIGINT UNSIGNED NULL, |
522 | 522 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
523 | 523 | PRIMARY KEY (PRC_ID)"; |
524 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
524 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
525 | 525 | |
526 | 526 | $table_name = "esp_price_type"; |
527 | 527 | $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -558,12 +558,12 @@ discard block |
||
558 | 558 | TKT_parent INT(10) UNSIGNED DEFAULT '0', |
559 | 559 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
560 | 560 | PRIMARY KEY (TKT_ID)"; |
561 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' ); |
|
561 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
562 | 562 | |
563 | - $this->_get_table_manager()->dropIndex( 'esp_question_group', 'QSG_identifier_UNIQUE' ); |
|
563 | + $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
564 | 564 | |
565 | 565 | $table_name = 'esp_question_group'; |
566 | - $sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
566 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
567 | 567 | QSG_name VARCHAR(255) NOT NULL, |
568 | 568 | QSG_identifier VARCHAR(100) NOT NULL, |
569 | 569 | QSG_desc TEXT NULL, |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | QSG_wp_user BIGINT UNSIGNED NULL, |
576 | 576 | PRIMARY KEY (QSG_ID), |
577 | 577 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
578 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' ); |
|
578 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
579 | 579 | |
580 | 580 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
581 | 581 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -603,15 +603,15 @@ discard block |
||
603 | 603 | return true; |
604 | 604 | } |
605 | 605 | |
606 | - public function migration_page_hooks(){ |
|
606 | + public function migration_page_hooks() { |
|
607 | 607 | |
608 | 608 | } |
609 | 609 | |
610 | - public function add_default_admin_only_payments(){ |
|
610 | + public function add_default_admin_only_payments() { |
|
611 | 611 | global $wpdb; |
612 | 612 | $table_name = $wpdb->prefix."esp_payment_method"; |
613 | 613 | $user_id = EEH_Activation::get_default_creator_id(); |
614 | - if ( $this->_get_table_analysis()->tableExists( $table_name ) ) { |
|
614 | + if ($this->_get_table_analysis()->tableExists($table_name)) { |
|
615 | 615 | |
616 | 616 | $SQL = "SELECT COUNT( * ) FROM $table_name"; |
617 | 617 | $existing_payment_methods = $wpdb->get_var($SQL); |
@@ -632,11 +632,11 @@ discard block |
||
632 | 632 | //so admins can record payments for them from the admin page |
633 | 633 | |
634 | 634 | |
635 | - foreach($default_admin_only_payment_methods as $nicename => $description){ |
|
635 | + foreach ($default_admin_only_payment_methods as $nicename => $description) { |
|
636 | 636 | $slug = sanitize_key($nicename); |
637 | 637 | //check that such a payment method exists |
638 | - $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s",$slug)); |
|
639 | - if( ! $exists){ |
|
638 | + $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug)); |
|
639 | + if ( ! $exists) { |
|
640 | 640 | $values = array( |
641 | 641 | 'PMD_type'=>'Admin_Only', |
642 | 642 | 'PMD_name'=>$nicename, |
@@ -650,17 +650,17 @@ discard block |
||
650 | 650 | $table_name, |
651 | 651 | $values, |
652 | 652 | array( |
653 | - '%s',//PMD_type |
|
654 | - '%s',//PMD_name |
|
655 | - '%s',//PMD_admin_name |
|
656 | - '%s',//PMD_admin_desc |
|
657 | - '%s',//PMD_slug |
|
658 | - '%d',//PMD_wp_user |
|
659 | - '%s',//PMD_scope |
|
653 | + '%s', //PMD_type |
|
654 | + '%s', //PMD_name |
|
655 | + '%s', //PMD_admin_name |
|
656 | + '%s', //PMD_admin_desc |
|
657 | + '%s', //PMD_slug |
|
658 | + '%d', //PMD_wp_user |
|
659 | + '%s', //PMD_scope |
|
660 | 660 | ) |
661 | 661 | ); |
662 | - if( ! $success ){ |
|
663 | - $this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration", "event_espresso"),$this->_json_encode($values))); |
|
662 | + if ( ! $success) { |
|
663 | + $this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration", "event_espresso"), $this->_json_encode($values))); |
|
664 | 664 | } |
665 | 665 | } |
666 | 666 | } |
@@ -678,11 +678,11 @@ discard block |
||
678 | 678 | |
679 | 679 | global $wpdb; |
680 | 680 | $currency_table = $wpdb->prefix."esp_currency"; |
681 | - if ( $this->_get_table_analysis()->tableExists( $currency_table ) ) { |
|
681 | + if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
682 | 682 | |
683 | 683 | $SQL = "SELECT COUNT('CUR_code') FROM $currency_table"; |
684 | 684 | $countries = $wpdb->get_var($SQL); |
685 | - if ( ! $countries ) { |
|
685 | + if ( ! $countries) { |
|
686 | 686 | $SQL = "INSERT INTO $currency_table |
687 | 687 | ( CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active) VALUES |
688 | 688 | ( 'EUR', 'Euro', 'Euros', '€', 2,1), |
@@ -71,11 +71,11 @@ |
||
71 | 71 | if ( version_compare( $version_string, '4.6.0', '<=' ) && version_compare( $version_string, '4.5.0', '>=' ) ) { |
72 | 72 | // echo "$version_string can be migrated from"; |
73 | 73 | return true; |
74 | - }elseif( ! $version_string ){ |
|
74 | + } elseif( ! $version_string ){ |
|
75 | 75 | // echo "no version string provided: $version_string"; |
76 | 76 | //no version string provided... this must be pre 4.3 |
77 | 77 | return false;//changed mind. dont want people thinking they should migrate yet because they cant |
78 | - }else{ |
|
78 | + } else{ |
|
79 | 79 | // echo "$version_string doesnt apply"; |
80 | 80 | return false; |
81 | 81 | } |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | // (all other times it gets resurrected from a wordpress option) |
18 | 18 | $stages = glob(EE_CORE.'data_migration_scripts/4_7_0_stages/*'); |
19 | 19 | $class_to_filepath = array(); |
20 | -foreach($stages as $filepath){ |
|
20 | +foreach ($stages as $filepath) { |
|
21 | 21 | $matches = array(); |
22 | - preg_match('~4_7_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
22 | + preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
23 | 23 | $class_to_filepath[$matches[1]] = $filepath; |
24 | 24 | } |
25 | 25 | //give addons a chance to autoload their stages too |
26 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages',$class_to_filepath); |
|
26 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath); |
|
27 | 27 | EEH_Autoloader::register_autoloader($class_to_filepath); |
28 | 28 | |
29 | 29 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @since 4.7.0 |
40 | 40 | * |
41 | 41 | */ |
42 | -class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base{ |
|
42 | +class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base { |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * return EE_DMS_Core_4_7_0 |
@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | * @param TableManager $table_manager |
48 | 48 | * @param TableAnalysis $table_analysis |
49 | 49 | */ |
50 | - public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) { |
|
50 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) { |
|
51 | 51 | $this->_pretty_name = __("Data Migration to Event Espresso 4.7.0.p", "event_espresso"); |
52 | 52 | $this->_priority = 10; |
53 | 53 | $this->_migration_stages = array( |
54 | 54 | new EE_DMS_4_7_0_Add_Taxes_To_REG_Final_Price(), |
55 | 55 | new EE_DMS_4_7_0_Registration_Payments(), |
56 | 56 | ); |
57 | - parent::__construct( $table_manager, $table_analysis ); |
|
57 | + parent::__construct($table_manager, $table_analysis); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -67,18 +67,18 @@ discard block |
||
67 | 67 | $version_string = $version_array['Core']; |
68 | 68 | if ( |
69 | 69 | ( |
70 | - version_compare( $version_string, '4.7.0', '<=' ) |
|
71 | - && version_compare( $version_string, '4.6.0', '>=' ) |
|
70 | + version_compare($version_string, '4.7.0', '<=') |
|
71 | + && version_compare($version_string, '4.6.0', '>=') |
|
72 | 72 | ) || ( |
73 | - version_compare( $version_string, '4.7.0', '>=' ) |
|
74 | - && ! $this->_get_table_analysis()->tableExists( 'esp_registration_payment' ) |
|
75 | - && $this->_get_table_analysis()->tableExists( 'esp_registration' ) |
|
73 | + version_compare($version_string, '4.7.0', '>=') |
|
74 | + && ! $this->_get_table_analysis()->tableExists('esp_registration_payment') |
|
75 | + && $this->_get_table_analysis()->tableExists('esp_registration') |
|
76 | 76 | ) |
77 | 77 | ) { |
78 | 78 | return true; |
79 | - } elseif ( ! $version_string ) { |
|
79 | + } elseif ( ! $version_string) { |
|
80 | 80 | //no version string provided... this must be pre 4.3 |
81 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
81 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
82 | 82 | } else { |
83 | 83 | return false; |
84 | 84 | } |
@@ -100,16 +100,16 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function schema_changes_before_migration() { |
102 | 102 | //relies on 4.1's EEH_Activation::create_table |
103 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
104 | - $table_name='esp_answer'; |
|
105 | - $sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
103 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
104 | + $table_name = 'esp_answer'; |
|
105 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
106 | 106 | REG_ID INT UNSIGNED NOT NULL, |
107 | 107 | QST_ID INT UNSIGNED NOT NULL, |
108 | 108 | ANS_value TEXT NOT NULL, |
109 | 109 | PRIMARY KEY (ANS_ID), |
110 | 110 | KEY REG_ID (REG_ID), |
111 | 111 | KEY QST_ID (QST_ID)"; |
112 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
112 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
113 | 113 | |
114 | 114 | $table_name = 'esp_attendee_meta'; |
115 | 115 | $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | CNT_is_EU TINYINT(1) DEFAULT '0', |
150 | 150 | CNT_active TINYINT(1) DEFAULT '0', |
151 | 151 | PRIMARY KEY (CNT_ISO)"; |
152 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
152 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
153 | 153 | |
154 | 154 | $table_name = 'esp_currency'; |
155 | 155 | $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
160 | 160 | CUR_active TINYINT(1) DEFAULT '0', |
161 | 161 | PRIMARY KEY (CUR_code)"; |
162 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
162 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
163 | 163 | |
164 | 164 | |
165 | 165 | $table_name = 'esp_currency_payment_method'; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | KEY EVT_ID (EVT_ID), |
190 | 190 | KEY DTT_is_primary (DTT_is_primary)"; |
191 | 191 | |
192 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
192 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
193 | 193 | |
194 | 194 | $table_name = 'esp_event_meta'; |
195 | 195 | $sql = " |
@@ -208,44 +208,44 @@ discard block |
||
208 | 208 | EVT_donations TINYINT(1) NULL, |
209 | 209 | PRIMARY KEY (EVTM_ID), |
210 | 210 | KEY EVT_ID (EVT_ID)"; |
211 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
211 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
212 | 212 | |
213 | 213 | |
214 | 214 | |
215 | - $table_name='esp_event_question_group'; |
|
216 | - $sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
215 | + $table_name = 'esp_event_question_group'; |
|
216 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
217 | 217 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
218 | 218 | QSG_ID INT UNSIGNED NOT NULL, |
219 | 219 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
220 | 220 | PRIMARY KEY (EQG_ID), |
221 | 221 | KEY EVT_ID (EVT_ID), |
222 | 222 | KEY QSG_ID (QSG_ID)"; |
223 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
223 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
224 | 224 | |
225 | 225 | |
226 | 226 | |
227 | - $table_name='esp_event_venue'; |
|
228 | - $sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
227 | + $table_name = 'esp_event_venue'; |
|
228 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
229 | 229 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
230 | 230 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
231 | 231 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
232 | 232 | PRIMARY KEY (EVV_ID)"; |
233 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
233 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
234 | 234 | |
235 | 235 | |
236 | 236 | |
237 | - $table_name='esp_extra_meta'; |
|
238 | - $sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
237 | + $table_name = 'esp_extra_meta'; |
|
238 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
239 | 239 | OBJ_ID INT(11) DEFAULT NULL, |
240 | 240 | EXM_type VARCHAR(45) DEFAULT NULL, |
241 | 241 | EXM_key VARCHAR(45) DEFAULT NULL, |
242 | 242 | EXM_value TEXT, |
243 | 243 | PRIMARY KEY (EXM_ID), |
244 | 244 | KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))"; |
245 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
245 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
246 | 246 | |
247 | - $table_name='esp_line_item'; |
|
248 | - $sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
247 | + $table_name = 'esp_line_item'; |
|
248 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
249 | 249 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
250 | 250 | TXN_ID INT(11) DEFAULT NULL, |
251 | 251 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | PRIMARY KEY (LIN_ID), |
264 | 264 | KEY LIN_code (LIN_code(191)), |
265 | 265 | KEY TXN_ID (TXN_ID)"; |
266 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' ); |
|
266 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
267 | 267 | |
268 | 268 | $table_name = 'esp_log'; |
269 | 269 | $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
304 | 304 | PRIMARY KEY (GRP_ID), |
305 | 305 | KEY MTP_user_id (MTP_user_id)"; |
306 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
306 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
307 | 307 | |
308 | 308 | $table_name = 'esp_event_message_template'; |
309 | 309 | $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | PRIMARY KEY (EMT_ID), |
313 | 313 | KEY EVT_ID (EVT_ID), |
314 | 314 | KEY GRP_ID (GRP_ID)"; |
315 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
315 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
316 | 316 | |
317 | 317 | |
318 | 318 | $table_name = 'esp_payment'; |
@@ -385,8 +385,8 @@ discard block |
||
385 | 385 | PRIMARY KEY (TTM_ID)"; |
386 | 386 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
387 | 387 | |
388 | - $table_name='esp_question'; |
|
389 | - $sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
388 | + $table_name = 'esp_question'; |
|
389 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
390 | 390 | QST_display_text TEXT NOT NULL, |
391 | 391 | QST_admin_label VARCHAR(255) NOT NULL, |
392 | 392 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -399,22 +399,22 @@ discard block |
||
399 | 399 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
400 | 400 | PRIMARY KEY (QST_ID), |
401 | 401 | KEY QST_order (QST_order)'; |
402 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
402 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
403 | 403 | |
404 | - $table_name='esp_question_group_question'; |
|
405 | - $sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
404 | + $table_name = 'esp_question_group_question'; |
|
405 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
406 | 406 | QSG_ID INT UNSIGNED NOT NULL, |
407 | 407 | QST_ID INT UNSIGNED NOT NULL, |
408 | 408 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
409 | 409 | PRIMARY KEY (QGQ_ID), |
410 | 410 | KEY QST_ID (QST_ID), |
411 | 411 | KEY QSG_ID_order (QSG_ID, QGQ_order)"; |
412 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
412 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
413 | 413 | |
414 | 414 | |
415 | 415 | |
416 | - $table_name='esp_question_option'; |
|
417 | - $sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
416 | + $table_name = 'esp_question_option'; |
|
417 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
418 | 418 | QSO_value VARCHAR(255) NOT NULL, |
419 | 419 | QSO_desc TEXT NOT NULL, |
420 | 420 | QST_ID INT UNSIGNED NOT NULL, |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | PRIMARY KEY (QSO_ID), |
424 | 424 | KEY QST_ID (QST_ID), |
425 | 425 | KEY QSO_order (QSO_order)"; |
426 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
426 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
427 | 427 | |
428 | 428 | |
429 | 429 | |
@@ -469,8 +469,8 @@ discard block |
||
469 | 469 | |
470 | 470 | |
471 | 471 | |
472 | - $table_name='esp_checkin'; |
|
473 | - $sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
472 | + $table_name = 'esp_checkin'; |
|
473 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
474 | 474 | REG_ID INT(10) UNSIGNED NOT NULL, |
475 | 475 | DTT_ID INT(10) UNSIGNED NOT NULL, |
476 | 476 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
566 | 566 | PRIMARY KEY (PRC_ID), |
567 | 567 | KEY PRT_ID (PRT_ID)"; |
568 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
568 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
569 | 569 | |
570 | 570 | $table_name = "esp_price_type"; |
571 | 571 | $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -603,10 +603,10 @@ discard block |
||
603 | 603 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
604 | 604 | PRIMARY KEY (TKT_ID), |
605 | 605 | KEY TKT_start_date (TKT_start_date)"; |
606 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
606 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
607 | 607 | |
608 | 608 | $table_name = 'esp_question_group'; |
609 | - $sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
609 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
610 | 610 | QSG_name VARCHAR(255) NOT NULL, |
611 | 611 | QSG_identifier VARCHAR(100) NOT NULL, |
612 | 612 | QSG_desc TEXT NULL, |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | PRIMARY KEY (QSG_ID), |
620 | 620 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
621 | 621 | KEY QSG_order (QSG_order)'; |
622 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
622 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
623 | 623 | |
624 | 624 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
625 | 625 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | return true; |
652 | 652 | } |
653 | 653 | |
654 | - public function migration_page_hooks(){ |
|
654 | + public function migration_page_hooks() { |
|
655 | 655 | |
656 | 656 | } |
657 | 657 | } |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | //(all other times it gets resurrected from a wordpress option) |
17 | 17 | $stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*'); |
18 | 18 | $class_to_filepath = array(); |
19 | -foreach($stages as $filepath){ |
|
19 | +foreach ($stages as $filepath) { |
|
20 | 20 | $matches = array(); |
21 | - preg_match('~4_8_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
21 | + preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
22 | 22 | $class_to_filepath[$matches[1]] = $filepath; |
23 | 23 | } |
24 | 24 | //give addons a chance to autoload their stages too |
25 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages',$class_to_filepath); |
|
25 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath); |
|
26 | 26 | EEH_Autoloader::register_autoloader($class_to_filepath); |
27 | 27 | |
28 | 28 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @since 4.6.0 |
39 | 39 | * |
40 | 40 | */ |
41 | -class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base{ |
|
41 | +class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base { |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * return EE_DMS_Core_4_8_0 |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | * @param TableManager $table_manager |
47 | 47 | * @param TableAnalysis $table_analysis |
48 | 48 | */ |
49 | - public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) { |
|
49 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) { |
|
50 | 50 | $this->_pretty_name = __("Data Migration to Event Espresso 4.8.0.P (for promotions)", "event_espresso"); |
51 | 51 | $this->_priority = 10; |
52 | 52 | $this->_migration_stages = array( |
53 | 53 | new EE_DMS_4_8_0_pretax_totals(), |
54 | 54 | new EE_DMS_4_8_0_event_subtotals(), |
55 | 55 | ); |
56 | - parent::__construct( $table_manager, $table_analysis ); |
|
56 | + parent::__construct($table_manager, $table_analysis); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function can_migrate_from_version($version_array) { |
70 | 70 | $version_string = $version_array['Core']; |
71 | - if ( version_compare( $version_string, '4.8.0', '<=' ) && version_compare( $version_string, '4.7.0', '>=' ) ) { |
|
71 | + if (version_compare($version_string, '4.8.0', '<=') && version_compare($version_string, '4.7.0', '>=')) { |
|
72 | 72 | // echo "$version_string can be migrated from"; |
73 | 73 | return true; |
74 | - }elseif( ! $version_string ){ |
|
74 | + }elseif ( ! $version_string) { |
|
75 | 75 | // echo "no version string provided: $version_string"; |
76 | 76 | //no version string provided... this must be pre 4.3 |
77 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
78 | - }else{ |
|
77 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
78 | + } else { |
|
79 | 79 | // echo "$version_string doesnt apply"; |
80 | 80 | return false; |
81 | 81 | } |
@@ -96,19 +96,19 @@ discard block |
||
96 | 96 | * @return bool |
97 | 97 | */ |
98 | 98 | public function schema_changes_before_migration() { |
99 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
100 | - $now_in_mysql = current_time( 'mysql', true ); |
|
99 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
100 | + $now_in_mysql = current_time('mysql', true); |
|
101 | 101 | |
102 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
103 | - $table_name='esp_answer'; |
|
104 | - $sql=" ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
102 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
103 | + $table_name = 'esp_answer'; |
|
104 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
105 | 105 | REG_ID int(10) unsigned NOT NULL, |
106 | 106 | QST_ID int(10) unsigned NOT NULL, |
107 | 107 | ANS_value text NOT NULL, |
108 | 108 | PRIMARY KEY (ANS_ID), |
109 | 109 | KEY REG_ID (REG_ID), |
110 | 110 | KEY QST_ID (QST_ID)"; |
111 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
111 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
112 | 112 | |
113 | 113 | $table_name = 'esp_attendee_meta'; |
114 | 114 | $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | CNT_is_EU tinyint(1) DEFAULT '0', |
149 | 149 | CNT_active tinyint(1) DEFAULT '0', |
150 | 150 | PRIMARY KEY (CNT_ISO)"; |
151 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
151 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
152 | 152 | |
153 | 153 | $table_name = 'esp_currency'; |
154 | 154 | $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2', |
159 | 159 | CUR_active tinyint(1) DEFAULT '0', |
160 | 160 | PRIMARY KEY (CUR_code)"; |
161 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
161 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
162 | 162 | |
163 | 163 | |
164 | 164 | $table_name = 'esp_currency_payment_method'; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | KEY EVT_ID (EVT_ID), |
189 | 189 | KEY DTT_is_primary (DTT_is_primary)"; |
190 | 190 | |
191 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
191 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
192 | 192 | |
193 | 193 | $table_name = 'esp_event_meta'; |
194 | 194 | $sql = " |
@@ -207,41 +207,41 @@ discard block |
||
207 | 207 | EVT_donations tinyint(1) NULL, |
208 | 208 | PRIMARY KEY (EVTM_ID), |
209 | 209 | KEY EVT_ID (EVT_ID)"; |
210 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
210 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
211 | 211 | |
212 | 212 | |
213 | 213 | |
214 | - $table_name='esp_event_question_group'; |
|
215 | - $sql="EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
214 | + $table_name = 'esp_event_question_group'; |
|
215 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
216 | 216 | EVT_ID bigint(20) unsigned NOT NULL, |
217 | 217 | QSG_ID int(10) unsigned NOT NULL, |
218 | 218 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
219 | 219 | PRIMARY KEY (EQG_ID), |
220 | 220 | KEY EVT_ID (EVT_ID), |
221 | 221 | KEY QSG_ID (QSG_ID)"; |
222 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
222 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
223 | 223 | |
224 | 224 | |
225 | 225 | |
226 | - $table_name='esp_event_venue'; |
|
227 | - $sql="EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
226 | + $table_name = 'esp_event_venue'; |
|
227 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
228 | 228 | EVT_ID bigint(20) unsigned NOT NULL, |
229 | 229 | VNU_ID bigint(20) unsigned NOT NULL, |
230 | 230 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
231 | 231 | PRIMARY KEY (EVV_ID)"; |
232 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
232 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
233 | 233 | |
234 | 234 | |
235 | 235 | |
236 | - $table_name='esp_extra_meta'; |
|
237 | - $sql="EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
236 | + $table_name = 'esp_extra_meta'; |
|
237 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
238 | 238 | OBJ_ID int(11) DEFAULT NULL, |
239 | 239 | EXM_type varchar(45) DEFAULT NULL, |
240 | 240 | EXM_key varchar(45) DEFAULT NULL, |
241 | 241 | EXM_value text, |
242 | 242 | PRIMARY KEY (EXM_ID), |
243 | 243 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
244 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
244 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
245 | 245 | |
246 | 246 | $table_name = 'esp_extra_join'; |
247 | 247 | $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
@@ -254,8 +254,8 @@ discard block |
||
254 | 254 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
255 | 255 | $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
256 | 256 | |
257 | - $table_name='esp_line_item'; |
|
258 | - $sql="LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
257 | + $table_name = 'esp_line_item'; |
|
258 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
259 | 259 | LIN_code varchar(245) NOT NULL DEFAULT '', |
260 | 260 | TXN_ID int(11) DEFAULT NULL, |
261 | 261 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | PRIMARY KEY (LIN_ID), |
275 | 275 | KEY LIN_code (LIN_code(191)), |
276 | 276 | KEY TXN_ID (TXN_ID)"; |
277 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' ); |
|
277 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
278 | 278 | |
279 | 279 | $table_name = 'esp_log'; |
280 | 280 | $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
314 | 314 | PRIMARY KEY (GRP_ID), |
315 | 315 | KEY MTP_user_id (MTP_user_id)"; |
316 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
316 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
317 | 317 | |
318 | 318 | $table_name = 'esp_event_message_template'; |
319 | 319 | $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | PRIMARY KEY (EMT_ID), |
323 | 323 | KEY EVT_ID (EVT_ID), |
324 | 324 | KEY GRP_ID (GRP_ID)"; |
325 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
325 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
326 | 326 | |
327 | 327 | |
328 | 328 | $table_name = 'esp_payment'; |
@@ -395,8 +395,8 @@ discard block |
||
395 | 395 | PRIMARY KEY (TTM_ID)"; |
396 | 396 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
397 | 397 | |
398 | - $table_name='esp_question'; |
|
399 | - $sql='QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
398 | + $table_name = 'esp_question'; |
|
399 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
400 | 400 | QST_display_text text NOT NULL, |
401 | 401 | QST_admin_label varchar(255) NOT NULL, |
402 | 402 | QST_system varchar(25) NOT NULL DEFAULT "", |
@@ -410,22 +410,22 @@ discard block |
||
410 | 410 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
411 | 411 | PRIMARY KEY (QST_ID), |
412 | 412 | KEY QST_order (QST_order)'; |
413 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
413 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
414 | 414 | |
415 | - $table_name='esp_question_group_question'; |
|
416 | - $sql="QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
415 | + $table_name = 'esp_question_group_question'; |
|
416 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
417 | 417 | QSG_ID int(10) unsigned NOT NULL, |
418 | 418 | QST_ID int(10) unsigned NOT NULL, |
419 | 419 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
420 | 420 | PRIMARY KEY (QGQ_ID), |
421 | 421 | KEY QST_ID (QST_ID), |
422 | 422 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
423 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
423 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
424 | 424 | |
425 | 425 | |
426 | 426 | |
427 | - $table_name='esp_question_option'; |
|
428 | - $sql="QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
427 | + $table_name = 'esp_question_option'; |
|
428 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
429 | 429 | QSO_value varchar(255) NOT NULL, |
430 | 430 | QSO_desc text NOT NULL, |
431 | 431 | QST_ID int(10) unsigned NOT NULL, |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | PRIMARY KEY (QSO_ID), |
436 | 436 | KEY QST_ID (QST_ID), |
437 | 437 | KEY QSO_order (QSO_order)"; |
438 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
438 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
439 | 439 | |
440 | 440 | |
441 | 441 | |
@@ -481,8 +481,8 @@ discard block |
||
481 | 481 | |
482 | 482 | |
483 | 483 | |
484 | - $table_name='esp_checkin'; |
|
485 | - $sql="CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
484 | + $table_name = 'esp_checkin'; |
|
485 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
486 | 486 | REG_ID int(10) unsigned NOT NULL, |
487 | 487 | DTT_ID int(10) unsigned NOT NULL, |
488 | 488 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | PRC_parent int(10) unsigned DEFAULT 0, |
578 | 578 | PRIMARY KEY (PRC_ID), |
579 | 579 | KEY PRT_ID (PRT_ID)"; |
580 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
580 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
581 | 581 | |
582 | 582 | $table_name = "esp_price_type"; |
583 | 583 | $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
@@ -615,10 +615,10 @@ discard block |
||
615 | 615 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
616 | 616 | PRIMARY KEY (TKT_ID), |
617 | 617 | KEY TKT_start_date (TKT_start_date)"; |
618 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
618 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
619 | 619 | |
620 | 620 | $table_name = 'esp_question_group'; |
621 | - $sql='QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
621 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
622 | 622 | QSG_name varchar(255) NOT NULL, |
623 | 623 | QSG_identifier varchar(100) NOT NULL, |
624 | 624 | QSG_desc text NULL, |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | PRIMARY KEY (QSG_ID), |
632 | 632 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
633 | 633 | KEY QSG_order (QSG_order)'; |
634 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
634 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
635 | 635 | |
636 | 636 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
637 | 637 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | return $script_4_7_defaults->schema_changes_after_migration(); |
668 | 668 | } |
669 | 669 | |
670 | - public function migration_page_hooks(){ |
|
670 | + public function migration_page_hooks() { |
|
671 | 671 | |
672 | 672 | } |
673 | 673 | |
@@ -681,19 +681,19 @@ discard block |
||
681 | 681 | //CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active |
682 | 682 | //('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
683 | 683 | $newer_countries = array( |
684 | - array( 'AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0 ), |
|
685 | - array( 'BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
686 | - array( 'CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0 ), |
|
687 | - array( 'GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0 ), |
|
688 | - array( 'IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
689 | - array( 'JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
690 | - array( 'MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
691 | - array( 'ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0 ), |
|
692 | - array( 'RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0 ), |
|
693 | - array( 'SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0 ), |
|
694 | - array( 'SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0 ), |
|
695 | - array( 'XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0 ), |
|
696 | - array( 'YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0 ), |
|
684 | + array('AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
685 | + array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
686 | + array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
687 | + array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
688 | + array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
689 | + array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
690 | + array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
691 | + array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
692 | + array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0), |
|
693 | + array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
694 | + array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
695 | + array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0), |
|
696 | + array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
697 | 697 | ); |
698 | 698 | global $wpdb; |
699 | 699 | $country_table = $wpdb->prefix."esp_country"; |
@@ -712,14 +712,14 @@ discard block |
||
712 | 712 | "CNT_is_EU" => '%d', |
713 | 713 | "CNT_active" => '%d', |
714 | 714 | ); |
715 | - if ( $this->_get_table_analysis()->tableExists( $country_table ) ) { |
|
716 | - foreach( $newer_countries as $country ) { |
|
717 | - $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1" ; |
|
715 | + if ($this->_get_table_analysis()->tableExists($country_table)) { |
|
716 | + foreach ($newer_countries as $country) { |
|
717 | + $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
718 | 718 | $countries = $wpdb->get_var($SQL); |
719 | - if ( ! $countries ) { |
|
719 | + if ( ! $countries) { |
|
720 | 720 | |
721 | - $wpdb->insert( $country_table, |
|
722 | - array_combine( array_keys( $country_format), $country ), |
|
721 | + $wpdb->insert($country_table, |
|
722 | + array_combine(array_keys($country_format), $country), |
|
723 | 723 | $country_format |
724 | 724 | ); |
725 | 725 | } |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
738 | 738 | //( 'EUR', 'Euro', 'Euros', '€', 2,1), |
739 | 739 | $newer_currencies = array( |
740 | - array( 'RSD', 'Dinar', 'Dinars', '', 3, 1 ), |
|
740 | + array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
741 | 741 | ); |
742 | 742 | global $wpdb; |
743 | 743 | $currency_table = $wpdb->prefix."esp_currency"; |
@@ -749,14 +749,14 @@ discard block |
||
749 | 749 | "CUR_dec_plc" => '%d', |
750 | 750 | "CUR_active" => '%d', |
751 | 751 | ); |
752 | - if ( $this->_get_table_analysis()->tableExists( $currency_table ) ) { |
|
753 | - foreach( $newer_currencies as $currency ) { |
|
754 | - $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1" ; |
|
752 | + if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
753 | + foreach ($newer_currencies as $currency) { |
|
754 | + $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
755 | 755 | $countries = $wpdb->get_var($SQL); |
756 | - if ( ! $countries ) { |
|
756 | + if ( ! $countries) { |
|
757 | 757 | |
758 | - $wpdb->insert( $currency_table, |
|
759 | - array_combine( array_keys( $currency_format), $currency ), |
|
758 | + $wpdb->insert($currency_table, |
|
759 | + array_combine(array_keys($currency_format), $currency), |
|
760 | 760 | $currency_format |
761 | 761 | ); |
762 | 762 | } |
@@ -768,9 +768,9 @@ discard block |
||
768 | 768 | * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
769 | 769 | * we should be able to stop doing this in 4.9 |
770 | 770 | */ |
771 | - public function fix_non_default_taxes(){ |
|
771 | + public function fix_non_default_taxes() { |
|
772 | 772 | global $wpdb; |
773 | - $query = $wpdb->prepare( "UPDATE |
|
773 | + $query = $wpdb->prepare("UPDATE |
|
774 | 774 | {$wpdb->prefix}esp_price p INNER JOIN |
775 | 775 | {$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID |
776 | 776 | SET |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | WHERE |
779 | 779 | p.PRC_is_default = 0 AND |
780 | 780 | pt.PBT_ID = %d |
781 | - ", EEM_Price_Type::base_type_tax ); |
|
782 | - $wpdb->query( $query ); |
|
781 | + ", EEM_Price_Type::base_type_tax); |
|
782 | + $wpdb->query($query); |
|
783 | 783 | } |
784 | 784 | } |
@@ -71,11 +71,11 @@ |
||
71 | 71 | if ( version_compare( $version_string, '4.8.0', '<=' ) && version_compare( $version_string, '4.7.0', '>=' ) ) { |
72 | 72 | // echo "$version_string can be migrated from"; |
73 | 73 | return true; |
74 | - }elseif( ! $version_string ){ |
|
74 | + } elseif( ! $version_string ){ |
|
75 | 75 | // echo "no version string provided: $version_string"; |
76 | 76 | //no version string provided... this must be pre 4.3 |
77 | 77 | return false;//changed mind. dont want people thinking they should migrate yet because they cant |
78 | - }else{ |
|
78 | + } else{ |
|
79 | 79 | // echo "$version_string doesnt apply"; |
80 | 80 | return false; |
81 | 81 | } |