@@ -91,6 +91,7 @@ |
||
| 91 | 91 | * @param EE_Registration $registration |
| 92 | 92 | * @param EE_Question $question |
| 93 | 93 | * @param mixed EE_Answer|NULL $answer |
| 94 | + * @param EE_Answer $answer |
|
| 94 | 95 | * @return EE_Form_Input_Base |
| 95 | 96 | */ |
| 96 | 97 | public function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
| 2 | 2 | /** |
| 3 | - * |
|
| 4 | - * Class EE_Registration_Question_Group_Reg_Form |
|
| 5 | - * |
|
| 6 | - * For auto-generating form sections for an EE_Transaction |
|
| 7 | - * |
|
| 8 | - * @package Event Espresso |
|
| 9 | - * @subpackage core |
|
| 10 | - * @author Brent Christensen |
|
| 11 | - * @since 4.5.0 |
|
| 12 | - * |
|
| 13 | - */ |
|
| 3 | + * |
|
| 4 | + * Class EE_Registration_Question_Group_Reg_Form |
|
| 5 | + * |
|
| 6 | + * For auto-generating form sections for an EE_Transaction |
|
| 7 | + * |
|
| 8 | + * @package Event Espresso |
|
| 9 | + * @subpackage core |
|
| 10 | + * @author Brent Christensen |
|
| 11 | + * @since 4.5.0 |
|
| 12 | + * |
|
| 13 | + */ |
|
| 14 | 14 | |
| 15 | 15 | class EE_Registration_Question_Group_Reg_Form extends EE_Form_Section_Proper { |
| 16 | 16 | |
@@ -20,15 +20,15 @@ discard block |
||
| 20 | 20 | * @param EE_Question_Group $question_group |
| 21 | 21 | * @return EE_Registration_Question_Group_Reg_Form |
| 22 | 22 | */ |
| 23 | - public function __construct( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
| 23 | + public function __construct(EE_Registration $registration, EE_Question_Group $question_group) { |
|
| 24 | 24 | // array of params to pass to parent constructor |
| 25 | 25 | $form_args = array( |
| 26 | 26 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
| 27 | 27 | 'subsections' => array(), |
| 28 | 28 | 'name' => $question_group->identifier(), |
| 29 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
| 29 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
| 30 | 30 | 'html_class' => 'ee-reg-form-qstn-grp-dv', |
| 31 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl' |
|
| 31 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl' |
|
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | 34 | $questions = $question_group->get_many_related( |
@@ -37,20 +37,20 @@ discard block |
||
| 37 | 37 | array( |
| 38 | 38 | // where params |
| 39 | 39 | 'QST_deleted' => 0, |
| 40 | - 'QST_admin_only' => is_admin() ? 1 :0 |
|
| 40 | + 'QST_admin_only' => is_admin() ? 1 : 0 |
|
| 41 | 41 | ), |
| 42 | 42 | 'order_by'=>array( |
| 43 | 43 | 'Question_Group_Question.QGQ_order' =>'ASC' |
| 44 | 44 | ) |
| 45 | 45 | ) |
| 46 | 46 | ); |
| 47 | - foreach ( $questions as $question ) { |
|
| 48 | - if( $question instanceof EE_Question ){ |
|
| 49 | - $form_args['subsections'][] = $this->_reg_form_question( $registration, $question ); |
|
| 47 | + foreach ($questions as $question) { |
|
| 48 | + if ($question instanceof EE_Question) { |
|
| 49 | + $form_args['subsections'][] = $this->_reg_form_question($registration, $question); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | // d( $form_args ); |
| 53 | - parent::__construct( $form_args ); |
|
| 53 | + parent::__construct($form_args); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -59,29 +59,29 @@ discard block |
||
| 59 | 59 | * @param EE_Question $question |
| 60 | 60 | * @return EE_Form_Input_Base |
| 61 | 61 | */ |
| 62 | - public function _reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
| 62 | + public function _reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
| 63 | 63 | |
| 64 | 64 | // if this question was for an attendee detail, then check for that answer |
| 65 | - $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->ID() ); |
|
| 66 | - $answer = $registration->reg_url_link() || ! $answer_value ? EEM_Answer::instance()->get_one( array( array( 'QST_ID'=>$question->ID(), 'REG_ID'=>$registration->ID() ))) : NULL; |
|
| 65 | + $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->ID()); |
|
| 66 | + $answer = $registration->reg_url_link() || ! $answer_value ? EEM_Answer::instance()->get_one(array(array('QST_ID'=>$question->ID(), 'REG_ID'=>$registration->ID()))) : NULL; |
|
| 67 | 67 | // if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object |
| 68 | - if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) { |
|
| 68 | + if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) { |
|
| 69 | 69 | // create an EE_Answer object for storing everything in |
| 70 | - $answer = EE_Answer::new_instance ( array( |
|
| 70 | + $answer = EE_Answer::new_instance(array( |
|
| 71 | 71 | 'QST_ID'=> $question->ID(), |
| 72 | 72 | 'REG_ID'=> $registration->ID() |
| 73 | 73 | )); |
| 74 | 74 | } |
| 75 | 75 | // verify instance |
| 76 | - if( $answer instanceof EE_Answer ){ |
|
| 77 | - if ( ! empty( $answer_value )) { |
|
| 78 | - $answer->set( 'ANS_value', $answer_value ); |
|
| 76 | + if ($answer instanceof EE_Answer) { |
|
| 77 | + if ( ! empty($answer_value)) { |
|
| 78 | + $answer->set('ANS_value', $answer_value); |
|
| 79 | 79 | } |
| 80 | - $answer->cache( 'Question', $question ); |
|
| 81 | - $answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link(); |
|
| 82 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
| 80 | + $answer->cache('Question', $question); |
|
| 81 | + $answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link(); |
|
| 82 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
| 83 | 83 | } |
| 84 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
| 84 | + return $this->_generate_question_input($registration, $question, $answer); |
|
| 85 | 85 | |
| 86 | 86 | } |
| 87 | 87 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param mixed EE_Answer|NULL $answer |
| 94 | 94 | * @return EE_Form_Input_Base |
| 95 | 95 | */ |
| 96 | - public function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
| 96 | + public function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
| 97 | 97 | // d( $registration ); |
| 98 | 98 | // d( $question ); |
| 99 | 99 | // d( $answer ); |
@@ -115,22 +115,22 @@ discard block |
||
| 115 | 115 | // raw_value; |
| 116 | 116 | $input_constructor_args = array( |
| 117 | 117 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
| 118 | - 'name' => $registration->reg_url_link() . '-' . $question->ID(), |
|
| 119 | - 'html_name' => 'ee_reg_qstn[' . $registration->reg_url_link() . '][' . $question->ID() . ']', |
|
| 120 | - 'html_id' => 'ee-reg-qstn-' . $registration->reg_url_link() . '-' . $question->ID(), |
|
| 118 | + 'name' => $registration->reg_url_link().'-'.$question->ID(), |
|
| 119 | + 'html_name' => 'ee_reg_qstn['.$registration->reg_url_link().']['.$question->ID().']', |
|
| 120 | + 'html_id' => 'ee-reg-qstn-'.$registration->reg_url_link().'-'.$question->ID(), |
|
| 121 | 121 | 'html_class' => 'ee-reg-qstn', |
| 122 | 122 | 'required' => $question->required(), |
| 123 | - 'html_label_id' => 'ee-reg-qstn-' . $registration->reg_url_link() . '-' . $question->ID() . '-lbl', |
|
| 123 | + 'html_label_id' => 'ee-reg-qstn-'.$registration->reg_url_link().'-'.$question->ID().'-lbl', |
|
| 124 | 124 | 'html_label_class' => 'ee-reg-qstn-lbl', |
| 125 | 125 | 'html_label_text' => $question->display_text() |
| 126 | 126 | ); |
| 127 | 127 | |
| 128 | - if ( $answer instanceof EE_Answer ) { |
|
| 129 | - $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']'; |
|
| 128 | + if ($answer instanceof EE_Answer) { |
|
| 129 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
| 130 | 130 | $input_constructor_args['default'] .= $answer->value(); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - switch ( $question->type() ) { |
|
| 133 | + switch ($question->type()) { |
|
| 134 | 134 | // Text |
| 135 | 135 | case EEM_Question::QST_type_text : |
| 136 | 136 | $input_class = 'EE_Text_Input'; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | break; |
| 158 | 158 | } |
| 159 | 159 | // d( $input_constructor_args ); |
| 160 | - return new $input_class( $input_constructor_args ); |
|
| 160 | + return new $input_class($input_constructor_args); |
|
| 161 | 161 | |
| 162 | 162 | } |
| 163 | 163 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | - * @return boolean |
|
| 45 | + * @return boolean|null |
|
| 46 | 46 | */ |
| 47 | 47 | public function initialize_reg_step() { |
| 48 | 48 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | - * @return boolean |
|
| 172 | + * @return boolean|null |
|
| 173 | 173 | */ |
| 174 | 174 | public function update_reg_step() { |
| 175 | 175 | EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' ); |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
| 2 | 2 | /** |
| 3 | - * |
|
| 4 | - * Class EE_SPCO_Reg_Step_Finalize_Registration |
|
| 5 | - * |
|
| 6 | - * Description |
|
| 7 | - * |
|
| 8 | - * @package Event Espresso |
|
| 9 | - * @subpackage core |
|
| 10 | - * @author Brent Christensen |
|
| 11 | - * @since 4.5.0 |
|
| 12 | - * |
|
| 13 | - */ |
|
| 3 | + * |
|
| 4 | + * Class EE_SPCO_Reg_Step_Finalize_Registration |
|
| 5 | + * |
|
| 6 | + * Description |
|
| 7 | + * |
|
| 8 | + * @package Event Espresso |
|
| 9 | + * @subpackage core |
|
| 10 | + * @author Brent Christensen |
|
| 11 | + * @since 4.5.0 |
|
| 12 | + * |
|
| 13 | + */ |
|
| 14 | 14 | class EE_SPCO_Reg_Step_Finalize_Registration extends EE_SPCO_Reg_Step { |
| 15 | 15 | |
| 16 | 16 | /** |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * @param EE_Checkout $checkout |
| 21 | 21 | * @return \EE_SPCO_Reg_Step_Finalize_Registration |
| 22 | 22 | */ |
| 23 | - public function __construct( EE_Checkout $checkout ) { |
|
| 23 | + public function __construct(EE_Checkout $checkout) { |
|
| 24 | 24 | $this->_slug = 'finalize_registration'; |
| 25 | 25 | $this->_name = __('Finalize Registration', 'event_espresso'); |
| 26 | 26 | $this->_submit_button_text = $this->_name; |
@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | public function initialize_reg_step() { |
| 48 | 48 | |
| 49 | 49 | // there's actually no reg form to process if this is the final step |
| 50 | - if ( $this->is_current_step() ) { |
|
| 50 | + if ($this->is_current_step()) { |
|
| 51 | 51 | $this->checkout->step = $_REQUEST['step'] = $this->slug(); |
| 52 | - $this->checkout->action = $_REQUEST[ 'action' ] = 'process_reg_step'; |
|
| 52 | + $this->checkout->action = $_REQUEST['action'] = 'process_reg_step'; |
|
| 53 | 53 | $this->checkout->generate_reg_form = false; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function process_reg_step() { |
| 74 | 74 | // ensure all data gets refreshed from the db |
| 75 | - $this->checkout->refresh_all_entities( true ); |
|
| 75 | + $this->checkout->refresh_all_entities(true); |
|
| 76 | 76 | // ensures that all details and statuses for transaction, registration, and payments are updated |
| 77 | 77 | $txn_update_params = $this->_finalize_transaction(); |
| 78 | 78 | // DEBUG LOG |
@@ -87,16 +87,16 @@ discard block |
||
| 87 | 87 | // ) |
| 88 | 88 | //); |
| 89 | 89 | // set a hook point |
| 90 | - do_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params ); |
|
| 90 | + do_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params); |
|
| 91 | 91 | // check if transaction has a primary registrant and that it has a related Attendee object |
| 92 | - if ( $this->checkout->transaction_has_primary_registrant() ) { |
|
| 92 | + if ($this->checkout->transaction_has_primary_registrant()) { |
|
| 93 | 93 | // setup URL for redirect |
| 94 | 94 | $this->checkout->redirect_url = add_query_arg( |
| 95 | - array( 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link() ), |
|
| 95 | + array('e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()), |
|
| 96 | 96 | $this->checkout->thank_you_page_url |
| 97 | 97 | ); |
| 98 | 98 | } else { |
| 99 | - EE_Error::add_error( __( 'A valid Primary Registration for this Transaction could not be found.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 99 | + EE_Error::add_error(__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 100 | 100 | $this->checkout->redirect = false; |
| 101 | 101 | $this->checkout->continue_reg = false; |
| 102 | 102 | return false; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | // you don't have to go home but you can't stay here ! |
| 105 | 105 | $this->checkout->redirect = true; |
| 106 | 106 | $this->checkout->continue_reg = true; |
| 107 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
| 107 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
| 108 | 108 | // mark this reg step as completed |
| 109 | 109 | $this->checkout->current_step->set_completed(); |
| 110 | 110 | $this->checkout->set_exit_spco(); |
@@ -120,21 +120,21 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | protected function _finalize_transaction() { |
| 122 | 122 | /** @type EE_Transaction_Processor $transaction_processor */ |
| 123 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
| 123 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
| 124 | 124 | //set revisit flag in txn processor |
| 125 | - $transaction_processor->set_revisit( $this->checkout->revisit ); |
|
| 125 | + $transaction_processor->set_revisit($this->checkout->revisit); |
|
| 126 | 126 | // at this point we'll consider a TXN to not have been abandoned |
| 127 | - $transaction_processor->toggle_abandoned_transaction_status( $this->checkout->transaction ); |
|
| 128 | - if ( $this->checkout->cart instanceof EE_Cart ) { |
|
| 127 | + $transaction_processor->toggle_abandoned_transaction_status($this->checkout->transaction); |
|
| 128 | + if ($this->checkout->cart instanceof EE_Cart) { |
|
| 129 | 129 | // save TXN data to the cart |
| 130 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() ); |
|
| 130 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID()); |
|
| 131 | 131 | } |
| 132 | 132 | /** @type EE_Transaction_Payments $transaction_payments */ |
| 133 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
| 133 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
| 134 | 134 | // maybe update status, but don't save transaction just yet |
| 135 | - $transaction_payments->update_transaction_status_based_on_total_paid( $this->checkout->transaction, false ); |
|
| 135 | + $transaction_payments->update_transaction_status_based_on_total_paid($this->checkout->transaction, false); |
|
| 136 | 136 | // If the selected method of payment used an off-site gateway... |
| 137 | - if ( $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
| 137 | + if ($this->checkout->payment_method instanceof EE_Payment_Method) { |
|
| 138 | 138 | // if SPCO revisit and TXN status has changed due to a payment |
| 139 | 139 | //if ( |
| 140 | 140 | // filter_var( $this->checkout->revisit, FILTER_VALIDATE_BOOLEAN ) && |
@@ -144,17 +144,17 @@ discard block |
||
| 144 | 144 | // add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
| 145 | 145 | //} |
| 146 | 146 | |
| 147 | - if ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) { |
|
| 148 | - $gateway= $this->checkout->payment_method->type_obj()->get_gateway(); |
|
| 149 | - if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) { |
|
| 147 | + if ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site()) { |
|
| 148 | + $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
|
| 149 | + if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) { |
|
| 150 | 150 | // do NOT trigger notifications because it was already done during the IPN |
| 151 | - remove_all_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications' ); |
|
| 152 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
| 151 | + remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications'); |
|
| 152 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | // this will result in the base session properties getting saved to the TXN_Session_data field |
| 157 | - $this->checkout->transaction->set_txn_session_data( EE_Registry::instance()->SSN->get_session_data( null, true )); |
|
| 157 | + $this->checkout->transaction->set_txn_session_data(EE_Registry::instance()->SSN->get_session_data(null, true)); |
|
| 158 | 158 | // update the TXN if payment conditions have changed |
| 159 | 159 | return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
| 160 | 160 | $this->checkout->transaction, |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * @return boolean |
| 170 | 170 | */ |
| 171 | 171 | public function update_reg_step() { |
| 172 | - EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' ); |
|
| 172 | + EE_Error::doing_it_wrong(__CLASS__.'::'.__FILE__, __('Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0'); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | |
@@ -4,14 +4,14 @@ discard block |
||
| 4 | 4 | */ |
| 5 | 5 | ?> |
| 6 | 6 | <h1> |
| 7 | - <?php _e( 'Reset/Delete Data for Event Espresso', 'event_espresso' );?> |
|
| 7 | + <?php _e('Reset/Delete Data for Event Espresso', 'event_espresso'); ?> |
|
| 8 | 8 | </h1> |
| 9 | 9 | <br /> |
| 10 | 10 | |
| 11 | 11 | <!-- reset DB url is here. Just need to make it look pretty and unhide it--> |
| 12 | 12 | <div class="padding"> |
| 13 | - <h3 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php _e('Reset Event Espresso Capabilities', 'event_espresso');?></h3> |
|
| 14 | - <p><?php _e('Use this to reset the capabilities on WP roles to the defaults as defined via EE_Capabilities. Note this reset does not REMOVE any existing capabilities, it just ensures that all the defaults are ADDED to the roles.', 'event_espresso');?></p> |
|
| 13 | + <h3 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php _e('Reset Event Espresso Capabilities', 'event_espresso'); ?></h3> |
|
| 14 | + <p><?php _e('Use this to reset the capabilities on WP roles to the defaults as defined via EE_Capabilities. Note this reset does not REMOVE any existing capabilities, it just ensures that all the defaults are ADDED to the roles.', 'event_espresso'); ?></p> |
|
| 15 | 15 | <div class="float-right"><?php echo $reset_capabilities_button; ?></div> |
| 16 | 16 | <div class="clear"></div> |
| 17 | 17 | </div> |
@@ -19,24 +19,24 @@ discard block |
||
| 19 | 19 | <br /> |
| 20 | 20 | |
| 21 | 21 | <div class="padding"> |
| 22 | - <h3 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php _e('Reset Event Espresso Tables', 'event_espresso');?></h3> |
|
| 23 | - <p><?php _e('Use this to reset Event Espresso Data and return your site to how it was just after first activating Event Espresso.', 'event_espresso');?></p> |
|
| 24 | - <div class="float-right"><a class="button button-primary" href="<?php echo $reset_db_url;?>"><?php _e('Reset Event Espresso Tables', 'event_espresso');?></a></div> |
|
| 22 | + <h3 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php _e('Reset Event Espresso Tables', 'event_espresso'); ?></h3> |
|
| 23 | + <p><?php _e('Use this to reset Event Espresso Data and return your site to how it was just after first activating Event Espresso.', 'event_espresso'); ?></p> |
|
| 24 | + <div class="float-right"><a class="button button-primary" href="<?php echo $reset_db_url; ?>"><?php _e('Reset Event Espresso Tables', 'event_espresso'); ?></a></div> |
|
| 25 | 25 | <div class="clear"></div> |
| 26 | 26 | </div> |
| 27 | 27 | <br /> |
| 28 | 28 | <br /> |
| 29 | 29 | |
| 30 | 30 | <div class="padding"> |
| 31 | - <h3 class="espresso-header"><span class="dashicons dashicons-post-trash ee-icon-size-22"></span><?php _e('Permanently Delete ALL Event Espresso Tables and Data', 'event_espresso');?></h3> |
|
| 32 | - <p><?php _e('If you know for certain that you will no longer be using Event Espresso and you wish to remove ALL traces of the plugin from your system, then perform the following steps.', 'event_espresso');?></p> |
|
| 33 | - <p class="important-notice"><?php printf( __('Please note: %sThis is permanent and can NOT be undone.%s', 'event_espresso'), '<strong>', '</strong>' ); ?><br/></p> |
|
| 31 | + <h3 class="espresso-header"><span class="dashicons dashicons-post-trash ee-icon-size-22"></span><?php _e('Permanently Delete ALL Event Espresso Tables and Data', 'event_espresso'); ?></h3> |
|
| 32 | + <p><?php _e('If you know for certain that you will no longer be using Event Espresso and you wish to remove ALL traces of the plugin from your system, then perform the following steps.', 'event_espresso'); ?></p> |
|
| 33 | + <p class="important-notice"><?php printf(__('Please note: %sThis is permanent and can NOT be undone.%s', 'event_espresso'), '<strong>', '</strong>'); ?><br/></p> |
|
| 34 | 34 | <ol> |
| 35 | - <li><?php _e('First, click the button below to permanently delete all Event Espresso tables, records, and options from your WordPress database', 'event_espresso');?></li> |
|
| 36 | - <li><?php printf( __('Then, locate Event Espresso on the WordPress Plugins page, and click on %sDelete%s', 'event_espresso'), '<strong>', '</strong>' ); ?></li> |
|
| 37 | - <li><?php printf( __('Once you are on the Delete Plugin page, click on %sYes, Delete these files and data%s', 'event_espresso'), '<strong>', '</strong>' ); ?></li> |
|
| 35 | + <li><?php _e('First, click the button below to permanently delete all Event Espresso tables, records, and options from your WordPress database', 'event_espresso'); ?></li> |
|
| 36 | + <li><?php printf(__('Then, locate Event Espresso on the WordPress Plugins page, and click on %sDelete%s', 'event_espresso'), '<strong>', '</strong>'); ?></li> |
|
| 37 | + <li><?php printf(__('Once you are on the Delete Plugin page, click on %sYes, Delete these files and data%s', 'event_espresso'), '<strong>', '</strong>'); ?></li> |
|
| 38 | 38 | </ol> |
| 39 | - <div class="float-right"><a href="<?php echo $delete_db_url; ?>" id="delete-all-data-btn" class="button-primary"><?php _e('Permanently Delete All Event Espresso Data', 'event_espresso');?></a></div> |
|
| 39 | + <div class="float-right"><a href="<?php echo $delete_db_url; ?>" id="delete-all-data-btn" class="button-primary"><?php _e('Permanently Delete All Event Espresso Data', 'event_espresso'); ?></a></div> |
|
| 40 | 40 | <div class="clear"></div> |
| 41 | 41 | </div> |
| 42 | 42 | <br/> |
@@ -12,70 +12,70 @@ discard block |
||
| 12 | 12 | * @var $update_migration_script_page_link string |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -if ( $show_backup_db_text ) { ?> |
|
| 16 | -<h1><span class="dashicons dashicons-migrate"></span><?php _e("Database Migration Manager", "event_espresso");?></h1> |
|
| 15 | +if ($show_backup_db_text) { ?> |
|
| 16 | +<h1><span class="dashicons dashicons-migrate"></span><?php _e("Database Migration Manager", "event_espresso"); ?></h1> |
|
| 17 | 17 | <?php } ?> |
| 18 | 18 | <div class="padding"> |
| 19 | 19 | <div id="migration-prep"> |
| 20 | 20 | |
| 21 | - <?php if ( $script_names ) { ?> |
|
| 21 | + <?php if ($script_names) { ?> |
|
| 22 | 22 | <h3 class="espresso-header"> |
| 23 | 23 | <span class="dashicons dashicons-flag ee-icon-size-22"></span> |
| 24 | - <?php echo apply_filters('FHEE__ee_migration_page__header', sprintf(__("Event Espresso has detected event data from version %s that can be migrated (updated) to work with version %s.", "event_espresso"),$current_db_state,$next_db_state),$current_db_state,$next_db_state);?> |
|
| 24 | + <?php echo apply_filters('FHEE__ee_migration_page__header', sprintf(__("Event Espresso has detected event data from version %s that can be migrated (updated) to work with version %s.", "event_espresso"), $current_db_state, $next_db_state), $current_db_state, $next_db_state); ?> |
|
| 25 | 25 | </h3> |
| 26 | 26 | <p> |
| 27 | - <?php echo apply_filters('FHEE__ee_migration_page__p_after_header',sprintf(__("Since you have already been using Event Espresso and have previous event and registration data in your database, you have the option to migrate, or copy over, this existing data into a format that is compatible with %s.", "event_espresso"),$next_db_state),$next_db_state);?> |
|
| 27 | + <?php echo apply_filters('FHEE__ee_migration_page__p_after_header', sprintf(__("Since you have already been using Event Espresso and have previous event and registration data in your database, you have the option to migrate, or copy over, this existing data into a format that is compatible with %s.", "event_espresso"), $next_db_state), $next_db_state); ?> |
|
| 28 | 28 | </p> |
| 29 | - <?php } elseif ( $show_most_recent_migration ) { ?> |
|
| 29 | + <?php } elseif ($show_most_recent_migration) { ?> |
|
| 30 | 30 | <h3 class="espresso-header"> |
| 31 | 31 | <span class="dashicons dashicons-awards ee-icon-size-22"></span> |
| 32 | - <?php echo apply_filters('FHEE__ee_migration_page__done_migration_header',sprintf(__('Congratulations! Your database is "up-to-date" and you are ready to begin using %s', "event_espresso"),$ultimate_db_state));?> |
|
| 32 | + <?php echo apply_filters('FHEE__ee_migration_page__done_migration_header', sprintf(__('Congratulations! Your database is "up-to-date" and you are ready to begin using %s', "event_espresso"), $ultimate_db_state)); ?> |
|
| 33 | 33 | </h3> |
| 34 | 34 | <p> |
| 35 | - <?php echo apply_filters('FHEE__ee_migration_page__p_after_done_migration_header',sprintf(__("Time to find out about all the great new features %s has to offer.", "event_espresso"),$ultimate_db_state));?> |
|
| 36 | - <b><a id="get-started-after-migrate" class="button-primary" href="<?php echo add_query_arg( array( 'page' => 'espresso_about' ), admin_url( 'admin.php' )); ?>"> |
|
| 37 | - <?php _e("Let's Get Started", "event_espresso");?> <span class="dashicons dashicons-arrow-right ee-icon-size-22" style="margin:0;"></span> |
|
| 35 | + <?php echo apply_filters('FHEE__ee_migration_page__p_after_done_migration_header', sprintf(__("Time to find out about all the great new features %s has to offer.", "event_espresso"), $ultimate_db_state)); ?> |
|
| 36 | + <b><a id="get-started-after-migrate" class="button-primary" href="<?php echo add_query_arg(array('page' => 'espresso_about'), admin_url('admin.php')); ?>"> |
|
| 37 | + <?php _e("Let's Get Started", "event_espresso"); ?> <span class="dashicons dashicons-arrow-right ee-icon-size-22" style="margin:0;"></span> |
|
| 38 | 38 | </a></b> |
| 39 | 39 | </p> |
| 40 | 40 | <?php } ?> |
| 41 | 41 | |
| 42 | 42 | |
| 43 | - <?php if ($show_backup_db_text){ ?> |
|
| 43 | + <?php if ($show_backup_db_text) { ?> |
|
| 44 | 44 | <div id="migration-options-dv"> |
| 45 | 45 | <h2> |
| 46 | 46 | <span class="dashicons dashicons-admin-tools"></span> |
| 47 | - <?php _e("Migration Options", "event_espresso");?> |
|
| 48 | - <span class="tiny-text lt-grey-text"> <?php _e(' to migrate or not to migrate?', "event_espresso");?></span> |
|
| 47 | + <?php _e("Migration Options", "event_espresso"); ?> |
|
| 48 | + <span class="tiny-text lt-grey-text"> <?php _e(' to migrate or not to migrate?', "event_espresso"); ?></span> |
|
| 49 | 49 | </h2> |
| 50 | 50 | <div class="ee-table-wrap"> |
| 51 | 51 | <table> |
| 52 | 52 | <tbody> |
| 53 | 53 | <tr> |
| 54 | - <td><h3><?php _e('1', 'event_espresso');?></h3></td> |
|
| 54 | + <td><h3><?php _e('1', 'event_espresso'); ?></h3></td> |
|
| 55 | 55 | <td> |
| 56 | 56 | <?php |
| 57 | - echo apply_filters('FHEE__ee_migration_page__option_1_main',sprintf( |
|
| 57 | + echo apply_filters('FHEE__ee_migration_page__option_1_main', sprintf( |
|
| 58 | 58 | __('%1$sYes. I have backed up my database%2$s, %3$sunderstand the risks involved%4$s, and am ready to migrate my existing %5$s data to %6$s.', "event_espresso"), |
| 59 | 59 | '<strong>', |
| 60 | 60 | '</strong>', |
| 61 | - '<a id="migration-risks" class="" title="' . esc_attr__('click for more details', "event_espresso") . '">', |
|
| 61 | + '<a id="migration-risks" class="" title="'.esc_attr__('click for more details', "event_espresso").'">', |
|
| 62 | 62 | '</a>', |
| 63 | 63 | $current_db_state, |
| 64 | 64 | $next_db_state |
| 65 | - ),$current_db_state,$next_db_state); |
|
| 65 | + ), $current_db_state, $next_db_state); |
|
| 66 | 66 | ?> |
| 67 | - <a id="display-migration-details" class="display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="migration-details" ><?php _e('click for more details', "event_espresso");?> +</a> |
|
| 68 | - <a id="hide-migration-details" class="hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="migration-details" style="display:none;" ><?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?></a> |
|
| 67 | + <a id="display-migration-details" class="display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="migration-details" ><?php _e('click for more details', "event_espresso"); ?> +</a> |
|
| 68 | + <a id="hide-migration-details" class="hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="migration-details" style="display:none;" ><?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?></a> |
|
| 69 | 69 | </td> |
| 70 | 70 | <td> |
| 71 | - <a id="db-backed-up" class="toggle-migration-monitor button-primary"><?php echo apply_filters('FHEE__ee_migration_page__option_1_button_text',sprintf(__("Migrate My %s Data to %s", "event_espresso"),$current_db_state,$next_db_state),$current_db_state,$next_db_state);?></a> |
|
| 71 | + <a id="db-backed-up" class="toggle-migration-monitor button-primary"><?php echo apply_filters('FHEE__ee_migration_page__option_1_button_text', sprintf(__("Migrate My %s Data to %s", "event_espresso"), $current_db_state, $next_db_state), $current_db_state, $next_db_state); ?></a> |
|
| 72 | 72 | </td> |
| 73 | 73 | </tr> |
| 74 | 74 | <tr> |
| 75 | 75 | <td colspan="3" style="padding: 0"> |
| 76 | 76 | <div id="migration-details-dv" style="display: none; padding: 1em;"> |
| 77 | 77 | |
| 78 | - <span class="reminder-spn"><?php printf(__("%s Important: %s Before migrating, please back up your database and files.", "event_espresso"),"<b>","</b>");?></span> |
|
| 78 | + <span class="reminder-spn"><?php printf(__("%s Important: %s Before migrating, please back up your database and files.", "event_espresso"), "<b>", "</b>"); ?></span> |
|
| 79 | 79 | <p> |
| 80 | 80 | <?php |
| 81 | 81 | printf( |
@@ -91,27 +91,27 @@ discard block |
||
| 91 | 91 | ); |
| 92 | 92 | ?> |
| 93 | 93 | </p> |
| 94 | - <?php do_action('AHEE__ee_migration_page__option_1_extra_details');?> |
|
| 94 | + <?php do_action('AHEE__ee_migration_page__option_1_extra_details'); ?> |
|
| 95 | 95 | </div> |
| 96 | 96 | </td> |
| 97 | 97 | </tr> |
| 98 | 98 | <tr> |
| 99 | - <td><h3><?php _e('2', 'event_espresso');?></h3></td> |
|
| 99 | + <td><h3><?php _e('2', 'event_espresso'); ?></h3></td> |
|
| 100 | 100 | <td> |
| 101 | - <?php echo apply_filters( 'FHEE__ee_migration_page__option_2_main',sprintf(__('I do NOT want to migrate my %1$s data to %2$s at this time and just want to use %3$s without migrating data.', "event_espresso"),$current_db_state,$next_db_state,$ultimate_db_state),$current_db_state,$next_db_state,$ultimate_db_state);?><br /> |
|
| 102 | - <span class="reminder-spn"><?php _e( 'Please Note: In order to avoid errors, any existing Event Espresso data (events, ticket, registrations, etc) in your db will be erased! Regular WP data will NOT be affected.', 'event_espresso' );?></span> |
|
| 103 | - <a id="display-no-migration-details" class="display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="no-migration-details"><?php _e('click for more details', "event_espresso");?> +</a> |
|
| 104 | - <a id="hide-no-migration-details" class="hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="no-migration-details" style="display:none;" ><?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?></a> |
|
| 101 | + <?php echo apply_filters('FHEE__ee_migration_page__option_2_main', sprintf(__('I do NOT want to migrate my %1$s data to %2$s at this time and just want to use %3$s without migrating data.', "event_espresso"), $current_db_state, $next_db_state, $ultimate_db_state), $current_db_state, $next_db_state, $ultimate_db_state); ?><br /> |
|
| 102 | + <span class="reminder-spn"><?php _e('Please Note: In order to avoid errors, any existing Event Espresso data (events, ticket, registrations, etc) in your db will be erased! Regular WP data will NOT be affected.', 'event_espresso'); ?></span> |
|
| 103 | + <a id="display-no-migration-details" class="display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="no-migration-details"><?php _e('click for more details', "event_espresso"); ?> +</a> |
|
| 104 | + <a id="hide-no-migration-details" class="hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="no-migration-details" style="display:none;" ><?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?></a> |
|
| 105 | 105 | </td> |
| 106 | 106 | <td> |
| 107 | - <a id="do-not-migrate" class="do-not-migrate button-primary" href="<?php echo $reset_db_page_link;?>"><?php echo apply_filters('FHEE__ee_migration_page__option_2_button_text',sprintf(__("Just Start %s and Delete Existing Data", "event_espresso"),$ultimate_db_state),$ultimate_db_state);?></a> |
|
| 107 | + <a id="do-not-migrate" class="do-not-migrate button-primary" href="<?php echo $reset_db_page_link; ?>"><?php echo apply_filters('FHEE__ee_migration_page__option_2_button_text', sprintf(__("Just Start %s and Delete Existing Data", "event_espresso"), $ultimate_db_state), $ultimate_db_state); ?></a> |
|
| 108 | 108 | </td> |
| 109 | 109 | </tr> |
| 110 | 110 | <tr> |
| 111 | 111 | <td colspan="3" style="padding: 0"> |
| 112 | 112 | <div id="no-migration-details-dv" style="display: none; padding: 1em;"> |
| 113 | 113 | <p> |
| 114 | - <?php echo apply_filters('FHEE__ee_migration_page__option_2_details',sprintf(__("If your existing Event and Registration Data is no longer relevant nor required, you can just start up %s without performing a data migration.", "event_espresso"),$ultimate_db_state),$ultimate_db_state);?> |
|
| 114 | + <?php echo apply_filters('FHEE__ee_migration_page__option_2_details', sprintf(__("If your existing Event and Registration Data is no longer relevant nor required, you can just start up %s without performing a data migration.", "event_espresso"), $ultimate_db_state), $ultimate_db_state); ?> |
|
| 115 | 115 | </p> |
| 116 | 116 | </div> |
| 117 | 117 | </td> |
@@ -119,20 +119,20 @@ discard block |
||
| 119 | 119 | </tbody> |
| 120 | 120 | </table> |
| 121 | 121 | </div> |
| 122 | - <?php do_action('AHEE__ee_migration_page__after_migration_options_table');?> |
|
| 122 | + <?php do_action('AHEE__ee_migration_page__after_migration_options_table'); ?> |
|
| 123 | 123 | </div> |
| 124 | 124 | <?php } ?> |
| 125 | 125 | |
| 126 | 126 | <?php |
| 127 | - if ( $show_most_recent_migration ) { |
|
| 128 | - if( $most_recent_migration && $most_recent_migration instanceof EE_Data_Migration_Script_Base ) { |
|
| 129 | - if( $most_recent_migration->can_continue() ) { |
|
| 127 | + if ($show_most_recent_migration) { |
|
| 128 | + if ($most_recent_migration && $most_recent_migration instanceof EE_Data_Migration_Script_Base) { |
|
| 129 | + if ($most_recent_migration->can_continue()) { |
|
| 130 | 130 | //tell the user they shoudl continue their migration because it appears to be unfinished... well, assuming there were no errors ?> |
| 131 | 131 | <h3 class="espresso-header"> |
| 132 | 132 | <span class="dashicons dashicons-star-half ee-icon-size-22"></span> |
| 133 | - <?php printf(__("It appears that your previous Data Migration Task (%s) is incomplete, and should be resumed", "event_espresso"),$most_recent_migration->pretty_name());?> |
|
| 133 | + <?php printf(__("It appears that your previous Data Migration Task (%s) is incomplete, and should be resumed", "event_espresso"), $most_recent_migration->pretty_name()); ?> |
|
| 134 | 134 | </h3> |
| 135 | - <?php } elseif ( $most_recent_migration->is_broken() ) { |
|
| 135 | + <?php } elseif ($most_recent_migration->is_broken()) { |
|
| 136 | 136 | //tell the user the migration failed and they should notify EE?> |
| 137 | 137 | <h3 class="espresso-header"> |
| 138 | 138 | <span class="dashicons dashicons-no ee-icon-size-22"></span> |
@@ -141,19 +141,19 @@ discard block |
||
| 141 | 141 | <?php } |
| 142 | 142 | |
| 143 | 143 | //display errors or not of the most recent migration ran |
| 144 | - if ( $most_recent_migration->get_errors() ){ ?> |
|
| 144 | + if ($most_recent_migration->get_errors()) { ?> |
|
| 145 | 145 | <div class="ee-attention"> |
| 146 | - <strong><?php printf(__("Warnings occurred during your last migration (%s):",'event_espresso'),$most_recent_migration->pretty_name()) ?></strong> |
|
| 147 | - <a id="show-hide-migration-warnings" class="display-the-hidden"><?php _e("Show Warnings", 'event_espresso');?></a> |
|
| 146 | + <strong><?php printf(__("Warnings occurred during your last migration (%s):", 'event_espresso'), $most_recent_migration->pretty_name()) ?></strong> |
|
| 147 | + <a id="show-hide-migration-warnings" class="display-the-hidden"><?php _e("Show Warnings", 'event_espresso'); ?></a> |
|
| 148 | 148 | <ul class="migration-warnings" style="display:none"> |
| 149 | - <?php foreach($most_recent_migration->get_errors() as $error){ ?> |
|
| 149 | + <?php foreach ($most_recent_migration->get_errors() as $error) { ?> |
|
| 150 | 150 | <li><?php echo $error ?></li> |
| 151 | 151 | <?php }?> |
| 152 | 152 | </ul> |
| 153 | 153 | </div> |
| 154 | 154 | <?php } else { |
| 155 | 155 | //there were no errors during the last migration, just say so?> |
| 156 | - <h2><?php printf(__("The last data migration task (%s) ran successfully without errors.", "event_espresso"),$most_recent_migration->pretty_name())?></h2> |
|
| 156 | + <h2><?php printf(__("The last data migration task (%s) ran successfully without errors.", "event_espresso"), $most_recent_migration->pretty_name())?></h2> |
|
| 157 | 157 | <?php } |
| 158 | 158 | } else { |
| 159 | 159 | } |
@@ -164,12 +164,12 @@ discard block |
||
| 164 | 164 | </div> |
| 165 | 165 | <!--end of #migration-prep--> |
| 166 | 166 | |
| 167 | - <?php if ($show_migration_progress){?> |
|
| 167 | + <?php if ($show_migration_progress) {?> |
|
| 168 | 168 | <div id='migration-monitor' <?php echo $show_backup_db_text ? "style='display:none'" : ''?>> |
| 169 | - <?php if( $show_backup_db_text){?> |
|
| 169 | + <?php if ($show_backup_db_text) {?> |
|
| 170 | 170 | <p> |
| 171 | 171 | <a class="toggle-migration-monitor small-text" style="cursor: pointer;"> |
| 172 | - <span class="dashicons dashicons-arrow-left-alt2" style="top:0px;"></span><?php _e("return to previous screen", "event_espresso");?> |
|
| 172 | + <span class="dashicons dashicons-arrow-left-alt2" style="top:0px;"></span><?php _e("return to previous screen", "event_espresso"); ?> |
|
| 173 | 173 | </a> |
| 174 | 174 | <br/> |
| 175 | 175 | |
@@ -178,33 +178,33 @@ discard block |
||
| 178 | 178 | <div id='progress-area'> |
| 179 | 179 | <h3 class="espresso-header"> |
| 180 | 180 | <?php |
| 181 | - echo sprintf( _n( |
|
| 181 | + echo sprintf(_n( |
|
| 182 | 182 | "In order to import all of your existing Event Espresso data, the following upgrade task needs to be performed:", |
| 183 | 183 | "In order to import all of your existing Event Espresso data, the following %s upgrade tasks need to be performed:", |
| 184 | 184 | count($script_names), |
| 185 | 185 | "event_espresso" |
| 186 | - ), count( $script_names ) );?> |
|
| 186 | + ), count($script_names)); ?> |
|
| 187 | 187 | </h3> |
| 188 | 188 | <ul style="list-style: inside;"> |
| 189 | - <?php foreach($script_names as $script_name){?> |
|
| 189 | + <?php foreach ($script_names as $script_name) {?> |
|
| 190 | 190 | <li style="margin: 0 0 1em 1em; line-height: 1.1em;"><?php echo $script_name?></li> |
| 191 | 191 | <?php }?> |
| 192 | 192 | </ul> |
| 193 | 193 | <br/> |
| 194 | 194 | <?php if (count($script_names) > 1) {?> |
| 195 | - <p><?php _e("Please note: after each task is completed you will need to continue the data migration, or report an error to Event Espresso.", "event_espresso");?></p> |
|
| 195 | + <p><?php _e("Please note: after each task is completed you will need to continue the data migration, or report an error to Event Espresso.", "event_espresso"); ?></p> |
|
| 196 | 196 | <?php }?> |
| 197 | 197 | |
| 198 | 198 | <div class="ee-attention"> |
| 199 | 199 | <p> |
| 200 | 200 | <span class="reminder-spn"> |
| 201 | - <strong><?php _e("Please Note:", "event_espresso");?></strong> |
|
| 201 | + <strong><?php _e("Please Note:", "event_espresso"); ?></strong> |
|
| 202 | 202 | </span> |
| 203 | 203 | <br/> |
| 204 | - <?php _e("Depending on the number of events and the complexity of the information in your database, this could take a few minutes.", "event_espresso");?> |
|
| 204 | + <?php _e("Depending on the number of events and the complexity of the information in your database, this could take a few minutes.", "event_espresso"); ?> |
|
| 205 | 205 | </p> |
| 206 | 206 | <p> |
| 207 | - <?php printf(__("%sPlease be patient and do NOT navigate away from this page once the migration has begun%s. If any issues arise due to existing malformed data, an itemized report will be made available to you after the migration has completed.", "event_espresso"),'<strong>', '</strong>' );?> |
|
| 207 | + <?php printf(__("%sPlease be patient and do NOT navigate away from this page once the migration has begun%s. If any issues arise due to existing malformed data, an itemized report will be made available to you after the migration has completed.", "event_espresso"), '<strong>', '</strong>'); ?> |
|
| 208 | 208 | </p> |
| 209 | 209 | <p> |
| 210 | 210 | <?php _e("Click the button below to begin the migration process.", "event_espresso") ?> |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | <!-- #progress-responsive --> |
| 220 | 220 | |
| 221 | 221 | <button id='start-migration' class='button-primary'> |
| 222 | - <?php echo $show_continue_current_migration_script ? __("Continue Migration", "event_espresso") : __("Begin Migration", "event_espresso");?> |
|
| 222 | + <?php echo $show_continue_current_migration_script ? __("Continue Migration", "event_espresso") : __("Begin Migration", "event_espresso"); ?> |
|
| 223 | 223 | </button> |
| 224 | 224 | <br class="clear"/> |
| 225 | 225 | |
@@ -235,9 +235,9 @@ discard block |
||
| 235 | 235 | </div> |
| 236 | 236 | |
| 237 | 237 | <?php } |
| 238 | - if ( $show_maintenance_switch ) { |
|
| 238 | + if ($show_maintenance_switch) { |
|
| 239 | 239 | ?> |
| 240 | - <h2><span class="dashicons dashicons-admin-tools"></span><?php _e('Set Event Espresso Maintenance Mode', 'event_espresso');?></h2> |
|
| 240 | + <h2><span class="dashicons dashicons-admin-tools"></span><?php _e('Set Event Espresso Maintenance Mode', 'event_espresso'); ?></h2> |
|
| 241 | 241 | <form method='post' action='<?php echo $update_migration_script_page_link?>'> |
| 242 | 242 | <div class="ee-table-wrap"> |
| 243 | 243 | <table> |
@@ -246,9 +246,9 @@ discard block |
||
| 246 | 246 | <input type="radio" id="maintenance_mode_level_off" name="maintenance_mode_level" value="0" <?php echo EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_0_not_in_maintenance ? 'checked="checked"' : ''?>> |
| 247 | 247 | </td> |
| 248 | 248 | <th align="left"> |
| 249 | - <label for="maintenance_mode_level_off"><?php _e('Maintenance Mode OFF', 'event_espresso');?></label> |
|
| 249 | + <label for="maintenance_mode_level_off"><?php _e('Maintenance Mode OFF', 'event_espresso'); ?></label> |
|
| 250 | 250 | <p class='description' style="font-weight: normal;"> |
| 251 | - <?php _e("This is the normal operating mode for Event Espresso and allows all functionality to be viewed by all site visitors.", "event_espresso");?> |
|
| 251 | + <?php _e("This is the normal operating mode for Event Espresso and allows all functionality to be viewed by all site visitors.", "event_espresso"); ?> |
|
| 252 | 252 | </p> |
| 253 | 253 | </th> |
| 254 | 254 | </tr> |
@@ -261,14 +261,14 @@ discard block |
||
| 261 | 261 | <?php _e('Maintenance Mode ON', 'event_espresso')?> |
| 262 | 262 | </label> |
| 263 | 263 | <p class='description' style="font-weight: normal;"> |
| 264 | - <?php _e("This disables Event Espresso frontend functionality for all site visitors that are not administrators, and allows you to configure and/or test things on the frontend of your website before others can see.", "event_espresso");?> |
|
| 264 | + <?php _e("This disables Event Espresso frontend functionality for all site visitors that are not administrators, and allows you to configure and/or test things on the frontend of your website before others can see.", "event_espresso"); ?> |
|
| 265 | 265 | </p> |
| 266 | 266 | </th> |
| 267 | 267 | </tr> |
| 268 | 268 | </table> |
| 269 | 269 | </div> |
| 270 | 270 | <p> |
| 271 | - <input type='submit' class="button-primary" value='<?php _e("Update Maintenance Mode", "event_espresso");?>'> |
|
| 271 | + <input type='submit' class="button-primary" value='<?php _e("Update Maintenance Mode", "event_espresso"); ?>'> |
|
| 272 | 272 | </p> |
| 273 | 273 | </form> |
| 274 | 274 | <?php |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | * @param array $arguments |
| 40 | 40 | * @return \EE_CPT_Event_Strategy |
| 41 | 41 | */ |
| 42 | - public function __construct( $arguments = array() ) { |
|
| 43 | - $this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL; |
|
| 44 | - $WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL; |
|
| 42 | + public function __construct($arguments = array()) { |
|
| 43 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL; |
|
| 44 | + $WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL; |
|
| 45 | 45 | |
| 46 | 46 | // !!!!!!!!!! IMPORTANT !!!!!!!!!!!! |
| 47 | 47 | // here's the list of available filters in the WP_Query object |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | // 'posts_fields' |
| 56 | 56 | // 'posts_join' |
| 57 | 57 | $this->_add_filters(); |
| 58 | - if ( $WP_Query instanceof WP_Query ) { |
|
| 59 | - $WP_Query->is_espresso_event_single = is_singular() && isset( $WP_Query->query->post_type ) && $WP_Query->query->post_type == 'espresso_events' ? TRUE : FALSE; |
|
| 58 | + if ($WP_Query instanceof WP_Query) { |
|
| 59 | + $WP_Query->is_espresso_event_single = is_singular() && isset($WP_Query->query->post_type) && $WP_Query->query->post_type == 'espresso_events' ? TRUE : FALSE; |
|
| 60 | 60 | $WP_Query->is_espresso_event_archive = is_post_type_archive('espresso_events') ? TRUE : FALSE; |
| 61 | - $WP_Query->is_espresso_event_taxonomy = is_tax( 'espresso_event_categories' ) ? TRUE : FALSE; |
|
| 61 | + $WP_Query->is_espresso_event_taxonomy = is_tax('espresso_event_categories') ? TRUE : FALSE; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | } |
@@ -70,13 +70,13 @@ discard block |
||
| 70 | 70 | * (which will get removed in case the next call to get_posts ISN'T |
| 71 | 71 | * for event CPTs) |
| 72 | 72 | */ |
| 73 | - protected function _add_filters(){ |
|
| 74 | - add_filter( 'posts_fields', array( $this, 'posts_fields' ), 1, 2 ); |
|
| 75 | - add_filter( 'posts_join', array( $this, 'posts_join' ), 1, 2 ); |
|
| 76 | - add_filter( 'posts_where', array( $this, 'posts_where' ), 10, 2 ); |
|
| 77 | - add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 ); |
|
| 78 | - add_filter( 'posts_orderby', array( $this, 'posts_orderby' ), 1, 2 ); |
|
| 79 | - add_filter( 'posts_groupby', array( $this, 'posts_groupby' ), 1, 2 ); |
|
| 73 | + protected function _add_filters() { |
|
| 74 | + add_filter('posts_fields', array($this, 'posts_fields'), 1, 2); |
|
| 75 | + add_filter('posts_join', array($this, 'posts_join'), 1, 2); |
|
| 76 | + add_filter('posts_where', array($this, 'posts_where'), 10, 2); |
|
| 77 | + add_filter('the_posts', array($this, 'the_posts'), 1, 2); |
|
| 78 | + add_filter('posts_orderby', array($this, 'posts_orderby'), 1, 2); |
|
| 79 | + add_filter('posts_groupby', array($this, 'posts_groupby'), 1, 2); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | * This is to avoid applying this CPT strategy for other posts or CPTs (eg, |
| 87 | 87 | * we don't want to join to the datetime table when querying for venues, do we!?) |
| 88 | 88 | */ |
| 89 | - protected function _remove_filters(){ |
|
| 90 | - remove_filter( 'posts_fields', array( $this, 'posts_fields' ), 1, 2 ); |
|
| 91 | - remove_filter( 'posts_join', array( $this, 'posts_join' ), 1, 2 ); |
|
| 92 | - remove_filter( 'posts_where', array( $this, 'posts_where' ), 10, 2 ); |
|
| 93 | - remove_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 ); |
|
| 94 | - remove_filter( 'posts_orderby', array( $this, 'posts_orderby' ), 1, 2 ); |
|
| 95 | - remove_filter( 'posts_groupby', array( $this, 'posts_groupby' ), 1, 2 ); |
|
| 89 | + protected function _remove_filters() { |
|
| 90 | + remove_filter('posts_fields', array($this, 'posts_fields'), 1, 2); |
|
| 91 | + remove_filter('posts_join', array($this, 'posts_join'), 1, 2); |
|
| 92 | + remove_filter('posts_where', array($this, 'posts_where'), 10, 2); |
|
| 93 | + remove_filter('the_posts', array($this, 'the_posts'), 1, 2); |
|
| 94 | + remove_filter('posts_orderby', array($this, 'posts_orderby'), 1, 2); |
|
| 95 | + remove_filter('posts_groupby', array($this, 'posts_groupby'), 1, 2); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @param WP_Query $wp_query |
| 106 | 106 | * @return string |
| 107 | 107 | */ |
| 108 | - public function posts_fields( $SQL, WP_Query $wp_query ) { |
|
| 108 | + public function posts_fields($SQL, WP_Query $wp_query) { |
|
| 109 | 109 | if ( |
| 110 | 110 | $wp_query instanceof WP_Query |
| 111 | 111 | && |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | ) |
| 117 | 117 | ) { |
| 118 | 118 | // adds something like ", wp_esp_datetime.* " to WP Query SELECT statement |
| 119 | - $SQL .= ', ' . EEM_Datetime::instance()->table() . '.* ' ; |
|
| 119 | + $SQL .= ', '.EEM_Datetime::instance()->table().'.* '; |
|
| 120 | 120 | } |
| 121 | 121 | return $SQL; |
| 122 | 122 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @internal param \WP_Query $WP_Query |
| 133 | 133 | * @return string |
| 134 | 134 | */ |
| 135 | - public function posts_join( $SQL, WP_Query $wp_query ) { |
|
| 135 | + public function posts_join($SQL, WP_Query $wp_query) { |
|
| 136 | 136 | if ( |
| 137 | 137 | $wp_query instanceof WP_Query |
| 138 | 138 | && |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | ) |
| 144 | 144 | ) { |
| 145 | 145 | // adds something like " LEFT JOIN wp_esp_datetime ON ( wp_esp_datetime.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement |
| 146 | - $SQL .= ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . EEM_Event::instance()->table() . '.ID = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name() . ' ) '; |
|
| 146 | + $SQL .= ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.EEM_Event::instance()->table().'.ID = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name().' ) '; |
|
| 147 | 147 | } |
| 148 | 148 | return $SQL; |
| 149 | 149 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @param WP_Query $wp_query |
| 159 | 159 | * @return string |
| 160 | 160 | */ |
| 161 | - public function posts_where( $SQL, WP_Query $wp_query ) { |
|
| 161 | + public function posts_where($SQL, WP_Query $wp_query) { |
|
| 162 | 162 | // global $wpdb; |
| 163 | 163 | if ( |
| 164 | 164 | $wp_query instanceof WP_Query |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | || $wp_query->is_espresso_event_taxonomy |
| 169 | 169 | ) |
| 170 | 170 | ) { |
| 171 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive ) || ! isset( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events ) || ! EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events ) { |
|
| 172 | - $SQL .= ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end > "' . current_time( 'mysql', TRUE ) . '" '; |
|
| 171 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive) || ! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events) || ! EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events) { |
|
| 172 | + $SQL .= ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end > "'.current_time('mysql', TRUE).'" '; |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | return $SQL; |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * @param WP_Query $wp_query |
| 186 | 186 | * @return string |
| 187 | 187 | */ |
| 188 | - public function posts_orderby( $SQL, WP_Query $wp_query ) { |
|
| 188 | + public function posts_orderby($SQL, WP_Query $wp_query) { |
|
| 189 | 189 | if ( |
| 190 | 190 | $wp_query instanceof WP_Query |
| 191 | 191 | && |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | || $wp_query->is_espresso_event_taxonomy |
| 195 | 195 | ) |
| 196 | 196 | ) { |
| 197 | - $SQL = EEM_Datetime::instance()->table() . '.DTT_EVT_start ASC'; |
|
| 197 | + $SQL = EEM_Datetime::instance()->table().'.DTT_EVT_start ASC'; |
|
| 198 | 198 | } |
| 199 | 199 | return $SQL; |
| 200 | 200 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * @param WP_Query $wp_query |
| 210 | 210 | * @return string |
| 211 | 211 | */ |
| 212 | - public function posts_groupby( $SQL, WP_Query $wp_query ) { |
|
| 212 | + public function posts_groupby($SQL, WP_Query $wp_query) { |
|
| 213 | 213 | if ( |
| 214 | 214 | $wp_query instanceof WP_Query |
| 215 | 215 | && |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | // we're joining to the datetimes table, where there can be MANY datetimes for a single event, but we want to only show each event only once |
| 223 | 223 | // (whereas if we didn't group them by the post's ID, then we would end up with many repeats) |
| 224 | 224 | global $wpdb; |
| 225 | - $SQL = $wpdb->posts . '.ID'; |
|
| 225 | + $SQL = $wpdb->posts.'.ID'; |
|
| 226 | 226 | } |
| 227 | 227 | return $SQL; |
| 228 | 228 | } |
@@ -237,8 +237,8 @@ discard block |
||
| 237 | 237 | * @param WP_Query $wp_query |
| 238 | 238 | * @return array |
| 239 | 239 | */ |
| 240 | - public function the_posts( $posts, WP_Query $wp_query ) { |
|
| 241 | - if ( $wp_query instanceof WP_Query && isset( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] == 'espresso_events' ) { |
|
| 240 | + public function the_posts($posts, WP_Query $wp_query) { |
|
| 241 | + if ($wp_query instanceof WP_Query && isset($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'espresso_events') { |
|
| 242 | 242 | // automagically load the EEH_Event_View helper so that it's functions are available |
| 243 | 243 | EE_Registry::instance()->load_helper('Event_View'); |
| 244 | 244 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | * @param $single |
| 258 | 258 | * @return string |
| 259 | 259 | */ |
| 260 | - public function get_EE_post_type_metadata( $meta_value = NULL, $post_id, $meta_key, $single ) { |
|
| 260 | + public function get_EE_post_type_metadata($meta_value = NULL, $post_id, $meta_key, $single) { |
|
| 261 | 261 | return $meta_value; |
| 262 | 262 | } |
| 263 | 263 | |
@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * Event Espresso |
| 4 | 6 | * |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * @return EE_Cron_Tasks |
| 23 | 23 | */ |
| 24 | 24 | public static function instance() { |
| 25 | - if ( ! self::$_instance instanceof EE_Cron_Tasks ) { |
|
| 25 | + if ( ! self::$_instance instanceof EE_Cron_Tasks) { |
|
| 26 | 26 | self::$_instance = new self(); |
| 27 | 27 | } |
| 28 | 28 | return self::$_instance; |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | // UPDATE TRANSACTION WITH PAYMENT |
| 39 | 39 | add_action( |
| 40 | 40 | 'AHEE__EE_Cron_Tasks__update_transaction_with_payment', |
| 41 | - array( 'EE_Cron_Tasks', 'setup_update_for_transaction_with_payment' ), |
|
| 41 | + array('EE_Cron_Tasks', 'setup_update_for_transaction_with_payment'), |
|
| 42 | 42 | 10, 2 |
| 43 | 43 | ); |
| 44 | 44 | // FINALIZE ABANDONED TRANSACTIONS |
| 45 | 45 | add_action( |
| 46 | 46 | 'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions', |
| 47 | - array( 'EE_Cron_Tasks', 'check_for_abandoned_transactions' ), |
|
| 47 | + array('EE_Cron_Tasks', 'check_for_abandoned_transactions'), |
|
| 48 | 48 | 10, 1 |
| 49 | 49 | ); |
| 50 | 50 | } |
@@ -79,13 +79,13 @@ discard block |
||
| 79 | 79 | $payment |
| 80 | 80 | ) { |
| 81 | 81 | // validate $TXN_ID and $timestamp |
| 82 | - $TXN_ID = absint( $TXN_ID ); |
|
| 83 | - $timestamp = absint( $timestamp ); |
|
| 84 | - if ( $TXN_ID && $timestamp ) { |
|
| 82 | + $TXN_ID = absint($TXN_ID); |
|
| 83 | + $timestamp = absint($timestamp); |
|
| 84 | + if ($TXN_ID && $timestamp) { |
|
| 85 | 85 | wp_schedule_single_event( |
| 86 | 86 | $timestamp, |
| 87 | 87 | 'AHEE__EE_Cron_Tasks__update_transaction_with_payment', |
| 88 | - array( $TXN_ID, $payment ) |
|
| 88 | + array($TXN_ID, $payment) |
|
| 89 | 89 | ); |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -107,12 +107,12 @@ discard block |
||
| 107 | 107 | * @param int $TXN_ID |
| 108 | 108 | * @param null $payment |
| 109 | 109 | */ |
| 110 | - public static function setup_update_for_transaction_with_payment( $TXN_ID = 0, $payment = null ) { |
|
| 111 | - if ( absint( $TXN_ID )) { |
|
| 112 | - self::$_update_transactions_with_payment[ $TXN_ID ] = $payment; |
|
| 110 | + public static function setup_update_for_transaction_with_payment($TXN_ID = 0, $payment = null) { |
|
| 111 | + if (absint($TXN_ID)) { |
|
| 112 | + self::$_update_transactions_with_payment[$TXN_ID] = $payment; |
|
| 113 | 113 | add_action( |
| 114 | 114 | 'shutdown', |
| 115 | - array( 'EE_Cron_Tasks', 'update_transaction_with_payment' ), |
|
| 115 | + array('EE_Cron_Tasks', 'update_transaction_with_payment'), |
|
| 116 | 116 | 5 |
| 117 | 117 | ); |
| 118 | 118 | } |
@@ -130,31 +130,31 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public static function update_transaction_with_payment() { |
| 132 | 132 | // are there any TXNs that need cleaning up ? |
| 133 | - if ( ! empty( self::$_update_transactions_with_payment ) ) { |
|
| 133 | + if ( ! empty(self::$_update_transactions_with_payment)) { |
|
| 134 | 134 | /** @type EE_Payment_Processor $payment_processor */ |
| 135 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
| 135 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
| 136 | 136 | // set revisit flag for payment processor |
| 137 | - $payment_processor->set_revisit( false ); |
|
| 137 | + $payment_processor->set_revisit(false); |
|
| 138 | 138 | // load EEM_Transaction |
| 139 | - EE_Registry::instance()->load_model( 'Transaction' ); |
|
| 140 | - foreach ( self::$_update_transactions_with_payment as $TXN_ID => $payment ) { |
|
| 139 | + EE_Registry::instance()->load_model('Transaction'); |
|
| 140 | + foreach (self::$_update_transactions_with_payment as $TXN_ID => $payment) { |
|
| 141 | 141 | // reschedule the cron if we can't hit the db right now |
| 142 | - if ( ! EE_Maintenance_Mode::instance()->models_can_query() ) { |
|
| 142 | + if ( ! EE_Maintenance_Mode::instance()->models_can_query()) { |
|
| 143 | 143 | // reset cron job for updating the TXN |
| 144 | 144 | EE_Cron_Tasks::schedule_update_transaction_with_payment( |
| 145 | - time() + ( 10 * MINUTE_IN_SECONDS ) + 1, |
|
| 145 | + time() + (10 * MINUTE_IN_SECONDS) + 1, |
|
| 146 | 146 | $TXN_ID, |
| 147 | 147 | $payment |
| 148 | 148 | ); |
| 149 | 149 | continue; |
| 150 | 150 | } |
| 151 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
| 151 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
| 152 | 152 | // verify transaction |
| 153 | - if ( $transaction instanceof EE_Transaction ) { |
|
| 153 | + if ($transaction instanceof EE_Transaction) { |
|
| 154 | 154 | // now try to update the TXN with any payments |
| 155 | - $payment_processor->update_txn_based_on_payment( $transaction, $payment, true, true ); |
|
| 155 | + $payment_processor->update_txn_based_on_payment($transaction, $payment, true, true); |
|
| 156 | 156 | } |
| 157 | - unset( self::$_update_transactions_with_payment[ $TXN_ID ] ); |
|
| 157 | + unset(self::$_update_transactions_with_payment[$TXN_ID]); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -191,13 +191,13 @@ discard block |
||
| 191 | 191 | $TXN_ID |
| 192 | 192 | ) { |
| 193 | 193 | // validate $TXN_ID and $timestamp |
| 194 | - $TXN_ID = absint( $TXN_ID ); |
|
| 195 | - $timestamp = absint( $timestamp ); |
|
| 196 | - if ( $TXN_ID && $timestamp ) { |
|
| 194 | + $TXN_ID = absint($TXN_ID); |
|
| 195 | + $timestamp = absint($timestamp); |
|
| 196 | + if ($TXN_ID && $timestamp) { |
|
| 197 | 197 | wp_schedule_single_event( |
| 198 | 198 | $timestamp, |
| 199 | 199 | 'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions', |
| 200 | - array( $TXN_ID ) |
|
| 200 | + array($TXN_ID) |
|
| 201 | 201 | ); |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -219,12 +219,12 @@ discard block |
||
| 219 | 219 | * |
| 220 | 220 | * @param int $TXN_ID |
| 221 | 221 | */ |
| 222 | - public static function check_for_abandoned_transactions( $TXN_ID = 0 ) { |
|
| 223 | - if ( absint( $TXN_ID )) { |
|
| 224 | - self::$_abandoned_transactions[] = $TXN_ID; |
|
| 222 | + public static function check_for_abandoned_transactions($TXN_ID = 0) { |
|
| 223 | + if (absint($TXN_ID)) { |
|
| 224 | + self::$_abandoned_transactions[] = $TXN_ID; |
|
| 225 | 225 | add_action( |
| 226 | 226 | 'shutdown', |
| 227 | - array( 'EE_Cron_Tasks', 'finalize_abandoned_transactions' ), |
|
| 227 | + array('EE_Cron_Tasks', 'finalize_abandoned_transactions'), |
|
| 228 | 228 | 5 |
| 229 | 229 | ); |
| 230 | 230 | } |
@@ -242,38 +242,38 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | public static function finalize_abandoned_transactions() { |
| 244 | 244 | // are there any TXNs that need cleaning up ? |
| 245 | - if ( ! empty( self::$_abandoned_transactions ) ) { |
|
| 245 | + if ( ! empty(self::$_abandoned_transactions)) { |
|
| 246 | 246 | /** @type EE_Transaction_Processor $transaction_processor */ |
| 247 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
| 247 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
| 248 | 248 | // set revisit flag for txn processor |
| 249 | - $transaction_processor->set_revisit( false ); |
|
| 249 | + $transaction_processor->set_revisit(false); |
|
| 250 | 250 | /** @type EE_Transaction_Payments $transaction_payments */ |
| 251 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
| 251 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
| 252 | 252 | // load EEM_Transaction |
| 253 | - EE_Registry::instance()->load_model( 'Transaction' ); |
|
| 254 | - foreach ( self::$_abandoned_transactions as $TXN_ID ) { |
|
| 253 | + EE_Registry::instance()->load_model('Transaction'); |
|
| 254 | + foreach (self::$_abandoned_transactions as $TXN_ID) { |
|
| 255 | 255 | // reschedule the cron if we can't hit the db right now |
| 256 | - if ( ! EE_Maintenance_Mode::instance()->models_can_query() ) { |
|
| 256 | + if ( ! EE_Maintenance_Mode::instance()->models_can_query()) { |
|
| 257 | 257 | // reset cron job for finalizing the TXN |
| 258 | 258 | EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check( |
| 259 | - time() + ( 10 * MINUTE_IN_SECONDS ) + 1, |
|
| 259 | + time() + (10 * MINUTE_IN_SECONDS) + 1, |
|
| 260 | 260 | $TXN_ID |
| 261 | 261 | ); |
| 262 | 262 | continue; |
| 263 | 263 | } |
| 264 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
| 264 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
| 265 | 265 | // verify transaction |
| 266 | - if ( $transaction instanceof EE_Transaction ) { |
|
| 266 | + if ($transaction instanceof EE_Transaction) { |
|
| 267 | 267 | // or have had all of their reg steps completed |
| 268 | - if ( $transaction_processor->all_reg_steps_completed( $transaction ) === true ) { |
|
| 268 | + if ($transaction_processor->all_reg_steps_completed($transaction) === true) { |
|
| 269 | 269 | continue; |
| 270 | 270 | } |
| 271 | 271 | // maybe update status, but don't save transaction just yet |
| 272 | - $transaction_payments ->update_transaction_status_based_on_total_paid( $transaction, false ); |
|
| 272 | + $transaction_payments ->update_transaction_status_based_on_total_paid($transaction, false); |
|
| 273 | 273 | // check if enough Reg Steps have been completed to warrant finalizing the TXN |
| 274 | - if ( $transaction_processor->all_reg_steps_completed_except_final_step( $transaction ) ) { |
|
| 274 | + if ($transaction_processor->all_reg_steps_completed_except_final_step($transaction)) { |
|
| 275 | 275 | // and if it hasn't already been set as being started... |
| 276 | - $transaction_processor->set_reg_step_initiated( $transaction, 'finalize_registration' ); |
|
| 276 | + $transaction_processor->set_reg_step_initiated($transaction, 'finalize_registration'); |
|
| 277 | 277 | } |
| 278 | 278 | // now update the TXN and trigger notifications |
| 279 | 279 | $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $transaction->last_payment() |
| 282 | 282 | ); |
| 283 | 283 | } |
| 284 | - unset( self::$_abandoned_transactions[ $TXN_ID ] ); |
|
| 284 | + unset(self::$_abandoned_transactions[$TXN_ID]); |
|
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public static function instance() { |
| 63 | 63 | // check if class object is instantiated, and instantiated properly |
| 64 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Front_Controller )) { |
|
| 64 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Front_Controller)) { |
|
| 65 | 65 | self::$_instance = new self(); |
| 66 | 66 | } |
| 67 | 67 | return self::$_instance; |
@@ -79,35 +79,35 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | private function __construct() { |
| 81 | 81 | // make sure template tags are loaded immediately so that themes don't break |
| 82 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'load_espresso_template_tags' ), 10 ); |
|
| 82 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'load_espresso_template_tags'), 10); |
|
| 83 | 83 | // determine how to integrate WP_Query with the EE models |
| 84 | - add_action( 'AHEE__EE_System__initialize', array( $this, 'employ_CPT_Strategy' )); |
|
| 84 | + add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy')); |
|
| 85 | 85 | // load other resources and begin to actually run shortcodes and modules |
| 86 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 5 ); |
|
| 86 | + add_action('wp_loaded', array($this, 'wp_loaded'), 5); |
|
| 87 | 87 | // analyse the incoming WP request |
| 88 | - add_action( 'parse_request', array( $this, 'get_request' ), 1, 1 ); |
|
| 88 | + add_action('parse_request', array($this, 'get_request'), 1, 1); |
|
| 89 | 89 | // process any content shortcodes |
| 90 | - add_action( 'parse_request', array( $this, '_initialize_shortcodes' ), 5 ); |
|
| 90 | + add_action('parse_request', array($this, '_initialize_shortcodes'), 5); |
|
| 91 | 91 | // process request with module factory |
| 92 | - add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 10, 1 ); |
|
| 92 | + add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1); |
|
| 93 | 93 | // before headers sent |
| 94 | - add_action( 'wp', array( $this, 'wp' ), 5 ); |
|
| 94 | + add_action('wp', array($this, 'wp'), 5); |
|
| 95 | 95 | // load css and js |
| 96 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 5 ); |
|
| 96 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 5); |
|
| 97 | 97 | // header |
| 98 | - add_action('wp_head', array( $this, 'header_meta_tag' ), 5 ); |
|
| 99 | - add_filter( 'template_include', array( $this, 'template_include' ), 1 ); |
|
| 98 | + add_action('wp_head', array($this, 'header_meta_tag'), 5); |
|
| 99 | + add_filter('template_include', array($this, 'template_include'), 1); |
|
| 100 | 100 | // display errors |
| 101 | - add_action('loop_start', array( $this, 'display_errors' ), 2 ); |
|
| 101 | + add_action('loop_start', array($this, 'display_errors'), 2); |
|
| 102 | 102 | // the content |
| 103 | - add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 ); |
|
| 103 | + add_filter('the_content', array($this, 'the_content'), 5, 1); |
|
| 104 | 104 | |
| 105 | 105 | //exclude our private cpt comments |
| 106 | - add_filter( 'comments_clauses', array( $this, 'filter_wp_comments'), 10, 1 ); |
|
| 106 | + add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1); |
|
| 107 | 107 | //make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://) |
| 108 | - add_filter( 'admin_url', array( $this, 'maybe_force_admin_ajax_ssl' ), 200, 1 ); |
|
| 108 | + add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1); |
|
| 109 | 109 | // action hook EE |
| 110 | - do_action( 'AHEE__EE_Front_Controller__construct__done',$this ); |
|
| 110 | + do_action('AHEE__EE_Front_Controller__construct__done', $this); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | * @return void |
| 127 | 127 | */ |
| 128 | 128 | public function load_espresso_template_tags() { |
| 129 | - if ( is_readable( EE_PUBLIC . 'template_tags.php' )) { |
|
| 130 | - require_once( EE_PUBLIC . 'template_tags.php' ); |
|
| 129 | + if (is_readable(EE_PUBLIC.'template_tags.php')) { |
|
| 130 | + require_once(EE_PUBLIC.'template_tags.php'); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
@@ -142,12 +142,12 @@ discard block |
||
| 142 | 142 | * @param array $clauses array of comment clauses setup by WP_Comment_Query |
| 143 | 143 | * @return array array of comment clauses with modifications. |
| 144 | 144 | */ |
| 145 | - public function filter_wp_comments( $clauses ) { |
|
| 145 | + public function filter_wp_comments($clauses) { |
|
| 146 | 146 | global $wpdb; |
| 147 | - if ( strpos( $clauses['join'], $wpdb->posts ) !== FALSE ) { |
|
| 147 | + if (strpos($clauses['join'], $wpdb->posts) !== FALSE) { |
|
| 148 | 148 | $cpts = EE_Register_CPTs::get_private_CPTs(); |
| 149 | - foreach ( $cpts as $cpt => $details ) { |
|
| 150 | - $clauses['where'] .= $wpdb->prepare( " AND $wpdb->posts.post_type != %s", $cpt ); |
|
| 149 | + foreach ($cpts as $cpt => $details) { |
|
| 150 | + $clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt); |
|
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | return $clauses; |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | * @return void |
| 165 | 165 | */ |
| 166 | 166 | public function employ_CPT_Strategy() { |
| 167 | - if ( apply_filters( 'FHEE__EE_Front_Controller__employ_CPT_Strategy',true) ){ |
|
| 168 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
| 167 | + if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) { |
|
| 168 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
@@ -177,9 +177,9 @@ discard block |
||
| 177 | 177 | * @param string $url incoming url |
| 178 | 178 | * @return string final assembled url |
| 179 | 179 | */ |
| 180 | - public function maybe_force_admin_ajax_ssl( $url ) { |
|
| 181 | - if ( is_ssl() && preg_match( '/admin-ajax.php/', $url )) { |
|
| 182 | - $url = str_replace( 'http://', 'https://', $url ); |
|
| 180 | + public function maybe_force_admin_ajax_ssl($url) { |
|
| 181 | + if (is_ssl() && preg_match('/admin-ajax.php/', $url)) { |
|
| 182 | + $url = str_replace('http://', 'https://', $url); |
|
| 183 | 183 | } |
| 184 | 184 | return $url; |
| 185 | 185 | } |
@@ -216,10 +216,10 @@ discard block |
||
| 216 | 216 | * @param WP $WP |
| 217 | 217 | * @return void |
| 218 | 218 | */ |
| 219 | - public function get_request( WP $WP ) { |
|
| 220 | - do_action( 'AHEE__EE_Front_Controller__get_request__start' ); |
|
| 221 | - EE_Registry::instance()->load_core( 'Request_Handler', $WP ); |
|
| 222 | - do_action( 'AHEE__EE_Front_Controller__get_request__complete' ); |
|
| 219 | + public function get_request(WP $WP) { |
|
| 220 | + do_action('AHEE__EE_Front_Controller__get_request__start'); |
|
| 221 | + EE_Registry::instance()->load_core('Request_Handler', $WP); |
|
| 222 | + do_action('AHEE__EE_Front_Controller__get_request__complete'); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | |
@@ -231,22 +231,22 @@ discard block |
||
| 231 | 231 | * @param WP $WP |
| 232 | 232 | * @return void |
| 233 | 233 | */ |
| 234 | - public function _initialize_shortcodes( WP $WP ) { |
|
| 235 | - do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this ); |
|
| 234 | + public function _initialize_shortcodes(WP $WP) { |
|
| 235 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this); |
|
| 236 | 236 | // grab post_name from request |
| 237 | - $current_post = apply_filters( 'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', EE_Registry::instance()->REQ->get( 'post_name' )); |
|
| 237 | + $current_post = apply_filters('FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', EE_Registry::instance()->REQ->get('post_name')); |
|
| 238 | 238 | // if it's not set, then check if frontpage is blog |
| 239 | - if ( empty( $current_post ) && get_option( 'show_on_front' ) == 'posts' ) { |
|
| 239 | + if (empty($current_post) && get_option('show_on_front') == 'posts') { |
|
| 240 | 240 | // yup.. this is the posts page, prepare to load all shortcode modules |
| 241 | 241 | $current_post = 'posts'; |
| 242 | - } else if ( empty( $current_post ) && get_option( 'show_on_front' ) == 'page' ) { |
|
| 242 | + } else if (empty($current_post) && get_option('show_on_front') == 'page') { |
|
| 243 | 243 | // some other page is set as the homepage |
| 244 | - $page_on_front = get_option( 'page_on_front' ); |
|
| 245 | - if ( $page_on_front ) { |
|
| 244 | + $page_on_front = get_option('page_on_front'); |
|
| 245 | + if ($page_on_front) { |
|
| 246 | 246 | // k now we need to find the post_name for this page |
| 247 | 247 | global $wpdb; |
| 248 | 248 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='page' AND post_status='publish' AND ID=%d"; |
| 249 | - $page_on_front = $wpdb->get_var( $wpdb->prepare( $SQL, $page_on_front )); |
|
| 249 | + $page_on_front = $wpdb->get_var($wpdb->prepare($SQL, $page_on_front)); |
|
| 250 | 250 | // set the current post slug to what it actually is |
| 251 | 251 | $current_post = $page_on_front ? $page_on_front : $current_post; |
| 252 | 252 | } |
@@ -254,58 +254,58 @@ discard block |
||
| 254 | 254 | // where are posts being displayed ? |
| 255 | 255 | $page_for_posts = EE_Config::get_page_for_posts(); |
| 256 | 256 | // in case $current_post is hierarchical like: /parent-page/current-page |
| 257 | - $current_post = basename( $current_post ); |
|
| 257 | + $current_post = basename($current_post); |
|
| 258 | 258 | // are we on a category page? |
| 259 | - $term_exists = is_array( term_exists( $current_post, 'category' )) || array_key_exists( 'category_name', $WP->query_vars ); |
|
| 259 | + $term_exists = is_array(term_exists($current_post, 'category')) || array_key_exists('category_name', $WP->query_vars); |
|
| 260 | 260 | // make sure shortcodes are set |
| 261 | - if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes )) { |
|
| 261 | + if (isset(EE_Registry::instance()->CFG->core->post_shortcodes)) { |
|
| 262 | 262 | // d( EE_Registry::instance()->CFG->core->post_shortcodes ); |
| 263 | 263 | // cycle thru all posts with shortcodes set |
| 264 | - foreach ( EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $post_shortcodes ) { |
|
| 264 | + foreach (EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $post_shortcodes) { |
|
| 265 | 265 | // filter shortcodes so |
| 266 | - $post_shortcodes = apply_filters( 'FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes ); |
|
| 266 | + $post_shortcodes = apply_filters('FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes); |
|
| 267 | 267 | // now cycle thru shortcodes |
| 268 | - foreach ( $post_shortcodes as $shortcode_class => $post_id ) { |
|
| 268 | + foreach ($post_shortcodes as $shortcode_class => $post_id) { |
|
| 269 | 269 | // are we on this page, or on the blog page, or an EE CPT category page ? |
| 270 | - if ( $current_post == $post_name || $term_exists ) { |
|
| 270 | + if ($current_post == $post_name || $term_exists) { |
|
| 271 | 271 | // verify shortcode is in list of registered shortcodes |
| 272 | - if ( ! isset( EE_Registry::instance()->shortcodes->$shortcode_class )) { |
|
| 273 | - if ( $current_post != $page_for_posts && current_user_can( 'edit_post', $post_id )) { |
|
| 274 | - $msg = sprintf( __( 'The [%s] shortcode has not been properly registered or the corresponding addon/module is not active for some reason. Either fix/remove the shortcode from the post, or activate the addon/module the shortcode is associated with.', 'event_espresso' ), $shortcode_class ); |
|
| 275 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 276 | - add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
|
| 272 | + if ( ! isset(EE_Registry::instance()->shortcodes->$shortcode_class)) { |
|
| 273 | + if ($current_post != $page_for_posts && current_user_can('edit_post', $post_id)) { |
|
| 274 | + $msg = sprintf(__('The [%s] shortcode has not been properly registered or the corresponding addon/module is not active for some reason. Either fix/remove the shortcode from the post, or activate the addon/module the shortcode is associated with.', 'event_espresso'), $shortcode_class); |
|
| 275 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 276 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
| 277 | 277 | } |
| 278 | - add_shortcode( $shortcode_class, array( 'EES_Shortcode', 'invalid_shortcode_processor' )); |
|
| 278 | + add_shortcode($shortcode_class, array('EES_Shortcode', 'invalid_shortcode_processor')); |
|
| 279 | 279 | break; |
| 280 | 280 | } |
| 281 | 281 | // is this : a shortcodes set exclusively for this post, or for the home page, or a category, or a taxonomy ? |
| 282 | - if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $current_post ] ) || $term_exists || $current_post == $page_for_posts ) { |
|
| 282 | + if (isset(EE_Registry::instance()->CFG->core->post_shortcodes[$current_post]) || $term_exists || $current_post == $page_for_posts) { |
|
| 283 | 283 | // let's pause to reflect on this... |
| 284 | - $sc_reflector = new ReflectionClass( 'EES_' . $shortcode_class ); |
|
| 284 | + $sc_reflector = new ReflectionClass('EES_'.$shortcode_class); |
|
| 285 | 285 | // ensure that class is actually a shortcode |
| 286 | - if ( ! $sc_reflector->isSubclassOf( 'EES_Shortcode' ) && defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE ) { |
|
| 287 | - $msg = sprintf( __( 'The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.', 'event_espresso' ), $shortcode_class ); |
|
| 288 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 289 | - add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
|
| 286 | + if ( ! $sc_reflector->isSubclassOf('EES_Shortcode') && defined('WP_DEBUG') && WP_DEBUG === TRUE) { |
|
| 287 | + $msg = sprintf(__('The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.', 'event_espresso'), $shortcode_class); |
|
| 288 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 289 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
| 290 | 290 | break; |
| 291 | 291 | } |
| 292 | 292 | // and pass the request object to the run method |
| 293 | 293 | EE_Registry::instance()->shortcodes->$shortcode_class = $sc_reflector->newInstance(); |
| 294 | 294 | // fire the shortcode class's run method, so that it can activate resources |
| 295 | - EE_Registry::instance()->shortcodes->$shortcode_class->run( $WP ); |
|
| 295 | + EE_Registry::instance()->shortcodes->$shortcode_class->run($WP); |
|
| 296 | 296 | } |
| 297 | 297 | // if this is NOT the "Posts page" and we have a valid entry for the "Posts page" in our tracked post_shortcodes array |
| 298 | - } else if ( $post_name != $page_for_posts && isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] )) { |
|
| 298 | + } else if ($post_name != $page_for_posts && isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) { |
|
| 299 | 299 | // and the shortcode is not being tracked for this page |
| 300 | - if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] )) { |
|
| 300 | + if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$shortcode_class])) { |
|
| 301 | 301 | // then remove the "fallback" shortcode processor |
| 302 | - remove_shortcode( $shortcode_class ); |
|
| 302 | + remove_shortcode($shortcode_class); |
|
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | - do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__end', $this ); |
|
| 308 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $this); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | |
@@ -317,20 +317,20 @@ discard block |
||
| 317 | 317 | * @param WP_Query $WP_Query |
| 318 | 318 | * @return void |
| 319 | 319 | */ |
| 320 | - public function pre_get_posts( $WP_Query ) { |
|
| 320 | + public function pre_get_posts($WP_Query) { |
|
| 321 | 321 | // only load Module_Request_Router if this is the main query |
| 322 | - if ( $WP_Query->is_main_query() ) { |
|
| 322 | + if ($WP_Query->is_main_query()) { |
|
| 323 | 323 | // load module request router |
| 324 | - $Module_Request_Router = EE_Registry::instance()->load_core( 'Module_Request_Router' ); |
|
| 324 | + $Module_Request_Router = EE_Registry::instance()->load_core('Module_Request_Router'); |
|
| 325 | 325 | // verify object |
| 326 | - if ( $Module_Request_Router instanceof EE_Module_Request_Router ) { |
|
| 326 | + if ($Module_Request_Router instanceof EE_Module_Request_Router) { |
|
| 327 | 327 | // cycle thru module routes |
| 328 | - while ( $route = $Module_Request_Router->get_route( $WP_Query )) { |
|
| 328 | + while ($route = $Module_Request_Router->get_route($WP_Query)) { |
|
| 329 | 329 | // determine module and method for route |
| 330 | - $module = $Module_Request_Router->resolve_route( $route[0], $route[1] ); |
|
| 331 | - if( $module instanceof EED_Module ) { |
|
| 330 | + $module = $Module_Request_Router->resolve_route($route[0], $route[1]); |
|
| 331 | + if ($module instanceof EED_Module) { |
|
| 332 | 332 | // get registered view for route |
| 333 | - $this->_template_path = $Module_Request_Router->get_view( $route ); |
|
| 333 | + $this->_template_path = $Module_Request_Router->get_view($route); |
|
| 334 | 334 | // grab module name |
| 335 | 335 | $module_name = $module->module_name(); |
| 336 | 336 | // map the module to the module objects |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | * @return void |
| 358 | 358 | */ |
| 359 | 359 | public function wp() { |
| 360 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
| 360 | + EE_Registry::instance()->load_helper('Template'); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | |
@@ -375,30 +375,30 @@ discard block |
||
| 375 | 375 | public function wp_enqueue_scripts() { |
| 376 | 376 | |
| 377 | 377 | // css is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF via: add_filter( 'FHEE_load_css', '__return_false' ); |
| 378 | - if ( apply_filters( 'FHEE_load_css', TRUE ) ) { |
|
| 378 | + if (apply_filters('FHEE_load_css', TRUE)) { |
|
| 379 | 379 | |
| 380 | 380 | EE_Registry::instance()->CFG->template_settings->enable_default_style = TRUE; |
| 381 | 381 | //Load the ThemeRoller styles if enabled |
| 382 | - if ( isset( EE_Registry::instance()->CFG->template_settings->enable_default_style ) && EE_Registry::instance()->CFG->template_settings->enable_default_style ) { |
|
| 382 | + if (isset(EE_Registry::instance()->CFG->template_settings->enable_default_style) && EE_Registry::instance()->CFG->template_settings->enable_default_style) { |
|
| 383 | 383 | |
| 384 | 384 | //Load custom style sheet if available |
| 385 | - if ( isset( EE_Registry::instance()->CFG->template_settings->custom_style_sheet )) { |
|
| 386 | - wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL . 'css/' . EE_Registry::instance()->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION ); |
|
| 385 | + if (isset(EE_Registry::instance()->CFG->template_settings->custom_style_sheet)) { |
|
| 386 | + wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL.'css/'.EE_Registry::instance()->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION); |
|
| 387 | 387 | wp_enqueue_style('espresso_custom_css'); |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - EE_Registry::instance()->load_helper( 'File' ); |
|
| 391 | - if ( is_readable( EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css' )) { |
|
| 392 | - wp_register_style( 'espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
| 390 | + EE_Registry::instance()->load_helper('File'); |
|
| 391 | + if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')) { |
|
| 392 | + wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
| 393 | 393 | } else { |
| 394 | - wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
| 394 | + wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
| 395 | 395 | } |
| 396 | 396 | wp_enqueue_style('espresso_default'); |
| 397 | 397 | |
| 398 | - if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css' )) { |
|
| 399 | - wp_register_style( 'espresso_style', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
| 398 | + if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'style.css')) { |
|
| 399 | + wp_register_style('espresso_style', get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default')); |
|
| 400 | 400 | } else { |
| 401 | - wp_register_style( 'espresso_style', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
| 401 | + wp_register_style('espresso_style', EE_TEMPLATES_URL.EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default')); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | } |
@@ -406,28 +406,28 @@ discard block |
||
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | // js is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF via: add_filter( 'FHEE_load_js', '__return_false' ); |
| 409 | - if ( apply_filters( 'FHEE_load_js', TRUE ) ) { |
|
| 409 | + if (apply_filters('FHEE_load_js', TRUE)) { |
|
| 410 | 410 | |
| 411 | - wp_enqueue_script( 'jquery' ); |
|
| 411 | + wp_enqueue_script('jquery'); |
|
| 412 | 412 | //let's make sure that all required scripts have been setup |
| 413 | - if ( function_exists( 'wp_script_is' )) { |
|
| 414 | - if ( ! wp_script_is( 'jquery' )) { |
|
| 413 | + if (function_exists('wp_script_is')) { |
|
| 414 | + if ( ! wp_script_is('jquery')) { |
|
| 415 | 415 | $msg = sprintf( |
| 416 | - __( '%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso' ), |
|
| 416 | + __('%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso'), |
|
| 417 | 417 | '<em><br />', |
| 418 | 418 | '</em>' |
| 419 | 419 | ); |
| 420 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 420 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 421 | 421 | } |
| 422 | 422 | } |
| 423 | 423 | // load core js |
| 424 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 425 | - wp_enqueue_script( 'espresso_core' ); |
|
| 424 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 425 | + wp_enqueue_script('espresso_core'); |
|
| 426 | 426 | |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | //qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' ); |
| 430 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
| 430 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
| 431 | 431 | EE_Registry::instance()->load_helper('Qtip_Loader'); |
| 432 | 432 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
| 433 | 433 | } |
@@ -435,11 +435,11 @@ discard block |
||
| 435 | 435 | |
| 436 | 436 | //accounting.js library |
| 437 | 437 | // @link http://josscrowcroft.github.io/accounting.js/ |
| 438 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
| 439 | - $acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js'; |
|
| 440 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 441 | - wp_register_script( 'ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE ); |
|
| 442 | - wp_enqueue_script( 'ee-accounting' ); |
|
| 438 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
| 439 | + $acct_js = EE_THIRD_PARTY_URL.'accounting/accounting.js'; |
|
| 440 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 441 | + wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE); |
|
| 442 | + wp_enqueue_script('ee-accounting'); |
|
| 443 | 443 | |
| 444 | 444 | $currency_config = array( |
| 445 | 445 | 'currency' => array( |
@@ -462,21 +462,21 @@ discard block |
||
| 462 | 462 | wp_localize_script('ee-accounting', 'EE_ACCOUNTING_CFG', $currency_config); |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | - if ( ! function_exists( 'wp_head' )) { |
|
| 465 | + if ( ! function_exists('wp_head')) { |
|
| 466 | 466 | $msg = sprintf( |
| 467 | - __( '%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ), |
|
| 467 | + __('%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'), |
|
| 468 | 468 | '<em><br />', |
| 469 | 469 | '</em>' |
| 470 | 470 | ); |
| 471 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 471 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 472 | 472 | } |
| 473 | - if ( ! function_exists( 'wp_footer' )) { |
|
| 473 | + if ( ! function_exists('wp_footer')) { |
|
| 474 | 474 | $msg = sprintf( |
| 475 | - __( '%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ), |
|
| 475 | + __('%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'), |
|
| 476 | 476 | '<em><br />', |
| 477 | 477 | '</em>' |
| 478 | 478 | ); |
| 479 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 479 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | } |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | * @return void |
| 491 | 491 | */ |
| 492 | 492 | public function header_meta_tag() { |
| 493 | - print( apply_filters("FHEE__EE_Front_Controller__header_meta_tag","<meta name='generator' content='Event Espresso Version " . EVENT_ESPRESSO_VERSION . "' />")); |
|
| 493 | + print(apply_filters("FHEE__EE_Front_Controller__header_meta_tag", "<meta name='generator' content='Event Espresso Version ".EVENT_ESPRESSO_VERSION."' />")); |
|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | |
@@ -504,9 +504,9 @@ discard block |
||
| 504 | 504 | * @param $the_content |
| 505 | 505 | * @return string |
| 506 | 506 | */ |
| 507 | - public function the_content( $the_content ) { |
|
| 507 | + public function the_content($the_content) { |
|
| 508 | 508 | // nothing gets loaded at this point unless other systems turn this hookpoint on by using: add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
| 509 | - if ( apply_filters( 'FHEE_run_EE_the_content', FALSE ) ) { |
|
| 509 | + if (apply_filters('FHEE_run_EE_the_content', FALSE)) { |
|
| 510 | 510 | } |
| 511 | 511 | return $the_content; |
| 512 | 512 | } |
@@ -531,14 +531,14 @@ discard block |
||
| 531 | 531 | */ |
| 532 | 532 | public function display_errors() { |
| 533 | 533 | static $shown_already = FALSE; |
| 534 | - do_action( 'AHEE__EE_Front_Controller__display_errors__begin' ); |
|
| 535 | - if ( apply_filters( 'FHEE__EE_Front_Controller__display_errors', TRUE ) && ! $shown_already && is_main_query() && ! is_feed() && in_the_loop() ) { |
|
| 534 | + do_action('AHEE__EE_Front_Controller__display_errors__begin'); |
|
| 535 | + if (apply_filters('FHEE__EE_Front_Controller__display_errors', TRUE) && ! $shown_already && is_main_query() && ! is_feed() && in_the_loop()) { |
|
| 536 | 536 | echo EE_Error::get_notices(); |
| 537 | 537 | $shown_already = TRUE; |
| 538 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
| 539 | - EEH_Template::display_template( EE_TEMPLATES . 'espresso-ajax-notices.template.php' ); |
|
| 538 | + EE_Registry::instance()->load_helper('Template'); |
|
| 539 | + EEH_Template::display_template(EE_TEMPLATES.'espresso-ajax-notices.template.php'); |
|
| 540 | 540 | } |
| 541 | - do_action( 'AHEE__EE_Front_Controller__display_errors__end' ); |
|
| 541 | + do_action('AHEE__EE_Front_Controller__display_errors__end'); |
|
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | |
@@ -553,12 +553,12 @@ discard block |
||
| 553 | 553 | * @param string $template_include_path |
| 554 | 554 | * @return string |
| 555 | 555 | */ |
| 556 | - public function template_include( $template_include_path = NULL ) { |
|
| 557 | - if ( EE_Registry::instance()->REQ->is_espresso_page() ) { |
|
| 558 | - $this->_template_path = ! empty( $this->_template_path ) ? basename( $this->_template_path ) : basename( $template_include_path ); |
|
| 559 | - $template_path = EEH_Template::locate_template( $this->_template_path, array(), false ); |
|
| 560 | - $this->_template_path = ! empty( $template_path ) ? $template_path : $template_include_path; |
|
| 561 | - $this->_template = basename( $this->_template_path ); |
|
| 556 | + public function template_include($template_include_path = NULL) { |
|
| 557 | + if (EE_Registry::instance()->REQ->is_espresso_page()) { |
|
| 558 | + $this->_template_path = ! empty($this->_template_path) ? basename($this->_template_path) : basename($template_include_path); |
|
| 559 | + $template_path = EEH_Template::locate_template($this->_template_path, array(), false); |
|
| 560 | + $this->_template_path = ! empty($template_path) ? $template_path : $template_include_path; |
|
| 561 | + $this->_template = basename($this->_template_path); |
|
| 562 | 562 | return $this->_template_path; |
| 563 | 563 | } |
| 564 | 564 | return $template_include_path; |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | * @param bool $with_path |
| 574 | 574 | * @return string |
| 575 | 575 | */ |
| 576 | - public function get_selected_template( $with_path = FALSE ) { |
|
| 576 | + public function get_selected_template($with_path = FALSE) { |
|
| 577 | 577 | return $with_path ? $this->_template_path : $this->_template; |
| 578 | 578 | } |
| 579 | 579 | |
@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * Event Espresso |
| 4 | 6 | * |
@@ -13,9 +13,9 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class EE_Payment_Processor extends EE_Processor_Base { |
| 15 | 15 | /** |
| 16 | - * @var EE_Payment_Processor $_instance |
|
| 16 | + * @var EE_Payment_Processor $_instance |
|
| 17 | 17 | * @access private |
| 18 | - */ |
|
| 18 | + */ |
|
| 19 | 19 | private static $_instance = NULL; |
| 20 | 20 | |
| 21 | 21 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
| 2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
| 2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
| 3 | 3 | /** |
| 4 | 4 | * |
| 5 | 5 | * EE_Payment_Processor |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public static function instance() { |
| 29 | 29 | // check if class object is instantiated |
| 30 | - if ( ! self::$_instance instanceof EE_Payment_Processor ) { |
|
| 30 | + if ( ! self::$_instance instanceof EE_Payment_Processor) { |
|
| 31 | 31 | self::$_instance = new self(); |
| 32 | 32 | } |
| 33 | 33 | return self::$_instance; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | *@return EE_Payment_Processor |
| 43 | 43 | */ |
| 44 | 44 | private function __construct() { |
| 45 | - do_action( 'AHEE__EE_Payment_Processor__construct' ); |
|
| 45 | + do_action('AHEE__EE_Payment_Processor__construct'); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
@@ -60,32 +60,32 @@ discard block |
||
| 60 | 60 | * @param boolean $update_txn whether or not to call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() |
| 61 | 61 | * @return EE_Payment | NULL |
| 62 | 62 | */ |
| 63 | - public function process_payment( EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE ) { |
|
| 63 | + public function process_payment(EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE) { |
|
| 64 | 64 | // verify payment method |
| 65 | - $payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE ); |
|
| 65 | + $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE); |
|
| 66 | 66 | // verify transaction |
| 67 | - EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
| 68 | - $transaction->set_payment_method_ID( $payment_method->ID() ); |
|
| 67 | + EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
| 68 | + $transaction->set_payment_method_ID($payment_method->ID()); |
|
| 69 | 69 | // verify payment method type |
| 70 | - if ( $payment_method->type_obj() instanceof EE_PMT_Base ){ |
|
| 70 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
| 71 | 71 | $payment = $payment_method->type_obj()->process_payment( |
| 72 | 72 | $transaction, |
| 73 | - min( $amount, $transaction->remaining() ),//make sure we don't overcharge |
|
| 73 | + min($amount, $transaction->remaining()), //make sure we don't overcharge |
|
| 74 | 74 | $billing_form, |
| 75 | 75 | $return_url, |
| 76 | - add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ), |
|
| 76 | + add_query_arg(array('ee_cancel_payment' => true), $return_url), |
|
| 77 | 77 | $method, |
| 78 | 78 | $by_admin |
| 79 | 79 | ); |
| 80 | 80 | //offline gateways DON'T return a payment object, so check it |
| 81 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn ); |
|
| 81 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn); |
|
| 82 | 82 | return $payment; |
| 83 | 83 | } else { |
| 84 | 84 | EE_Error::add_error( |
| 85 | 85 | sprintf( |
| 86 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
| 86 | + __('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
| 87 | 87 | '<br/>', |
| 88 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
| 88 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
| 89 | 89 | ), __FILE__, __FUNCTION__, __LINE__ |
| 90 | 90 | ); |
| 91 | 91 | return NULL; |
@@ -101,14 +101,14 @@ discard block |
||
| 101 | 101 | * @throws EE_Error |
| 102 | 102 | * @return string |
| 103 | 103 | */ |
| 104 | - public function get_ipn_url_for_payment_method( $transaction, $payment_method ){ |
|
| 104 | + public function get_ipn_url_for_payment_method($transaction, $payment_method) { |
|
| 105 | 105 | /** @type EE_Transaction $transaction */ |
| 106 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
| 106 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
| 107 | 107 | $primary_reg = $transaction->primary_registration(); |
| 108 | - if( ! $primary_reg instanceof EE_Registration ){ |
|
| 109 | - throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"),$transaction->ID())); |
|
| 108 | + if ( ! $primary_reg instanceof EE_Registration) { |
|
| 109 | + throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"), $transaction->ID())); |
|
| 110 | 110 | } |
| 111 | - $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true); |
|
| 111 | + $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true); |
|
| 112 | 112 | $url = add_query_arg( |
| 113 | 113 | array( |
| 114 | 114 | 'e_reg_url_link'=>$primary_reg->reg_url_link(), |
@@ -134,80 +134,80 @@ discard block |
||
| 134 | 134 | * @throws Exception |
| 135 | 135 | * @return EE_Payment |
| 136 | 136 | */ |
| 137 | - public function process_ipn( $_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true ){ |
|
| 138 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
| 139 | - EE_Processor_Base::set_IPN( $separate_IPN_request ); |
|
| 140 | - if( $transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method ){ |
|
| 141 | - $obj_for_log = EEM_Payment::instance()->get_one( array( array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), 'order_by' => array( 'PAY_timestamp' => 'desc' ) ) ); |
|
| 142 | - }elseif( $payment_method instanceof EE_Payment ){ |
|
| 137 | + public function process_ipn($_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true) { |
|
| 138 | + EE_Registry::instance()->load_model('Change_Log'); |
|
| 139 | + EE_Processor_Base::set_IPN($separate_IPN_request); |
|
| 140 | + if ($transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method) { |
|
| 141 | + $obj_for_log = EEM_Payment::instance()->get_one(array(array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()), 'order_by' => array('PAY_timestamp' => 'desc'))); |
|
| 142 | + }elseif ($payment_method instanceof EE_Payment) { |
|
| 143 | 143 | $obj_for_log = $payment_method; |
| 144 | - }elseif( $transaction instanceof EE_Transaction ){ |
|
| 144 | + }elseif ($transaction instanceof EE_Transaction) { |
|
| 145 | 145 | $obj_for_log = $transaction; |
| 146 | - }else{ |
|
| 146 | + } else { |
|
| 147 | 147 | $obj_for_log = null; |
| 148 | 148 | } |
| 149 | 149 | $log = EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data received'=>$_req_data), $obj_for_log); |
| 150 | - try{ |
|
| 150 | + try { |
|
| 151 | 151 | /** |
| 152 | 152 | * @var EE_Payment $payment |
| 153 | 153 | */ |
| 154 | 154 | $payment = NULL; |
| 155 | - if($transaction && $payment_method){ |
|
| 155 | + if ($transaction && $payment_method) { |
|
| 156 | 156 | /** @type EE_Transaction $transaction */ |
| 157 | 157 | $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
| 158 | 158 | /** @type EE_Payment_Method $payment_method */ |
| 159 | 159 | $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method); |
| 160 | - if ( $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
| 161 | - $payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction ); |
|
| 160 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
| 161 | + $payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction); |
|
| 162 | 162 | $log->set_object($payment); |
| 163 | 163 | } else { |
| 164 | 164 | // not a payment |
| 165 | 165 | EE_Error::add_error( |
| 166 | 166 | sprintf( |
| 167 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ), |
|
| 167 | + __('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'), |
|
| 168 | 168 | '<br/>', |
| 169 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
| 169 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
| 170 | 170 | ), |
| 171 | 171 | __FILE__, __FUNCTION__, __LINE__ |
| 172 | 172 | ); |
| 173 | 173 | } |
| 174 | - }else{ |
|
| 174 | + } else { |
|
| 175 | 175 | //that's actually pretty ok. The IPN just wasn't able |
| 176 | 176 | //to identify which transaction or payment method this was for |
| 177 | 177 | // give all active payment methods a chance to claim it |
| 178 | 178 | $active_pms = EEM_Payment_Method::instance()->get_all_active(); |
| 179 | - foreach( $active_pms as $payment_method ){ |
|
| 180 | - try{ |
|
| 181 | - $payment = $payment_method->type_obj()->handle_unclaimed_ipn( $_req_data ); |
|
| 179 | + foreach ($active_pms as $payment_method) { |
|
| 180 | + try { |
|
| 181 | + $payment = $payment_method->type_obj()->handle_unclaimed_ipn($_req_data); |
|
| 182 | 182 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment); |
| 183 | 183 | break; |
| 184 | - } catch( EE_Error $e ) { |
|
| 184 | + } catch (EE_Error $e) { |
|
| 185 | 185 | //that's fine- it apparently couldn't handle the IPN |
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | } |
| 190 | 190 | // EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method); |
| 191 | - if( $payment instanceof EE_Payment){ |
|
| 191 | + if ($payment instanceof EE_Payment) { |
|
| 192 | 192 | $payment->save(); |
| 193 | 193 | // update the TXN |
| 194 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request ); |
|
| 195 | - }else{ |
|
| 194 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request); |
|
| 195 | + } else { |
|
| 196 | 196 | //we couldn't find the payment for this IPN... let's try and log at least SOMETHING |
| 197 | - if($payment_method){ |
|
| 197 | + if ($payment_method) { |
|
| 198 | 198 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method); |
| 199 | - }elseif($transaction){ |
|
| 199 | + }elseif ($transaction) { |
|
| 200 | 200 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction); |
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | return $payment; |
| 204 | 204 | |
| 205 | - } catch( EE_Error $e ) { |
|
| 205 | + } catch (EE_Error $e) { |
|
| 206 | 206 | do_action( |
| 207 | 207 | 'AHEE__log', __FILE__, __FUNCTION__, sprintf( |
| 208 | 208 | "Error occurred while receiving IPN. Transaction: %s, req data: %s. The error was '%s'", |
| 209 | - print_r( $transaction, TRUE ), |
|
| 210 | - print_r( $_req_data, TRUE ), |
|
| 209 | + print_r($transaction, TRUE), |
|
| 210 | + print_r($_req_data, TRUE), |
|
| 211 | 211 | $e->getMessage() |
| 212 | 212 | ) |
| 213 | 213 | ); |
@@ -231,13 +231,13 @@ discard block |
||
| 231 | 231 | * @throws \EE_Error |
| 232 | 232 | * @return EE_Payment |
| 233 | 233 | */ |
| 234 | - public function finalize_payment_for( $transaction, $update_txn = TRUE ){ |
|
| 234 | + public function finalize_payment_for($transaction, $update_txn = TRUE) { |
|
| 235 | 235 | /** @var $transaction EE_Transaction */ |
| 236 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
| 236 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
| 237 | 237 | $last_payment_method = $transaction->payment_method(); |
| 238 | - if ( $last_payment_method instanceof EE_Payment_Method ) { |
|
| 239 | - $payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction ); |
|
| 240 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn ); |
|
| 238 | + if ($last_payment_method instanceof EE_Payment_Method) { |
|
| 239 | + $payment = $last_payment_method->type_obj()->finalize_payment_for($transaction); |
|
| 240 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn); |
|
| 241 | 241 | return $payment; |
| 242 | 242 | } else { |
| 243 | 243 | return NULL; |
@@ -254,12 +254,12 @@ discard block |
||
| 254 | 254 | * @internal param float $amount |
| 255 | 255 | * @return EE_Payment |
| 256 | 256 | */ |
| 257 | - public function process_refund( $payment_method, $payment_to_refund, $refund_info = array() ){ |
|
| 257 | + public function process_refund($payment_method, $payment_to_refund, $refund_info = array()) { |
|
| 258 | 258 | /** @type EE_Payment_Method $payment_method */ |
| 259 | 259 | $payment_method = EEM_Payment_Method::instance()->ensure_is_ID($payment_method); |
| 260 | - if ( $payment_method->type_obj()->supports_sending_refunds() ) { |
|
| 261 | - $payment_method->do_direct_refund( $payment_to_refund,$refund_info ); |
|
| 262 | - $this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund ); |
|
| 260 | + if ($payment_method->type_obj()->supports_sending_refunds()) { |
|
| 261 | + $payment_method->do_direct_refund($payment_to_refund, $refund_info); |
|
| 262 | + $this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund); |
|
| 263 | 263 | } |
| 264 | 264 | return $payment_to_refund; |
| 265 | 265 | } |
@@ -295,12 +295,12 @@ discard block |
||
| 295 | 295 | * TXN is locked before updating |
| 296 | 296 | * @throws \EE_Error |
| 297 | 297 | */ |
| 298 | - public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){ |
|
| 298 | + public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) { |
|
| 299 | 299 | $do_action = FALSE; |
| 300 | 300 | /** @type EE_Transaction $transaction */ |
| 301 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
| 301 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
| 302 | 302 | // can we freely update the TXN at this moment? |
| 303 | - if ( $IPN && $transaction->is_locked() ) { |
|
| 303 | + if ($IPN && $transaction->is_locked()) { |
|
| 304 | 304 | // don't update the transaction at this exact moment |
| 305 | 305 | // because the TXN is active in another request |
| 306 | 306 | EE_Cron_Tasks::schedule_update_transaction_with_payment( |
@@ -310,9 +310,9 @@ discard block |
||
| 310 | 310 | ); |
| 311 | 311 | } else { |
| 312 | 312 | // verify payment |
| 313 | - if ( $payment instanceof EE_Payment ) { |
|
| 314 | - if( $payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base ){ |
|
| 315 | - $payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment ); |
|
| 313 | + if ($payment instanceof EE_Payment) { |
|
| 314 | + if ($payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base) { |
|
| 315 | + $payment->payment_method()->type_obj()->update_txn_based_on_payment($payment); |
|
| 316 | 316 | } |
| 317 | 317 | // we need to save this payment in order for transaction to be updated correctly |
| 318 | 318 | // because it queries the DB to find the total amount paid, and saving puts the payment into the DB |
@@ -331,23 +331,23 @@ discard block |
||
| 331 | 331 | 'PMD_ID' => $transaction->payment_method_ID() |
| 332 | 332 | ) |
| 333 | 333 | ); |
| 334 | - $transaction->set_status( EEM_Transaction::incomplete_status_code ); |
|
| 334 | + $transaction->set_status(EEM_Transaction::incomplete_status_code); |
|
| 335 | 335 | // send out notifications |
| 336 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
| 336 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
| 337 | 337 | $do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made'; |
| 338 | 338 | } |
| 339 | - if ( $payment->status() !== EEM_Payment::status_id_failed ) { |
|
| 339 | + if ($payment->status() !== EEM_Payment::status_id_failed) { |
|
| 340 | 340 | /** @type EE_Transaction_Payments $transaction_payments */ |
| 341 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
| 341 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
| 342 | 342 | // set new value for total paid |
| 343 | - $transaction_payments->calculate_total_payments_and_update_status( $transaction ); |
|
| 343 | + $transaction_payments->calculate_total_payments_and_update_status($transaction); |
|
| 344 | 344 | // call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ??? |
| 345 | - if ( $update_txn ) { |
|
| 346 | - $this->_post_payment_processing( $transaction, $payment, $IPN ); |
|
| 345 | + if ($update_txn) { |
|
| 346 | + $this->_post_payment_processing($transaction, $payment, $IPN); |
|
| 347 | 347 | } |
| 348 | 348 | // and set a hook point for others to use? |
| 349 | - if ( $do_action ) { |
|
| 350 | - do_action( $do_action, $transaction, $payment ); |
|
| 349 | + if ($do_action) { |
|
| 350 | + do_action($do_action, $transaction, $payment); |
|
| 351 | 351 | } |
| 352 | 352 | } |
| 353 | 353 | } |
@@ -366,40 +366,40 @@ discard block |
||
| 366 | 366 | * @param EE_Payment $payment |
| 367 | 367 | * @param bool $IPN |
| 368 | 368 | */ |
| 369 | - protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) { |
|
| 369 | + protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) { |
|
| 370 | 370 | /** @type EE_Transaction_Processor $transaction_processor */ |
| 371 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
| 371 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
| 372 | 372 | // is the Payment Options Reg Step completed ? |
| 373 | - $payment_options_step_completed = $transaction_processor->reg_step_completed( $transaction, 'payment_options' ); |
|
| 373 | + $payment_options_step_completed = $transaction_processor->reg_step_completed($transaction, 'payment_options'); |
|
| 374 | 374 | // if the Payment Options Reg Step is completed... |
| 375 | 375 | $revisit = $payment_options_step_completed !== false ? true : false; |
| 376 | 376 | // then this is kinda sorta a revisit with regards to payments at least |
| 377 | - $transaction_processor->set_revisit( $revisit ); |
|
| 377 | + $transaction_processor->set_revisit($revisit); |
|
| 378 | 378 | // if this is an IPN, let's consider the Payment Options Reg Step completed if not already |
| 379 | 379 | if ( |
| 380 | 380 | $IPN && |
| 381 | 381 | $payment_options_step_completed !== true && |
| 382 | - ( $payment->is_approved() || $payment->is_pending() ) |
|
| 382 | + ($payment->is_approved() || $payment->is_pending()) |
|
| 383 | 383 | ) { |
| 384 | - $transaction_processor->set_reg_step_completed( $transaction, 'payment_options' ); |
|
| 384 | + $transaction_processor->set_reg_step_completed($transaction, 'payment_options'); |
|
| 385 | 385 | } |
| 386 | 386 | // DEBUG LOG |
| 387 | 387 | //$this->log( __CLASS__, __FUNCTION__, __LINE__, $transaction ); |
| 388 | 388 | /** @type EE_Transaction_Payments $transaction_payments */ |
| 389 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
| 389 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
| 390 | 390 | // maybe update status, but don't save transaction just yet |
| 391 | - $transaction_payments->update_transaction_status_based_on_total_paid( $transaction, false ); |
|
| 391 | + $transaction_payments->update_transaction_status_based_on_total_paid($transaction, false); |
|
| 392 | 392 | //check if enough Reg Steps have been completed to warrant finalizing the TXN |
| 393 | - $finalized = $transaction_processor->all_reg_steps_completed_except_final_step( $transaction ); |
|
| 393 | + $finalized = $transaction_processor->all_reg_steps_completed_except_final_step($transaction); |
|
| 394 | 394 | // if this is an IPN and the final step has not been initiated |
| 395 | - if ( $IPN && $finalized === false ) { |
|
| 395 | + if ($IPN && $finalized === false) { |
|
| 396 | 396 | // and if it hasn't already been set as being started... |
| 397 | - $finalized = $transaction_processor->set_reg_step_initiated( $transaction, 'finalize_registration' ); |
|
| 397 | + $finalized = $transaction_processor->set_reg_step_initiated($transaction, 'finalize_registration'); |
|
| 398 | 398 | } |
| 399 | 399 | // because the above will return false if the final step was not fully completed, we need to check again... |
| 400 | - if ( $IPN && $finalized ) { |
|
| 400 | + if ($IPN && $finalized) { |
|
| 401 | 401 | // and if we are all good to go, then send out notifications |
| 402 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
| 402 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
| 403 | 403 | // DEBUG LOG |
| 404 | 404 | //$this->log( __CLASS__, __FUNCTION__, __LINE__, $transaction ); |
| 405 | 405 | } |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | // ) |
| 420 | 420 | //); |
| 421 | 421 | //ok, now process the transaction according to the payment |
| 422 | - $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment ); |
|
| 422 | + $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment); |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | |
@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | EE_Processor_Base::set_IPN( $separate_IPN_request ); |
| 140 | 140 | if( $transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method ){ |
| 141 | 141 | $obj_for_log = EEM_Payment::instance()->get_one( array( array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), 'order_by' => array( 'PAY_timestamp' => 'desc' ) ) ); |
| 142 | - }elseif( $payment_method instanceof EE_Payment ){ |
|
| 142 | + } elseif( $payment_method instanceof EE_Payment ){ |
|
| 143 | 143 | $obj_for_log = $payment_method; |
| 144 | - }elseif( $transaction instanceof EE_Transaction ){ |
|
| 144 | + } elseif( $transaction instanceof EE_Transaction ){ |
|
| 145 | 145 | $obj_for_log = $transaction; |
| 146 | - }else{ |
|
| 146 | + } else{ |
|
| 147 | 147 | $obj_for_log = null; |
| 148 | 148 | } |
| 149 | 149 | $log = EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data received'=>$_req_data), $obj_for_log); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | __FILE__, __FUNCTION__, __LINE__ |
| 172 | 172 | ); |
| 173 | 173 | } |
| 174 | - }else{ |
|
| 174 | + } else{ |
|
| 175 | 175 | //that's actually pretty ok. The IPN just wasn't able |
| 176 | 176 | //to identify which transaction or payment method this was for |
| 177 | 177 | // give all active payment methods a chance to claim it |
@@ -192,11 +192,11 @@ discard block |
||
| 192 | 192 | $payment->save(); |
| 193 | 193 | // update the TXN |
| 194 | 194 | $this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request ); |
| 195 | - }else{ |
|
| 195 | + } else{ |
|
| 196 | 196 | //we couldn't find the payment for this IPN... let's try and log at least SOMETHING |
| 197 | 197 | if($payment_method){ |
| 198 | 198 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method); |
| 199 | - }elseif($transaction){ |
|
| 199 | + } elseif($transaction){ |
|
| 200 | 200 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction); |
| 201 | 201 | } |
| 202 | 202 | } |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | $records_migrated_during_stage = $stage->migration_step($num_records_to_migrate_limit - $num_records_actually_migrated); |
| 308 | 308 | $num_records_actually_migrated += $records_migrated_during_stage; |
| 309 | 309 | $records_migrated_per_stage[$stage->pretty_name()] = $records_migrated_during_stage; |
| 310 | - }catch(Exception $e){ |
|
| 310 | + } catch(Exception $e){ |
|
| 311 | 311 | //yes if we catch an exception here, we consider that migration stage borked. |
| 312 | 312 | $stage->set_status(EE_Data_Migration_Manager::status_fatal_error); |
| 313 | 313 | $this->set_status(EE_Data_Migration_Manager::status_fatal_error); |
@@ -333,14 +333,14 @@ discard block |
||
| 333 | 333 | //this migration script apparently has NO stages... which is super weird, but whatever |
| 334 | 334 | $this->set_completed(); |
| 335 | 335 | $this->_maybe_do_schema_changes(false); |
| 336 | - }else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){ |
|
| 336 | + } else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){ |
|
| 337 | 337 | //apparently we're done, because we couldn't migrate the number we intended to |
| 338 | 338 | $this->set_completed(); |
| 339 | 339 | $this->_update_feedback_message(array_reverse($records_migrated_per_stage)); |
| 340 | 340 | //do schema changes for after the migration now |
| 341 | 341 | //first double-check we haven't already done this |
| 342 | 342 | $this->_maybe_do_schema_changes(false); |
| 343 | - }else{ |
|
| 343 | + } else{ |
|
| 344 | 344 | //update feedback message, keeping in mind that we show them with the most recent at the top |
| 345 | 345 | $this->_update_feedback_message(array_reverse($records_migrated_per_stage)); |
| 346 | 346 | } |
@@ -379,12 +379,12 @@ discard block |
||
| 379 | 379 | ob_start(); |
| 380 | 380 | if($before){ |
| 381 | 381 | $this->schema_changes_before_migration(); |
| 382 | - }else{ |
|
| 382 | + } else{ |
|
| 383 | 383 | $this->schema_changes_after_migration(); |
| 384 | 384 | } |
| 385 | 385 | $output = ob_get_contents(); |
| 386 | 386 | ob_end_clean(); |
| 387 | - }catch(Exception $e){ |
|
| 387 | + } catch(Exception $e){ |
|
| 388 | 388 | $this->set_status(EE_Data_Migration_Manager::status_fatal_error); |
| 389 | 389 | throw $e; |
| 390 | 390 | } |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | EE_Maintenance_Mode::instance()->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance; |
| 426 | 426 | if( $this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $currently_migrating ){ |
| 427 | 427 | $drop_pre_existing_tables = true; |
| 428 | - }else{ |
|
| 428 | + } else{ |
|
| 429 | 429 | $drop_pre_existing_tables = false; |
| 430 | 430 | } |
| 431 | 431 | $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables ); |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | |
| 449 | 449 | if(in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(),array(EE_System::req_type_new_activation))){ |
| 450 | 450 | $drop_pre_existing_tables = true; |
| 451 | - }else{ |
|
| 451 | + } else{ |
|
| 452 | 452 | $drop_pre_existing_tables = false; |
| 453 | 453 | } |
| 454 | 454 | $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables ); |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | EE_Registry::instance()->load_helper('Activation'); |
| 466 | 466 | try{ |
| 467 | 467 | EEH_Activation::create_table($table_name,$table_definition_sql, $engine_string, $drop_pre_existing_tables); |
| 468 | - }catch( EE_Error $e ) { |
|
| 468 | + } catch( EE_Error $e ) { |
|
| 469 | 469 | $message = $e->getMessage() . '<br>Stack Trace:' . $e->getTraceAsString(); |
| 470 | 470 | $this->add_error( $message ); |
| 471 | 471 | $this->_feedback_message .= $message; |
@@ -482,11 +482,11 @@ discard block |
||
| 482 | 482 | private function _get_req_type_for_plugin_corresponding_to_this_dms(){ |
| 483 | 483 | if($this->slug() == 'Core'){ |
| 484 | 484 | return EE_System::instance()->detect_req_type(); |
| 485 | - }else{//it must be for an addon |
|
| 485 | + } else{//it must be for an addon |
|
| 486 | 486 | $addon_name = $this->slug(); |
| 487 | 487 | if( EE_Registry::instance()->get_addon_by_name($addon_name)){ |
| 488 | 488 | return EE_Registry::instance()->get_addon_by_name($addon_name)->detect_req_type(); |
| 489 | - }else{ |
|
| 489 | + } else{ |
|
| 490 | 490 | throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"),$this->slug(),$addon_name,implode(",",array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ) ) ; |
| 491 | 491 | } |
| 492 | 492 | } |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | * All children of this must call parent::__construct() at the end of their constructor or suffer the consequences! |
| 118 | 118 | */ |
| 119 | 119 | public function __construct() { |
| 120 | - $this->_migration_stages = apply_filters('FHEE__'.get_class($this).'__construct__migration_stages',$this->_migration_stages); |
|
| 121 | - foreach($this->_migration_stages as $migration_stage){ |
|
| 122 | - if ( $migration_stage instanceof EE_Data_Migration_Script_Stage ) { |
|
| 120 | + $this->_migration_stages = apply_filters('FHEE__'.get_class($this).'__construct__migration_stages', $this->_migration_stages); |
|
| 121 | + foreach ($this->_migration_stages as $migration_stage) { |
|
| 122 | + if ($migration_stage instanceof EE_Data_Migration_Script_Stage) { |
|
| 123 | 123 | $migration_stage->_construct_finalize($this); |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * Place to add hooks and filters for tweaking the migrations page, in order |
| 133 | 133 | * to customize it |
| 134 | 134 | */ |
| 135 | - public function migration_page_hooks(){ |
|
| 135 | + public function migration_page_hooks() { |
|
| 136 | 136 | //by default none are added because we normally like the default look of the migration page |
| 137 | 137 | } |
| 138 | 138 | |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | * @param int|string $new_pk eg posts.ID |
| 148 | 148 | * @return void |
| 149 | 149 | */ |
| 150 | - public function set_mapping($old_table,$old_pk,$new_table,$new_pk){ |
|
| 150 | + public function set_mapping($old_table, $old_pk, $new_table, $new_pk) { |
|
| 151 | 151 | //make sure it has the needed keys |
| 152 | - if( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])){ |
|
| 152 | + if ( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])) { |
|
| 153 | 153 | $this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table); |
| 154 | 154 | } |
| 155 | 155 | $this->_mappings[$old_table][$new_table][$old_pk] = $new_pk; |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | * @param string $new_table with wpdb prefix (wp_). Eg: wp_posts |
| 166 | 166 | * @return mixed the primary key on the new table |
| 167 | 167 | */ |
| 168 | - public function get_mapping_new_pk($old_table,$old_pk,$new_table){ |
|
| 169 | - if( ! isset($this->_mappings[$old_table]) || |
|
| 170 | - ! isset($this->_mappings[$old_table][$new_table])){ |
|
| 168 | + public function get_mapping_new_pk($old_table, $old_pk, $new_table) { |
|
| 169 | + if ( ! isset($this->_mappings[$old_table]) || |
|
| 170 | + ! isset($this->_mappings[$old_table][$new_table])) { |
|
| 171 | 171 | //try fetching the option |
| 172 | 172 | $this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table); |
| 173 | 173 | } |
@@ -184,15 +184,15 @@ discard block |
||
| 184 | 184 | * @param mixed $new_pk |
| 185 | 185 | * @return mixed |
| 186 | 186 | */ |
| 187 | - public function get_mapping_old_pk($old_table,$new_table,$new_pk){ |
|
| 188 | - if( ! isset($this->_mappings[$old_table]) || |
|
| 189 | - ! isset($this->_mappings[$old_table][$new_table])){ |
|
| 187 | + public function get_mapping_old_pk($old_table, $new_table, $new_pk) { |
|
| 188 | + if ( ! isset($this->_mappings[$old_table]) || |
|
| 189 | + ! isset($this->_mappings[$old_table][$new_table])) { |
|
| 190 | 190 | //try fetching the option |
| 191 | 191 | $this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table); |
| 192 | 192 | } |
| 193 | - if(isset($this->_mappings[$old_table][$new_table])){ |
|
| 193 | + if (isset($this->_mappings[$old_table][$new_table])) { |
|
| 194 | 194 | $new_pk_to_old_pk = array_flip($this->_mappings[$old_table][$new_table]); |
| 195 | - if(isset($new_pk_to_old_pk[$new_pk])){ |
|
| 195 | + if (isset($new_pk_to_old_pk[$new_pk])) { |
|
| 196 | 196 | return $new_pk_to_old_pk[$new_pk]; |
| 197 | 197 | } |
| 198 | 198 | } |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | * @param string $new_table_name |
| 208 | 208 | * @return array |
| 209 | 209 | */ |
| 210 | - protected function _get_mapping_option($old_table_name,$new_table_name){ |
|
| 211 | - $option = get_option($this->_get_mapping_option_name($old_table_name, $new_table_name),array()); |
|
| 210 | + protected function _get_mapping_option($old_table_name, $new_table_name) { |
|
| 211 | + $option = get_option($this->_get_mapping_option_name($old_table_name, $new_table_name), array()); |
|
| 212 | 212 | return $option; |
| 213 | 213 | } |
| 214 | 214 | |
@@ -221,9 +221,9 @@ discard block |
||
| 221 | 221 | * @param array $mapping_array |
| 222 | 222 | * @return boolean success of updating option |
| 223 | 223 | */ |
| 224 | - protected function _set_mapping_option($old_table_name,$new_table_name,$mapping_array){ |
|
| 224 | + protected function _set_mapping_option($old_table_name, $new_table_name, $mapping_array) { |
|
| 225 | 225 | // echo "set mapping for $old_table_name $new_table_name".count($mapping_array)."<br>"; |
| 226 | - $success = update_option($this->_get_mapping_option_name($old_table_name, $new_table_name),$mapping_array); |
|
| 226 | + $success = update_option($this->_get_mapping_option_name($old_table_name, $new_table_name), $mapping_array); |
|
| 227 | 227 | return $success; |
| 228 | 228 | } |
| 229 | 229 | |
@@ -235,12 +235,12 @@ discard block |
||
| 235 | 235 | * @param string $new_table_name |
| 236 | 236 | * @return string |
| 237 | 237 | */ |
| 238 | - protected function _get_mapping_option_name($old_table_name,$new_table_name){ |
|
| 238 | + protected function _get_mapping_option_name($old_table_name, $new_table_name) { |
|
| 239 | 239 | global $wpdb; |
| 240 | - $old_table_name_sans_wp = str_replace($wpdb->prefix,"",$old_table_name); |
|
| 241 | - $new_table_name_sans_wp = str_replace($wpdb->prefix,"",$new_table_name); |
|
| 240 | + $old_table_name_sans_wp = str_replace($wpdb->prefix, "", $old_table_name); |
|
| 241 | + $new_table_name_sans_wp = str_replace($wpdb->prefix, "", $new_table_name); |
|
| 242 | 242 | $migrates_to = EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this)); |
| 243 | - return substr( EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix . $migrates_to [ 'slug' ] . '_' . $migrates_to[ 'version' ] . '_' . $old_table_name_sans_wp . '_' . $new_table_name_sans_wp, 0, 64 ); |
|
| 243 | + return substr(EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix.$migrates_to ['slug'].'_'.$migrates_to['version'].'_'.$old_table_name_sans_wp.'_'.$new_table_name_sans_wp, 0, 64); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | |
@@ -257,10 +257,10 @@ discard block |
||
| 257 | 257 | * 99% until the function "migration_step" returns EE_Data_Migration_Script_Base::status_complete. |
| 258 | 258 | * @return int |
| 259 | 259 | */ |
| 260 | - protected function _count_records_to_migrate(){ |
|
| 260 | + protected function _count_records_to_migrate() { |
|
| 261 | 261 | $count = 0; |
| 262 | - foreach($this->stages() as $stage){ |
|
| 263 | - $count+= $stage->count_records_to_migrate(); |
|
| 262 | + foreach ($this->stages() as $stage) { |
|
| 263 | + $count += $stage->count_records_to_migrate(); |
|
| 264 | 264 | } |
| 265 | 265 | return $count; |
| 266 | 266 | } |
@@ -272,10 +272,10 @@ discard block |
||
| 272 | 272 | * by just setting a transient and updating it after each migration_step |
| 273 | 273 | * @return int |
| 274 | 274 | */ |
| 275 | - public function count_records_migrated(){ |
|
| 275 | + public function count_records_migrated() { |
|
| 276 | 276 | $count = 0; |
| 277 | - foreach($this->stages() as $stage){ |
|
| 278 | - $count+= $stage->count_records_migrated(); |
|
| 277 | + foreach ($this->stages() as $stage) { |
|
| 278 | + $count += $stage->count_records_migrated(); |
|
| 279 | 279 | } |
| 280 | 280 | $this->_records_migrated = $count; |
| 281 | 281 | return $count; |
@@ -289,24 +289,24 @@ discard block |
||
| 289 | 289 | * @throws EE_Error |
| 290 | 290 | * @throws Exception |
| 291 | 291 | */ |
| 292 | - public function migration_step($num_records_to_migrate_limit){ |
|
| 292 | + public function migration_step($num_records_to_migrate_limit) { |
|
| 293 | 293 | //reset the feedback message |
| 294 | 294 | $this->_feedback_message = ''; |
| 295 | 295 | //if we haven't yet done the 1st schema changes, do them now. buffer any output |
| 296 | 296 | $this->_maybe_do_schema_changes(true); |
| 297 | 297 | |
| 298 | - $num_records_actually_migrated =0; |
|
| 298 | + $num_records_actually_migrated = 0; |
|
| 299 | 299 | $records_migrated_per_stage = array(); |
| 300 | 300 | //setup the 'stage' variable, which should hold the last run stage of the migration (or none at all if nothing runs) |
| 301 | 301 | $stage = null; |
| 302 | 302 | //get the next stage that isn't complete |
| 303 | - foreach($this->stages() as $stage){ |
|
| 304 | - if( $stage->get_status() == EE_Data_Migration_Manager::status_continue){ |
|
| 305 | - try{ |
|
| 303 | + foreach ($this->stages() as $stage) { |
|
| 304 | + if ($stage->get_status() == EE_Data_Migration_Manager::status_continue) { |
|
| 305 | + try { |
|
| 306 | 306 | $records_migrated_during_stage = $stage->migration_step($num_records_to_migrate_limit - $num_records_actually_migrated); |
| 307 | 307 | $num_records_actually_migrated += $records_migrated_during_stage; |
| 308 | 308 | $records_migrated_per_stage[$stage->pretty_name()] = $records_migrated_during_stage; |
| 309 | - }catch(Exception $e){ |
|
| 309 | + } catch (Exception $e) { |
|
| 310 | 310 | //yes if we catch an exception here, we consider that migration stage borked. |
| 311 | 311 | $stage->set_status(EE_Data_Migration_Manager::status_fatal_error); |
| 312 | 312 | $this->set_status(EE_Data_Migration_Manager::status_fatal_error); |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | throw $e; |
| 315 | 315 | } |
| 316 | 316 | //check that the migration stage didn't mark itself as having a fatal error |
| 317 | - if($stage->is_broken()){ |
|
| 317 | + if ($stage->is_broken()) { |
|
| 318 | 318 | $this->set_broken(); |
| 319 | 319 | throw new EE_Error($stage->get_last_error()); |
| 320 | 320 | } |
@@ -322,24 +322,24 @@ discard block |
||
| 322 | 322 | //once we've migrated all the number we intended to (possibly from different stages), stop migrating |
| 323 | 323 | //or if we had a fatal error |
| 324 | 324 | //or if the current script stopped early- its not done, but it's done all it thinks we should do on this step |
| 325 | - if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()){ |
|
| 325 | + if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()) { |
|
| 326 | 326 | break; |
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | //check if we're all done this data migration... |
| 330 | 330 | //which is indicated by being done early AND the last stage claims to be done |
| 331 | - if($stage == NULL){ |
|
| 331 | + if ($stage == NULL) { |
|
| 332 | 332 | //this migration script apparently has NO stages... which is super weird, but whatever |
| 333 | 333 | $this->set_completed(); |
| 334 | 334 | $this->_maybe_do_schema_changes(false); |
| 335 | - }else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){ |
|
| 335 | + } else if ($num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()) { |
|
| 336 | 336 | //apparently we're done, because we couldn't migrate the number we intended to |
| 337 | 337 | $this->set_completed(); |
| 338 | 338 | $this->_update_feedback_message(array_reverse($records_migrated_per_stage)); |
| 339 | 339 | //do schema changes for after the migration now |
| 340 | 340 | //first double-check we haven't already done this |
| 341 | 341 | $this->_maybe_do_schema_changes(false); |
| 342 | - }else{ |
|
| 342 | + } else { |
|
| 343 | 343 | //update feedback message, keeping in mind that we show them with the most recent at the top |
| 344 | 344 | $this->_update_feedback_message(array_reverse($records_migrated_per_stage)); |
| 345 | 345 | } |
@@ -353,12 +353,12 @@ discard block |
||
| 353 | 353 | * @param array $records_migrated_per_stage KEYS are pretty names for each stage; values are the count of records migrated from that stage |
| 354 | 354 | * @return void |
| 355 | 355 | */ |
| 356 | - private function _update_feedback_message($records_migrated_per_stage){ |
|
| 356 | + private function _update_feedback_message($records_migrated_per_stage) { |
|
| 357 | 357 | $feedback_message_array = array(); |
| 358 | - foreach($records_migrated_per_stage as $migration_stage_name => $num_records_migrated){ |
|
| 359 | - $feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"),$num_records_migrated,$migration_stage_name) ; |
|
| 358 | + foreach ($records_migrated_per_stage as $migration_stage_name => $num_records_migrated) { |
|
| 359 | + $feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"), $num_records_migrated, $migration_stage_name); |
|
| 360 | 360 | } |
| 361 | - $this->_feedback_message .= implode("<br>",$feedback_message_array); |
|
| 361 | + $this->_feedback_message .= implode("<br>", $feedback_message_array); |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | |
@@ -370,27 +370,27 @@ discard block |
||
| 370 | 370 | * @throws Exception |
| 371 | 371 | * @return void |
| 372 | 372 | */ |
| 373 | - private function _maybe_do_schema_changes($before = true){ |
|
| 373 | + private function _maybe_do_schema_changes($before = true) { |
|
| 374 | 374 | //so this property will be either _schema_changes_after_migration_ran or _schema_changes_before_migration_ran |
| 375 | - $property_name = '_schema_changes_'. ($before ? 'before' : 'after').'_migration_ran'; |
|
| 376 | - if ( ! $this->$property_name ){ |
|
| 377 | - try{ |
|
| 375 | + $property_name = '_schema_changes_'.($before ? 'before' : 'after').'_migration_ran'; |
|
| 376 | + if ( ! $this->$property_name) { |
|
| 377 | + try { |
|
| 378 | 378 | ob_start(); |
| 379 | - if($before){ |
|
| 379 | + if ($before) { |
|
| 380 | 380 | $this->schema_changes_before_migration(); |
| 381 | - }else{ |
|
| 381 | + } else { |
|
| 382 | 382 | $this->schema_changes_after_migration(); |
| 383 | 383 | } |
| 384 | 384 | $output = ob_get_contents(); |
| 385 | 385 | ob_end_clean(); |
| 386 | - }catch(Exception $e){ |
|
| 386 | + } catch (Exception $e) { |
|
| 387 | 387 | $this->set_status(EE_Data_Migration_Manager::status_fatal_error); |
| 388 | 388 | throw $e; |
| 389 | 389 | } |
| 390 | 390 | //record that we've done these schema changes |
| 391 | 391 | $this->$property_name = true; |
| 392 | 392 | //if there were any warnings etc, record them as non-fatal errors |
| 393 | - if( $output ){ |
|
| 393 | + if ($output) { |
|
| 394 | 394 | //there were some warnings |
| 395 | 395 | $this->_errors[] = $output; |
| 396 | 396 | } |
@@ -417,17 +417,17 @@ discard block |
||
| 417 | 417 | * @param string $table_definition_sql |
| 418 | 418 | * @param string $engine_string |
| 419 | 419 | */ |
| 420 | - protected function _table_is_new_in_this_version($table_name,$table_definition_sql,$engine_string='ENGINE=InnoDB '){ |
|
| 420 | + protected function _table_is_new_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=InnoDB ') { |
|
| 421 | 421 | //we want to know if we are currently performing a migration. We could just believe what was set on the _migrating property, but let's double-check (ie the script should apply and we should be in MM) |
| 422 | 422 | $currently_migrating = $this->_migrating && |
| 423 | - $this->can_migrate_from_version( EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set() ) && |
|
| 423 | + $this->can_migrate_from_version(EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set()) && |
|
| 424 | 424 | EE_Maintenance_Mode::instance()->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance; |
| 425 | - if( $this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $currently_migrating ){ |
|
| 425 | + if ($this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $currently_migrating) { |
|
| 426 | 426 | $drop_pre_existing_tables = true; |
| 427 | - }else{ |
|
| 427 | + } else { |
|
| 428 | 428 | $drop_pre_existing_tables = false; |
| 429 | 429 | } |
| 430 | - $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables ); |
|
| 430 | + $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables); |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | |
@@ -443,14 +443,14 @@ discard block |
||
| 443 | 443 | * @param string $table_definition_sql |
| 444 | 444 | * @param string $engine_string |
| 445 | 445 | */ |
| 446 | - protected function _table_should_exist_previously($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){ |
|
| 446 | + protected function _table_should_exist_previously($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') { |
|
| 447 | 447 | |
| 448 | - if(in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(),array(EE_System::req_type_new_activation))){ |
|
| 448 | + if (in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(), array(EE_System::req_type_new_activation))) { |
|
| 449 | 449 | $drop_pre_existing_tables = true; |
| 450 | - }else{ |
|
| 450 | + } else { |
|
| 451 | 451 | $drop_pre_existing_tables = false; |
| 452 | 452 | } |
| 453 | - $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables ); |
|
| 453 | + $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables); |
|
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | /** |
@@ -460,13 +460,13 @@ discard block |
||
| 460 | 460 | * @param string $engine_string |
| 461 | 461 | * @param boolean $drop_pre_existing_tables |
| 462 | 462 | */ |
| 463 | - private function _create_table_and_catch_errors( $table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE ){ |
|
| 463 | + private function _create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE) { |
|
| 464 | 464 | EE_Registry::instance()->load_helper('Activation'); |
| 465 | - try{ |
|
| 466 | - EEH_Activation::create_table($table_name,$table_definition_sql, $engine_string, $drop_pre_existing_tables); |
|
| 467 | - }catch( EE_Error $e ) { |
|
| 468 | - $message = $e->getMessage() . '<br>Stack Trace:' . $e->getTraceAsString(); |
|
| 469 | - $this->add_error( $message ); |
|
| 465 | + try { |
|
| 466 | + EEH_Activation::create_table($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables); |
|
| 467 | + } catch (EE_Error $e) { |
|
| 468 | + $message = $e->getMessage().'<br>Stack Trace:'.$e->getTraceAsString(); |
|
| 469 | + $this->add_error($message); |
|
| 470 | 470 | $this->_feedback_message .= $message; |
| 471 | 471 | } |
| 472 | 472 | } |
@@ -478,15 +478,15 @@ discard block |
||
| 478 | 478 | * @return int one of EE_System::_req_type_* constants |
| 479 | 479 | * @throws EE_Error |
| 480 | 480 | */ |
| 481 | - private function _get_req_type_for_plugin_corresponding_to_this_dms(){ |
|
| 482 | - if($this->slug() == 'Core'){ |
|
| 481 | + private function _get_req_type_for_plugin_corresponding_to_this_dms() { |
|
| 482 | + if ($this->slug() == 'Core') { |
|
| 483 | 483 | return EE_System::instance()->detect_req_type(); |
| 484 | - }else{//it must be for an addon |
|
| 484 | + } else {//it must be for an addon |
|
| 485 | 485 | $addon_name = $this->slug(); |
| 486 | - if( EE_Registry::instance()->get_addon_by_name($addon_name)){ |
|
| 486 | + if (EE_Registry::instance()->get_addon_by_name($addon_name)) { |
|
| 487 | 487 | return EE_Registry::instance()->get_addon_by_name($addon_name)->detect_req_type(); |
| 488 | - }else{ |
|
| 489 | - throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"),$this->slug(),$addon_name,implode(",",array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ) ) ; |
|
| 488 | + } else { |
|
| 489 | + throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"), $this->slug(), $addon_name, implode(",", array_keys(EE_Registry::instance()->get_addons_by_name())))); |
|
| 490 | 490 | } |
| 491 | 491 | } |
| 492 | 492 | } |
@@ -497,13 +497,13 @@ discard block |
||
| 497 | 497 | * returns an array of strings describing errors by all the script's stages |
| 498 | 498 | * @return array |
| 499 | 499 | */ |
| 500 | - public function get_errors(){ |
|
| 500 | + public function get_errors() { |
|
| 501 | 501 | $all_errors = $this->_errors; |
| 502 | - if( ! is_array($all_errors)){ |
|
| 502 | + if ( ! is_array($all_errors)) { |
|
| 503 | 503 | $all_errors = array(); |
| 504 | 504 | } |
| 505 | - foreach($this->stages() as $stage){ |
|
| 506 | - $all_errors = array_merge($stage->get_errors(),$all_errors); |
|
| 505 | + foreach ($this->stages() as $stage) { |
|
| 506 | + $all_errors = array_merge($stage->get_errors(), $all_errors); |
|
| 507 | 507 | } |
| 508 | 508 | return $all_errors; |
| 509 | 509 | } |
@@ -514,8 +514,8 @@ discard block |
||
| 514 | 514 | * Indicates whether or not this migration script should continue |
| 515 | 515 | * @return boolean |
| 516 | 516 | */ |
| 517 | - public function can_continue(){ |
|
| 518 | - return in_array($this->get_status(), EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script); |
|
| 517 | + public function can_continue() { |
|
| 518 | + return in_array($this->get_status(), EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script); |
|
| 519 | 519 | } |
| 520 | 520 | |
| 521 | 521 | |
@@ -527,8 +527,8 @@ discard block |
||
| 527 | 527 | * get ordered by the indexes |
| 528 | 528 | * @return EE_Data_Migration_Script_Stage[] |
| 529 | 529 | */ |
| 530 | - protected function stages(){ |
|
| 531 | - $stages = apply_filters( 'FHEE__'.get_class($this).'__stages',$this->_migration_stages ); |
|
| 530 | + protected function stages() { |
|
| 531 | + $stages = apply_filters('FHEE__'.get_class($this).'__stages', $this->_migration_stages); |
|
| 532 | 532 | ksort($stages); |
| 533 | 533 | return $stages; |
| 534 | 534 | } |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | * can be displayed to the user |
| 541 | 541 | * @return string |
| 542 | 542 | */ |
| 543 | - public function get_feedback_message(){ |
|
| 543 | + public function get_feedback_message() { |
|
| 544 | 544 | return $this->_feedback_message; |
| 545 | 545 | } |
| 546 | 546 | |
@@ -552,16 +552,16 @@ discard block |
||
| 552 | 552 | * possible that this class is defined when it goes to sleep, but NOT available when it |
| 553 | 553 | * awakes (eg, this class is part of an addon that is deactivated at some point). |
| 554 | 554 | */ |
| 555 | - public function properties_as_array(){ |
|
| 555 | + public function properties_as_array() { |
|
| 556 | 556 | $properties = parent::properties_as_array(); |
| 557 | 557 | $properties['_migration_stages'] = array(); |
| 558 | - foreach($this->_migration_stages as $migration_stage_priority => $migration_stage_class){ |
|
| 558 | + foreach ($this->_migration_stages as $migration_stage_priority => $migration_stage_class) { |
|
| 559 | 559 | $properties['_migration_stages'][$migration_stage_priority] = $migration_stage_class->properties_as_array(); |
| 560 | 560 | } |
| 561 | 561 | unset($properties['_mappings']); |
| 562 | 562 | |
| 563 | - foreach($this->_mappings as $old_table_name => $mapping_to_new_table){ |
|
| 564 | - foreach($mapping_to_new_table as $new_table_name => $mapping){ |
|
| 563 | + foreach ($this->_mappings as $old_table_name => $mapping_to_new_table) { |
|
| 564 | + foreach ($mapping_to_new_table as $new_table_name => $mapping) { |
|
| 565 | 565 | $this->_set_mapping_option($old_table_name, $new_table_name, $mapping); |
| 566 | 566 | } |
| 567 | 567 | } |
@@ -576,19 +576,19 @@ discard block |
||
| 576 | 576 | * @param array $array_of_properties like what's produced from properties_as_array() method |
| 577 | 577 | * @return void |
| 578 | 578 | */ |
| 579 | - public function instantiate_from_array_of_properties($array_of_properties){ |
|
| 579 | + public function instantiate_from_array_of_properties($array_of_properties) { |
|
| 580 | 580 | $stages_properties_arrays = $array_of_properties['_migration_stages']; |
| 581 | 581 | unset($array_of_properties['_migration_stages']); |
| 582 | 582 | unset($array_of_properties['class']); |
| 583 | - foreach($array_of_properties as $property_name => $property_value){ |
|
| 583 | + foreach ($array_of_properties as $property_name => $property_value) { |
|
| 584 | 584 | $this->$property_name = $property_value; |
| 585 | 585 | } |
| 586 | 586 | //_migration_stages are already instantiated, but have only default data |
| 587 | - foreach($this->_migration_stages as $stage){ |
|
| 588 | - $stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage),$stages_properties_arrays); |
|
| 587 | + foreach ($this->_migration_stages as $stage) { |
|
| 588 | + $stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage), $stages_properties_arrays); |
|
| 589 | 589 | //SO, if we found the stage data that was saved, use it. Otherwise, I guess the stage is new? (maybe added by |
| 590 | 590 | //an addon? Unlikely... not sure why it wouldn't exist, but if it doesn't just treat it like it was never started yet) |
| 591 | - if($stage_data){ |
|
| 591 | + if ($stage_data) { |
|
| 592 | 592 | $stage->instantiate_from_array_of_properties($stage_data); |
| 593 | 593 | } |
| 594 | 594 | } |
@@ -604,9 +604,9 @@ discard block |
||
| 604 | 604 | * @param array $migration_stage_data_arrays |
| 605 | 605 | * @return null |
| 606 | 606 | */ |
| 607 | - private function _find_migration_stage_data_with_classname($classname,$migration_stage_data_arrays){ |
|
| 608 | - foreach($migration_stage_data_arrays as $migration_stage_data_array){ |
|
| 609 | - if(isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname){ |
|
| 607 | + private function _find_migration_stage_data_with_classname($classname, $migration_stage_data_arrays) { |
|
| 608 | + foreach ($migration_stage_data_arrays as $migration_stage_data_array) { |
|
| 609 | + if (isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname) { |
|
| 610 | 610 | return $migration_stage_data_array; |
| 611 | 611 | } |
| 612 | 612 | } |
@@ -622,8 +622,8 @@ discard block |
||
| 622 | 622 | * @return array where the first key is the plugin's slug, the 2nd is the version of that plugin |
| 623 | 623 | * that will be updated to. Eg array('Core','4.1.0') |
| 624 | 624 | */ |
| 625 | - public final function migrates_to_version(){ |
|
| 626 | - return EE_Data_Migration_Manager::instance()->script_migrates_to_version( get_class( $this ) ); |
|
| 625 | + public final function migrates_to_version() { |
|
| 626 | + return EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this)); |
|
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | |
@@ -635,10 +635,10 @@ discard block |
||
| 635 | 635 | * Or 'Core' for core (non-addon). |
| 636 | 636 | * @return string |
| 637 | 637 | */ |
| 638 | - public function slug(){ |
|
| 638 | + public function slug() { |
|
| 639 | 639 | $migrates_to_version_info = $this->migrates_to_version(); |
| 640 | 640 | //the slug is the first part of the array |
| 641 | - return $migrates_to_version_info[ 'slug' ]; |
|
| 641 | + return $migrates_to_version_info['slug']; |
|
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | * the database up so it can run), then you can set "A" to priority 3 or something. |
| 653 | 653 | * @return int |
| 654 | 654 | */ |
| 655 | - public function priority(){ |
|
| 655 | + public function priority() { |
|
| 656 | 656 | return $this->_priority; |
| 657 | 657 | } |
| 658 | 658 | |
@@ -665,18 +665,18 @@ discard block |
||
| 665 | 665 | * @param boolean $migrating |
| 666 | 666 | * @return void |
| 667 | 667 | */ |
| 668 | - public function set_migrating( $migrating = TRUE ){ |
|
| 668 | + public function set_migrating($migrating = TRUE) { |
|
| 669 | 669 | $this->_migrating = $migrating; |
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | /** |
| 673 | 673 | * Marks that we think this migration class can continue to migrate |
| 674 | 674 | */ |
| 675 | - public function reattempt(){ |
|
| 675 | + public function reattempt() { |
|
| 676 | 676 | parent::reattempt(); |
| 677 | 677 | //also, we want to reattempt any stages that were marked as borked |
| 678 | - foreach( $this->stages() as $stage ) { |
|
| 679 | - if( $stage->is_broken() ) { |
|
| 678 | + foreach ($this->stages() as $stage) { |
|
| 679 | + if ($stage->is_broken()) { |
|
| 680 | 680 | $stage->reattempt(); |
| 681 | 681 | } |
| 682 | 682 | } |