@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | /** |
6 | 7 | * Event Espresso |
7 | 8 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_PMT_Bank extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Bank extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $this->_pretty_name = __("Bank", 'event_espresso'); |
39 | 39 | parent::__construct($pm_instance); |
40 | 40 | $this->_default_button_url = $this->file_url().'lib'.DS.'bank-logo.png'; |
41 | - $this->_default_description = __( 'Make payment using an electronic funds transfer from your bank.', 'event_espresso' ); |
|
41 | + $this->_default_description = __('Make payment using an electronic funds transfer from your bank.', 'event_espresso'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param \EE_Transaction $transaction |
49 | 49 | * @return NULL |
50 | 50 | */ |
51 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
51 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
52 | 52 | return NULL; |
53 | 53 | } |
54 | 54 | |
@@ -62,17 +62,17 @@ discard block |
||
62 | 62 | return new EE_Payment_Method_Form(array( |
63 | 63 | 'extra_meta_inputs'=>array( |
64 | 64 | 'page_title'=>new EE_Text_Input(array( |
65 | - 'html_label_text'=> sprintf(__("Title %s", "event_espresso"), $this->get_help_tab_link()), |
|
65 | + 'html_label_text'=> sprintf(__("Title %s", "event_espresso"), $this->get_help_tab_link()), |
|
66 | 66 | 'default'=> __("Electronic Funds Transfers", 'event_espresso') |
67 | 67 | )), |
68 | - 'payment_instructions'=>new EE_Text_Area_Input( array( |
|
69 | - 'html_label_text'=> sprintf(__("Payment Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
70 | - 'html_help_text' => __( 'Provide instructions on how registrants can send the bank draft payment. Eg, mention your account name, bank account number, bank name, bank routing code, and bank address, etc.', 'event_espresso' ), |
|
68 | + 'payment_instructions'=>new EE_Text_Area_Input(array( |
|
69 | + 'html_label_text'=> sprintf(__("Payment Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
70 | + 'html_help_text' => __('Provide instructions on how registrants can send the bank draft payment. Eg, mention your account name, bank account number, bank name, bank routing code, and bank address, etc.', 'event_espresso'), |
|
71 | 71 | 'default'=> sprintf( |
72 | 72 | __('Please initiate an electronic payment using the following bank information: %1$sAccount Owner: Luke Skywalker%1$sBank Account # 1234567890%1$sBank Name: Rebellion Bank%1$sRouting Number: 12345%1$sBank Address: 12345 Wookie Rd., Planet Corellian.%1$sPayment must be received within 48 hours of event date.', 'event_espresso'), |
73 | 73 | "\n" |
74 | 74 | ), |
75 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
75 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
76 | 76 | )), |
77 | 77 | ), |
78 | 78 | 'exclude'=>array('PMD_debug_mode') |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @see EE_PMT_Base::help_tabs_config() |
87 | 87 | * @return array |
88 | 88 | */ |
89 | - public function help_tabs_config(){ |
|
89 | + public function help_tabs_config() { |
|
90 | 90 | return array( |
91 | 91 | $this->get_help_tab_name() => array( |
92 | 92 | 'title' => __('Bank Draft Settings', 'event_espresso'), |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * Other gateways may want to override this, such as offline gateways. |
104 | 104 | * @return string |
105 | 105 | */ |
106 | - public function payment_overview_content(EE_Payment $payment){ |
|
106 | + public function payment_overview_content(EE_Payment $payment) { |
|
107 | 107 | EE_Registry::instance()->load_helper('Template'); |
108 | 108 | $extra_meta_for_payment_method = $this->_pm_instance->all_extra_meta_array(); |
109 | 109 | $template_vars = array_merge( |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | ), |
116 | 116 | $extra_meta_for_payment_method); |
117 | 117 | return EEH_Template::locate_template( |
118 | - 'payment_methods' . DS . 'Bank'. DS . 'templates' . DS . 'bank_payment_details_content.template.php', |
|
118 | + 'payment_methods'.DS.'Bank'.DS.'templates'.DS.'bank_payment_details_content.template.php', |
|
119 | 119 | $template_vars); |
120 | 120 | } |
121 | 121 |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | /** |
6 | 7 | * Event Espresso |
7 | 8 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_PMT_Invoice extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Invoice extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function __construct($pm_instance = NULL) { |
38 | 38 | $this->_pretty_name = __("Invoice", 'event_espresso'); |
39 | - $this->_default_description = __( 'After clicking "Finalize Registration", you will be given instructions on how to access your invoice and complete your payment.', 'event_espresso' ); |
|
39 | + $this->_default_description = __('After clicking "Finalize Registration", you will be given instructions on how to access your invoice and complete your payment.', 'event_espresso'); |
|
40 | 40 | parent::__construct($pm_instance); |
41 | 41 | $this->_default_button_url = $this->file_url().'lib'.DS.'invoice-logo.png'; |
42 | 42 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param \EE_Transaction $transaction |
49 | 49 | * @return NULL |
50 | 50 | */ |
51 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
51 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
52 | 52 | return NULL; |
53 | 53 | } |
54 | 54 | |
@@ -61,53 +61,53 @@ discard block |
||
61 | 61 | public function generate_new_settings_form() { |
62 | 62 | $pdf_payee_input_name = 'pdf_payee_name'; |
63 | 63 | $confirmation_text_input_name = 'page_confirmation_text'; |
64 | - $form = new EE_Payment_Method_Form(array( |
|
64 | + $form = new EE_Payment_Method_Form(array( |
|
65 | 65 | // 'payment_method_type' => $this, |
66 | 66 | 'extra_meta_inputs'=>array( |
67 | 67 | $pdf_payee_input_name => new EE_Text_Input(array( |
68 | - 'html_label_text' => sprintf( __( 'Payee Name %s', 'event_espresso' ), $this->get_help_tab_link()) |
|
68 | + 'html_label_text' => sprintf(__('Payee Name %s', 'event_espresso'), $this->get_help_tab_link()) |
|
69 | 69 | )), |
70 | 70 | 'pdf_payee_email' => new EE_Email_Input(array( |
71 | - 'html_label_text' => sprintf( __( 'Payee Email %s', 'event_espresso' ), $this->get_help_tab_link()), |
|
71 | + 'html_label_text' => sprintf(__('Payee Email %s', 'event_espresso'), $this->get_help_tab_link()), |
|
72 | 72 | )), |
73 | 73 | 'pdf_payee_tax_number' => new EE_Text_Input(array( |
74 | - 'html_label_text' => sprintf( __( 'Payee Tax Number %s', 'event_espresso' ), $this->get_help_tab_link()), |
|
74 | + 'html_label_text' => sprintf(__('Payee Tax Number %s', 'event_espresso'), $this->get_help_tab_link()), |
|
75 | 75 | )), |
76 | - 'pdf_payee_address' => new EE_Text_Area_Input( array( |
|
77 | - 'html_label_text' => sprintf( __( 'Payee Address %s', 'event_espresso' ), $this->get_help_tab_link() ), |
|
78 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
76 | + 'pdf_payee_address' => new EE_Text_Area_Input(array( |
|
77 | + 'html_label_text' => sprintf(__('Payee Address %s', 'event_espresso'), $this->get_help_tab_link()), |
|
78 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
79 | 79 | )), |
80 | 80 | 'pdf_instructions'=>new EE_Text_Area_Input(array( |
81 | - 'html_label_text'=> sprintf(__("Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
81 | + 'html_label_text'=> sprintf(__("Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
82 | 82 | 'default'=> __("Please send this invoice with payment attached to the address above, or use the payment link below. Payment must be received within 48 hours of event date.", 'event_espresso'), |
83 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
83 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
84 | 84 | )), |
85 | 85 | 'pdf_logo_image'=>new EE_Admin_File_Uploader_Input(array( |
86 | - 'html_label_text'=> sprintf(__("Logo Image %s", "event_espresso"), $this->get_help_tab_link()), |
|
86 | + 'html_label_text'=> sprintf(__("Logo Image %s", "event_espresso"), $this->get_help_tab_link()), |
|
87 | 87 | 'default'=> EE_Config::instance()->organization->logo_url, |
88 | 88 | 'html_help_text'=> __("(Logo for the top left of the invoice)", 'event_espresso'), |
89 | 89 | )), |
90 | 90 | $confirmation_text_input_name =>new EE_Text_Area_Input(array( |
91 | - 'html_label_text'=> sprintf(__("Confirmation Text %s", "event_espresso"), $this->get_help_tab_link()), |
|
91 | + 'html_label_text'=> sprintf(__("Confirmation Text %s", "event_espresso"), $this->get_help_tab_link()), |
|
92 | 92 | 'default'=> __("Payment must be received within 48 hours of event date. Details about where to send payment is included on the invoice.", 'event_espresso'), |
93 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
93 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
94 | 94 | )), |
95 | 95 | 'page_extra_info'=>new EE_Text_Area_Input(array( |
96 | - 'html_label_text'=> sprintf(__("Extra Info %s", "event_espresso"), $this->get_help_tab_link()), |
|
97 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
96 | + 'html_label_text'=> sprintf(__("Extra Info %s", "event_espresso"), $this->get_help_tab_link()), |
|
97 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
98 | 98 | )), |
99 | 99 | ), |
100 | 100 | 'include'=>array( |
101 | - 'PMD_ID', 'PMD_name','PMD_desc','PMD_admin_name','PMD_admin_desc', 'PMD_type','PMD_slug', 'PMD_open_by_default','PMD_button_url','PMD_scope','Currency','PMD_order', |
|
102 | - $pdf_payee_input_name, 'pdf_payee_email', 'pdf_payee_tax_number', 'pdf_payee_address', 'pdf_instructions','pdf_logo_image', |
|
101 | + 'PMD_ID', 'PMD_name', 'PMD_desc', 'PMD_admin_name', 'PMD_admin_desc', 'PMD_type', 'PMD_slug', 'PMD_open_by_default', 'PMD_button_url', 'PMD_scope', 'Currency', 'PMD_order', |
|
102 | + $pdf_payee_input_name, 'pdf_payee_email', 'pdf_payee_tax_number', 'pdf_payee_address', 'pdf_instructions', 'pdf_logo_image', |
|
103 | 103 | $confirmation_text_input_name, 'page_extra_info'), |
104 | 104 | )); |
105 | 105 | $form->add_subsections( |
106 | - array( 'header1' => new EE_Form_Section_HTML_From_Template( 'payment_methods/Invoice/templates/invoice_settings_header_display.template.php' )), |
|
106 | + array('header1' => new EE_Form_Section_HTML_From_Template('payment_methods/Invoice/templates/invoice_settings_header_display.template.php')), |
|
107 | 107 | $pdf_payee_input_name |
108 | 108 | ); |
109 | 109 | $form->add_subsections( |
110 | - array( 'header2'=>new EE_Form_Section_HTML_From_Template( 'payment_methods/Invoice/templates/invoice_settings_header_gateway.template.php' )), |
|
110 | + array('header2'=>new EE_Form_Section_HTML_From_Template('payment_methods/Invoice/templates/invoice_settings_header_gateway.template.php')), |
|
111 | 111 | $confirmation_text_input_name |
112 | 112 | ); |
113 | 113 | return $form; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @see EE_PMT_Base::help_tabs_config() |
121 | 121 | * @return array |
122 | 122 | */ |
123 | - public function help_tabs_config(){ |
|
123 | + public function help_tabs_config() { |
|
124 | 124 | return array( |
125 | 125 | $this->get_help_tab_name() => array( |
126 | 126 | 'title' => __('Invoice Settings', 'event_espresso'), |
@@ -138,17 +138,17 @@ discard block |
||
138 | 138 | * @param \EE_Payment $payment |
139 | 139 | * @return string |
140 | 140 | */ |
141 | - public function payment_overview_content( EE_Payment $payment ){ |
|
141 | + public function payment_overview_content(EE_Payment $payment) { |
|
142 | 142 | EE_Registry::instance()->load_helper('Template'); |
143 | 143 | return EEH_Template::locate_template( |
144 | - 'payment_methods' . DS . 'Invoice'. DS . 'templates'.DS.'invoice_payment_details_content.template.php', |
|
144 | + 'payment_methods'.DS.'Invoice'.DS.'templates'.DS.'invoice_payment_details_content.template.php', |
|
145 | 145 | array_merge( |
146 | 146 | array( |
147 | 147 | 'payment_method' => $this->_pm_instance, |
148 | 148 | 'payment' => $payment, |
149 | 149 | 'page_confirmation_text' => '', |
150 | 150 | 'page_extra_info' => '', |
151 | - 'invoice_url' => $payment->transaction()->primary_registration()->invoice_url( 'html' ) |
|
151 | + 'invoice_url' => $payment->transaction()->primary_registration()->invoice_url('html') |
|
152 | 152 | ), |
153 | 153 | $this->_pm_instance->all_extra_meta_array() |
154 | 154 | ) |
@@ -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 | * |
@@ -51,17 +51,17 @@ discard block |
||
51 | 51 | * @param WP $WP |
52 | 52 | * @return void |
53 | 53 | */ |
54 | - public function run( WP $WP ) { |
|
55 | - if ( did_action( 'pre_get_posts' ) && did_action( 'send_headers' ) ) { |
|
54 | + public function run(WP $WP) { |
|
55 | + if (did_action('pre_get_posts') && did_action('send_headers')) { |
|
56 | 56 | global $wp_query; |
57 | 57 | EED_Single_Page_Checkout::load_reg_steps(); |
58 | - EED_Single_Page_Checkout::init( $wp_query ); |
|
58 | + EED_Single_Page_Checkout::init($wp_query); |
|
59 | 59 | } else { |
60 | 60 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
61 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
61 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
62 | 62 | // this will trigger the EED_Single_Page_Checkout module's run() method during the pre_get_posts hook point, |
63 | 63 | // this allows us to initialize things, enqueue assets, etc, |
64 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'init' ), 10, 1 ); |
|
64 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'init'), 10, 1); |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param array $attributes |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - public function process_shortcode( $attributes = array() ) { |
|
77 | + public function process_shortcode($attributes = array()) { |
|
78 | 78 | return EE_Registry::instance()->REQ->get_output(); |
79 | 79 | } |
80 | 80 |
@@ -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 | * |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @return void |
92 | 92 | */ |
93 | 93 | public static function set_hooks() { |
94 | - add_action( 'wp_loaded', array( 'EES_Espresso_Thank_You', 'set_definitions' ), 2 ); |
|
94 | + add_action('wp_loaded', array('EES_Espresso_Thank_You', 'set_definitions'), 2); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public static function set_hooks_admin() { |
104 | 104 | // AJAX for IPN monitoring |
105 | - add_filter( 'heartbeat_received', array( 'EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor' ), 10, 3 ); |
|
106 | - add_filter( 'heartbeat_nopriv_received', array( 'EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor' ), 10, 3 ); |
|
107 | - add_action( 'wp_ajax_espresso_resend_reg_confirmation_email', array( 'EES_Espresso_Thank_You', 'resend_reg_confirmation_email' ), 10, 2 ); |
|
108 | - add_action( 'wp_ajax_nopriv_espresso_resend_reg_confirmation_email', array( 'EES_Espresso_Thank_You', 'resend_reg_confirmation_email' ), 10, 2 ); |
|
105 | + add_filter('heartbeat_received', array('EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor'), 10, 3); |
|
106 | + add_filter('heartbeat_nopriv_received', array('EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor'), 10, 3); |
|
107 | + add_action('wp_ajax_espresso_resend_reg_confirmation_email', array('EES_Espresso_Thank_You', 'resend_reg_confirmation_email'), 10, 2); |
|
108 | + add_action('wp_ajax_nopriv_espresso_resend_reg_confirmation_email', array('EES_Espresso_Thank_You', 'resend_reg_confirmation_email'), 10, 2); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | * @return void |
118 | 118 | */ |
119 | 119 | public static function set_definitions() { |
120 | - define( 'THANK_YOU_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
121 | - define( 'THANK_YOU_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
120 | + define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
121 | + define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | |
@@ -130,23 +130,23 @@ discard block |
||
130 | 130 | * @return EE_Transaction |
131 | 131 | */ |
132 | 132 | public function get_txn() { |
133 | - if ( $this->_current_txn instanceof EE_Transaction ) { |
|
133 | + if ($this->_current_txn instanceof EE_Transaction) { |
|
134 | 134 | return $this->_current_txn; |
135 | 135 | } |
136 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
137 | - if ( ! $TXN_model instanceof EEM_Transaction ) { |
|
136 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
137 | + if ( ! $TXN_model instanceof EEM_Transaction) { |
|
138 | 138 | EE_Error::add_error( |
139 | - __( 'The transaction model could not be established.', 'event_espresso' ), |
|
139 | + __('The transaction model could not be established.', 'event_espresso'), |
|
140 | 140 | __FILE__, __FUNCTION__, __LINE__ |
141 | 141 | ); |
142 | 142 | return NULL; |
143 | 143 | } |
144 | 144 | //get the transaction. yes, we may have just loaded it, but it may have been updated, or this may be via an ajax request |
145 | - $this->_current_txn = $TXN_model->get_transaction_from_reg_url_link( $this->_reg_url_link ); |
|
145 | + $this->_current_txn = $TXN_model->get_transaction_from_reg_url_link($this->_reg_url_link); |
|
146 | 146 | // verify TXN |
147 | - if ( WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction ) { |
|
147 | + if (WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction) { |
|
148 | 148 | EE_Error::add_error( |
149 | - __( 'No transaction information could be retrieved or the transaction data is not of the correct type.', 'event_espresso' ), |
|
149 | + __('No transaction information could be retrieved or the transaction data is not of the correct type.', 'event_espresso'), |
|
150 | 150 | __FILE__, __FUNCTION__, __LINE__ |
151 | 151 | ); |
152 | 152 | return NULL; |
@@ -163,16 +163,16 @@ discard block |
||
163 | 163 | * @param int $since |
164 | 164 | * @return mixed array of EE_Payment || FALSE |
165 | 165 | */ |
166 | - public function get_txn_payments( $since = 0 ) { |
|
167 | - if ( ! $this->get_txn() ) { |
|
166 | + public function get_txn_payments($since = 0) { |
|
167 | + if ( ! $this->get_txn()) { |
|
168 | 168 | return FALSE; |
169 | 169 | } |
170 | - $args = array( 'order_by' => array( 'PAY_timestamp' => 'ASC' )); |
|
171 | - if ( $since > 0 ) { |
|
172 | - $args[0] = array( 'PAY_timestamp' => array( '>', $since )); |
|
170 | + $args = array('order_by' => array('PAY_timestamp' => 'ASC')); |
|
171 | + if ($since > 0) { |
|
172 | + $args[0] = array('PAY_timestamp' => array('>', $since)); |
|
173 | 173 | } |
174 | 174 | // get array of payments with most recent first |
175 | - $payments = $this->_current_txn->payments( $args ); |
|
175 | + $payments = $this->_current_txn->payments($args); |
|
176 | 176 | // global $wpdb; |
177 | 177 | // echo $wpdb->last_query; |
178 | 178 | // EEH_Debug_Tools::printr( $payments, '$payments <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
@@ -188,19 +188,19 @@ discard block |
||
188 | 188 | * @return void |
189 | 189 | */ |
190 | 190 | private function _get_reg_url_link() { |
191 | - if ( ! empty( $this->_reg_url_link )) { |
|
191 | + if ( ! empty($this->_reg_url_link)) { |
|
192 | 192 | return; |
193 | 193 | } |
194 | 194 | // only do thank you page stuff if we have a REG_url_link in the url |
195 | - if ( WP_DEBUG && ! EE_Registry::instance()->REQ->is_set( 'e_reg_url_link' )) { |
|
195 | + if (WP_DEBUG && ! EE_Registry::instance()->REQ->is_set('e_reg_url_link')) { |
|
196 | 196 | EE_Error::add_error( |
197 | - __( 'No transaction information could be retrieved because the registration URL link is missing or invalid.', 'event_espresso' ), |
|
197 | + __('No transaction information could be retrieved because the registration URL link is missing or invalid.', 'event_espresso'), |
|
198 | 198 | __FILE__, __FUNCTION__, __LINE__ |
199 | 199 | ); |
200 | 200 | return; |
201 | 201 | } |
202 | 202 | // check for reg_url_link |
203 | - $this->_reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link' ); |
|
203 | + $this->_reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link'); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | * @param string $reg_url_link |
213 | 213 | * @return string |
214 | 214 | */ |
215 | - public function set_reg_url_link( $reg_url_link = NULL ) { |
|
216 | - $this->_reg_url_link = ! empty( $reg_url_link ) ? $reg_url_link : $this->_reg_url_link; |
|
215 | + public function set_reg_url_link($reg_url_link = NULL) { |
|
216 | + $this->_reg_url_link = ! empty($reg_url_link) ? $reg_url_link : $this->_reg_url_link; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | |
@@ -226,25 +226,25 @@ discard block |
||
226 | 226 | * @param WP $WP |
227 | 227 | * @return void |
228 | 228 | */ |
229 | - public function run( WP $WP ) { |
|
229 | + public function run(WP $WP) { |
|
230 | 230 | // remove site_url() from thank you page URL |
231 | - $thank_you_page_URL = substr( EE_Registry::instance()->CFG->core->thank_you_page_url(), strlen( home_url() ) ); |
|
231 | + $thank_you_page_URL = substr(EE_Registry::instance()->CFG->core->thank_you_page_url(), strlen(home_url())); |
|
232 | 232 | // remove other non-essential details from URL |
233 | - $thank_you_page_URL = trim( parse_url( $thank_you_page_URL, PHP_URL_PATH ), '/' ); |
|
233 | + $thank_you_page_URL = trim(parse_url($thank_you_page_URL, PHP_URL_PATH), '/'); |
|
234 | 234 | // ensure this shortcode doesn't trigger on anything BUT the thank you page |
235 | - if ( isset( $WP->request ) && trim( $WP->request, '/' ) != $thank_you_page_URL ) { |
|
235 | + if (isset($WP->request) && trim($WP->request, '/') != $thank_you_page_URL) { |
|
236 | 236 | return; |
237 | - } else if ( isset( $WP->query_vars['page_id'] ) && $WP->query_vars['page_id'] != EE_Registry::instance()->CFG->core->thank_you_page_id ) { |
|
237 | + } else if (isset($WP->query_vars['page_id']) && $WP->query_vars['page_id'] != EE_Registry::instance()->CFG->core->thank_you_page_id) { |
|
238 | 238 | return; |
239 | 239 | } |
240 | 240 | $this->_get_reg_url_link(); |
241 | 241 | // resend_reg_confirmation_email ? |
242 | - if ( EE_Registry::instance()->REQ->is_set( 'resend' )) { |
|
242 | + if (EE_Registry::instance()->REQ->is_set('resend')) { |
|
243 | 243 | EES_Espresso_Thank_You::resend_reg_confirmation_email(); |
244 | 244 | } |
245 | 245 | // load assets |
246 | - add_action( 'wp_enqueue_scripts', array( $this, 'load_js' ), 10 ); |
|
247 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
246 | + add_action('wp_enqueue_scripts', array($this, 'load_js'), 10); |
|
247 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
248 | 248 | $this->_translate_strings(); |
249 | 249 | } |
250 | 250 | |
@@ -257,18 +257,18 @@ discard block |
||
257 | 257 | * @return void |
258 | 258 | */ |
259 | 259 | protected function _translate_strings() { |
260 | - EE_Registry::$i18n_js_strings[ 'e_reg_url_link' ] = $this->_reg_url_link; |
|
261 | - EE_Registry::$i18n_js_strings[ 'initial_access' ] = time(); |
|
262 | - EE_Registry::$i18n_js_strings[ 'IPN_wait_time' ] = EES_Espresso_Thank_You::IPN_wait_time; |
|
263 | - EE_Registry::$i18n_js_strings[ 'TXN_complete' ] = EEM_Transaction::complete_status_code; |
|
264 | - EE_Registry::$i18n_js_strings[ 'TXN_incomplete' ] = EEM_Transaction::incomplete_status_code; |
|
265 | - EE_Registry::$i18n_js_strings[ 'checking_for_new_payments' ] = __( 'checking for new payments...', 'event_espresso' ); |
|
266 | - EE_Registry::$i18n_js_strings[ 'loading_payment_info' ] = __( 'loading payment information...', 'event_espresso' ); |
|
267 | - EE_Registry::$i18n_js_strings[ 'server_error' ] = __( 'An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again.', 'event_espresso' ); |
|
268 | - EE_Registry::$i18n_js_strings[ 'slow_IPN' ] = apply_filters( |
|
260 | + EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->_reg_url_link; |
|
261 | + EE_Registry::$i18n_js_strings['initial_access'] = time(); |
|
262 | + EE_Registry::$i18n_js_strings['IPN_wait_time'] = EES_Espresso_Thank_You::IPN_wait_time; |
|
263 | + EE_Registry::$i18n_js_strings['TXN_complete'] = EEM_Transaction::complete_status_code; |
|
264 | + EE_Registry::$i18n_js_strings['TXN_incomplete'] = EEM_Transaction::incomplete_status_code; |
|
265 | + EE_Registry::$i18n_js_strings['checking_for_new_payments'] = __('checking for new payments...', 'event_espresso'); |
|
266 | + EE_Registry::$i18n_js_strings['loading_payment_info'] = __('loading payment information...', 'event_espresso'); |
|
267 | + EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again.', 'event_espresso'); |
|
268 | + EE_Registry::$i18n_js_strings['slow_IPN'] = apply_filters( |
|
269 | 269 | 'EES_Espresso_Thank_You__load_js__slow_IPN', |
270 | 270 | sprintf( |
271 | - __( '%sThe Payment Notification appears to be taking longer than usual to arrive. Maybe check back later or just wait for your payment and registration confirmation results to be sent to you via email. We apologize for any inconvenience this may have caused.%s', 'event_espresso' ), |
|
271 | + __('%sThe Payment Notification appears to be taking longer than usual to arrive. Maybe check back later or just wait for your payment and registration confirmation results to be sent to you via email. We apologize for any inconvenience this may have caused.%s', 'event_espresso'), |
|
272 | 272 | '<div id="espresso-thank-you-page-slow-IPN-dv" class="ee-attention jst-left">', |
273 | 273 | '</div>' |
274 | 274 | ) |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | * @return void |
286 | 286 | */ |
287 | 287 | public function load_js() { |
288 | - wp_register_script( 'thank_you_page', THANK_YOU_ASSETS_URL . 'thank_you_page.js', array( 'espresso_core', 'heartbeat' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
289 | - wp_enqueue_script( 'thank_you_page' ); |
|
288 | + wp_register_script('thank_you_page', THANK_YOU_ASSETS_URL.'thank_you_page.js', array('espresso_core', 'heartbeat'), EVENT_ESPRESSO_VERSION, TRUE); |
|
289 | + wp_enqueue_script('thank_you_page'); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | |
@@ -299,13 +299,13 @@ discard block |
||
299 | 299 | */ |
300 | 300 | public function init() { |
301 | 301 | $this->_get_reg_url_link(); |
302 | - if ( ! $this->get_txn() ) { |
|
303 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
302 | + if ( ! $this->get_txn()) { |
|
303 | + EE_Registry::instance()->load_helper('HTML'); |
|
304 | 304 | |
305 | 305 | echo EEH_HTML::div( |
306 | - EEH_HTML::h4( __( 'We\'re sorry...', 'event_espresso' ), '', '' ) . |
|
306 | + EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', ''). |
|
307 | 307 | sprintf( |
308 | - __( 'This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s', 'event_espresso' ), |
|
308 | + __('This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s', 'event_espresso'), |
|
309 | 309 | '<br/>' |
310 | 310 | ), |
311 | 311 | '', 'ee-attention' |
@@ -313,22 +313,22 @@ discard block |
||
313 | 313 | return NULL; |
314 | 314 | } |
315 | 315 | // if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete" |
316 | - if ( $this->_current_txn->status_ID() == EEM_Transaction::failed_status_code ) { |
|
317 | - $this->_current_txn->set_status( EEM_Transaction::incomplete_status_code ); |
|
316 | + if ($this->_current_txn->status_ID() == EEM_Transaction::failed_status_code) { |
|
317 | + $this->_current_txn->set_status(EEM_Transaction::incomplete_status_code); |
|
318 | 318 | $this->_current_txn->save(); |
319 | 319 | } |
320 | 320 | $this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration ? $this->_current_txn->primary_registration() : NULL; |
321 | 321 | $this->_is_primary = $this->_primary_registrant->reg_url_link() == $this->_reg_url_link ? TRUE : FALSE; |
322 | 322 | |
323 | - $show_try_pay_again_link_default = apply_filters( 'AFEE__EES_Espresso_Thank_You__init__show_try_pay_again_link_default', TRUE ); |
|
323 | + $show_try_pay_again_link_default = apply_filters('AFEE__EES_Espresso_Thank_You__init__show_try_pay_again_link_default', TRUE); |
|
324 | 324 | // txn status ? |
325 | - if( $this->_current_txn->is_completed() ){ |
|
325 | + if ($this->_current_txn->is_completed()) { |
|
326 | 326 | $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
327 | - } else if ( $this->_current_txn->is_incomplete() && ( $this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment() )){ |
|
327 | + } else if ($this->_current_txn->is_incomplete() && ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment())) { |
|
328 | 328 | $this->_show_try_pay_again_link = TRUE; |
329 | - } else if ( $this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment() ) { |
|
329 | + } else if ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) { |
|
330 | 330 | // its pending |
331 | - $this->_show_try_pay_again_link = isset( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) && EE_Registry::instance()->CFG->registration->show_pending_payment_options ? TRUE : $show_try_pay_again_link_default; |
|
331 | + $this->_show_try_pay_again_link = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) && EE_Registry::instance()->CFG->registration->show_pending_payment_options ? TRUE : $show_try_pay_again_link_default; |
|
332 | 332 | } else { |
333 | 333 | $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
334 | 334 | } |
@@ -350,18 +350,18 @@ discard block |
||
350 | 350 | } |
351 | 351 | // link to SPCO |
352 | 352 | $revisit_spco_url = add_query_arg( |
353 | - array( 'ee'=>'_register', 'revisit'=>TRUE, 'e_reg_url_link'=>$this->_reg_url_link ), |
|
353 | + array('ee'=>'_register', 'revisit'=>TRUE, 'e_reg_url_link'=>$this->_reg_url_link), |
|
354 | 354 | EE_Registry::instance()->CFG->core->reg_page_url() |
355 | 355 | ); |
356 | 356 | // link to SPCO payment_options |
357 | - $this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration ? $this->_primary_registrant->payment_overview_url() : add_query_arg( array('step'=>'payment_options' ), $revisit_spco_url ); |
|
357 | + $this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration ? $this->_primary_registrant->payment_overview_url() : add_query_arg(array('step'=>'payment_options'), $revisit_spco_url); |
|
358 | 358 | // link to SPCO attendee_information |
359 | 359 | $this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration ? $this->_primary_registrant->edit_attendee_information_url() : FALSE; |
360 | 360 | |
361 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
362 | - EE_Registry::instance()->load_helper( 'Template_Validator' ); |
|
361 | + EE_Registry::instance()->load_helper('Template'); |
|
362 | + EE_Registry::instance()->load_helper('Template_Validator'); |
|
363 | 363 | |
364 | - do_action( 'AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn ); |
|
364 | + do_action('AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn); |
|
365 | 365 | // set no cache headers and constants |
366 | 366 | EE_System::do_not_cache(); |
367 | 367 | |
@@ -377,31 +377,31 @@ discard block |
||
377 | 377 | * @param array $attributes |
378 | 378 | * @return string |
379 | 379 | */ |
380 | - public function process_shortcode( $attributes = array() ) { |
|
380 | + public function process_shortcode($attributes = array()) { |
|
381 | 381 | |
382 | 382 | $this->init(); |
383 | 383 | |
384 | - if ( ! $this->_current_txn instanceof EE_Transaction ) { |
|
384 | + if ( ! $this->_current_txn instanceof EE_Transaction) { |
|
385 | 385 | return EE_Error::get_notices(); |
386 | 386 | } |
387 | 387 | //EE_Registry::instance()->load_helper( 'Debug_Tools' ); |
388 | 388 | //EEH_Debug_Tools::log( __CLASS__, __FUNCTION__, __LINE__, array( $this->_current_txn ), true, 'EE_Transaction: ' . $this->_current_txn->ID() ); |
389 | 389 | // link to receipt |
390 | - $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url( 'html' ); |
|
391 | - if ( ! empty( $template_args['TXN_receipt_url'] )) { |
|
392 | - $template_args['order_conf_desc'] = __( '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.', 'event_espresso' ); |
|
390 | + $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url('html'); |
|
391 | + if ( ! empty($template_args['TXN_receipt_url'])) { |
|
392 | + $template_args['order_conf_desc'] = __('%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.', 'event_espresso'); |
|
393 | 393 | } else { |
394 | - $template_args['order_conf_desc'] = __( '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.', 'event_espresso' ); |
|
394 | + $template_args['order_conf_desc'] = __('%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.', 'event_espresso'); |
|
395 | 395 | } |
396 | 396 | $template_args['transaction'] = $this->_current_txn; |
397 | - $template_args['revisit'] = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
397 | + $template_args['revisit'] = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
398 | 398 | |
399 | - add_action( 'AHEE__thank_you_page_overview_template__content', array( $this, 'get_registration_details' )); |
|
400 | - if ( $this->_is_primary && ! $this->_current_txn->is_free() ) { |
|
401 | - add_action( 'AHEE__thank_you_page_overview_template__content', array( $this, 'get_ajax_content' )); |
|
399 | + add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details')); |
|
400 | + if ($this->_is_primary && ! $this->_current_txn->is_free()) { |
|
401 | + add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content')); |
|
402 | 402 | } |
403 | 403 | |
404 | - return EEH_Template::locate_template( THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php', $template_args, TRUE, TRUE ); |
|
404 | + return EEH_Template::locate_template(THANK_YOU_TEMPLATES_PATH.'thank-you-page-overview.template.php', $template_args, TRUE, TRUE); |
|
405 | 405 | |
406 | 406 | } |
407 | 407 | |
@@ -418,15 +418,15 @@ discard block |
||
418 | 418 | * @param array $data |
419 | 419 | * @return array |
420 | 420 | */ |
421 | - public static function thank_you_page_IPN_monitor( $response = array(), $data = array() ) { |
|
421 | + public static function thank_you_page_IPN_monitor($response = array(), $data = array()) { |
|
422 | 422 | // does this heartbeat contain our data ? |
423 | - if ( ! isset( $data['espresso_thank_you_page'] )) { |
|
423 | + if ( ! isset($data['espresso_thank_you_page'])) { |
|
424 | 424 | return $response; |
425 | 425 | } |
426 | 426 | // check for reg_url_link in the incoming heartbeat data |
427 | - if ( ! isset( $data['espresso_thank_you_page']['e_reg_url_link'] )) { |
|
428 | - $response['espresso_thank_you_page'] = array ( |
|
429 | - 'errors' => ! empty( $notices['errors'] ) ? $notices['errors'] : __( 'No transaction information could be retrieved because the registration URL link is missing or invalid.', 'event_espresso' ) |
|
427 | + if ( ! isset($data['espresso_thank_you_page']['e_reg_url_link'])) { |
|
428 | + $response['espresso_thank_you_page'] = array( |
|
429 | + 'errors' => ! empty($notices['errors']) ? $notices['errors'] : __('No transaction information could be retrieved because the registration URL link is missing or invalid.', 'event_espresso') |
|
430 | 430 | ); |
431 | 431 | return $response; |
432 | 432 | } |
@@ -436,24 +436,24 @@ discard block |
||
436 | 436 | EES_Espresso_Thank_You::set_definitions(); |
437 | 437 | /** @var $espresso_thank_you_page EES_Espresso_Thank_You */ |
438 | 438 | $espresso_thank_you_page = EES_Espresso_Thank_You::instance(); |
439 | - $espresso_thank_you_page->set_reg_url_link( $data['espresso_thank_you_page']['e_reg_url_link'] ); |
|
439 | + $espresso_thank_you_page->set_reg_url_link($data['espresso_thank_you_page']['e_reg_url_link']); |
|
440 | 440 | $espresso_thank_you_page->init(); |
441 | 441 | //get TXN |
442 | 442 | $TXN = $espresso_thank_you_page->get_txn(); |
443 | 443 | // no TXN? then get out |
444 | - if ( ! $TXN instanceof EE_Transaction ) { |
|
444 | + if ( ! $TXN instanceof EE_Transaction) { |
|
445 | 445 | $notices = EE_Error::get_notices(); |
446 | - $response['espresso_thank_you_page'] = array ( |
|
447 | - 'errors' => ! empty( $notices['errors'] ) ? $notices['errors'] : sprintf( __( 'The information for your transaction could not be retrieved from the server or the transaction data received was invalid because of a technical reason. (%s)', 'event_espresso' ), __LINE__ ) |
|
446 | + $response['espresso_thank_you_page'] = array( |
|
447 | + 'errors' => ! empty($notices['errors']) ? $notices['errors'] : sprintf(__('The information for your transaction could not be retrieved from the server or the transaction data received was invalid because of a technical reason. (%s)', 'event_espresso'), __LINE__) |
|
448 | 448 | ); |
449 | 449 | return $response; |
450 | 450 | } |
451 | 451 | // grab transient of TXN's status |
452 | - $txn_status = isset( $data['espresso_thank_you_page']['txn_status'] ) ? $data['espresso_thank_you_page']['txn_status'] : NULL; |
|
452 | + $txn_status = isset($data['espresso_thank_you_page']['txn_status']) ? $data['espresso_thank_you_page']['txn_status'] : NULL; |
|
453 | 453 | // has the TXN status changed since we last checked (or empty because this is the first time running through this code)? |
454 | - if ( $txn_status !== $TXN->status_ID() ) { |
|
454 | + if ($txn_status !== $TXN->status_ID()) { |
|
455 | 455 | // switch between two possible basic outcomes |
456 | - switch( $TXN->status_ID()) { |
|
456 | + switch ($TXN->status_ID()) { |
|
457 | 457 | // TXN has been updated in some way |
458 | 458 | case EEM_Transaction::overpaid_status_code: |
459 | 459 | case EEM_Transaction::complete_status_code: |
@@ -468,29 +468,29 @@ discard block |
||
468 | 468 | case EEM_Transaction::failed_status_code: |
469 | 469 | default: |
470 | 470 | // keep on waiting... |
471 | - return $espresso_thank_you_page->_update_server_wait_time( $data['espresso_thank_you_page'] ); |
|
471 | + return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | // or is the TXN still failed (never been updated) ??? |
475 | - } else if ( $TXN->failed() ) { |
|
475 | + } else if ($TXN->failed()) { |
|
476 | 476 | // keep on waiting... |
477 | - return $espresso_thank_you_page->_update_server_wait_time( $data['espresso_thank_you_page'] ); |
|
477 | + return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']); |
|
478 | 478 | } |
479 | 479 | // TXN is happening so let's get the payments now |
480 | 480 | // if we've already gotten payments then the heartbeat data will contain the timestamp of the last time we checked |
481 | - $since = isset( $data['espresso_thank_you_page']['get_payments_since'] ) ? $data['espresso_thank_you_page']['get_payments_since'] : 0; |
|
481 | + $since = isset($data['espresso_thank_you_page']['get_payments_since']) ? $data['espresso_thank_you_page']['get_payments_since'] : 0; |
|
482 | 482 | // then check for payments |
483 | - $payments = $espresso_thank_you_page->get_txn_payments( $since ); |
|
483 | + $payments = $espresso_thank_you_page->get_txn_payments($since); |
|
484 | 484 | // has a payment been processed ? |
485 | - if ( ! empty( $payments ) || $espresso_thank_you_page->_is_offline_payment_method ) { |
|
486 | - if ( $since ) { |
|
485 | + if ( ! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) { |
|
486 | + if ($since) { |
|
487 | 487 | $response['espresso_thank_you_page'] = array( |
488 | - 'new_payments' => $espresso_thank_you_page->get_new_payments( $payments ), |
|
488 | + 'new_payments' => $espresso_thank_you_page->get_new_payments($payments), |
|
489 | 489 | 'transaction_details' => $espresso_thank_you_page->get_transaction_details(), |
490 | 490 | 'txn_status' => $TXN->status_ID() |
491 | 491 | ); |
492 | 492 | } else { |
493 | - $response['espresso_thank_you_page']['payment_details'] = $espresso_thank_you_page->get_payment_details( $payments ); |
|
493 | + $response['espresso_thank_you_page']['payment_details'] = $espresso_thank_you_page->get_payment_details($payments); |
|
494 | 494 | } |
495 | 495 | // reset time to check for payments |
496 | 496 | $response['espresso_thank_you_page']['get_payments_since'] = time(); |
@@ -510,9 +510,9 @@ discard block |
||
510 | 510 | * @param array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data |
511 | 511 | * @return array |
512 | 512 | */ |
513 | - private function _update_server_wait_time( $thank_you_page_data = array() ) { |
|
514 | - $response['espresso_thank_you_page'] = array ( |
|
515 | - 'still_waiting' => isset( $thank_you_page_data['initial_access'] ) ? time() - $thank_you_page_data['initial_access'] : 0, |
|
513 | + private function _update_server_wait_time($thank_you_page_data = array()) { |
|
514 | + $response['espresso_thank_you_page'] = array( |
|
515 | + 'still_waiting' => isset($thank_you_page_data['initial_access']) ? time() - $thank_you_page_data['initial_access'] : 0, |
|
516 | 516 | 'txn_status' => $this->_current_txn->status_ID() |
517 | 517 | ); |
518 | 518 | return $response; |
@@ -535,13 +535,13 @@ discard block |
||
535 | 535 | $template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url; |
536 | 536 | |
537 | 537 | $template_args['resend_reg_confirmation_url'] = add_query_arg( |
538 | - array( 'token'=>$this->_reg_url_link, 'resend_reg_confirmation' => 'true' ), |
|
538 | + array('token'=>$this->_reg_url_link, 'resend_reg_confirmation' => 'true'), |
|
539 | 539 | EE_Registry::instance()->CFG->core->thank_you_page_url() |
540 | 540 | ); |
541 | 541 | // verify template arguments |
542 | - EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' ); |
|
543 | - EEH_Template_Validator::verify_isnt_null( $template_args['SPCO_attendee_information_url'], '$SPCO_attendee_information_url'); |
|
544 | - echo EEH_Template::locate_template( THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php', $template_args, TRUE, TRUE ); |
|
542 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
543 | + EEH_Template_Validator::verify_isnt_null($template_args['SPCO_attendee_information_url'], '$SPCO_attendee_information_url'); |
|
544 | + echo EEH_Template::locate_template(THANK_YOU_TEMPLATES_PATH.'thank-you-page-registration-details.template.php', $template_args, TRUE, TRUE); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | |
@@ -550,38 +550,38 @@ discard block |
||
550 | 550 | * resend_reg_confirmation_email |
551 | 551 | */ |
552 | 552 | public static function resend_reg_confirmation_email() { |
553 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
554 | - $reg_url_link = EE_Registry::instance()->REQ->get( 'token' ); |
|
553 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
554 | + $reg_url_link = EE_Registry::instance()->REQ->get('token'); |
|
555 | 555 | |
556 | 556 | // was a REG_ID passed ? |
557 | - if ( $reg_url_link ) { |
|
558 | - $registration = EE_Registry::instance()->load_model( 'Registration' )->get_one( array( array( 'REG_url_link' => $reg_url_link ))); |
|
559 | - if ( $registration instanceof EE_Registration ) { |
|
557 | + if ($reg_url_link) { |
|
558 | + $registration = EE_Registry::instance()->load_model('Registration')->get_one(array(array('REG_url_link' => $reg_url_link))); |
|
559 | + if ($registration instanceof EE_Registration) { |
|
560 | 560 | // resend email |
561 | - EED_Messages::process_resend( array( '_REG_ID' => $registration->ID() )); |
|
561 | + EED_Messages::process_resend(array('_REG_ID' => $registration->ID())); |
|
562 | 562 | } else { |
563 | 563 | EE_Error::add_error( |
564 | - __( 'The Registration Confirmation email could not be sent because a valid Registration could not be retrieved from the database.', 'event_espresso' ), |
|
564 | + __('The Registration Confirmation email could not be sent because a valid Registration could not be retrieved from the database.', 'event_espresso'), |
|
565 | 565 | __FILE__, __FUNCTION__, __LINE__ |
566 | 566 | ); |
567 | 567 | } |
568 | 568 | } else { |
569 | 569 | EE_Error::add_error( |
570 | - __( 'The Registration Confirmation email could not be sent because a registration token is missing or invalid.', 'event_espresso' ), |
|
570 | + __('The Registration Confirmation email could not be sent because a registration token is missing or invalid.', 'event_espresso'), |
|
571 | 571 | __FILE__, __FUNCTION__, __LINE__ |
572 | 572 | ); |
573 | 573 | } |
574 | 574 | // request sent via AJAX ? |
575 | - if ( EE_FRONT_AJAX ) { |
|
576 | - echo json_encode( EE_Error::get_notices( FALSE )); |
|
575 | + if (EE_FRONT_AJAX) { |
|
576 | + echo json_encode(EE_Error::get_notices(FALSE)); |
|
577 | 577 | die(); |
578 | 578 | // or was JS disabled ? |
579 | 579 | } else { |
580 | 580 | // save errors so that they get picked up on the next request |
581 | - EE_Error::get_notices( TRUE, TRUE ); |
|
581 | + EE_Error::get_notices(TRUE, TRUE); |
|
582 | 582 | wp_safe_redirect( |
583 | 583 | add_query_arg( |
584 | - array( 'e_reg_url_link'=> $reg_url_link ), |
|
584 | + array('e_reg_url_link'=> $reg_url_link), |
|
585 | 585 | EE_Registry::instance()->CFG->core->thank_you_page_url() |
586 | 586 | ) |
587 | 587 | ); |
@@ -597,26 +597,26 @@ discard block |
||
597 | 597 | * @return void |
598 | 598 | */ |
599 | 599 | public function get_ajax_content() { |
600 | - if ( ! $this->get_txn() ) { |
|
600 | + if ( ! $this->get_txn()) { |
|
601 | 601 | return; |
602 | 602 | } |
603 | 603 | // first determine which event(s) require pre-approval or not |
604 | 604 | $events = array(); |
605 | 605 | $events_requiring_pre_approval = array(); |
606 | - foreach ( $this->_current_txn->registrations() as $registration ) { |
|
607 | - if ( $registration instanceof EE_Registration ) { |
|
606 | + foreach ($this->_current_txn->registrations() as $registration) { |
|
607 | + if ($registration instanceof EE_Registration) { |
|
608 | 608 | $event = $registration->event(); |
609 | - if ( $event instanceof EE_Event ) { |
|
610 | - if ( $registration->is_not_approved() && $registration->event() instanceof EE_Event ) { |
|
611 | - $events_requiring_pre_approval[ $event->ID() ] = $event; |
|
609 | + if ($event instanceof EE_Event) { |
|
610 | + if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) { |
|
611 | + $events_requiring_pre_approval[$event->ID()] = $event; |
|
612 | 612 | } else { |
613 | - $events[ $event->ID() ] = $event; |
|
613 | + $events[$event->ID()] = $event; |
|
614 | 614 | } |
615 | 615 | } |
616 | 616 | } |
617 | 617 | } |
618 | - $this->display_details_for_events_requiring_pre_approval( $events_requiring_pre_approval ); |
|
619 | - $this->display_details_for_events( $events ); |
|
618 | + $this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval); |
|
619 | + $this->display_details_for_events($events); |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | |
@@ -628,21 +628,21 @@ discard block |
||
628 | 628 | * @param EE_Event[] $events |
629 | 629 | * @return string |
630 | 630 | */ |
631 | - public function display_details_for_events( $events = array() ) { |
|
632 | - if ( ! empty( $events ) ) { |
|
631 | + public function display_details_for_events($events = array()) { |
|
632 | + if ( ! empty($events)) { |
|
633 | 633 | ?> |
634 | 634 | <div id="espresso-thank-you-page-ajax-content-dv"> |
635 | 635 | <div id="espresso-thank-you-page-ajax-transaction-dv"></div> |
636 | 636 | <div id="espresso-thank-you-page-ajax-payment-dv"></div> |
637 | 637 | <div id="espresso-thank-you-page-ajax-loading-dv"> |
638 | 638 | <div id="ee-ajax-loading-dv" class="left lt-blue-text"> |
639 | - <span class="dashicons dashicons-upload"></span><span id="ee-ajax-loading-msg-spn"><?php _e( 'loading transaction and payment information...', 'event_espresso' ); ?></span> |
|
639 | + <span class="dashicons dashicons-upload"></span><span id="ee-ajax-loading-msg-spn"><?php _e('loading transaction and payment information...', 'event_espresso'); ?></span> |
|
640 | 640 | </div> |
641 | - <?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed ) : ?> |
|
641 | + <?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed) : ?> |
|
642 | 642 | <p id="ee-ajax-loading-pg" class="highlight-bg small-text clear"> |
643 | - <?php echo apply_filters( 'EES_Espresso_Thank_You__get_ajax_content__waiting_for_IPN_msg', __( 'Some payment gateways can take 15 minutes or more to return their payment notification, so please be patient if you require payment confirmation as soon as possible. Please note that as soon as everything is finalized, we will send your full payment and registration confirmation results to you via email.', 'event_espresso' ) ); ?> |
|
643 | + <?php echo apply_filters('EES_Espresso_Thank_You__get_ajax_content__waiting_for_IPN_msg', __('Some payment gateways can take 15 minutes or more to return their payment notification, so please be patient if you require payment confirmation as soon as possible. Please note that as soon as everything is finalized, we will send your full payment and registration confirmation results to you via email.', 'event_espresso')); ?> |
|
644 | 644 | <br/> |
645 | - <span class="jst-rght ee-block small-text lt-grey-text"><?php _e( 'current wait time ', 'event_espresso' ); ?> |
|
645 | + <span class="jst-rght ee-block small-text lt-grey-text"><?php _e('current wait time ', 'event_espresso'); ?> |
|
646 | 646 | <span id="espresso-thank-you-page-ajax-time-dv">00:00:00</span></span> |
647 | 647 | </p> |
648 | 648 | <?php endif; ?> |
@@ -662,20 +662,20 @@ discard block |
||
662 | 662 | * @param EE_Event[] $events |
663 | 663 | * @return string |
664 | 664 | */ |
665 | - public function display_details_for_events_requiring_pre_approval( $events = array() ) { |
|
666 | - if ( ! empty( $events ) ) { |
|
665 | + public function display_details_for_events_requiring_pre_approval($events = array()) { |
|
666 | + if ( ! empty($events)) { |
|
667 | 667 | ?> |
668 | 668 | <div id = "espresso-thank-you-page-not-approved-message-dv" > |
669 | - <h4 class="orange-text" ><?php _e( 'Important Notice:', 'event_espresso' );?></h4> |
|
669 | + <h4 class="orange-text" ><?php _e('Important Notice:', 'event_espresso'); ?></h4> |
|
670 | 670 | <p id="events-requiring-pre-approval-pg" class="small-text"> |
671 | 671 | <?php echo apply_filters( |
672 | 672 | 'AHEE__EES_Espresso_Thank_You__get_ajax_content__not_approved_message', |
673 | - __( 'The following Event(s) you have registered for do not require payment at this time and will not be billed for during this transaction. Billing will only occur after all attendees have been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' ) |
|
673 | + __('The following Event(s) you have registered for do not require payment at this time and will not be billed for during this transaction. Billing will only occur after all attendees have been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso') |
|
674 | 674 | ); ?> |
675 | 675 | </p> |
676 | 676 | <ul class="events-requiring-pre-approval-ul"> |
677 | - <?php foreach ( $events as $event ) { |
|
678 | - if ( $event instanceof EE_Event ) { |
|
677 | + <?php foreach ($events as $event) { |
|
678 | + if ($event instanceof EE_Event) { |
|
679 | 679 | echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>', $event->name(), '</li>'; |
680 | 680 | } |
681 | 681 | } ?> |
@@ -699,15 +699,15 @@ discard block |
||
699 | 699 | $template_args = array(); |
700 | 700 | $template_args['transaction'] = $this->_current_txn; |
701 | 701 | $template_args['reg_url_link'] = $this->_reg_url_link; |
702 | - $template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name( TRUE ); |
|
702 | + $template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(TRUE); |
|
703 | 703 | // link to SPCO payment_options |
704 | 704 | $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
705 | 705 | $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
706 | 706 | // verify template arguments |
707 | - EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' ); |
|
708 | - EEH_Template_Validator::verify_isnt_null( $template_args['show_try_pay_again_link'], '$show_try_pay_again_link' ); |
|
709 | - EEH_Template_Validator::verify_isnt_null( $template_args['SPCO_payment_options_url'], '$SPCO_payment_options_url' ); |
|
710 | - return EEH_Template::locate_template( THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php', $template_args, TRUE, TRUE ); |
|
707 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
708 | + EEH_Template_Validator::verify_isnt_null($template_args['show_try_pay_again_link'], '$show_try_pay_again_link'); |
|
709 | + EEH_Template_Validator::verify_isnt_null($template_args['SPCO_payment_options_url'], '$SPCO_payment_options_url'); |
|
710 | + return EEH_Template::locate_template(THANK_YOU_TEMPLATES_PATH.'thank-you-page-transaction-details.template.php', $template_args, TRUE, TRUE); |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | |
@@ -719,9 +719,9 @@ discard block |
||
719 | 719 | * @param EE_Payment $payment |
720 | 720 | * @return string |
721 | 721 | */ |
722 | - public function get_payment_row_html( $payment = NULL ) { |
|
722 | + public function get_payment_row_html($payment = NULL) { |
|
723 | 723 | $html = ''; |
724 | - if ( $payment instanceof EE_Payment ) { |
|
724 | + if ($payment instanceof EE_Payment) { |
|
725 | 725 | if ( |
726 | 726 | $payment->payment_method() instanceof EE_Payment_Method |
727 | 727 | && $payment->payment_method()->is_off_site() |
@@ -730,25 +730,25 @@ discard block |
||
730 | 730 | // considering the registrant has made it to the Thank You page, |
731 | 731 | // any failed payments may actually be pending and the IPN is just slow |
732 | 732 | // so let's |
733 | - $payment->set_status( EEM_Payment::status_id_pending ); |
|
733 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
734 | 734 | } |
735 | - $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined ? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>' : ''; |
|
735 | + $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined ? '<br /><span class="small-text">'.$payment->gateway_response().'</span>' : ''; |
|
736 | 736 | $html .= ' |
737 | 737 | <tr> |
738 | 738 | <td> |
739 | - ' . $payment->timestamp() . ' |
|
739 | + ' . $payment->timestamp().' |
|
740 | 740 | </td> |
741 | 741 | <td> |
742 | - ' . ( $payment->payment_method() instanceof EE_Payment_Method ? $payment->payment_method()->name() : __( 'Unknown', 'event_espresso' ) ) . ' |
|
742 | + ' . ($payment->payment_method() instanceof EE_Payment_Method ? $payment->payment_method()->name() : __('Unknown', 'event_espresso')).' |
|
743 | 743 | </td> |
744 | 744 | <td class="jst-rght"> |
745 | - ' . EEH_Template::format_currency( $payment->amount() ) . ' |
|
745 | + ' . EEH_Template::format_currency($payment->amount()).' |
|
746 | 746 | </td> |
747 | 747 | <td class="jst-rght" style="line-height:1;"> |
748 | - ' . $payment->pretty_status( TRUE ) . $payment_declined_msg . ' |
|
748 | + ' . $payment->pretty_status(TRUE).$payment_declined_msg.' |
|
749 | 749 | </td> |
750 | 750 | </tr>'; |
751 | - do_action( 'AHEE__thank_you_page_payment_details_template__after_each_payment', $payment ); |
|
751 | + do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment); |
|
752 | 752 | } |
753 | 753 | return $html; |
754 | 754 | } |
@@ -762,17 +762,17 @@ discard block |
||
762 | 762 | * @param array $payments |
763 | 763 | * @return string |
764 | 764 | */ |
765 | - public function get_payment_details( $payments = array() ) { |
|
765 | + public function get_payment_details($payments = array()) { |
|
766 | 766 | //prepare variables for displaying |
767 | 767 | $template_args = array(); |
768 | 768 | $template_args['transaction'] = $this->_current_txn; |
769 | 769 | $template_args['reg_url_link'] = $this->_reg_url_link; |
770 | 770 | $template_args['payments'] = array(); |
771 | - foreach ( $payments as $payment ) { |
|
772 | - $template_args['payments'][] = $this->get_payment_row_html( $payment ); |
|
771 | + foreach ($payments as $payment) { |
|
772 | + $template_args['payments'][] = $this->get_payment_row_html($payment); |
|
773 | 773 | } |
774 | 774 | //create a hacky payment object, but dont save it |
775 | - $payment = EE_Payment::new_instance( array( |
|
775 | + $payment = EE_Payment::new_instance(array( |
|
776 | 776 | 'TXN_ID'=>$this->_current_txn->ID(), |
777 | 777 | 'STS_ID'=>EEM_Payment::status_id_pending, |
778 | 778 | 'PAY_timestamp'=>time(), |
@@ -780,21 +780,21 @@ discard block |
||
780 | 780 | 'PMD_ID'=>$this->_current_txn->payment_method_ID() |
781 | 781 | )); |
782 | 782 | $payment_method = $this->_current_txn->payment_method(); |
783 | - if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
784 | - $template_args[ 'gateway_content' ] = $payment_method->type_obj()->payment_overview_content( $payment ); |
|
783 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
784 | + $template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment); |
|
785 | 785 | } else { |
786 | - $template_args[ 'gateway_content' ] = ''; |
|
786 | + $template_args['gateway_content'] = ''; |
|
787 | 787 | } |
788 | 788 | // link to SPCO payment_options |
789 | 789 | $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
790 | 790 | $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
791 | 791 | // verify template arguments |
792 | - EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' ); |
|
793 | - EEH_Template_Validator::verify_isnt_null( $template_args['payments'], '$payments' ); |
|
794 | - EEH_Template_Validator::verify_isnt_null( $template_args['show_try_pay_again_link'], '$show_try_pay_again_link' ); |
|
795 | - EEH_Template_Validator::verify_isnt_null( $template_args['gateway_content'], '$gateway_content'); |
|
796 | - EEH_Template_Validator::verify_isnt_null( $template_args['SPCO_payment_options_url'], '$SPCO_payment_options_url'); |
|
797 | - return EEH_Template::locate_template( THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php', $template_args, TRUE, TRUE ); |
|
792 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
793 | + EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments'); |
|
794 | + EEH_Template_Validator::verify_isnt_null($template_args['show_try_pay_again_link'], '$show_try_pay_again_link'); |
|
795 | + EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content'); |
|
796 | + EEH_Template_Validator::verify_isnt_null($template_args['SPCO_payment_options_url'], '$SPCO_payment_options_url'); |
|
797 | + return EEH_Template::locate_template(THANK_YOU_TEMPLATES_PATH.'thank-you-page-payment-details.template.php', $template_args, TRUE, TRUE); |
|
798 | 798 | } |
799 | 799 | |
800 | 800 | |
@@ -806,11 +806,11 @@ discard block |
||
806 | 806 | * @param array $payments |
807 | 807 | * @return string |
808 | 808 | */ |
809 | - public function get_new_payments( $payments = array() ) { |
|
809 | + public function get_new_payments($payments = array()) { |
|
810 | 810 | $payments_html = ''; |
811 | 811 | //prepare variables for displaying |
812 | - foreach ( $payments as $payment ) { |
|
813 | - $payments_html .= $this->get_payment_row_html( $payment ); |
|
812 | + foreach ($payments as $payment) { |
|
813 | + $payments_html .= $this->get_payment_row_html($payment); |
|
814 | 814 | } |
815 | 815 | return $payments_html; |
816 | 816 | } |
@@ -6,11 +6,11 @@ |
||
6 | 6 | <li class="ticket-registration"> |
7 | 7 | <table class="registration-details"> |
8 | 8 | <tr class="odd"> |
9 | - <th><?php _e('Attendee', 'event_espresso');?></th> |
|
9 | + <th><?php _e('Attendee', 'event_espresso'); ?></th> |
|
10 | 10 | <td>[FNAME] [LNAME] ([ATTENDEE_EMAIL])</td> |
11 | 11 | </tr> |
12 | 12 | <tr> |
13 | - <th><?php _e("Registration Code:", "event_espresso");?></th> |
|
13 | + <th><?php _e("Registration Code:", "event_espresso"); ?></th> |
|
14 | 14 | <td>[REGISTRATION_CODE] - <span class="[REGISTRATION_STATUS_ID]">[REGISTRATION_STATUS_LABEL]</span></td> |
15 | 15 | </tr> |
16 | 16 | </table> |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | // (all other times it gets resurrected from a wordpress option) |
15 | 15 | $stages = glob(EE_CORE.'data_migration_scripts/4_7_0_stages/*'); |
16 | 16 | $class_to_filepath = array(); |
17 | -foreach($stages as $filepath){ |
|
17 | +foreach ($stages as $filepath) { |
|
18 | 18 | $matches = array(); |
19 | - preg_match('~4_7_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
19 | + preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
20 | 20 | $class_to_filepath[$matches[1]] = $filepath; |
21 | 21 | } |
22 | 22 | //give addons a chance to autoload their stages too |
23 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages',$class_to_filepath); |
|
23 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath); |
|
24 | 24 | EEH_Autoloader::register_autoloader($class_to_filepath); |
25 | 25 | |
26 | 26 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @since 4.7.0 |
37 | 37 | * |
38 | 38 | */ |
39 | -class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base{ |
|
39 | +class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base { |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * return EE_DMS_Core_4_7_0 |
@@ -58,18 +58,18 @@ discard block |
||
58 | 58 | * @return bool |
59 | 59 | */ |
60 | 60 | public function can_migrate_from_version($version_array) { |
61 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
61 | + EE_Registry::instance()->load_helper('Activation'); |
|
62 | 62 | $version_string = $version_array['Core']; |
63 | 63 | if ( |
64 | - ( $version_string <= '4.7.0' && $version_string >= '4.6.0' ) |
|
64 | + ($version_string <= '4.7.0' && $version_string >= '4.6.0') |
|
65 | 65 | || |
66 | - ( $version_string >= '4.7.0' && |
|
67 | - ! EEH_Activation::table_exists( 'esp_registration_payment' ) && |
|
68 | - EEH_Activation::table_exists( 'esp_registration' ) ) ) { |
|
66 | + ($version_string >= '4.7.0' && |
|
67 | + ! EEH_Activation::table_exists('esp_registration_payment') && |
|
68 | + EEH_Activation::table_exists('esp_registration')) ) { |
|
69 | 69 | return true; |
70 | - } elseif ( ! $version_string ) { |
|
70 | + } elseif ( ! $version_string) { |
|
71 | 71 | //no version string provided... this must be pre 4.3 |
72 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
73 | 73 | } else { |
74 | 74 | return false; |
75 | 75 | } |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function schema_changes_before_migration() { |
93 | 93 | //relies on 4.1's EEH_Activation::create_table |
94 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
95 | - $table_name='esp_answer'; |
|
96 | - $sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
94 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
95 | + $table_name = 'esp_answer'; |
|
96 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
97 | 97 | REG_ID INT UNSIGNED NOT NULL, |
98 | 98 | QST_ID INT UNSIGNED NOT NULL, |
99 | 99 | ANS_value TEXT NOT NULL, |
100 | 100 | PRIMARY KEY (ANS_ID), |
101 | 101 | KEY REG_ID (REG_ID), |
102 | 102 | KEY QST_ID (QST_ID)"; |
103 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
103 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
104 | 104 | |
105 | 105 | $table_name = 'esp_attendee_meta'; |
106 | 106 | $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | CNT_is_EU TINYINT(1) DEFAULT '0', |
141 | 141 | CNT_active TINYINT(1) DEFAULT '0', |
142 | 142 | PRIMARY KEY (CNT_ISO)"; |
143 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
143 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
144 | 144 | |
145 | 145 | $table_name = 'esp_currency'; |
146 | 146 | $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
151 | 151 | CUR_active TINYINT(1) DEFAULT '0', |
152 | 152 | PRIMARY KEY (CUR_code)"; |
153 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
153 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
154 | 154 | |
155 | 155 | |
156 | 156 | $table_name = 'esp_currency_payment_method'; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | KEY EVT_ID (EVT_ID), |
181 | 181 | KEY DTT_is_primary (DTT_is_primary)"; |
182 | 182 | |
183 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
183 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
184 | 184 | |
185 | 185 | $table_name = 'esp_event_meta'; |
186 | 186 | $sql = " |
@@ -199,44 +199,44 @@ discard block |
||
199 | 199 | EVT_donations TINYINT(1) NULL, |
200 | 200 | PRIMARY KEY (EVTM_ID), |
201 | 201 | KEY EVT_ID (EVT_ID)"; |
202 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
202 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
203 | 203 | |
204 | 204 | |
205 | 205 | |
206 | - $table_name='esp_event_question_group'; |
|
207 | - $sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
206 | + $table_name = 'esp_event_question_group'; |
|
207 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
208 | 208 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
209 | 209 | QSG_ID INT UNSIGNED NOT NULL, |
210 | 210 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
211 | 211 | PRIMARY KEY (EQG_ID), |
212 | 212 | KEY EVT_ID (EVT_ID), |
213 | 213 | KEY QSG_ID (QSG_ID)"; |
214 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
214 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
215 | 215 | |
216 | 216 | |
217 | 217 | |
218 | - $table_name='esp_event_venue'; |
|
219 | - $sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
218 | + $table_name = 'esp_event_venue'; |
|
219 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
220 | 220 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
221 | 221 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
222 | 222 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
223 | 223 | PRIMARY KEY (EVV_ID)"; |
224 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
224 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
225 | 225 | |
226 | 226 | |
227 | 227 | |
228 | - $table_name='esp_extra_meta'; |
|
229 | - $sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
228 | + $table_name = 'esp_extra_meta'; |
|
229 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
230 | 230 | OBJ_ID INT(11) DEFAULT NULL, |
231 | 231 | EXM_type VARCHAR(45) DEFAULT NULL, |
232 | 232 | EXM_key VARCHAR(45) DEFAULT NULL, |
233 | 233 | EXM_value TEXT, |
234 | 234 | PRIMARY KEY (EXM_ID), |
235 | 235 | KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))"; |
236 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
236 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
237 | 237 | |
238 | - $table_name='esp_line_item'; |
|
239 | - $sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
238 | + $table_name = 'esp_line_item'; |
|
239 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
240 | 240 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
241 | 241 | TXN_ID INT(11) DEFAULT NULL, |
242 | 242 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | PRIMARY KEY (LIN_ID), |
255 | 255 | KEY LIN_code (LIN_code(191)), |
256 | 256 | KEY TXN_ID (TXN_ID)"; |
257 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' ); |
|
257 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
258 | 258 | |
259 | 259 | $table_name = 'esp_log'; |
260 | 260 | $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
295 | 295 | PRIMARY KEY (GRP_ID), |
296 | 296 | KEY MTP_user_id (MTP_user_id)"; |
297 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
297 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
298 | 298 | |
299 | 299 | $table_name = 'esp_event_message_template'; |
300 | 300 | $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | PRIMARY KEY (EMT_ID), |
304 | 304 | KEY EVT_ID (EVT_ID), |
305 | 305 | KEY GRP_ID (GRP_ID)"; |
306 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
306 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
307 | 307 | |
308 | 308 | |
309 | 309 | $table_name = 'esp_payment'; |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | PRIMARY KEY (TTM_ID)"; |
377 | 377 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
378 | 378 | |
379 | - $table_name='esp_question'; |
|
380 | - $sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
379 | + $table_name = 'esp_question'; |
|
380 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
381 | 381 | QST_display_text TEXT NOT NULL, |
382 | 382 | QST_admin_label VARCHAR(255) NOT NULL, |
383 | 383 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -390,22 +390,22 @@ discard block |
||
390 | 390 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
391 | 391 | PRIMARY KEY (QST_ID), |
392 | 392 | KEY QST_order (QST_order)'; |
393 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
393 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
394 | 394 | |
395 | - $table_name='esp_question_group_question'; |
|
396 | - $sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
395 | + $table_name = 'esp_question_group_question'; |
|
396 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
397 | 397 | QSG_ID INT UNSIGNED NOT NULL, |
398 | 398 | QST_ID INT UNSIGNED NOT NULL, |
399 | 399 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
400 | 400 | PRIMARY KEY (QGQ_ID), |
401 | 401 | KEY QST_ID (QST_ID), |
402 | 402 | KEY QSG_ID_order (QSG_ID, QGQ_order)"; |
403 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
403 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
404 | 404 | |
405 | 405 | |
406 | 406 | |
407 | - $table_name='esp_question_option'; |
|
408 | - $sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
407 | + $table_name = 'esp_question_option'; |
|
408 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
409 | 409 | QSO_value VARCHAR(255) NOT NULL, |
410 | 410 | QSO_desc TEXT NOT NULL, |
411 | 411 | QST_ID INT UNSIGNED NOT NULL, |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | PRIMARY KEY (QSO_ID), |
415 | 415 | KEY QST_ID (QST_ID), |
416 | 416 | KEY QSO_order (QSO_order)"; |
417 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
417 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
418 | 418 | |
419 | 419 | |
420 | 420 | |
@@ -460,8 +460,8 @@ discard block |
||
460 | 460 | |
461 | 461 | |
462 | 462 | |
463 | - $table_name='esp_checkin'; |
|
464 | - $sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
463 | + $table_name = 'esp_checkin'; |
|
464 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
465 | 465 | REG_ID INT(10) UNSIGNED NOT NULL, |
466 | 466 | DTT_ID INT(10) UNSIGNED NOT NULL, |
467 | 467 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
557 | 557 | PRIMARY KEY (PRC_ID), |
558 | 558 | KEY PRT_ID (PRT_ID)"; |
559 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
559 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
560 | 560 | |
561 | 561 | $table_name = "esp_price_type"; |
562 | 562 | $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -594,10 +594,10 @@ discard block |
||
594 | 594 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
595 | 595 | PRIMARY KEY (TKT_ID), |
596 | 596 | KEY TKT_start_date (TKT_start_date)"; |
597 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
597 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
598 | 598 | |
599 | 599 | $table_name = 'esp_question_group'; |
600 | - $sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
600 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
601 | 601 | QSG_name VARCHAR(255) NOT NULL, |
602 | 602 | QSG_identifier VARCHAR(100) NOT NULL, |
603 | 603 | QSG_desc TEXT NULL, |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | PRIMARY KEY (QSG_ID), |
611 | 611 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC), |
612 | 612 | KEY QSG_order (QSG_order)'; |
613 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
613 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
614 | 614 | |
615 | 615 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
616 | 616 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | return true; |
643 | 643 | } |
644 | 644 | |
645 | - public function migration_page_hooks(){ |
|
645 | + public function migration_page_hooks() { |
|
646 | 646 | |
647 | 647 | } |
648 | 648 |
@@ -647,6 +647,7 @@ |
||
647 | 647 | * @access public |
648 | 648 | * @static |
649 | 649 | * @param string $table_name, without prefixed $wpdb->prefix |
650 | + * @param string $table_name |
|
650 | 651 | * @return array of database column names |
651 | 652 | */ |
652 | 653 | public static function get_fields_on_table( $table_name = NULL ) { |
@@ -1,4 +1,6 @@ discard block |
||
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 | * |
@@ -140,15 +142,15 @@ discard block |
||
140 | 142 | ); |
141 | 143 | if( $which_to_include === 'all' ) { |
142 | 144 | //leave as-is |
143 | - }elseif( $which_to_include === 'old' ) { |
|
145 | + } elseif( $which_to_include === 'old' ) { |
|
144 | 146 | $cron_tasks = array_filter( $cron_tasks, function ( $value ) { |
145 | 147 | return $value === EEH_Activation::cron_task_no_longer_in_use; |
146 | 148 | }); |
147 | - }elseif( $which_to_include === 'current' ) { |
|
149 | + } elseif( $which_to_include === 'current' ) { |
|
148 | 150 | $cron_tasks = array_filter( $cron_tasks ); |
149 | - }elseif( WP_DEBUG ) { |
|
151 | + } elseif( WP_DEBUG ) { |
|
150 | 152 | throw new EE_Error( sprintf( __( 'Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso' ), $which_to_include ) ); |
151 | - }else{ |
|
153 | + } else{ |
|
152 | 154 | //leave as-is |
153 | 155 | } |
154 | 156 | return $cron_tasks; |
@@ -401,7 +403,7 @@ discard block |
||
401 | 403 | $post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1"); |
402 | 404 | if($post_id){ |
403 | 405 | return get_post($post_id); |
404 | - }else{ |
|
406 | + } else{ |
|
405 | 407 | return NULL; |
406 | 408 | } |
407 | 409 | |
@@ -772,13 +774,13 @@ discard block |
||
772 | 774 | foreach( $current_data_migration_script->get_errors() as $error ){ |
773 | 775 | EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ ); |
774 | 776 | } |
775 | - }else{ |
|
777 | + } else{ |
|
776 | 778 | EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) ); |
777 | 779 | } |
778 | 780 | return false; |
779 | 781 | } |
780 | 782 | EE_Data_Migration_Manager::instance()->update_current_database_state_to(); |
781 | - }else{ |
|
783 | + } else{ |
|
782 | 784 | EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
783 | 785 | return false; |
784 | 786 | } |
@@ -1070,7 +1072,7 @@ discard block |
||
1070 | 1072 | if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){ |
1071 | 1073 | EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
1072 | 1074 | EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
1073 | - }else{ |
|
1075 | + } else{ |
|
1074 | 1076 | EEM_Payment_Method::instance()->verify_button_urls(); |
1075 | 1077 | } |
1076 | 1078 | } |
@@ -1226,7 +1228,9 @@ discard block |
||
1226 | 1228 | //do an initial loop to determine if we need to continue |
1227 | 1229 | $def_ms = array(); |
1228 | 1230 | foreach ( $default_messengers as $msgr ) { |
1229 | - if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue; |
|
1231 | + if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) { |
|
1232 | + continue; |
|
1233 | + } |
|
1230 | 1234 | $def_ms[] = $msgr; |
1231 | 1235 | } |
1232 | 1236 | |
@@ -1555,7 +1559,7 @@ discard block |
||
1555 | 1559 | if( ! delete_option( $option_name ) ){ |
1556 | 1560 | $undeleted_options[] = $option_name; |
1557 | 1561 | } |
1558 | - }else{ |
|
1562 | + } else{ |
|
1559 | 1563 | $option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" ); |
1560 | 1564 | foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){ |
1561 | 1565 | if( ! delete_option( $option_name_from_wildcard ) ){ |
@@ -1619,7 +1623,7 @@ discard block |
||
1619 | 1623 | $EZSQL_ERROR = $ezsql_error_cache; |
1620 | 1624 | if( empty( $new_error ) ){ |
1621 | 1625 | return TRUE; |
1622 | - }else{ |
|
1626 | + } else{ |
|
1623 | 1627 | return FALSE; |
1624 | 1628 | } |
1625 | 1629 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | if ( is_array( $hooks_to_fire_at_time ) ) { |
207 | 207 | foreach ( $hooks_to_fire_at_time as $hook_name => $hook_actions ) { |
208 | 208 | if ( isset( $ee_cron_tasks_to_remove[ $hook_name ] ) |
209 | - && is_array( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
209 | + && is_array( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
210 | 210 | ) { |
211 | 211 | unset( $crons[ $timestamp ][ $hook_name ] ); |
212 | 212 | } |
@@ -1120,14 +1120,14 @@ discard block |
||
1120 | 1120 | $QSG_ID = reset( $id_col ); |
1121 | 1121 | } else { |
1122 | 1122 | //ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method |
1123 | - EE_Log::instance()->log( |
|
1124 | - __FILE__, |
|
1125 | - __FUNCTION__, |
|
1126 | - sprintf( |
|
1127 | - __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1128 | - $QST_ID ), |
|
1129 | - 'error' ); |
|
1130 | - continue; |
|
1123 | + EE_Log::instance()->log( |
|
1124 | + __FILE__, |
|
1125 | + __FUNCTION__, |
|
1126 | + sprintf( |
|
1127 | + __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1128 | + $QST_ID ), |
|
1129 | + 'error' ); |
|
1130 | + continue; |
|
1131 | 1131 | } |
1132 | 1132 | } |
1133 | 1133 | |
@@ -1657,8 +1657,8 @@ discard block |
||
1657 | 1657 | } |
1658 | 1658 | } |
1659 | 1659 | } |
1660 | - //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
|
1661 | - remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1660 | + //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
|
1661 | + remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1662 | 1662 | |
1663 | 1663 | if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) { |
1664 | 1664 | $db_update_sans_ee4 = array(); |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | * @param $table_name |
58 | 58 | * @return string |
59 | 59 | */ |
60 | - public static function ensure_table_name_has_prefix( $table_name ) { |
|
60 | + public static function ensure_table_name_has_prefix($table_name) { |
|
61 | 61 | global $wpdb; |
62 | - return strpos( $table_name, $wpdb->prefix ) === 0 ? $table_name : $wpdb->prefix . $table_name; |
|
62 | + return strpos($table_name, $wpdb->prefix) === 0 ? $table_name : $wpdb->prefix.$table_name; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * be called on plugin activation and reactivation |
86 | 86 | * @return boolean success, whether the database and folders are setup properly |
87 | 87 | */ |
88 | - public static function initialize_db_and_folders(){ |
|
88 | + public static function initialize_db_and_folders() { |
|
89 | 89 | $good_filesystem = EEH_Activation::create_upload_directories(); |
90 | 90 | $good_db = EEH_Activation::create_database_tables(); |
91 | 91 | return $good_filesystem && $good_db; |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | * upon activation of a new plugin, reactivation, and at the end |
100 | 100 | * of running migration scripts |
101 | 101 | */ |
102 | - public static function initialize_db_content(){ |
|
102 | + public static function initialize_db_content() { |
|
103 | 103 | //let's avoid doing all this logic repeatedly, especially when addons are requesting it |
104 | - if( EEH_Activation::$_initialized_db_content_already_in_this_request ) { |
|
104 | + if (EEH_Activation::$_initialized_db_content_already_in_this_request) { |
|
105 | 105 | return; |
106 | 106 | } |
107 | 107 | EEH_Activation::$_initialized_db_content_already_in_this_request = true; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | EEH_Activation::remove_cron_tasks(); |
119 | 119 | EEH_Activation::create_cron_tasks(); |
120 | 120 | //also, check for CAF default db content |
121 | - do_action( 'AHEE__EEH_Activation__initialize_db_content' ); |
|
121 | + do_action('AHEE__EEH_Activation__initialize_db_content'); |
|
122 | 122 | //also: EEM_Gateways::load_all_gateways() outputs a lot of success messages |
123 | 123 | //which users really won't care about on initial activation |
124 | 124 | EE_Error::overwrite_success(); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @return array |
138 | 138 | * @throws \EE_Error |
139 | 139 | */ |
140 | - public static function get_cron_tasks( $which_to_include ) { |
|
140 | + public static function get_cron_tasks($which_to_include) { |
|
141 | 141 | $cron_tasks = apply_filters( |
142 | 142 | 'FHEE__EEH_Activation__get_cron_tasks', |
143 | 143 | array( |
@@ -146,17 +146,17 @@ discard block |
||
146 | 146 | 'AHEE__EE_Cron_Tasks__update_transaction_with_payment' => EEH_Activation::cron_task_no_longer_in_use, //there may have been a bug which prevented from these cron tasks from getting unscheduled, so we might want to remove these for a few updates |
147 | 147 | ) |
148 | 148 | ); |
149 | - if( $which_to_include === 'all' ) { |
|
149 | + if ($which_to_include === 'all') { |
|
150 | 150 | //leave as-is |
151 | - }elseif( $which_to_include === 'old' ) { |
|
152 | - $cron_tasks = array_filter( $cron_tasks, function ( $value ) { |
|
151 | + }elseif ($which_to_include === 'old') { |
|
152 | + $cron_tasks = array_filter($cron_tasks, function($value) { |
|
153 | 153 | return $value === EEH_Activation::cron_task_no_longer_in_use; |
154 | 154 | }); |
155 | - }elseif( $which_to_include === 'current' ) { |
|
156 | - $cron_tasks = array_filter( $cron_tasks ); |
|
157 | - }elseif( WP_DEBUG ) { |
|
158 | - throw new EE_Error( sprintf( __( 'Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso' ), $which_to_include ) ); |
|
159 | - }else{ |
|
155 | + }elseif ($which_to_include === 'current') { |
|
156 | + $cron_tasks = array_filter($cron_tasks); |
|
157 | + }elseif (WP_DEBUG) { |
|
158 | + throw new EE_Error(sprintf(__('Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso'), $which_to_include)); |
|
159 | + } else { |
|
160 | 160 | //leave as-is |
161 | 161 | } |
162 | 162 | return $cron_tasks; |
@@ -167,9 +167,9 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public static function create_cron_tasks() { |
169 | 169 | |
170 | - foreach( EEH_Activation::get_cron_tasks( 'current' ) as $hook_name => $frequency ) { |
|
171 | - if( ! wp_next_scheduled( $hook_name ) ) { |
|
172 | - wp_schedule_event( time(), $frequency, $hook_name ); |
|
170 | + foreach (EEH_Activation::get_cron_tasks('current') as $hook_name => $frequency) { |
|
171 | + if ( ! wp_next_scheduled($hook_name)) { |
|
172 | + wp_schedule_event(time(), $frequency, $hook_name); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | * Remove the currently-existing and now-removed cron tasks. |
180 | 180 | * @param boolean $remove_all whether to only remove the old ones, or remove absolutely ALL the EE ones |
181 | 181 | */ |
182 | - public static function remove_cron_tasks( $remove_all = true ) { |
|
182 | + public static function remove_cron_tasks($remove_all = true) { |
|
183 | 183 | $cron_tasks_to_remove = $remove_all ? 'all' : 'old'; |
184 | 184 | $crons = _get_cron_array(); |
185 | - $crons = is_array( $crons ) ? $crons : array(); |
|
185 | + $crons = is_array($crons) ? $crons : array(); |
|
186 | 186 | /* reminder of what $crons look like: |
187 | 187 | * Top-level keys are timestamps, and their values are arrays. |
188 | 188 | * The 2nd level arrays have keys with each of the cron task hook names to run at that time |
@@ -200,23 +200,23 @@ discard block |
||
200 | 200 | * ... |
201 | 201 | * ... |
202 | 202 | */ |
203 | - $ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks( $cron_tasks_to_remove ); |
|
204 | - foreach ( $crons as $timestamp => $hooks_to_fire_at_time ) { |
|
205 | - if ( is_array( $hooks_to_fire_at_time ) ) { |
|
206 | - foreach ( $hooks_to_fire_at_time as $hook_name => $hook_actions ) { |
|
207 | - if ( isset( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
208 | - && is_array( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
203 | + $ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks($cron_tasks_to_remove); |
|
204 | + foreach ($crons as $timestamp => $hooks_to_fire_at_time) { |
|
205 | + if (is_array($hooks_to_fire_at_time)) { |
|
206 | + foreach ($hooks_to_fire_at_time as $hook_name => $hook_actions) { |
|
207 | + if (isset($ee_cron_tasks_to_remove[$hook_name]) |
|
208 | + && is_array($ee_cron_tasks_to_remove[$hook_name]) |
|
209 | 209 | ) { |
210 | - unset( $crons[ $timestamp ][ $hook_name ] ); |
|
210 | + unset($crons[$timestamp][$hook_name]); |
|
211 | 211 | } |
212 | 212 | } |
213 | 213 | //also take care of any empty cron timestamps. |
214 | - if ( empty( $hooks_to_fire_at_time ) ) { |
|
215 | - unset( $crons[ $timestamp ] ); |
|
214 | + if (empty($hooks_to_fire_at_time)) { |
|
215 | + unset($crons[$timestamp]); |
|
216 | 216 | } |
217 | 217 | } |
218 | 218 | } |
219 | - _set_cron_array( $crons ); |
|
219 | + _set_cron_array($crons); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public static function CPT_initialization() { |
233 | 233 | // register Custom Post Types |
234 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
234 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
235 | 235 | flush_rewrite_rules(); |
236 | 236 | } |
237 | 237 | |
@@ -249,8 +249,8 @@ discard block |
||
249 | 249 | * @return void |
250 | 250 | */ |
251 | 251 | public static function reset_and_update_config() { |
252 | - do_action( 'AHEE__EE_Config___load_core_config__start', array( 'EEH_Activation', 'load_calendar_config' ) ); |
|
253 | - add_filter( 'FHEE__EE_Config___load_core_config__config_settings', array( 'EEH_Activation', 'migrate_old_config_data' ), 10, 3 ); |
|
252 | + do_action('AHEE__EE_Config___load_core_config__start', array('EEH_Activation', 'load_calendar_config')); |
|
253 | + add_filter('FHEE__EE_Config___load_core_config__config_settings', array('EEH_Activation', 'migrate_old_config_data'), 10, 3); |
|
254 | 254 | //EE_Config::reset(); |
255 | 255 | } |
256 | 256 | |
@@ -263,23 +263,23 @@ discard block |
||
263 | 263 | */ |
264 | 264 | public static function load_calendar_config() { |
265 | 265 | // grab array of all plugin folders and loop thru it |
266 | - $plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR ); |
|
267 | - if ( empty( $plugins ) ) { |
|
266 | + $plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR); |
|
267 | + if (empty($plugins)) { |
|
268 | 268 | return; |
269 | 269 | } |
270 | - foreach ( $plugins as $plugin_path ) { |
|
270 | + foreach ($plugins as $plugin_path) { |
|
271 | 271 | // grab plugin folder name from path |
272 | - $plugin = basename( $plugin_path ); |
|
272 | + $plugin = basename($plugin_path); |
|
273 | 273 | // drill down to Espresso plugins |
274 | - if ( strpos( $plugin, 'espresso' ) !== FALSE || strpos( $plugin, 'Espresso' ) !== FALSE || strpos( $plugin, 'ee4' ) !== FALSE || strpos( $plugin, 'EE4' ) !== FALSE ) { |
|
274 | + if (strpos($plugin, 'espresso') !== FALSE || strpos($plugin, 'Espresso') !== FALSE || strpos($plugin, 'ee4') !== FALSE || strpos($plugin, 'EE4') !== FALSE) { |
|
275 | 275 | // then to calendar related plugins |
276 | - if ( strpos( $plugin, 'calendar' ) !== FALSE ) { |
|
276 | + if (strpos($plugin, 'calendar') !== FALSE) { |
|
277 | 277 | // this is what we are looking for |
278 | - $calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php'; |
|
278 | + $calendar_config = $plugin_path.DS.'EE_Calendar_Config.php'; |
|
279 | 279 | // does it exist in this folder ? |
280 | - if ( is_readable( $calendar_config )) { |
|
280 | + if (is_readable($calendar_config)) { |
|
281 | 281 | // YEAH! let's load it |
282 | - require_once( $calendar_config ); |
|
282 | + require_once($calendar_config); |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | } |
@@ -296,21 +296,21 @@ discard block |
||
296 | 296 | * @param \EE_Config $EE_Config |
297 | 297 | * @return \stdClass |
298 | 298 | */ |
299 | - public static function migrate_old_config_data( $settings = array(), $config = '', EE_Config $EE_Config ) { |
|
300 | - $convert_from_array = array( 'addons' ); |
|
299 | + public static function migrate_old_config_data($settings = array(), $config = '', EE_Config $EE_Config) { |
|
300 | + $convert_from_array = array('addons'); |
|
301 | 301 | // in case old settings were saved as an array |
302 | - if ( is_array( $settings ) && in_array( $config, $convert_from_array )) { |
|
302 | + if (is_array($settings) && in_array($config, $convert_from_array)) { |
|
303 | 303 | // convert existing settings to an object |
304 | 304 | $config_array = $settings; |
305 | 305 | $settings = new stdClass(); |
306 | - foreach ( $config_array as $key => $value ){ |
|
307 | - if ( $key == 'calendar' && class_exists( 'EE_Calendar_Config' )) { |
|
308 | - $EE_Config->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value ); |
|
306 | + foreach ($config_array as $key => $value) { |
|
307 | + if ($key == 'calendar' && class_exists('EE_Calendar_Config')) { |
|
308 | + $EE_Config->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value); |
|
309 | 309 | } else { |
310 | 310 | $settings->{$key} = $value; |
311 | 311 | } |
312 | 312 | } |
313 | - add_filter( 'FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true' ); |
|
313 | + add_filter('FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true'); |
|
314 | 314 | } |
315 | 315 | return $settings; |
316 | 316 | } |
@@ -326,8 +326,8 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public static function deactivate_event_espresso() { |
328 | 328 | // check permissions |
329 | - if ( current_user_can( 'activate_plugins' )) { |
|
330 | - deactivate_plugins( EE_PLUGIN_BASENAME, TRUE ); |
|
329 | + if (current_user_can('activate_plugins')) { |
|
330 | + deactivate_plugins(EE_PLUGIN_BASENAME, TRUE); |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
@@ -349,25 +349,25 @@ discard block |
||
349 | 349 | $critical_pages = array( |
350 | 350 | array( |
351 | 351 | 'id' =>'reg_page_id', |
352 | - 'name' => __( 'Registration Checkout', 'event_espresso' ), |
|
352 | + 'name' => __('Registration Checkout', 'event_espresso'), |
|
353 | 353 | 'post' => NULL, |
354 | 354 | 'code' => 'ESPRESSO_CHECKOUT' |
355 | 355 | ), |
356 | 356 | array( |
357 | 357 | 'id' => 'txn_page_id', |
358 | - 'name' => __( 'Transactions', 'event_espresso' ), |
|
358 | + 'name' => __('Transactions', 'event_espresso'), |
|
359 | 359 | 'post' => NULL, |
360 | 360 | 'code' => 'ESPRESSO_TXN_PAGE' |
361 | 361 | ), |
362 | 362 | array( |
363 | 363 | 'id' => 'thank_you_page_id', |
364 | - 'name' => __( 'Thank You', 'event_espresso' ), |
|
364 | + 'name' => __('Thank You', 'event_espresso'), |
|
365 | 365 | 'post' => NULL, |
366 | 366 | 'code' => 'ESPRESSO_THANK_YOU' |
367 | 367 | ), |
368 | 368 | array( |
369 | 369 | 'id' => 'cancel_page_id', |
370 | - 'name' => __( 'Registration Cancelled', 'event_espresso' ), |
|
370 | + 'name' => __('Registration Cancelled', 'event_espresso'), |
|
371 | 371 | 'post' => NULL, |
372 | 372 | 'code' => 'ESPRESSO_CANCELLED' |
373 | 373 | ), |
@@ -375,62 +375,62 @@ discard block |
||
375 | 375 | |
376 | 376 | $EE_Core_Config = EE_Registry::instance()->CFG->core; |
377 | 377 | |
378 | - foreach ( $critical_pages as $critical_page ) { |
|
378 | + foreach ($critical_pages as $critical_page) { |
|
379 | 379 | // is critical page ID set in config ? |
380 | - if ( $EE_Core_Config->{$critical_page[ 'id' ]} !== FALSE ) { |
|
380 | + if ($EE_Core_Config->{$critical_page['id']} !== FALSE) { |
|
381 | 381 | // attempt to find post by ID |
382 | - $critical_page['post'] = get_post( $EE_Core_Config->{$critical_page[ 'id' ]} ); |
|
382 | + $critical_page['post'] = get_post($EE_Core_Config->{$critical_page['id']} ); |
|
383 | 383 | } |
384 | 384 | // no dice? |
385 | - if ( $critical_page['post'] == NULL ) { |
|
385 | + if ($critical_page['post'] == NULL) { |
|
386 | 386 | // attempt to find post by title |
387 | - $critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] ); |
|
387 | + $critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']); |
|
388 | 388 | // still nothing? |
389 | - if ( $critical_page['post'] == NULL ) { |
|
390 | - $critical_page = EEH_Activation::create_critical_page( $critical_page ); |
|
389 | + if ($critical_page['post'] == NULL) { |
|
390 | + $critical_page = EEH_Activation::create_critical_page($critical_page); |
|
391 | 391 | // REALLY? Still nothing ??!?!? |
392 | - if ( $critical_page['post'] == NULL ) { |
|
393 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
394 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
392 | + if ($critical_page['post'] == NULL) { |
|
393 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
394 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
395 | 395 | break; |
396 | 396 | } |
397 | 397 | } |
398 | 398 | } |
399 | 399 | // track post_shortcodes |
400 | - if ( $critical_page['post'] ) { |
|
401 | - EEH_Activation::_track_critical_page_post_shortcodes( $critical_page ); |
|
400 | + if ($critical_page['post']) { |
|
401 | + EEH_Activation::_track_critical_page_post_shortcodes($critical_page); |
|
402 | 402 | } |
403 | 403 | // check that Post ID matches critical page ID in config |
404 | 404 | if ( |
405 | - isset( $critical_page['post']->ID ) |
|
406 | - && $critical_page['post']->ID != $EE_Core_Config->{$critical_page[ 'id' ]} |
|
405 | + isset($critical_page['post']->ID) |
|
406 | + && $critical_page['post']->ID != $EE_Core_Config->{$critical_page['id']} |
|
407 | 407 | ) { |
408 | 408 | //update Config with post ID |
409 | - $EE_Core_Config->{$critical_page[ 'id' ]} = $critical_page['post']->ID; |
|
410 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) { |
|
411 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
412 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
409 | + $EE_Core_Config->{$critical_page['id']} = $critical_page['post']->ID; |
|
410 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
411 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
412 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
416 | 416 | $critical_page_problem = |
417 | - ! isset( $critical_page['post']->post_status ) |
|
417 | + ! isset($critical_page['post']->post_status) |
|
418 | 418 | || $critical_page['post']->post_status != 'publish' |
419 | - || strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE |
|
419 | + || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE |
|
420 | 420 | ? TRUE |
421 | 421 | : $critical_page_problem; |
422 | 422 | |
423 | 423 | } |
424 | 424 | |
425 | - if ( $critical_page_problem ) { |
|
425 | + if ($critical_page_problem) { |
|
426 | 426 | $msg = sprintf( |
427 | - __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ), |
|
428 | - '<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>' |
|
427 | + __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'), |
|
428 | + '<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>' |
|
429 | 429 | ); |
430 | - EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg ); |
|
430 | + EE_Error::add_persistent_admin_notice('critical_page_problem', $msg); |
|
431 | 431 | } |
432 | - if ( EE_Error::has_notices() ) { |
|
433 | - EE_Error::get_notices( FALSE, TRUE, TRUE ); |
|
432 | + if (EE_Error::has_notices()) { |
|
433 | + EE_Error::get_notices(FALSE, TRUE, TRUE); |
|
434 | 434 | } |
435 | 435 | } |
436 | 436 | |
@@ -442,13 +442,13 @@ discard block |
||
442 | 442 | * parameter to the shortcode |
443 | 443 | * @return WP_Post or NULl |
444 | 444 | */ |
445 | - public static function get_page_by_ee_shortcode($ee_shortcode){ |
|
445 | + public static function get_page_by_ee_shortcode($ee_shortcode) { |
|
446 | 446 | global $wpdb; |
447 | 447 | $shortcode_and_opening_bracket = '['.$ee_shortcode; |
448 | 448 | $post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1"); |
449 | - if($post_id){ |
|
449 | + if ($post_id) { |
|
450 | 450 | return get_post($post_id); |
451 | - }else{ |
|
451 | + } else { |
|
452 | 452 | return NULL; |
453 | 453 | } |
454 | 454 | |
@@ -465,32 +465,32 @@ discard block |
||
465 | 465 | * @param array $critical_page |
466 | 466 | * @return array |
467 | 467 | */ |
468 | - public static function create_critical_page( $critical_page ) { |
|
468 | + public static function create_critical_page($critical_page) { |
|
469 | 469 | |
470 | 470 | $post_args = array( |
471 | 471 | 'post_title' => $critical_page['name'], |
472 | 472 | 'post_status' => 'publish', |
473 | 473 | 'post_type' => 'page', |
474 | 474 | 'comment_status' => 'closed', |
475 | - 'post_content' => '[' . $critical_page['code'] . ']' |
|
475 | + 'post_content' => '['.$critical_page['code'].']' |
|
476 | 476 | ); |
477 | 477 | |
478 | - $post_id = wp_insert_post( $post_args ); |
|
479 | - if ( ! $post_id ) { |
|
478 | + $post_id = wp_insert_post($post_args); |
|
479 | + if ( ! $post_id) { |
|
480 | 480 | $msg = sprintf( |
481 | - __( 'The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso' ), |
|
481 | + __('The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso'), |
|
482 | 482 | $critical_page['name'] |
483 | 483 | ); |
484 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
484 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
485 | 485 | return $critical_page; |
486 | 486 | } |
487 | 487 | // get newly created post's details |
488 | - if ( ! $critical_page['post'] = get_post( $post_id )) { |
|
488 | + if ( ! $critical_page['post'] = get_post($post_id)) { |
|
489 | 489 | $msg = sprintf( |
490 | - __( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ), |
|
490 | + __('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'), |
|
491 | 491 | $critical_page['name'] |
492 | 492 | ); |
493 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
493 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | return $critical_page; |
@@ -509,35 +509,35 @@ discard block |
||
509 | 509 | * @param array $critical_page |
510 | 510 | * @return void |
511 | 511 | */ |
512 | - private static function _track_critical_page_post_shortcodes( $critical_page = array() ) { |
|
512 | + private static function _track_critical_page_post_shortcodes($critical_page = array()) { |
|
513 | 513 | // check the goods |
514 | - if ( ! $critical_page['post'] instanceof WP_Post ) { |
|
514 | + if ( ! $critical_page['post'] instanceof WP_Post) { |
|
515 | 515 | $msg = sprintf( |
516 | - __( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ), |
|
516 | + __('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'), |
|
517 | 517 | $critical_page['name'] |
518 | 518 | ); |
519 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
519 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
520 | 520 | return; |
521 | 521 | } |
522 | 522 | $EE_Core_Config = EE_Registry::instance()->CFG->core; |
523 | 523 | // map shortcode to post |
524 | - $EE_Core_Config->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID; |
|
524 | + $EE_Core_Config->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID; |
|
525 | 525 | // and make sure it's NOT added to the WP "Posts Page" |
526 | 526 | // name of the WP Posts Page |
527 | 527 | $posts_page = EE_Registry::instance()->CFG->get_page_for_posts(); |
528 | - if ( isset( $EE_Core_Config->post_shortcodes[ $posts_page ] )) { |
|
529 | - unset( $EE_Core_Config->post_shortcodes[ $posts_page ][ $critical_page['code'] ] ); |
|
528 | + if (isset($EE_Core_Config->post_shortcodes[$posts_page])) { |
|
529 | + unset($EE_Core_Config->post_shortcodes[$posts_page][$critical_page['code']]); |
|
530 | 530 | } |
531 | - if ( $posts_page != 'posts' && isset( $EE_Core_Config->post_shortcodes['posts'] )) { |
|
532 | - unset( $EE_Core_Config->post_shortcodes['posts'][ $critical_page['code'] ] ); |
|
531 | + if ($posts_page != 'posts' && isset($EE_Core_Config->post_shortcodes['posts'])) { |
|
532 | + unset($EE_Core_Config->post_shortcodes['posts'][$critical_page['code']]); |
|
533 | 533 | } |
534 | 534 | // update post_shortcode CFG |
535 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) { |
|
535 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
536 | 536 | $msg = sprintf( |
537 | - __( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ), |
|
537 | + __('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'), |
|
538 | 538 | $critical_page['name'] |
539 | 539 | ); |
540 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
540 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
541 | 541 | } |
542 | 542 | } |
543 | 543 | |
@@ -555,24 +555,24 @@ discard block |
||
555 | 555 | public static function get_default_creator_id() { |
556 | 556 | global $wpdb; |
557 | 557 | |
558 | - if ( ! empty( self::$_default_creator_id ) ) { |
|
558 | + if ( ! empty(self::$_default_creator_id)) { |
|
559 | 559 | return self::$_default_creator_id; |
560 | 560 | }/**/ |
561 | 561 | |
562 | - $role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' ); |
|
562 | + $role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator'); |
|
563 | 563 | |
564 | 564 | //let's allow pre_filtering for early exits by alternative methods for getting id. We check for truthy result and if so then exit early. |
565 | - $pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check ); |
|
566 | - if ( $pre_filtered_id !== false ) { |
|
565 | + $pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check); |
|
566 | + if ($pre_filtered_id !== false) { |
|
567 | 567 | return (int) $pre_filtered_id; |
568 | 568 | } |
569 | 569 | |
570 | - $capabilities_key = EEH_Activation::ensure_table_name_has_prefix( 'capabilities' ); |
|
571 | - $query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' ); |
|
572 | - $user_id = $wpdb->get_var( $query ); |
|
573 | - $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id ); |
|
574 | - if ( $user_id && intval( $user_id ) ) { |
|
575 | - self::$_default_creator_id = intval( $user_id ); |
|
570 | + $capabilities_key = EEH_Activation::ensure_table_name_has_prefix('capabilities'); |
|
571 | + $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%'); |
|
572 | + $user_id = $wpdb->get_var($query); |
|
573 | + $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id); |
|
574 | + if ($user_id && intval($user_id)) { |
|
575 | + self::$_default_creator_id = intval($user_id); |
|
576 | 576 | return self::$_default_creator_id; |
577 | 577 | } else { |
578 | 578 | return NULL; |
@@ -599,29 +599,29 @@ discard block |
||
599 | 599 | * @return void |
600 | 600 | * @throws EE_Error if there are database errors |
601 | 601 | */ |
602 | - public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false ) { |
|
603 | - if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){ |
|
602 | + public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false) { |
|
603 | + if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) { |
|
604 | 604 | return; |
605 | 605 | } |
606 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
607 | - if ( ! function_exists( 'dbDelta' )) { |
|
608 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
606 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
607 | + if ( ! function_exists('dbDelta')) { |
|
608 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
609 | 609 | } |
610 | 610 | /** @var WPDB $wpdb */ |
611 | 611 | global $wpdb; |
612 | - $wp_table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
612 | + $wp_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
613 | 613 | // do we need to first delete an existing version of this table ? |
614 | - if ( $drop_pre_existing_table && EEH_Activation::table_exists( $wp_table_name ) ){ |
|
614 | + if ($drop_pre_existing_table && EEH_Activation::table_exists($wp_table_name)) { |
|
615 | 615 | // ok, delete the table... but ONLY if it's empty |
616 | - $deleted_safely = EEH_Activation::delete_db_table_if_empty( $wp_table_name ); |
|
616 | + $deleted_safely = EEH_Activation::delete_db_table_if_empty($wp_table_name); |
|
617 | 617 | // table is NOT empty, are you SURE you want to delete this table ??? |
618 | - if ( ! $deleted_safely && defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){ |
|
619 | - EEH_Activation::delete_unused_db_table( $wp_table_name ); |
|
620 | - } else if ( ! $deleted_safely ) { |
|
618 | + if ( ! $deleted_safely && defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) { |
|
619 | + EEH_Activation::delete_unused_db_table($wp_table_name); |
|
620 | + } else if ( ! $deleted_safely) { |
|
621 | 621 | // so we should be more cautious rather than just dropping tables so easily |
622 | 622 | EE_Error::add_persistent_admin_notice( |
623 | - 'bad_table_' . $wp_table_name . '_detected', |
|
624 | - sprintf( __( 'Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ), |
|
623 | + 'bad_table_'.$wp_table_name.'_detected', |
|
624 | + sprintf(__('Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'), |
|
625 | 625 | $wp_table_name, |
626 | 626 | "<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>", |
627 | 627 | '<b>wp-config.php</b>', |
@@ -630,25 +630,25 @@ discard block |
||
630 | 630 | } |
631 | 631 | } |
632 | 632 | // does $sql contain valid column information? ( LPT: https://regex101.com/ is great for working out regex patterns ) |
633 | - if ( preg_match( '((((.*?))(,\s))+)', $sql, $valid_column_data ) ) { |
|
633 | + if (preg_match('((((.*?))(,\s))+)', $sql, $valid_column_data)) { |
|
634 | 634 | $SQL = "CREATE TABLE $wp_table_name ( $sql ) $engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"; |
635 | 635 | //get $wpdb to echo errors, but buffer them. This way at least WE know an error |
636 | 636 | //happened. And then we can choose to tell the end user |
637 | - $old_show_errors_policy = $wpdb->show_errors( TRUE ); |
|
638 | - $old_error_suppression_policy = $wpdb->suppress_errors( FALSE ); |
|
637 | + $old_show_errors_policy = $wpdb->show_errors(TRUE); |
|
638 | + $old_error_suppression_policy = $wpdb->suppress_errors(FALSE); |
|
639 | 639 | ob_start(); |
640 | - dbDelta( $SQL ); |
|
640 | + dbDelta($SQL); |
|
641 | 641 | $output = ob_get_contents(); |
642 | 642 | ob_end_clean(); |
643 | - $wpdb->show_errors( $old_show_errors_policy ); |
|
644 | - $wpdb->suppress_errors( $old_error_suppression_policy ); |
|
645 | - if( ! empty( $output ) ){ |
|
646 | - throw new EE_Error( $output ); |
|
643 | + $wpdb->show_errors($old_show_errors_policy); |
|
644 | + $wpdb->suppress_errors($old_error_suppression_policy); |
|
645 | + if ( ! empty($output)) { |
|
646 | + throw new EE_Error($output); |
|
647 | 647 | } |
648 | 648 | } else { |
649 | 649 | throw new EE_Error( |
650 | 650 | sprintf( |
651 | - __( 'The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso' ), |
|
651 | + __('The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso'), |
|
652 | 652 | '<br />', |
653 | 653 | $sql |
654 | 654 | ) |
@@ -670,15 +670,15 @@ discard block |
||
670 | 670 | * @param string $column_info if your SQL were 'ALTER TABLE table_name ADD price VARCHAR(10)', this would be 'VARCHAR(10)' |
671 | 671 | * @return bool|int |
672 | 672 | */ |
673 | - public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){ |
|
674 | - if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){ |
|
673 | + public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') { |
|
674 | + if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE)) { |
|
675 | 675 | return FALSE; |
676 | 676 | } |
677 | 677 | global $wpdb; |
678 | - $full_table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
678 | + $full_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
679 | 679 | $fields = self::get_fields_on_table($table_name); |
680 | - if (!in_array($column_name, $fields)){ |
|
681 | - $alter_query="ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
680 | + if ( ! in_array($column_name, $fields)) { |
|
681 | + $alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
682 | 682 | //echo "alter query:$alter_query"; |
683 | 683 | return $wpdb->query($alter_query); |
684 | 684 | } |
@@ -697,15 +697,15 @@ discard block |
||
697 | 697 | * @param string $table_name, without prefixed $wpdb->prefix |
698 | 698 | * @return array of database column names |
699 | 699 | */ |
700 | - public static function get_fields_on_table( $table_name = NULL ) { |
|
700 | + public static function get_fields_on_table($table_name = NULL) { |
|
701 | 701 | global $wpdb; |
702 | - $table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
703 | - if ( ! empty( $table_name )) { |
|
702 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
703 | + if ( ! empty($table_name)) { |
|
704 | 704 | $columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name "); |
705 | 705 | if ($columns !== FALSE) { |
706 | 706 | $field_array = array(); |
707 | - foreach($columns as $column ){ |
|
708 | - $field_array[] = $column->Field;; |
|
707 | + foreach ($columns as $column) { |
|
708 | + $field_array[] = $column->Field; ; |
|
709 | 709 | } |
710 | 710 | return $field_array; |
711 | 711 | } |
@@ -723,12 +723,12 @@ discard block |
||
723 | 723 | * @param string $table_name |
724 | 724 | * @return bool |
725 | 725 | */ |
726 | - public static function db_table_is_empty( $table_name ) { |
|
726 | + public static function db_table_is_empty($table_name) { |
|
727 | 727 | global $wpdb; |
728 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
729 | - if ( EEH_Activation::table_exists( $table_name ) ) { |
|
730 | - $count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" ); |
|
731 | - return absint( $count ) === 0 ? true : false; |
|
728 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
729 | + if (EEH_Activation::table_exists($table_name)) { |
|
730 | + $count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name"); |
|
731 | + return absint($count) === 0 ? true : false; |
|
732 | 732 | } |
733 | 733 | return false; |
734 | 734 | } |
@@ -743,9 +743,9 @@ discard block |
||
743 | 743 | * @param string $table_name |
744 | 744 | * @return bool | int |
745 | 745 | */ |
746 | - public static function delete_db_table_if_empty( $table_name ) { |
|
747 | - if ( EEH_Activation::db_table_is_empty( $table_name ) ) { |
|
748 | - return EEH_Activation::delete_unused_db_table( $table_name ); |
|
746 | + public static function delete_db_table_if_empty($table_name) { |
|
747 | + if (EEH_Activation::db_table_is_empty($table_name)) { |
|
748 | + return EEH_Activation::delete_unused_db_table($table_name); |
|
749 | 749 | } |
750 | 750 | return false; |
751 | 751 | } |
@@ -760,11 +760,11 @@ discard block |
||
760 | 760 | * @param string $table_name |
761 | 761 | * @return bool | int |
762 | 762 | */ |
763 | - public static function delete_unused_db_table( $table_name ) { |
|
763 | + public static function delete_unused_db_table($table_name) { |
|
764 | 764 | global $wpdb; |
765 | - if ( EEH_Activation::table_exists( $table_name ) ) { |
|
766 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
767 | - return $wpdb->query( "DROP TABLE IF EXISTS $table_name" ); |
|
765 | + if (EEH_Activation::table_exists($table_name)) { |
|
766 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
767 | + return $wpdb->query("DROP TABLE IF EXISTS $table_name"); |
|
768 | 768 | } |
769 | 769 | return false; |
770 | 770 | } |
@@ -780,18 +780,18 @@ discard block |
||
780 | 780 | * @param string $index_name |
781 | 781 | * @return bool | int |
782 | 782 | */ |
783 | - public static function drop_index( $table_name, $index_name ) { |
|
784 | - if( apply_filters( 'FHEE__EEH_Activation__drop_index__short_circuit', FALSE ) ){ |
|
783 | + public static function drop_index($table_name, $index_name) { |
|
784 | + if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', FALSE)) { |
|
785 | 785 | return FALSE; |
786 | 786 | } |
787 | 787 | global $wpdb; |
788 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
788 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
789 | 789 | $index_exists_query = "SHOW INDEX FROM $table_name WHERE Key_name = '$index_name'"; |
790 | 790 | if ( |
791 | - $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) == $table_name |
|
792 | - && $wpdb->get_var( $index_exists_query ) == $table_name //using get_var with the $index_exists_query returns the table's name |
|
791 | + $wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name |
|
792 | + && $wpdb->get_var($index_exists_query) == $table_name //using get_var with the $index_exists_query returns the table's name |
|
793 | 793 | ) { |
794 | - return $wpdb->query( "ALTER TABLE $table_name DROP INDEX $index_name" ); |
|
794 | + return $wpdb->query("ALTER TABLE $table_name DROP INDEX $index_name"); |
|
795 | 795 | } |
796 | 796 | return TRUE; |
797 | 797 | } |
@@ -807,27 +807,27 @@ discard block |
||
807 | 807 | * @return boolean success (whether database is setup properly or not) |
808 | 808 | */ |
809 | 809 | public static function create_database_tables() { |
810 | - EE_Registry::instance()->load_core( 'Data_Migration_Manager' ); |
|
810 | + EE_Registry::instance()->load_core('Data_Migration_Manager'); |
|
811 | 811 | //find the migration script that sets the database to be compatible with the code |
812 | 812 | $dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms(); |
813 | - if( $dms_name ){ |
|
814 | - $current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name ); |
|
815 | - $current_data_migration_script->set_migrating( false ); |
|
813 | + if ($dms_name) { |
|
814 | + $current_data_migration_script = EE_Registry::instance()->load_dms($dms_name); |
|
815 | + $current_data_migration_script->set_migrating(false); |
|
816 | 816 | $current_data_migration_script->schema_changes_before_migration(); |
817 | 817 | $current_data_migration_script->schema_changes_after_migration(); |
818 | - if( $current_data_migration_script->get_errors() ){ |
|
819 | - if( WP_DEBUG ){ |
|
820 | - foreach( $current_data_migration_script->get_errors() as $error ){ |
|
821 | - EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ ); |
|
818 | + if ($current_data_migration_script->get_errors()) { |
|
819 | + if (WP_DEBUG) { |
|
820 | + foreach ($current_data_migration_script->get_errors() as $error) { |
|
821 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
822 | 822 | } |
823 | - }else{ |
|
824 | - EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) ); |
|
823 | + } else { |
|
824 | + EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso')); |
|
825 | 825 | } |
826 | 826 | return false; |
827 | 827 | } |
828 | 828 | EE_Data_Migration_Manager::instance()->update_current_database_state_to(); |
829 | - }else{ |
|
830 | - EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
829 | + } else { |
|
830 | + EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
831 | 831 | return false; |
832 | 832 | } |
833 | 833 | return true; |
@@ -847,27 +847,27 @@ discard block |
||
847 | 847 | public static function initialize_system_questions() { |
848 | 848 | // QUESTION GROUPS |
849 | 849 | global $wpdb; |
850 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group' ); |
|
850 | + $table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question_group'); |
|
851 | 851 | $SQL = "SELECT QSG_system FROM $table_name WHERE QSG_system != 0"; |
852 | 852 | // what we have |
853 | - $question_groups = $wpdb->get_col( $SQL ); |
|
853 | + $question_groups = $wpdb->get_col($SQL); |
|
854 | 854 | // check the response |
855 | - $question_groups = is_array( $question_groups ) ? $question_groups : array(); |
|
855 | + $question_groups = is_array($question_groups) ? $question_groups : array(); |
|
856 | 856 | // what we should have |
857 | - $QSG_systems = array( 1, 2 ); |
|
857 | + $QSG_systems = array(1, 2); |
|
858 | 858 | // loop thru what we should have and compare to what we have |
859 | - foreach ( $QSG_systems as $QSG_system ) { |
|
859 | + foreach ($QSG_systems as $QSG_system) { |
|
860 | 860 | // reset values array |
861 | 861 | $QSG_values = array(); |
862 | 862 | // if we don't have what we should have (but use $QST_system as as string because that's what we got from the db) |
863 | - if ( ! in_array( "$QSG_system", $question_groups )) { |
|
863 | + if ( ! in_array("$QSG_system", $question_groups)) { |
|
864 | 864 | // add it |
865 | - switch ( $QSG_system ) { |
|
865 | + switch ($QSG_system) { |
|
866 | 866 | |
867 | 867 | case 1: |
868 | 868 | $QSG_values = array( |
869 | - 'QSG_name' => __( 'Personal Information', 'event_espresso' ), |
|
870 | - 'QSG_identifier' => 'personal-information-' . time(), |
|
869 | + 'QSG_name' => __('Personal Information', 'event_espresso'), |
|
870 | + 'QSG_identifier' => 'personal-information-'.time(), |
|
871 | 871 | 'QSG_desc' => '', |
872 | 872 | 'QSG_order' => 1, |
873 | 873 | 'QSG_show_group_name' => 1, |
@@ -879,8 +879,8 @@ discard block |
||
879 | 879 | |
880 | 880 | case 2: |
881 | 881 | $QSG_values = array( |
882 | - 'QSG_name' => __( 'Address Information','event_espresso' ), |
|
883 | - 'QSG_identifier' => 'address-information-' . time(), |
|
882 | + 'QSG_name' => __('Address Information', 'event_espresso'), |
|
883 | + 'QSG_identifier' => 'address-information-'.time(), |
|
884 | 884 | 'QSG_desc' => '', |
885 | 885 | 'QSG_order' => 2, |
886 | 886 | 'QSG_show_group_name' => 1, |
@@ -892,14 +892,14 @@ discard block |
||
892 | 892 | |
893 | 893 | } |
894 | 894 | // make sure we have some values before inserting them |
895 | - if ( ! empty( $QSG_values )) { |
|
895 | + if ( ! empty($QSG_values)) { |
|
896 | 896 | // insert system question |
897 | 897 | $wpdb->insert( |
898 | 898 | $table_name, |
899 | 899 | $QSG_values, |
900 | - array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' ) |
|
900 | + array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d') |
|
901 | 901 | ); |
902 | - $QSG_IDs[ $QSG_system ] = $wpdb->insert_id; |
|
902 | + $QSG_IDs[$QSG_system] = $wpdb->insert_id; |
|
903 | 903 | } |
904 | 904 | } |
905 | 905 | } |
@@ -908,10 +908,10 @@ discard block |
||
908 | 908 | |
909 | 909 | // QUESTIONS |
910 | 910 | global $wpdb; |
911 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question' ); |
|
911 | + $table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question'); |
|
912 | 912 | $SQL = "SELECT QST_system FROM $table_name WHERE QST_system != ''"; |
913 | 913 | // what we have |
914 | - $questions = $wpdb->get_col( $SQL ); |
|
914 | + $questions = $wpdb->get_col($SQL); |
|
915 | 915 | // what we should have |
916 | 916 | $QST_systems = array( |
917 | 917 | 'fname', |
@@ -928,25 +928,25 @@ discard block |
||
928 | 928 | $order_for_group_1 = 1; |
929 | 929 | $order_for_group_2 = 1; |
930 | 930 | // loop thru what we should have and compare to what we have |
931 | - foreach ( $QST_systems as $QST_system ) { |
|
931 | + foreach ($QST_systems as $QST_system) { |
|
932 | 932 | // reset values array |
933 | 933 | $QST_values = array(); |
934 | 934 | // if we don't have what we should have |
935 | - if ( ! in_array( $QST_system, $questions )) { |
|
935 | + if ( ! in_array($QST_system, $questions)) { |
|
936 | 936 | // add it |
937 | - switch ( $QST_system ) { |
|
937 | + switch ($QST_system) { |
|
938 | 938 | |
939 | 939 | case 'fname': |
940 | 940 | $QST_values = array( |
941 | - 'QST_display_text' => __( 'First Name', 'event_espresso' ), |
|
942 | - 'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ), |
|
941 | + 'QST_display_text' => __('First Name', 'event_espresso'), |
|
942 | + 'QST_admin_label' => __('First Name - System Question', 'event_espresso'), |
|
943 | 943 | 'QST_system' => 'fname', |
944 | 944 | 'QST_type' => 'TEXT', |
945 | 945 | 'QST_required' => 1, |
946 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
946 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
947 | 947 | 'QST_order' => 1, |
948 | 948 | 'QST_admin_only' => 0, |
949 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
949 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
950 | 950 | 'QST_wp_user' => self::get_default_creator_id(), |
951 | 951 | 'QST_deleted' => 0 |
952 | 952 | ); |
@@ -954,15 +954,15 @@ discard block |
||
954 | 954 | |
955 | 955 | case 'lname': |
956 | 956 | $QST_values = array( |
957 | - 'QST_display_text' => __( 'Last Name', 'event_espresso' ), |
|
958 | - 'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ), |
|
957 | + 'QST_display_text' => __('Last Name', 'event_espresso'), |
|
958 | + 'QST_admin_label' => __('Last Name - System Question', 'event_espresso'), |
|
959 | 959 | 'QST_system' => 'lname', |
960 | 960 | 'QST_type' => 'TEXT', |
961 | 961 | 'QST_required' => 1, |
962 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
962 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
963 | 963 | 'QST_order' => 2, |
964 | 964 | 'QST_admin_only' => 0, |
965 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
965 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
966 | 966 | 'QST_wp_user' => self::get_default_creator_id(), |
967 | 967 | 'QST_deleted' => 0 |
968 | 968 | ); |
@@ -970,15 +970,15 @@ discard block |
||
970 | 970 | |
971 | 971 | case 'email': |
972 | 972 | $QST_values = array( |
973 | - 'QST_display_text' => __( 'Email Address', 'event_espresso' ), |
|
974 | - 'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ), |
|
973 | + 'QST_display_text' => __('Email Address', 'event_espresso'), |
|
974 | + 'QST_admin_label' => __('Email Address - System Question', 'event_espresso'), |
|
975 | 975 | 'QST_system' => 'email', |
976 | 976 | 'QST_type' => 'TEXT', |
977 | 977 | 'QST_required' => 1, |
978 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
978 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
979 | 979 | 'QST_order' => 3, |
980 | 980 | 'QST_admin_only' => 0, |
981 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
981 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
982 | 982 | 'QST_wp_user' => self::get_default_creator_id(), |
983 | 983 | 'QST_deleted' => 0 |
984 | 984 | ); |
@@ -986,15 +986,15 @@ discard block |
||
986 | 986 | |
987 | 987 | case 'address': |
988 | 988 | $QST_values = array( |
989 | - 'QST_display_text' => __( 'Address', 'event_espresso' ), |
|
990 | - 'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ), |
|
989 | + 'QST_display_text' => __('Address', 'event_espresso'), |
|
990 | + 'QST_admin_label' => __('Address - System Question', 'event_espresso'), |
|
991 | 991 | 'QST_system' => 'address', |
992 | 992 | 'QST_type' => 'TEXT', |
993 | 993 | 'QST_required' => 0, |
994 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
994 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
995 | 995 | 'QST_order' => 4, |
996 | 996 | 'QST_admin_only' => 0, |
997 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
997 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
998 | 998 | 'QST_wp_user' => self::get_default_creator_id(), |
999 | 999 | 'QST_deleted' => 0 |
1000 | 1000 | ); |
@@ -1002,15 +1002,15 @@ discard block |
||
1002 | 1002 | |
1003 | 1003 | case 'address2': |
1004 | 1004 | $QST_values = array( |
1005 | - 'QST_display_text' => __( 'Address2', 'event_espresso' ), |
|
1006 | - 'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ), |
|
1005 | + 'QST_display_text' => __('Address2', 'event_espresso'), |
|
1006 | + 'QST_admin_label' => __('Address2 - System Question', 'event_espresso'), |
|
1007 | 1007 | 'QST_system' => 'address2', |
1008 | 1008 | 'QST_type' => 'TEXT', |
1009 | 1009 | 'QST_required' => 0, |
1010 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1010 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1011 | 1011 | 'QST_order' => 5, |
1012 | 1012 | 'QST_admin_only' => 0, |
1013 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1013 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1014 | 1014 | 'QST_wp_user' => self::get_default_creator_id(), |
1015 | 1015 | 'QST_deleted' => 0 |
1016 | 1016 | ); |
@@ -1018,15 +1018,15 @@ discard block |
||
1018 | 1018 | |
1019 | 1019 | case 'city': |
1020 | 1020 | $QST_values = array( |
1021 | - 'QST_display_text' => __( 'City', 'event_espresso' ), |
|
1022 | - 'QST_admin_label' => __( 'City - System Question', 'event_espresso' ), |
|
1021 | + 'QST_display_text' => __('City', 'event_espresso'), |
|
1022 | + 'QST_admin_label' => __('City - System Question', 'event_espresso'), |
|
1023 | 1023 | 'QST_system' => 'city', |
1024 | 1024 | 'QST_type' => 'TEXT', |
1025 | 1025 | 'QST_required' => 0, |
1026 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1026 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1027 | 1027 | 'QST_order' => 6, |
1028 | 1028 | 'QST_admin_only' => 0, |
1029 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1029 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1030 | 1030 | 'QST_wp_user' => self::get_default_creator_id(), |
1031 | 1031 | 'QST_deleted' => 0 |
1032 | 1032 | ); |
@@ -1034,12 +1034,12 @@ discard block |
||
1034 | 1034 | |
1035 | 1035 | case 'state': |
1036 | 1036 | $QST_values = array( |
1037 | - 'QST_display_text' => __( 'State/Province', 'event_espresso' ), |
|
1038 | - 'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ), |
|
1037 | + 'QST_display_text' => __('State/Province', 'event_espresso'), |
|
1038 | + 'QST_admin_label' => __('State/Province - System Question', 'event_espresso'), |
|
1039 | 1039 | 'QST_system' => 'state', |
1040 | 1040 | 'QST_type' => 'STATE', |
1041 | 1041 | 'QST_required' => 0, |
1042 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1042 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1043 | 1043 | 'QST_order' => 7, |
1044 | 1044 | 'QST_admin_only' => 0, |
1045 | 1045 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1049,12 +1049,12 @@ discard block |
||
1049 | 1049 | |
1050 | 1050 | case 'country' : |
1051 | 1051 | $QST_values = array( |
1052 | - 'QST_display_text' => __( 'Country', 'event_espresso' ), |
|
1053 | - 'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ), |
|
1052 | + 'QST_display_text' => __('Country', 'event_espresso'), |
|
1053 | + 'QST_admin_label' => __('Country - System Question', 'event_espresso'), |
|
1054 | 1054 | 'QST_system' => 'country', |
1055 | 1055 | 'QST_type' => 'COUNTRY', |
1056 | 1056 | 'QST_required' => 0, |
1057 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1057 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1058 | 1058 | 'QST_order' => 8, |
1059 | 1059 | 'QST_admin_only' => 0, |
1060 | 1060 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1064,15 +1064,15 @@ discard block |
||
1064 | 1064 | |
1065 | 1065 | case 'zip': |
1066 | 1066 | $QST_values = array( |
1067 | - 'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ), |
|
1068 | - 'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ), |
|
1067 | + 'QST_display_text' => __('Zip/Postal Code', 'event_espresso'), |
|
1068 | + 'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'), |
|
1069 | 1069 | 'QST_system' => 'zip', |
1070 | 1070 | 'QST_type' => 'TEXT', |
1071 | 1071 | 'QST_required' => 0, |
1072 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1072 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1073 | 1073 | 'QST_order' => 9, |
1074 | 1074 | 'QST_admin_only' => 0, |
1075 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1075 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1076 | 1076 | 'QST_wp_user' => self::get_default_creator_id(), |
1077 | 1077 | 'QST_deleted' => 0 |
1078 | 1078 | ); |
@@ -1080,49 +1080,49 @@ discard block |
||
1080 | 1080 | |
1081 | 1081 | case 'phone': |
1082 | 1082 | $QST_values = array( |
1083 | - 'QST_display_text' => __( 'Phone Number', 'event_espresso' ), |
|
1084 | - 'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ), |
|
1083 | + 'QST_display_text' => __('Phone Number', 'event_espresso'), |
|
1084 | + 'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'), |
|
1085 | 1085 | 'QST_system' => 'phone', |
1086 | 1086 | 'QST_type' => 'TEXT', |
1087 | 1087 | 'QST_required' => 0, |
1088 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1088 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1089 | 1089 | 'QST_order' => 10, |
1090 | 1090 | 'QST_admin_only' => 0, |
1091 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1091 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1092 | 1092 | 'QST_wp_user' => self::get_default_creator_id(), |
1093 | 1093 | 'QST_deleted' => 0 |
1094 | 1094 | ); |
1095 | 1095 | break; |
1096 | 1096 | |
1097 | 1097 | } |
1098 | - if ( ! empty( $QST_values )) { |
|
1098 | + if ( ! empty($QST_values)) { |
|
1099 | 1099 | // insert system question |
1100 | 1100 | $wpdb->insert( |
1101 | 1101 | $table_name, |
1102 | 1102 | $QST_values, |
1103 | - array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' ) |
|
1103 | + array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d') |
|
1104 | 1104 | ); |
1105 | 1105 | $QST_ID = $wpdb->insert_id; |
1106 | 1106 | |
1107 | 1107 | // QUESTION GROUP QUESTIONS |
1108 | - if( in_array( $QST_system, array( 'fname', 'lname', 'email' ) ) ) { |
|
1108 | + if (in_array($QST_system, array('fname', 'lname', 'email'))) { |
|
1109 | 1109 | $system_question_we_want = EEM_Question_Group::system_personal; |
1110 | 1110 | } else { |
1111 | 1111 | $system_question_we_want = EEM_Question_Group::system_address; |
1112 | 1112 | } |
1113 | - if( isset( $QSG_IDs[ $system_question_we_want ] ) ) { |
|
1114 | - $QSG_ID = $QSG_IDs[ $system_question_we_want ]; |
|
1113 | + if (isset($QSG_IDs[$system_question_we_want])) { |
|
1114 | + $QSG_ID = $QSG_IDs[$system_question_we_want]; |
|
1115 | 1115 | } else { |
1116 | - $id_col = EEM_Question_Group::instance()->get_col( array( array( 'QSG_system' => $system_question_we_want ) ) ); |
|
1117 | - if( is_array( $id_col ) ) { |
|
1118 | - $QSG_ID = reset( $id_col ); |
|
1116 | + $id_col = EEM_Question_Group::instance()->get_col(array(array('QSG_system' => $system_question_we_want))); |
|
1117 | + if (is_array($id_col)) { |
|
1118 | + $QSG_ID = reset($id_col); |
|
1119 | 1119 | } else { |
1120 | 1120 | //ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method |
1121 | 1121 | EE_Log::instance()->log( |
1122 | 1122 | __FILE__, |
1123 | 1123 | __FUNCTION__, |
1124 | 1124 | sprintf( |
1125 | - __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1125 | + __('Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1126 | 1126 | $QST_ID ), |
1127 | 1127 | 'error' ); |
1128 | 1128 | continue; |
@@ -1131,9 +1131,9 @@ discard block |
||
1131 | 1131 | |
1132 | 1132 | // add system questions to groups |
1133 | 1133 | $wpdb->insert( |
1134 | - EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group_question' ), |
|
1135 | - array( 'QSG_ID' => $QSG_ID , 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID==1)? $order_for_group_1++ : $order_for_group_2++ ), |
|
1136 | - array( '%d', '%d','%d' ) |
|
1134 | + EEH_Activation::ensure_table_name_has_prefix('esp_question_group_question'), |
|
1135 | + array('QSG_ID' => $QSG_ID, 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID == 1) ? $order_for_group_1++ : $order_for_group_2++), |
|
1136 | + array('%d', '%d', '%d') |
|
1137 | 1137 | ); |
1138 | 1138 | } |
1139 | 1139 | } |
@@ -1145,11 +1145,11 @@ discard block |
||
1145 | 1145 | * Makes sure the default payment method (Invoice) is active. |
1146 | 1146 | * This used to be done automatically as part of constructing the old gateways config |
1147 | 1147 | */ |
1148 | - public static function insert_default_payment_methods(){ |
|
1149 | - if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){ |
|
1150 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
1151 | - EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
|
1152 | - }else{ |
|
1148 | + public static function insert_default_payment_methods() { |
|
1149 | + if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) { |
|
1150 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
1151 | + EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice'); |
|
1152 | + } else { |
|
1153 | 1153 | EEM_Payment_Method::instance()->verify_button_urls(); |
1154 | 1154 | } |
1155 | 1155 | } |
@@ -1165,7 +1165,7 @@ discard block |
||
1165 | 1165 | |
1166 | 1166 | global $wpdb; |
1167 | 1167 | |
1168 | - if ( EEH_Activation::table_exists( EEM_Status::instance()->table() ) ) { |
|
1168 | + if (EEH_Activation::table_exists(EEM_Status::instance()->table())) { |
|
1169 | 1169 | |
1170 | 1170 | $table_name = EEM_Status::instance()->table(); |
1171 | 1171 | |
@@ -1231,38 +1231,38 @@ discard block |
||
1231 | 1231 | * @return boolean success of verifying upload directories exist |
1232 | 1232 | */ |
1233 | 1233 | public static function create_upload_directories() { |
1234 | - EE_Registry::instance()->load_helper( 'File' ); |
|
1234 | + EE_Registry::instance()->load_helper('File'); |
|
1235 | 1235 | // Create the required folders |
1236 | 1236 | $folders = array( |
1237 | 1237 | EVENT_ESPRESSO_TEMPLATE_DIR, |
1238 | 1238 | EVENT_ESPRESSO_GATEWAY_DIR, |
1239 | - EVENT_ESPRESSO_UPLOAD_DIR . 'logs/', |
|
1240 | - EVENT_ESPRESSO_UPLOAD_DIR . 'css/', |
|
1241 | - EVENT_ESPRESSO_UPLOAD_DIR . 'tickets/' |
|
1239 | + EVENT_ESPRESSO_UPLOAD_DIR.'logs/', |
|
1240 | + EVENT_ESPRESSO_UPLOAD_DIR.'css/', |
|
1241 | + EVENT_ESPRESSO_UPLOAD_DIR.'tickets/' |
|
1242 | 1242 | ); |
1243 | - foreach ( $folders as $folder ) { |
|
1243 | + foreach ($folders as $folder) { |
|
1244 | 1244 | try { |
1245 | - EEH_File::ensure_folder_exists_and_is_writable( $folder ); |
|
1246 | - @ chmod( $folder, 0755 ); |
|
1247 | - } catch( EE_Error $e ){ |
|
1245 | + EEH_File::ensure_folder_exists_and_is_writable($folder); |
|
1246 | + @ chmod($folder, 0755); |
|
1247 | + } catch (EE_Error $e) { |
|
1248 | 1248 | EE_Error::add_error( |
1249 | 1249 | sprintf( |
1250 | - __( 'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ), |
|
1250 | + __('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'), |
|
1251 | 1251 | $folder, |
1252 | - '<br />' . $e->getMessage() |
|
1252 | + '<br />'.$e->getMessage() |
|
1253 | 1253 | ), |
1254 | 1254 | __FILE__, __FUNCTION__, __LINE__ |
1255 | 1255 | ); |
1256 | 1256 | //indicate we'll need to fix this later |
1257 | - update_option( EEH_Activation::upload_directories_incomplete_option_name, true ); |
|
1257 | + update_option(EEH_Activation::upload_directories_incomplete_option_name, true); |
|
1258 | 1258 | return FALSE; |
1259 | 1259 | } |
1260 | 1260 | } |
1261 | 1261 | //just add the .htaccess file to the logs directory to begin with. Even if logging |
1262 | 1262 | //is disabled, there might be activation errors recorded in there |
1263 | - EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs/' ); |
|
1263 | + EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs/'); |
|
1264 | 1264 | //remember EE's folders are all good |
1265 | - delete_option( EEH_Activation::upload_directories_incomplete_option_name ); |
|
1265 | + delete_option(EEH_Activation::upload_directories_incomplete_option_name); |
|
1266 | 1266 | return TRUE; |
1267 | 1267 | } |
1268 | 1268 | |
@@ -1275,7 +1275,7 @@ discard block |
||
1275 | 1275 | * @return boolean |
1276 | 1276 | */ |
1277 | 1277 | public static function upload_directories_incomplete() { |
1278 | - return get_option( EEH_Activation::upload_directories_incomplete_option_name, false ); |
|
1278 | + return get_option(EEH_Activation::upload_directories_incomplete_option_name, false); |
|
1279 | 1279 | } |
1280 | 1280 | |
1281 | 1281 | |
@@ -1294,16 +1294,16 @@ discard block |
||
1294 | 1294 | $installed_messengers = $default_messengers = array(); |
1295 | 1295 | |
1296 | 1296 | //include our helper |
1297 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
1297 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
1298 | 1298 | |
1299 | 1299 | //get all installed messenger objects |
1300 | 1300 | $installed = EEH_MSG_Template::get_installed_message_objects(); |
1301 | 1301 | |
1302 | 1302 | //let's setup the $installed messengers in an array AND the messengers that are set to be activated on install. |
1303 | - foreach ( $installed['messengers'] as $msgr ) { |
|
1304 | - if ( $msgr instanceof EE_messenger ) { |
|
1303 | + foreach ($installed['messengers'] as $msgr) { |
|
1304 | + if ($msgr instanceof EE_messenger) { |
|
1305 | 1305 | $installed_messengers[$msgr->name] = $msgr; |
1306 | - if ( $msgr->activate_on_install ) { |
|
1306 | + if ($msgr->activate_on_install) { |
|
1307 | 1307 | $default_messengers[] = $msgr->name; |
1308 | 1308 | } |
1309 | 1309 | } |
@@ -1313,36 +1313,36 @@ discard block |
||
1313 | 1313 | $active_messengers = EEH_MSG_Template::get_active_messengers_in_db(); |
1314 | 1314 | |
1315 | 1315 | //things that have already been activated before |
1316 | - $has_activated = get_option( 'ee_has_activated_messenger' ); |
|
1316 | + $has_activated = get_option('ee_has_activated_messenger'); |
|
1317 | 1317 | |
1318 | 1318 | //do an initial loop to determine if we need to continue |
1319 | 1319 | $def_ms = array(); |
1320 | - foreach ( $default_messengers as $msgr ) { |
|
1321 | - if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue; |
|
1320 | + foreach ($default_messengers as $msgr) { |
|
1321 | + if (isset($active_messengers[$msgr]) || isset($has_activated[$msgr])) continue; |
|
1322 | 1322 | $def_ms[] = $msgr; |
1323 | 1323 | } |
1324 | 1324 | |
1325 | 1325 | //setup the $installed_mts in an array |
1326 | - foreach ( $installed['message_types'] as $imt ) { |
|
1327 | - if ( $imt instanceof EE_message_type ) { |
|
1326 | + foreach ($installed['message_types'] as $imt) { |
|
1327 | + if ($imt instanceof EE_message_type) { |
|
1328 | 1328 | $installed_mts[$imt->name] = $imt; |
1329 | 1329 | } |
1330 | 1330 | } |
1331 | 1331 | |
1332 | 1332 | //loop through default array for default messengers (if present) |
1333 | - if ( ! empty( $def_ms ) ) { |
|
1334 | - foreach ( $def_ms as $messenger ) { |
|
1333 | + if ( ! empty($def_ms)) { |
|
1334 | + foreach ($def_ms as $messenger) { |
|
1335 | 1335 | //all is good so let's setup the default stuff. We need to use the given messenger object (if exists) to get the default message type for the messenger. |
1336 | - if ( ! isset( $installed_messengers[$messenger] )) { |
|
1336 | + if ( ! isset($installed_messengers[$messenger])) { |
|
1337 | 1337 | continue; |
1338 | 1338 | } |
1339 | 1339 | /** @var EE_messenger[] $installed_messengers */ |
1340 | 1340 | $default_mts = $installed_messengers[$messenger]->get_default_message_types(); |
1341 | 1341 | $active_messengers[$messenger]['obj'] = $installed_messengers[$messenger]; |
1342 | - foreach ( $default_mts as $index => $mt ) { |
|
1342 | + foreach ($default_mts as $index => $mt) { |
|
1343 | 1343 | //is there an installed_mt matching the default string? If not then nothing to do here. |
1344 | - if ( ! isset( $installed_mts[$mt] ) ) { |
|
1345 | - unset( $default_mts[$index] ); |
|
1344 | + if ( ! isset($installed_mts[$mt])) { |
|
1345 | + unset($default_mts[$index]); |
|
1346 | 1346 | continue; |
1347 | 1347 | } |
1348 | 1348 | |
@@ -1351,41 +1351,41 @@ discard block |
||
1351 | 1351 | /** @var EE_message_type[] $installed_mts */ |
1352 | 1352 | $settings_fields = $installed_mts[$mt]->get_admin_settings_fields(); |
1353 | 1353 | $settings = array(); |
1354 | - if ( is_array( $settings_fields ) ) { |
|
1355 | - foreach ( $settings_fields as $field => $values ) { |
|
1356 | - if ( isset( $values['default'] ) ) { |
|
1354 | + if (is_array($settings_fields)) { |
|
1355 | + foreach ($settings_fields as $field => $values) { |
|
1356 | + if (isset($values['default'])) { |
|
1357 | 1357 | $settings[$field] = $values['default']; |
1358 | 1358 | } |
1359 | 1359 | } |
1360 | 1360 | } |
1361 | 1361 | |
1362 | - $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings; |
|
1362 | + $active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings; |
|
1363 | 1363 | $has_activated[$messenger][] = $mt; |
1364 | 1364 | } |
1365 | 1365 | |
1366 | 1366 | //setup any initial settings for the messenger |
1367 | 1367 | $msgr_settings = $installed_messengers[$messenger]->get_admin_settings_fields(); |
1368 | 1368 | |
1369 | - if ( !empty( $msgr_settings ) ) { |
|
1370 | - foreach ( $msgr_settings as $field => $value ) { |
|
1369 | + if ( ! empty($msgr_settings)) { |
|
1370 | + foreach ($msgr_settings as $field => $value) { |
|
1371 | 1371 | $active_messengers[$messenger]['settings'][$field] = $value; |
1372 | 1372 | } |
1373 | 1373 | } |
1374 | 1374 | |
1375 | 1375 | //now let's save the settings for this messenger! Must do now because the validator checks the db for active messengers to validate. |
1376 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
1376 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
1377 | 1377 | |
1378 | 1378 | //let's generate all the templates but only if the messenger has default_mts (otherwise its just activated). |
1379 | - if ( !empty( $default_mts ) ) { |
|
1380 | - $success = EEH_MSG_Template::generate_new_templates( $messenger, $default_mts, '', TRUE ); |
|
1379 | + if ( ! empty($default_mts)) { |
|
1380 | + $success = EEH_MSG_Template::generate_new_templates($messenger, $default_mts, '', TRUE); |
|
1381 | 1381 | } |
1382 | 1382 | } |
1383 | 1383 | } //end check for empty( $def_ms ) |
1384 | 1384 | |
1385 | 1385 | //still need to see if there are any message types to activate for active messengers |
1386 | - foreach ( $active_messengers as $messenger => $settings ) { |
|
1386 | + foreach ($active_messengers as $messenger => $settings) { |
|
1387 | 1387 | $msg_obj = $settings['obj']; |
1388 | - if ( ! $msg_obj instanceof EE_messenger ) { |
|
1388 | + if ( ! $msg_obj instanceof EE_messenger) { |
|
1389 | 1389 | continue; |
1390 | 1390 | } |
1391 | 1391 | |
@@ -1393,45 +1393,45 @@ discard block |
||
1393 | 1393 | $new_default_mts = array(); |
1394 | 1394 | |
1395 | 1395 | //loop through each default mt reported by the messenger and make sure its set in its active db entry. |
1396 | - foreach( $all_default_mts as $index => $mt ) { |
|
1396 | + foreach ($all_default_mts as $index => $mt) { |
|
1397 | 1397 | //already active? already has generated templates? || has already been activated before (we dont' want to reactivate things users intentionally deactivated). |
1398 | - if ( ( isset( $has_activated[$messenger] ) && in_array($mt, $has_activated[$messenger]) ) || isset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) || EEH_MSG_Template::already_generated( $messenger, $mt, 0, FALSE ) ) { |
|
1398 | + if ((isset($has_activated[$messenger]) && in_array($mt, $has_activated[$messenger])) || isset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) || EEH_MSG_Template::already_generated($messenger, $mt, 0, FALSE)) { |
|
1399 | 1399 | continue; |
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 | //is there an installed_mt matching the default string? If not then nothing to do here. |
1403 | - if ( ! isset( $installed_mts[$mt] ) ) { |
|
1404 | - unset( $all_default_mts[$mt] ); |
|
1403 | + if ( ! isset($installed_mts[$mt])) { |
|
1404 | + unset($all_default_mts[$mt]); |
|
1405 | 1405 | continue; |
1406 | 1406 | } |
1407 | 1407 | |
1408 | 1408 | $settings_fields = $installed_mts[$mt]->get_admin_settings_fields(); |
1409 | 1409 | $settings = array(); |
1410 | - if ( is_array( $settings_fields ) ) { |
|
1411 | - foreach ( $settings_fields as $field => $values ) { |
|
1412 | - if ( isset( $values['default'] ) ) { |
|
1410 | + if (is_array($settings_fields)) { |
|
1411 | + foreach ($settings_fields as $field => $values) { |
|
1412 | + if (isset($values['default'])) { |
|
1413 | 1413 | $settings[$field] = $values['default']; |
1414 | 1414 | } |
1415 | 1415 | } |
1416 | 1416 | } |
1417 | 1417 | |
1418 | - $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings; |
|
1418 | + $active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings; |
|
1419 | 1419 | $new_default_mts[] = $mt; |
1420 | 1420 | $has_activated[$messenger][] = $mt; |
1421 | 1421 | } |
1422 | 1422 | |
1423 | 1423 | |
1424 | - if ( ! empty( $new_default_mts ) ) { |
|
1425 | - $success = EEH_MSG_Template::generate_new_templates( $messenger, $new_default_mts, '', TRUE ); |
|
1424 | + if ( ! empty($new_default_mts)) { |
|
1425 | + $success = EEH_MSG_Template::generate_new_templates($messenger, $new_default_mts, '', TRUE); |
|
1426 | 1426 | } |
1427 | 1427 | |
1428 | 1428 | } |
1429 | 1429 | |
1430 | 1430 | //now let's save the settings for this messenger! |
1431 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
1431 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
1432 | 1432 | |
1433 | 1433 | //update $has_activated record |
1434 | - update_option( 'ee_has_activated_messenger', $has_activated ); |
|
1434 | + update_option('ee_has_activated_messenger', $has_activated); |
|
1435 | 1435 | |
1436 | 1436 | //that's it! |
1437 | 1437 | return $success; |
@@ -1451,47 +1451,47 @@ discard block |
||
1451 | 1451 | */ |
1452 | 1452 | public static function validate_messages_system() { |
1453 | 1453 | //include our helper |
1454 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
1454 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
1455 | 1455 | |
1456 | 1456 | //get active and installed messengers/message types. |
1457 | 1457 | $active_messengers = EEH_MSG_Template::get_active_messengers_in_db(); |
1458 | 1458 | $installed = EEH_MSG_Template::get_installed_message_objects(); |
1459 | 1459 | $installed_messengers = $installed_mts = array(); |
1460 | 1460 | //set up the arrays so they can be handled easier. |
1461 | - foreach( $installed['messengers'] as $im ) { |
|
1462 | - if ( $im instanceof EE_messenger ) { |
|
1461 | + foreach ($installed['messengers'] as $im) { |
|
1462 | + if ($im instanceof EE_messenger) { |
|
1463 | 1463 | $installed_messengers[$im->name] = $im; |
1464 | 1464 | } |
1465 | 1465 | } |
1466 | - foreach( $installed['message_types'] as $imt ) { |
|
1467 | - if ( $imt instanceof EE_message_type ) { |
|
1466 | + foreach ($installed['message_types'] as $imt) { |
|
1467 | + if ($imt instanceof EE_message_type) { |
|
1468 | 1468 | $installed_mts[$imt->name] = $imt; |
1469 | 1469 | } |
1470 | 1470 | } |
1471 | 1471 | |
1472 | 1472 | //now let's loop through the active array and validate |
1473 | - foreach( $active_messengers as $messenger => $active_details ) { |
|
1473 | + foreach ($active_messengers as $messenger => $active_details) { |
|
1474 | 1474 | //first let's see if this messenger is installed. |
1475 | - if ( ! isset( $installed_messengers[$messenger] ) ) { |
|
1475 | + if ( ! isset($installed_messengers[$messenger])) { |
|
1476 | 1476 | //not set so let's just remove from actives and make sure templates are inactive. |
1477 | - unset( $active_messengers[$messenger] ); |
|
1478 | - EEH_MSG_Template::update_to_inactive( $messenger ); |
|
1477 | + unset($active_messengers[$messenger]); |
|
1478 | + EEH_MSG_Template::update_to_inactive($messenger); |
|
1479 | 1479 | continue; |
1480 | 1480 | } |
1481 | 1481 | |
1482 | 1482 | //messenger is active, so let's just make sure that any active message types not installed are deactivated. |
1483 | - $mts = ! empty( $active_details['settings'][$messenger . '-message_types'] ) ? $active_details['settings'][$messenger . '-message_types'] : array(); |
|
1484 | - foreach ( $mts as $mt_name => $mt ) { |
|
1485 | - if ( ! isset( $installed_mts[$mt_name] ) ) { |
|
1486 | - unset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt_name] ); |
|
1487 | - EEH_MSG_Template::update_to_inactive( $messenger, $mt_name ); |
|
1483 | + $mts = ! empty($active_details['settings'][$messenger.'-message_types']) ? $active_details['settings'][$messenger.'-message_types'] : array(); |
|
1484 | + foreach ($mts as $mt_name => $mt) { |
|
1485 | + if ( ! isset($installed_mts[$mt_name])) { |
|
1486 | + unset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt_name]); |
|
1487 | + EEH_MSG_Template::update_to_inactive($messenger, $mt_name); |
|
1488 | 1488 | } |
1489 | 1489 | } |
1490 | 1490 | } |
1491 | 1491 | |
1492 | 1492 | //all done! let's update the active_messengers. |
1493 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
1494 | - do_action( 'AHEE__EEH_Activation__validate_messages_system' ); |
|
1493 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
1494 | + do_action('AHEE__EEH_Activation__validate_messages_system'); |
|
1495 | 1495 | return; |
1496 | 1496 | } |
1497 | 1497 | |
@@ -1505,12 +1505,12 @@ discard block |
||
1505 | 1505 | * @static |
1506 | 1506 | * @return void |
1507 | 1507 | */ |
1508 | - public static function create_no_ticket_prices_array(){ |
|
1508 | + public static function create_no_ticket_prices_array() { |
|
1509 | 1509 | // this creates an array for tracking events that have no active ticket prices created |
1510 | 1510 | // this allows us to warn admins of the situation so that it can be corrected |
1511 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE ); |
|
1512 | - if ( ! $espresso_no_ticket_prices ) { |
|
1513 | - add_option( 'ee_no_ticket_prices', array(), '', FALSE ); |
|
1511 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE); |
|
1512 | + if ( ! $espresso_no_ticket_prices) { |
|
1513 | + add_option('ee_no_ticket_prices', array(), '', FALSE); |
|
1514 | 1514 | } |
1515 | 1515 | } |
1516 | 1516 | |
@@ -1532,24 +1532,24 @@ discard block |
||
1532 | 1532 | * Finds all our EE4 custom post types, and deletes them and their associated data (like post meta or term relations)/ |
1533 | 1533 | * @global wpdb $wpdb |
1534 | 1534 | */ |
1535 | - public static function delete_all_espresso_cpt_data(){ |
|
1535 | + public static function delete_all_espresso_cpt_data() { |
|
1536 | 1536 | global $wpdb; |
1537 | 1537 | //get all the CPT post_types |
1538 | 1538 | $ee_post_types = array(); |
1539 | - foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){ |
|
1540 | - if ( method_exists( $model_name, 'instance' )) { |
|
1541 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
1542 | - if ( $model_obj instanceof EEM_CPT_Base ) { |
|
1543 | - $ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type()); |
|
1539 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
1540 | + if (method_exists($model_name, 'instance')) { |
|
1541 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
1542 | + if ($model_obj instanceof EEM_CPT_Base) { |
|
1543 | + $ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type()); |
|
1544 | 1544 | } |
1545 | 1545 | } |
1546 | 1546 | } |
1547 | 1547 | //get all our CPTs |
1548 | - $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")"; |
|
1548 | + $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")"; |
|
1549 | 1549 | $cpt_ids = $wpdb->get_col($query); |
1550 | 1550 | //delete each post meta and term relations too |
1551 | - foreach($cpt_ids as $post_id){ |
|
1552 | - wp_delete_post($post_id,true); |
|
1551 | + foreach ($cpt_ids as $post_id) { |
|
1552 | + wp_delete_post($post_id, true); |
|
1553 | 1553 | } |
1554 | 1554 | } |
1555 | 1555 | |
@@ -1563,18 +1563,18 @@ discard block |
||
1563 | 1563 | * @param bool $remove_all |
1564 | 1564 | * @return void |
1565 | 1565 | */ |
1566 | - public static function delete_all_espresso_tables_and_data( $remove_all = true ) { |
|
1566 | + public static function delete_all_espresso_tables_and_data($remove_all = true) { |
|
1567 | 1567 | global $wpdb; |
1568 | 1568 | $undeleted_tables = array(); |
1569 | 1569 | |
1570 | 1570 | // load registry |
1571 | - foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){ |
|
1572 | - if ( method_exists( $model_name, 'instance' )) { |
|
1573 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
1574 | - if ( $model_obj instanceof EEM_Base ) { |
|
1575 | - foreach ( $model_obj->get_tables() as $table ) { |
|
1576 | - if ( strpos( $table->get_table_name(), 'esp_' )) { |
|
1577 | - switch ( EEH_Activation::delete_unused_db_table( $table->get_table_name() )) { |
|
1571 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
1572 | + if (method_exists($model_name, 'instance')) { |
|
1573 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
1574 | + if ($model_obj instanceof EEM_Base) { |
|
1575 | + foreach ($model_obj->get_tables() as $table) { |
|
1576 | + if (strpos($table->get_table_name(), 'esp_')) { |
|
1577 | + switch (EEH_Activation::delete_unused_db_table($table->get_table_name())) { |
|
1578 | 1578 | case false : |
1579 | 1579 | $undeleted_tables[] = $table->get_table_name(); |
1580 | 1580 | break; |
@@ -1599,8 +1599,8 @@ discard block |
||
1599 | 1599 | 'esp_promotion_rule', |
1600 | 1600 | 'esp_rule' |
1601 | 1601 | ); |
1602 | - foreach( $tables_without_models as $table ){ |
|
1603 | - EEH_Activation::delete_db_table_if_empty( $table ); |
|
1602 | + foreach ($tables_without_models as $table) { |
|
1603 | + EEH_Activation::delete_db_table_if_empty($table); |
|
1604 | 1604 | } |
1605 | 1605 | |
1606 | 1606 | |
@@ -1638,58 +1638,58 @@ discard block |
||
1638 | 1638 | 'ee_job_parameters_' => false, |
1639 | 1639 | 'ee_upload_directories_incomplete' => true, |
1640 | 1640 | ); |
1641 | - if( is_main_site() ) { |
|
1642 | - $wp_options_to_delete[ 'ee_network_config' ] = true; |
|
1641 | + if (is_main_site()) { |
|
1642 | + $wp_options_to_delete['ee_network_config'] = true; |
|
1643 | 1643 | } |
1644 | 1644 | |
1645 | 1645 | $undeleted_options = array(); |
1646 | - foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) { |
|
1646 | + foreach ($wp_options_to_delete as $option_name => $no_wildcard) { |
|
1647 | 1647 | |
1648 | - if( $no_wildcard ){ |
|
1649 | - if( ! delete_option( $option_name ) ){ |
|
1648 | + if ($no_wildcard) { |
|
1649 | + if ( ! delete_option($option_name)) { |
|
1650 | 1650 | $undeleted_options[] = $option_name; |
1651 | 1651 | } |
1652 | - }else{ |
|
1653 | - $option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" ); |
|
1654 | - foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){ |
|
1655 | - if( ! delete_option( $option_name_from_wildcard ) ){ |
|
1652 | + } else { |
|
1653 | + $option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'"); |
|
1654 | + foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) { |
|
1655 | + if ( ! delete_option($option_name_from_wildcard)) { |
|
1656 | 1656 | $undeleted_options[] = $option_name_from_wildcard; |
1657 | 1657 | } |
1658 | 1658 | } |
1659 | 1659 | } |
1660 | 1660 | } |
1661 | 1661 | //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
1662 | - remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1662 | + remove_action('shutdown', array(EE_Config::instance(), 'shutdown'), 10); |
|
1663 | 1663 | |
1664 | - if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) { |
|
1664 | + if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) { |
|
1665 | 1665 | $db_update_sans_ee4 = array(); |
1666 | - foreach($espresso_db_update as $version => $times_activated){ |
|
1667 | - if( $version[0] =='3'){//if its NON EE4 |
|
1666 | + foreach ($espresso_db_update as $version => $times_activated) { |
|
1667 | + if ($version[0] == '3') {//if its NON EE4 |
|
1668 | 1668 | $db_update_sans_ee4[$version] = $times_activated; |
1669 | 1669 | } |
1670 | 1670 | } |
1671 | - update_option( 'espresso_db_update', $db_update_sans_ee4 ); |
|
1671 | + update_option('espresso_db_update', $db_update_sans_ee4); |
|
1672 | 1672 | } |
1673 | 1673 | |
1674 | 1674 | $errors = ''; |
1675 | - if ( ! empty( $undeleted_tables )) { |
|
1675 | + if ( ! empty($undeleted_tables)) { |
|
1676 | 1676 | $errors .= sprintf( |
1677 | - __( 'The following tables could not be deleted: %s%s', 'event_espresso' ), |
|
1677 | + __('The following tables could not be deleted: %s%s', 'event_espresso'), |
|
1678 | 1678 | '<br/>', |
1679 | - implode( ',<br/>', $undeleted_tables ) |
|
1679 | + implode(',<br/>', $undeleted_tables) |
|
1680 | 1680 | ); |
1681 | 1681 | } |
1682 | - if ( ! empty( $undeleted_options )) { |
|
1683 | - $errors .= ! empty( $undeleted_tables ) ? '<br/>' : ''; |
|
1682 | + if ( ! empty($undeleted_options)) { |
|
1683 | + $errors .= ! empty($undeleted_tables) ? '<br/>' : ''; |
|
1684 | 1684 | $errors .= sprintf( |
1685 | - __( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ), |
|
1685 | + __('The following wp-options could not be deleted: %s%s', 'event_espresso'), |
|
1686 | 1686 | '<br/>', |
1687 | - implode( ',<br/>', $undeleted_options ) |
|
1687 | + implode(',<br/>', $undeleted_options) |
|
1688 | 1688 | ); |
1689 | 1689 | |
1690 | 1690 | } |
1691 | - if ( $errors != '' ) { |
|
1692 | - EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
1691 | + if ($errors != '') { |
|
1692 | + EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__); |
|
1693 | 1693 | } |
1694 | 1694 | } |
1695 | 1695 | |
@@ -1699,23 +1699,23 @@ discard block |
||
1699 | 1699 | * @param string $table_name with or without $wpdb->prefix |
1700 | 1700 | * @return boolean |
1701 | 1701 | */ |
1702 | - public static function table_exists( $table_name ){ |
|
1702 | + public static function table_exists($table_name) { |
|
1703 | 1703 | global $wpdb, $EZSQL_ERROR; |
1704 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
1704 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
1705 | 1705 | //ignore if this causes an sql error |
1706 | 1706 | $old_error = $wpdb->last_error; |
1707 | 1707 | $old_suppress_errors = $wpdb->suppress_errors(); |
1708 | - $old_show_errors_value = $wpdb->show_errors( FALSE ); |
|
1708 | + $old_show_errors_value = $wpdb->show_errors(FALSE); |
|
1709 | 1709 | $ezsql_error_cache = $EZSQL_ERROR; |
1710 | - $wpdb->get_results( "SELECT * from $table_name LIMIT 1"); |
|
1711 | - $wpdb->show_errors( $old_show_errors_value ); |
|
1712 | - $wpdb->suppress_errors( $old_suppress_errors ); |
|
1710 | + $wpdb->get_results("SELECT * from $table_name LIMIT 1"); |
|
1711 | + $wpdb->show_errors($old_show_errors_value); |
|
1712 | + $wpdb->suppress_errors($old_suppress_errors); |
|
1713 | 1713 | $new_error = $wpdb->last_error; |
1714 | 1714 | $wpdb->last_error = $old_error; |
1715 | 1715 | $EZSQL_ERROR = $ezsql_error_cache; |
1716 | - if( empty( $new_error ) ){ |
|
1716 | + if (empty($new_error)) { |
|
1717 | 1717 | return TRUE; |
1718 | - }else{ |
|
1718 | + } else { |
|
1719 | 1719 | return FALSE; |
1720 | 1720 | } |
1721 | 1721 | } |
@@ -1723,7 +1723,7 @@ discard block |
||
1723 | 1723 | /** |
1724 | 1724 | * Resets the cache on EEH_Activation |
1725 | 1725 | */ |
1726 | - public static function reset(){ |
|
1726 | + public static function reset() { |
|
1727 | 1727 | self::$_default_creator_id = NULL; |
1728 | 1728 | self::$_initialized_db_content_already_in_this_request = false; |
1729 | 1729 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | 0 => array( |
34 | 34 | 'content_id' => 'attendee-column-tip', |
35 | 35 | 'target' => '.column-attendees .dashicons-groups', |
36 | - 'content' => sprintf( __('%s Registrations', 'event_espresso'), EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') ), |
|
36 | + 'content' => sprintf(__('%s Registrations', 'event_espresso'), EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')), |
|
37 | 37 | 'options' => array( |
38 | 38 | 'position' => array( |
39 | 39 | 'my' => 'bottom left', |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param EE_Datetime constant $status What status is set (by class) |
125 | 125 | * @return string The status legend with the related status highlighted |
126 | 126 | */ |
127 | - private function _event_status_legend( $status ) { |
|
127 | + private function _event_status_legend($status) { |
|
128 | 128 | |
129 | 129 | $status_array = array( |
130 | 130 | 'active_status' => EE_Datetime::active, |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | 'inactive_status' => EE_Datetime::inactive |
137 | 137 | ); |
138 | 138 | |
139 | - return EEH_Template::status_legend( $status_array, $status ); |
|
139 | + return EEH_Template::status_legend($status_array, $status); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | } |
143 | 143 | \ No newline at end of file |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | |
94 | 94 | private function _registration_trash_message() { |
95 | - return '<p>' . __('This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', 'event_espresso') . '</p>'; |
|
95 | + return '<p>'.__('This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', 'event_espresso').'</p>'; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param EEM_Registration constant $status What status is set (by class) |
105 | 105 | * @return string The status legend with the related status highlighted |
106 | 106 | */ |
107 | - private function _registration_status_legend( $status ) { |
|
107 | + private function _registration_status_legend($status) { |
|
108 | 108 | |
109 | 109 | $status_array = array( |
110 | 110 | 'approved_status' => EEM_Registration::status_id_approved, |
@@ -114,6 +114,6 @@ discard block |
||
114 | 114 | 'cancelled_status' => EEM_Registration::status_id_cancelled |
115 | 115 | ); |
116 | 116 | |
117 | - return EEH_Template::status_legend( $status_array, $status ); |
|
117 | + return EEH_Template::status_legend($status_array, $status); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | \ No newline at end of file |