@@ -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 | * |
@@ -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> |
@@ -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 | } |
@@ -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 that $crons looks like: top-level keys are timestamps, |
187 | 187 | * and their values are arrays. |
188 | 188 | * The 2nd level arrays have keys with each of the cron task hooknames to run at that time |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | * ... |
201 | 201 | * ... |
202 | 202 | */ |
203 | - foreach( EEH_Activation::get_cron_tasks( $cron_tasks_to_remove ) as $hook_name => $frequency ) { |
|
204 | - foreach( $crons as $timestamp => $hooks_to_fire_at_time ) { |
|
205 | - if ( array_key_exists( $hook_name, $hooks_to_fire_at_time ) ) { |
|
206 | - unset( $crons[ $timestamp ][ $hook_name ] ); |
|
203 | + foreach (EEH_Activation::get_cron_tasks($cron_tasks_to_remove) as $hook_name => $frequency) { |
|
204 | + foreach ($crons as $timestamp => $hooks_to_fire_at_time) { |
|
205 | + if (array_key_exists($hook_name, $hooks_to_fire_at_time)) { |
|
206 | + unset($crons[$timestamp][$hook_name]); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | } |
210 | - _set_cron_array( $crons ); |
|
210 | + _set_cron_array($crons); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | */ |
223 | 223 | public static function CPT_initialization() { |
224 | 224 | // register Custom Post Types |
225 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
225 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
226 | 226 | flush_rewrite_rules(); |
227 | 227 | } |
228 | 228 | |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | * @return void |
241 | 241 | */ |
242 | 242 | public static function reset_and_update_config() { |
243 | - do_action( 'AHEE__EE_Config___load_core_config__start', array( 'EEH_Activation', 'load_calendar_config' ) ); |
|
244 | - add_filter( 'FHEE__EE_Config___load_core_config__config_settings', array( 'EEH_Activation', 'migrate_old_config_data' ), 10, 3 ); |
|
243 | + do_action('AHEE__EE_Config___load_core_config__start', array('EEH_Activation', 'load_calendar_config')); |
|
244 | + add_filter('FHEE__EE_Config___load_core_config__config_settings', array('EEH_Activation', 'migrate_old_config_data'), 10, 3); |
|
245 | 245 | //EE_Config::reset(); |
246 | 246 | } |
247 | 247 | |
@@ -254,23 +254,23 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public static function load_calendar_config() { |
256 | 256 | // grab array of all plugin folders and loop thru it |
257 | - $plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR ); |
|
258 | - if ( empty( $plugins ) ) { |
|
257 | + $plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR); |
|
258 | + if (empty($plugins)) { |
|
259 | 259 | return; |
260 | 260 | } |
261 | - foreach ( $plugins as $plugin_path ) { |
|
261 | + foreach ($plugins as $plugin_path) { |
|
262 | 262 | // grab plugin folder name from path |
263 | - $plugin = basename( $plugin_path ); |
|
263 | + $plugin = basename($plugin_path); |
|
264 | 264 | // drill down to Espresso plugins |
265 | - if ( strpos( $plugin, 'espresso' ) !== FALSE || strpos( $plugin, 'Espresso' ) !== FALSE || strpos( $plugin, 'ee4' ) !== FALSE || strpos( $plugin, 'EE4' ) !== FALSE ) { |
|
265 | + if (strpos($plugin, 'espresso') !== FALSE || strpos($plugin, 'Espresso') !== FALSE || strpos($plugin, 'ee4') !== FALSE || strpos($plugin, 'EE4') !== FALSE) { |
|
266 | 266 | // then to calendar related plugins |
267 | - if ( strpos( $plugin, 'calendar' ) !== FALSE ) { |
|
267 | + if (strpos($plugin, 'calendar') !== FALSE) { |
|
268 | 268 | // this is what we are looking for |
269 | - $calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php'; |
|
269 | + $calendar_config = $plugin_path.DS.'EE_Calendar_Config.php'; |
|
270 | 270 | // does it exist in this folder ? |
271 | - if ( is_readable( $calendar_config )) { |
|
271 | + if (is_readable($calendar_config)) { |
|
272 | 272 | // YEAH! let's load it |
273 | - require_once( $calendar_config ); |
|
273 | + require_once($calendar_config); |
|
274 | 274 | } |
275 | 275 | } |
276 | 276 | } |
@@ -287,21 +287,21 @@ discard block |
||
287 | 287 | * @param \EE_Config $EE_Config |
288 | 288 | * @return \stdClass |
289 | 289 | */ |
290 | - public static function migrate_old_config_data( $settings = array(), $config = '', EE_Config $EE_Config ) { |
|
291 | - $convert_from_array = array( 'addons' ); |
|
290 | + public static function migrate_old_config_data($settings = array(), $config = '', EE_Config $EE_Config) { |
|
291 | + $convert_from_array = array('addons'); |
|
292 | 292 | // in case old settings were saved as an array |
293 | - if ( is_array( $settings ) && in_array( $config, $convert_from_array )) { |
|
293 | + if (is_array($settings) && in_array($config, $convert_from_array)) { |
|
294 | 294 | // convert existing settings to an object |
295 | 295 | $config_array = $settings; |
296 | 296 | $settings = new stdClass(); |
297 | - foreach ( $config_array as $key => $value ){ |
|
298 | - if ( $key == 'calendar' && class_exists( 'EE_Calendar_Config' )) { |
|
299 | - $EE_Config->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value ); |
|
297 | + foreach ($config_array as $key => $value) { |
|
298 | + if ($key == 'calendar' && class_exists('EE_Calendar_Config')) { |
|
299 | + $EE_Config->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value); |
|
300 | 300 | } else { |
301 | 301 | $settings->$key = $value; |
302 | 302 | } |
303 | 303 | } |
304 | - add_filter( 'FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true' ); |
|
304 | + add_filter('FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true'); |
|
305 | 305 | } |
306 | 306 | return $settings; |
307 | 307 | } |
@@ -317,8 +317,8 @@ discard block |
||
317 | 317 | */ |
318 | 318 | public static function deactivate_event_espresso() { |
319 | 319 | // check permissions |
320 | - if ( current_user_can( 'activate_plugins' )) { |
|
321 | - deactivate_plugins( EE_PLUGIN_BASENAME, TRUE ); |
|
320 | + if (current_user_can('activate_plugins')) { |
|
321 | + deactivate_plugins(EE_PLUGIN_BASENAME, TRUE); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
@@ -340,79 +340,79 @@ discard block |
||
340 | 340 | $critical_pages = array( |
341 | 341 | array( |
342 | 342 | 'id' =>'reg_page_id', |
343 | - 'name' => __( 'Registration Checkout', 'event_espresso' ), |
|
343 | + 'name' => __('Registration Checkout', 'event_espresso'), |
|
344 | 344 | 'post' => NULL, |
345 | 345 | 'code' => 'ESPRESSO_CHECKOUT' |
346 | 346 | ), |
347 | 347 | array( |
348 | 348 | 'id' => 'txn_page_id', |
349 | - 'name' => __( 'Transactions', 'event_espresso' ), |
|
349 | + 'name' => __('Transactions', 'event_espresso'), |
|
350 | 350 | 'post' => NULL, |
351 | 351 | 'code' => 'ESPRESSO_TXN_PAGE' |
352 | 352 | ), |
353 | 353 | array( |
354 | 354 | 'id' => 'thank_you_page_id', |
355 | - 'name' => __( 'Thank You', 'event_espresso' ), |
|
355 | + 'name' => __('Thank You', 'event_espresso'), |
|
356 | 356 | 'post' => NULL, |
357 | 357 | 'code' => 'ESPRESSO_THANK_YOU' |
358 | 358 | ), |
359 | 359 | array( |
360 | 360 | 'id' => 'cancel_page_id', |
361 | - 'name' => __( 'Registration Cancelled', 'event_espresso' ), |
|
361 | + 'name' => __('Registration Cancelled', 'event_espresso'), |
|
362 | 362 | 'post' => NULL, |
363 | 363 | 'code' => 'ESPRESSO_CANCELLED' |
364 | 364 | ), |
365 | 365 | ); |
366 | 366 | |
367 | - foreach ( $critical_pages as $critical_page ) { |
|
367 | + foreach ($critical_pages as $critical_page) { |
|
368 | 368 | // is critical page ID set in config ? |
369 | - if ( EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE ) { |
|
369 | + if (EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE) { |
|
370 | 370 | // attempt to find post by ID |
371 | - $critical_page['post'] = get_post( EE_Registry::instance()->CFG->core->$critical_page['id'] ); |
|
371 | + $critical_page['post'] = get_post(EE_Registry::instance()->CFG->core->$critical_page['id']); |
|
372 | 372 | } |
373 | 373 | // no dice? |
374 | - if ( $critical_page['post'] == NULL ) { |
|
374 | + if ($critical_page['post'] == NULL) { |
|
375 | 375 | // attempt to find post by title |
376 | - $critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] ); |
|
376 | + $critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']); |
|
377 | 377 | // still nothing? |
378 | - if ( $critical_page['post'] == NULL ) { |
|
379 | - $critical_page = EEH_Activation::create_critical_page( $critical_page ); |
|
378 | + if ($critical_page['post'] == NULL) { |
|
379 | + $critical_page = EEH_Activation::create_critical_page($critical_page); |
|
380 | 380 | // REALLY? Still nothing ??!?!? |
381 | - if ( $critical_page['post'] == NULL ) { |
|
382 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
383 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
381 | + if ($critical_page['post'] == NULL) { |
|
382 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
383 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
384 | 384 | break; |
385 | 385 | } |
386 | 386 | } |
387 | 387 | } |
388 | 388 | // track post_shortcodes |
389 | - if ( $critical_page['post'] ) { |
|
390 | - EEH_Activation::_track_critical_page_post_shortcodes( $critical_page ); |
|
389 | + if ($critical_page['post']) { |
|
390 | + EEH_Activation::_track_critical_page_post_shortcodes($critical_page); |
|
391 | 391 | } |
392 | 392 | // check that Post ID matches critical page ID in config |
393 | - if ( isset( $critical_page['post']->ID ) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id'] ) { |
|
393 | + if (isset($critical_page['post']->ID) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id']) { |
|
394 | 394 | //update Config with post ID |
395 | 395 | EE_Registry::instance()->CFG->core->$critical_page['id'] = $critical_page['post']->ID; |
396 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) { |
|
397 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
398 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
396 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
397 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
398 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
399 | 399 | } |
400 | 400 | } |
401 | 401 | |
402 | - $critical_page_problem = ! isset( $critical_page['post']->post_status ) || $critical_page['post']->post_status != 'publish' || strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE ? TRUE : $critical_page_problem; |
|
402 | + $critical_page_problem = ! isset($critical_page['post']->post_status) || $critical_page['post']->post_status != 'publish' || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE ? TRUE : $critical_page_problem; |
|
403 | 403 | |
404 | 404 | } |
405 | 405 | |
406 | - if ( $critical_page_problem ) { |
|
406 | + if ($critical_page_problem) { |
|
407 | 407 | $msg = sprintf( |
408 | - __('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' ), |
|
409 | - '<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>' |
|
408 | + __('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'), |
|
409 | + '<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>' |
|
410 | 410 | ); |
411 | - EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg ); |
|
411 | + EE_Error::add_persistent_admin_notice('critical_page_problem', $msg); |
|
412 | 412 | } |
413 | 413 | |
414 | - if ( EE_Error::has_notices() ) { |
|
415 | - EE_Error::get_notices( FALSE, TRUE, TRUE ); |
|
414 | + if (EE_Error::has_notices()) { |
|
415 | + EE_Error::get_notices(FALSE, TRUE, TRUE); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | } |
@@ -425,13 +425,13 @@ discard block |
||
425 | 425 | * parameter to the shortcode |
426 | 426 | * @return WP_Post or NULl |
427 | 427 | */ |
428 | - public static function get_page_by_ee_shortcode($ee_shortcode){ |
|
428 | + public static function get_page_by_ee_shortcode($ee_shortcode) { |
|
429 | 429 | global $wpdb; |
430 | 430 | $shortcode_and_opening_bracket = '['.$ee_shortcode; |
431 | 431 | $post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1"); |
432 | - if($post_id){ |
|
432 | + if ($post_id) { |
|
433 | 433 | return get_post($post_id); |
434 | - }else{ |
|
434 | + } else { |
|
435 | 435 | return NULL; |
436 | 436 | } |
437 | 437 | |
@@ -448,32 +448,32 @@ discard block |
||
448 | 448 | * @param array $critical_page |
449 | 449 | * @return array |
450 | 450 | */ |
451 | - public static function create_critical_page( $critical_page ) { |
|
451 | + public static function create_critical_page($critical_page) { |
|
452 | 452 | |
453 | 453 | $post_args = array( |
454 | 454 | 'post_title' => $critical_page['name'], |
455 | 455 | 'post_status' => 'publish', |
456 | 456 | 'post_type' => 'page', |
457 | 457 | 'comment_status' => 'closed', |
458 | - 'post_content' => '[' . $critical_page['code'] . ']' |
|
458 | + 'post_content' => '['.$critical_page['code'].']' |
|
459 | 459 | ); |
460 | 460 | |
461 | - $post_id = wp_insert_post( $post_args ); |
|
462 | - if ( ! $post_id ) { |
|
461 | + $post_id = wp_insert_post($post_args); |
|
462 | + if ( ! $post_id) { |
|
463 | 463 | $msg = sprintf( |
464 | - __( 'The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso' ), |
|
464 | + __('The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso'), |
|
465 | 465 | $critical_page['name'] |
466 | 466 | ); |
467 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
467 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
468 | 468 | return $critical_page; |
469 | 469 | } |
470 | 470 | // get newly created post's details |
471 | - if ( ! $critical_page['post'] = get_post( $post_id )) { |
|
471 | + if ( ! $critical_page['post'] = get_post($post_id)) { |
|
472 | 472 | $msg = sprintf( |
473 | - __( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ), |
|
473 | + __('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'), |
|
474 | 474 | $critical_page['name'] |
475 | 475 | ); |
476 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
476 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | return $critical_page; |
@@ -492,34 +492,34 @@ discard block |
||
492 | 492 | * @param array $critical_page |
493 | 493 | * @return void |
494 | 494 | */ |
495 | - private static function _track_critical_page_post_shortcodes( $critical_page = array() ) { |
|
495 | + private static function _track_critical_page_post_shortcodes($critical_page = array()) { |
|
496 | 496 | // check the goods |
497 | - if ( ! $critical_page['post'] instanceof WP_Post ) { |
|
497 | + if ( ! $critical_page['post'] instanceof WP_Post) { |
|
498 | 498 | $msg = sprintf( |
499 | - __( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ), |
|
499 | + __('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'), |
|
500 | 500 | $critical_page['name'] |
501 | 501 | ); |
502 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
502 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
503 | 503 | return; |
504 | 504 | } |
505 | 505 | // map shortcode to post |
506 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID; |
|
506 | + EE_Registry::instance()->CFG->core->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID; |
|
507 | 507 | // and make sure it's NOT added to the WP "Posts Page" |
508 | 508 | // name of the WP Posts Page |
509 | 509 | $posts_page = EE_Registry::instance()->CFG->get_page_for_posts(); |
510 | - if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ] )) { |
|
511 | - unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ][ $critical_page['code'] ] ); |
|
510 | + if (isset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page])) { |
|
511 | + unset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page][$critical_page['code']]); |
|
512 | 512 | } |
513 | - if ( $posts_page != 'posts' && isset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'] )) { |
|
514 | - unset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'][ $critical_page['code'] ] ); |
|
513 | + if ($posts_page != 'posts' && isset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'])) { |
|
514 | + unset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'][$critical_page['code']]); |
|
515 | 515 | } |
516 | 516 | // update post_shortcode CFG |
517 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) { |
|
517 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
518 | 518 | $msg = sprintf( |
519 | - __( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ), |
|
519 | + __('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'), |
|
520 | 520 | $critical_page['name'] |
521 | 521 | ); |
522 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
522 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
523 | 523 | } |
524 | 524 | } |
525 | 525 | |
@@ -537,24 +537,24 @@ discard block |
||
537 | 537 | public static function get_default_creator_id() { |
538 | 538 | global $wpdb; |
539 | 539 | |
540 | - if ( ! empty( self::$_default_creator_id ) ) { |
|
540 | + if ( ! empty(self::$_default_creator_id)) { |
|
541 | 541 | return self::$_default_creator_id; |
542 | 542 | }/**/ |
543 | 543 | |
544 | - $role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' ); |
|
544 | + $role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator'); |
|
545 | 545 | |
546 | 546 | //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. |
547 | - $pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check ); |
|
548 | - if ( $pre_filtered_id !== false ) { |
|
547 | + $pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check); |
|
548 | + if ($pre_filtered_id !== false) { |
|
549 | 549 | return (int) $pre_filtered_id; |
550 | 550 | } |
551 | 551 | |
552 | - $capabilities_key = EEH_Activation::ensure_table_name_has_prefix( 'capabilities' ); |
|
553 | - $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 . '%' ); |
|
554 | - $user_id = $wpdb->get_var( $query ); |
|
555 | - $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id ); |
|
556 | - if ( $user_id && intval( $user_id ) ) { |
|
557 | - self::$_default_creator_id = intval( $user_id ); |
|
552 | + $capabilities_key = EEH_Activation::ensure_table_name_has_prefix('capabilities'); |
|
553 | + $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.'%'); |
|
554 | + $user_id = $wpdb->get_var($query); |
|
555 | + $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id); |
|
556 | + if ($user_id && intval($user_id)) { |
|
557 | + self::$_default_creator_id = intval($user_id); |
|
558 | 558 | return self::$_default_creator_id; |
559 | 559 | } else { |
560 | 560 | return NULL; |
@@ -581,29 +581,29 @@ discard block |
||
581 | 581 | * @return void |
582 | 582 | * @throws EE_Error if there are database errors |
583 | 583 | */ |
584 | - public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false ) { |
|
585 | - if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){ |
|
584 | + public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false) { |
|
585 | + if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) { |
|
586 | 586 | return; |
587 | 587 | } |
588 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
589 | - if ( ! function_exists( 'dbDelta' )) { |
|
590 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
588 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
589 | + if ( ! function_exists('dbDelta')) { |
|
590 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
591 | 591 | } |
592 | 592 | /** @var WPDB $wpdb */ |
593 | 593 | global $wpdb; |
594 | - $wp_table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
594 | + $wp_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
595 | 595 | // do we need to first delete an existing version of this table ? |
596 | - if ( $drop_pre_existing_table && EEH_Activation::table_exists( $wp_table_name ) ){ |
|
596 | + if ($drop_pre_existing_table && EEH_Activation::table_exists($wp_table_name)) { |
|
597 | 597 | // ok, delete the table... but ONLY if it's empty |
598 | - $deleted_safely = EEH_Activation::delete_db_table_if_empty( $wp_table_name ); |
|
598 | + $deleted_safely = EEH_Activation::delete_db_table_if_empty($wp_table_name); |
|
599 | 599 | // table is NOT empty, are you SURE you want to delete this table ??? |
600 | - if ( ! $deleted_safely && defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){ |
|
601 | - EEH_Activation::delete_unused_db_table( $wp_table_name ); |
|
602 | - } else if ( ! $deleted_safely ) { |
|
600 | + if ( ! $deleted_safely && defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) { |
|
601 | + EEH_Activation::delete_unused_db_table($wp_table_name); |
|
602 | + } else if ( ! $deleted_safely) { |
|
603 | 603 | // so we should be more cautious rather than just dropping tables so easily |
604 | 604 | EE_Error::add_persistent_admin_notice( |
605 | - 'bad_table_' . $wp_table_name . '_detected', |
|
606 | - 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' ), |
|
605 | + 'bad_table_'.$wp_table_name.'_detected', |
|
606 | + 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'), |
|
607 | 607 | $wp_table_name, |
608 | 608 | "<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>", |
609 | 609 | '<b>wp-config.php</b>', |
@@ -612,25 +612,25 @@ discard block |
||
612 | 612 | } |
613 | 613 | } |
614 | 614 | // does $sql contain valid column information? ( LPT: https://regex101.com/ is great for working out regex patterns ) |
615 | - if ( preg_match( '((((.*?))(,\s))+)', $sql, $valid_column_data ) ) { |
|
615 | + if (preg_match('((((.*?))(,\s))+)', $sql, $valid_column_data)) { |
|
616 | 616 | $SQL = "CREATE TABLE $wp_table_name ( $sql ) $engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"; |
617 | 617 | //get $wpdb to echo errors, but buffer them. This way at least WE know an error |
618 | 618 | //happened. And then we can choose to tell the end user |
619 | - $old_show_errors_policy = $wpdb->show_errors( TRUE ); |
|
620 | - $old_error_suppression_policy = $wpdb->suppress_errors( FALSE ); |
|
619 | + $old_show_errors_policy = $wpdb->show_errors(TRUE); |
|
620 | + $old_error_suppression_policy = $wpdb->suppress_errors(FALSE); |
|
621 | 621 | ob_start(); |
622 | - dbDelta( $SQL ); |
|
622 | + dbDelta($SQL); |
|
623 | 623 | $output = ob_get_contents(); |
624 | 624 | ob_end_clean(); |
625 | - $wpdb->show_errors( $old_show_errors_policy ); |
|
626 | - $wpdb->suppress_errors( $old_error_suppression_policy ); |
|
627 | - if( ! empty( $output ) ){ |
|
628 | - throw new EE_Error( $output ); |
|
625 | + $wpdb->show_errors($old_show_errors_policy); |
|
626 | + $wpdb->suppress_errors($old_error_suppression_policy); |
|
627 | + if ( ! empty($output)) { |
|
628 | + throw new EE_Error($output); |
|
629 | 629 | } |
630 | 630 | } else { |
631 | 631 | throw new EE_Error( |
632 | 632 | sprintf( |
633 | - __( 'The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso' ), |
|
633 | + __('The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso'), |
|
634 | 634 | '<br />', |
635 | 635 | $sql |
636 | 636 | ) |
@@ -652,15 +652,15 @@ discard block |
||
652 | 652 | * @param string $column_info if your SQL were 'ALTER TABLE table_name ADD price VARCHAR(10)', this would be 'VARCHAR(10)' |
653 | 653 | * @return bool|int |
654 | 654 | */ |
655 | - public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){ |
|
656 | - if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){ |
|
655 | + public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') { |
|
656 | + if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE)) { |
|
657 | 657 | return FALSE; |
658 | 658 | } |
659 | 659 | global $wpdb; |
660 | - $full_table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
660 | + $full_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
661 | 661 | $fields = self::get_fields_on_table($table_name); |
662 | - if (!in_array($column_name, $fields)){ |
|
663 | - $alter_query="ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
662 | + if ( ! in_array($column_name, $fields)) { |
|
663 | + $alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
664 | 664 | //echo "alter query:$alter_query"; |
665 | 665 | return $wpdb->query($alter_query); |
666 | 666 | } |
@@ -679,15 +679,15 @@ discard block |
||
679 | 679 | * @param string $table_name, without prefixed $wpdb->prefix |
680 | 680 | * @return array of database column names |
681 | 681 | */ |
682 | - public static function get_fields_on_table( $table_name = NULL ) { |
|
682 | + public static function get_fields_on_table($table_name = NULL) { |
|
683 | 683 | global $wpdb; |
684 | - $table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
685 | - if ( ! empty( $table_name )) { |
|
684 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
685 | + if ( ! empty($table_name)) { |
|
686 | 686 | $columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name "); |
687 | 687 | if ($columns !== FALSE) { |
688 | 688 | $field_array = array(); |
689 | - foreach($columns as $column ){ |
|
690 | - $field_array[] = $column->Field;; |
|
689 | + foreach ($columns as $column) { |
|
690 | + $field_array[] = $column->Field; ; |
|
691 | 691 | } |
692 | 692 | return $field_array; |
693 | 693 | } |
@@ -705,12 +705,12 @@ discard block |
||
705 | 705 | * @param string $table_name |
706 | 706 | * @return bool |
707 | 707 | */ |
708 | - public static function db_table_is_empty( $table_name ) { |
|
708 | + public static function db_table_is_empty($table_name) { |
|
709 | 709 | global $wpdb; |
710 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
711 | - if ( EEH_Activation::table_exists( $table_name ) ) { |
|
712 | - $count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" ); |
|
713 | - return absint( $count ) === 0 ? true : false; |
|
710 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
711 | + if (EEH_Activation::table_exists($table_name)) { |
|
712 | + $count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name"); |
|
713 | + return absint($count) === 0 ? true : false; |
|
714 | 714 | } |
715 | 715 | return false; |
716 | 716 | } |
@@ -725,9 +725,9 @@ discard block |
||
725 | 725 | * @param string $table_name |
726 | 726 | * @return bool | int |
727 | 727 | */ |
728 | - public static function delete_db_table_if_empty( $table_name ) { |
|
729 | - if ( EEH_Activation::db_table_is_empty( $table_name ) ) { |
|
730 | - return EEH_Activation::delete_unused_db_table( $table_name ); |
|
728 | + public static function delete_db_table_if_empty($table_name) { |
|
729 | + if (EEH_Activation::db_table_is_empty($table_name)) { |
|
730 | + return EEH_Activation::delete_unused_db_table($table_name); |
|
731 | 731 | } |
732 | 732 | return false; |
733 | 733 | } |
@@ -742,11 +742,11 @@ discard block |
||
742 | 742 | * @param string $table_name |
743 | 743 | * @return bool | int |
744 | 744 | */ |
745 | - public static function delete_unused_db_table( $table_name ) { |
|
745 | + public static function delete_unused_db_table($table_name) { |
|
746 | 746 | global $wpdb; |
747 | - if ( EEH_Activation::table_exists( $table_name ) ) { |
|
748 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
749 | - return $wpdb->query( "DROP TABLE IF EXISTS $table_name" ); |
|
747 | + if (EEH_Activation::table_exists($table_name)) { |
|
748 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
749 | + return $wpdb->query("DROP TABLE IF EXISTS $table_name"); |
|
750 | 750 | } |
751 | 751 | return false; |
752 | 752 | } |
@@ -762,18 +762,18 @@ discard block |
||
762 | 762 | * @param string $index_name |
763 | 763 | * @return bool | int |
764 | 764 | */ |
765 | - public static function drop_index( $table_name, $index_name ) { |
|
766 | - if( apply_filters( 'FHEE__EEH_Activation__drop_index__short_circuit', FALSE ) ){ |
|
765 | + public static function drop_index($table_name, $index_name) { |
|
766 | + if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', FALSE)) { |
|
767 | 767 | return FALSE; |
768 | 768 | } |
769 | 769 | global $wpdb; |
770 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
770 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
771 | 771 | $index_exists_query = "SHOW INDEX FROM $table_name WHERE Key_name = '$index_name'"; |
772 | 772 | if ( |
773 | - $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) == $table_name |
|
774 | - && $wpdb->get_var( $index_exists_query ) == $table_name //using get_var with the $index_exists_query returns the table's name |
|
773 | + $wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name |
|
774 | + && $wpdb->get_var($index_exists_query) == $table_name //using get_var with the $index_exists_query returns the table's name |
|
775 | 775 | ) { |
776 | - return $wpdb->query( "ALTER TABLE $table_name DROP INDEX $index_name" ); |
|
776 | + return $wpdb->query("ALTER TABLE $table_name DROP INDEX $index_name"); |
|
777 | 777 | } |
778 | 778 | return TRUE; |
779 | 779 | } |
@@ -789,27 +789,27 @@ discard block |
||
789 | 789 | * @return boolean success (whether database is setup properly or not) |
790 | 790 | */ |
791 | 791 | public static function create_database_tables() { |
792 | - EE_Registry::instance()->load_core( 'Data_Migration_Manager' ); |
|
792 | + EE_Registry::instance()->load_core('Data_Migration_Manager'); |
|
793 | 793 | //find the migration script that sets the database to be compatible with the code |
794 | 794 | $dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms(); |
795 | - if( $dms_name ){ |
|
796 | - $current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name ); |
|
797 | - $current_data_migration_script->set_migrating( false ); |
|
795 | + if ($dms_name) { |
|
796 | + $current_data_migration_script = EE_Registry::instance()->load_dms($dms_name); |
|
797 | + $current_data_migration_script->set_migrating(false); |
|
798 | 798 | $current_data_migration_script->schema_changes_before_migration(); |
799 | 799 | $current_data_migration_script->schema_changes_after_migration(); |
800 | - if( $current_data_migration_script->get_errors() ){ |
|
801 | - if( WP_DEBUG ){ |
|
802 | - foreach( $current_data_migration_script->get_errors() as $error ){ |
|
803 | - EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ ); |
|
800 | + if ($current_data_migration_script->get_errors()) { |
|
801 | + if (WP_DEBUG) { |
|
802 | + foreach ($current_data_migration_script->get_errors() as $error) { |
|
803 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
804 | 804 | } |
805 | - }else{ |
|
806 | - 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' ) ); |
|
805 | + } else { |
|
806 | + 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')); |
|
807 | 807 | } |
808 | 808 | return false; |
809 | 809 | } |
810 | 810 | EE_Data_Migration_Manager::instance()->update_current_database_state_to(); |
811 | - }else{ |
|
812 | - 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__); |
|
811 | + } else { |
|
812 | + 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__); |
|
813 | 813 | return false; |
814 | 814 | } |
815 | 815 | return true; |
@@ -829,27 +829,27 @@ discard block |
||
829 | 829 | public static function initialize_system_questions() { |
830 | 830 | // QUESTION GROUPS |
831 | 831 | global $wpdb; |
832 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group' ); |
|
832 | + $table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question_group'); |
|
833 | 833 | $SQL = "SELECT QSG_system FROM $table_name WHERE QSG_system != 0"; |
834 | 834 | // what we have |
835 | - $question_groups = $wpdb->get_col( $SQL ); |
|
835 | + $question_groups = $wpdb->get_col($SQL); |
|
836 | 836 | // check the response |
837 | - $question_groups = is_array( $question_groups ) ? $question_groups : array(); |
|
837 | + $question_groups = is_array($question_groups) ? $question_groups : array(); |
|
838 | 838 | // what we should have |
839 | - $QSG_systems = array( 1, 2 ); |
|
839 | + $QSG_systems = array(1, 2); |
|
840 | 840 | // loop thru what we should have and compare to what we have |
841 | - foreach ( $QSG_systems as $QSG_system ) { |
|
841 | + foreach ($QSG_systems as $QSG_system) { |
|
842 | 842 | // reset values array |
843 | 843 | $QSG_values = array(); |
844 | 844 | // 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) |
845 | - if ( ! in_array( "$QSG_system", $question_groups )) { |
|
845 | + if ( ! in_array("$QSG_system", $question_groups)) { |
|
846 | 846 | // add it |
847 | - switch ( $QSG_system ) { |
|
847 | + switch ($QSG_system) { |
|
848 | 848 | |
849 | 849 | case 1: |
850 | 850 | $QSG_values = array( |
851 | - 'QSG_name' => __( 'Personal Information', 'event_espresso' ), |
|
852 | - 'QSG_identifier' => 'personal-information-' . time(), |
|
851 | + 'QSG_name' => __('Personal Information', 'event_espresso'), |
|
852 | + 'QSG_identifier' => 'personal-information-'.time(), |
|
853 | 853 | 'QSG_desc' => '', |
854 | 854 | 'QSG_order' => 1, |
855 | 855 | 'QSG_show_group_name' => 1, |
@@ -861,8 +861,8 @@ discard block |
||
861 | 861 | |
862 | 862 | case 2: |
863 | 863 | $QSG_values = array( |
864 | - 'QSG_name' => __( 'Address Information','event_espresso' ), |
|
865 | - 'QSG_identifier' => 'address-information-' . time(), |
|
864 | + 'QSG_name' => __('Address Information', 'event_espresso'), |
|
865 | + 'QSG_identifier' => 'address-information-'.time(), |
|
866 | 866 | 'QSG_desc' => '', |
867 | 867 | 'QSG_order' => 2, |
868 | 868 | 'QSG_show_group_name' => 1, |
@@ -874,14 +874,14 @@ discard block |
||
874 | 874 | |
875 | 875 | } |
876 | 876 | // make sure we have some values before inserting them |
877 | - if ( ! empty( $QSG_values )) { |
|
877 | + if ( ! empty($QSG_values)) { |
|
878 | 878 | // insert system question |
879 | 879 | $wpdb->insert( |
880 | 880 | $table_name, |
881 | 881 | $QSG_values, |
882 | - array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' ) |
|
882 | + array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d') |
|
883 | 883 | ); |
884 | - $QSG_IDs[ $QSG_system ] = $wpdb->insert_id; |
|
884 | + $QSG_IDs[$QSG_system] = $wpdb->insert_id; |
|
885 | 885 | } |
886 | 886 | } |
887 | 887 | } |
@@ -890,10 +890,10 @@ discard block |
||
890 | 890 | |
891 | 891 | // QUESTIONS |
892 | 892 | global $wpdb; |
893 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question' ); |
|
893 | + $table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question'); |
|
894 | 894 | $SQL = "SELECT QST_system FROM $table_name WHERE QST_system != ''"; |
895 | 895 | // what we have |
896 | - $questions = $wpdb->get_col( $SQL ); |
|
896 | + $questions = $wpdb->get_col($SQL); |
|
897 | 897 | // what we should have |
898 | 898 | $QST_systems = array( |
899 | 899 | 'fname', |
@@ -910,22 +910,22 @@ discard block |
||
910 | 910 | $order_for_group_1 = 1; |
911 | 911 | $order_for_group_2 = 1; |
912 | 912 | // loop thru what we should have and compare to what we have |
913 | - foreach ( $QST_systems as $QST_system ) { |
|
913 | + foreach ($QST_systems as $QST_system) { |
|
914 | 914 | // reset values array |
915 | 915 | $QST_values = array(); |
916 | 916 | // if we don't have what we should have |
917 | - if ( ! in_array( $QST_system, $questions )) { |
|
917 | + if ( ! in_array($QST_system, $questions)) { |
|
918 | 918 | // add it |
919 | - switch ( $QST_system ) { |
|
919 | + switch ($QST_system) { |
|
920 | 920 | |
921 | 921 | case 'fname': |
922 | 922 | $QST_values = array( |
923 | - 'QST_display_text' => __( 'First Name', 'event_espresso' ), |
|
924 | - 'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ), |
|
923 | + 'QST_display_text' => __('First Name', 'event_espresso'), |
|
924 | + 'QST_admin_label' => __('First Name - System Question', 'event_espresso'), |
|
925 | 925 | 'QST_system' => 'fname', |
926 | 926 | 'QST_type' => 'TEXT', |
927 | 927 | 'QST_required' => 1, |
928 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
928 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
929 | 929 | 'QST_order' => 1, |
930 | 930 | 'QST_admin_only' => 0, |
931 | 931 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -935,12 +935,12 @@ discard block |
||
935 | 935 | |
936 | 936 | case 'lname': |
937 | 937 | $QST_values = array( |
938 | - 'QST_display_text' => __( 'Last Name', 'event_espresso' ), |
|
939 | - 'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ), |
|
938 | + 'QST_display_text' => __('Last Name', 'event_espresso'), |
|
939 | + 'QST_admin_label' => __('Last Name - System Question', 'event_espresso'), |
|
940 | 940 | 'QST_system' => 'lname', |
941 | 941 | 'QST_type' => 'TEXT', |
942 | 942 | 'QST_required' => 1, |
943 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
943 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
944 | 944 | 'QST_order' => 2, |
945 | 945 | 'QST_admin_only' => 0, |
946 | 946 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -950,12 +950,12 @@ discard block |
||
950 | 950 | |
951 | 951 | case 'email': |
952 | 952 | $QST_values = array( |
953 | - 'QST_display_text' => __( 'Email Address', 'event_espresso' ), |
|
954 | - 'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ), |
|
953 | + 'QST_display_text' => __('Email Address', 'event_espresso'), |
|
954 | + 'QST_admin_label' => __('Email Address - System Question', 'event_espresso'), |
|
955 | 955 | 'QST_system' => 'email', |
956 | 956 | 'QST_type' => 'TEXT', |
957 | 957 | 'QST_required' => 1, |
958 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
958 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
959 | 959 | 'QST_order' => 3, |
960 | 960 | 'QST_admin_only' => 0, |
961 | 961 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -965,12 +965,12 @@ discard block |
||
965 | 965 | |
966 | 966 | case 'address': |
967 | 967 | $QST_values = array( |
968 | - 'QST_display_text' => __( 'Address', 'event_espresso' ), |
|
969 | - 'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ), |
|
968 | + 'QST_display_text' => __('Address', 'event_espresso'), |
|
969 | + 'QST_admin_label' => __('Address - System Question', 'event_espresso'), |
|
970 | 970 | 'QST_system' => 'address', |
971 | 971 | 'QST_type' => 'TEXT', |
972 | 972 | 'QST_required' => 0, |
973 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
973 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
974 | 974 | 'QST_order' => 4, |
975 | 975 | 'QST_admin_only' => 0, |
976 | 976 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -980,12 +980,12 @@ discard block |
||
980 | 980 | |
981 | 981 | case 'address2': |
982 | 982 | $QST_values = array( |
983 | - 'QST_display_text' => __( 'Address2', 'event_espresso' ), |
|
984 | - 'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ), |
|
983 | + 'QST_display_text' => __('Address2', 'event_espresso'), |
|
984 | + 'QST_admin_label' => __('Address2 - System Question', 'event_espresso'), |
|
985 | 985 | 'QST_system' => 'address2', |
986 | 986 | 'QST_type' => 'TEXT', |
987 | 987 | 'QST_required' => 0, |
988 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
988 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
989 | 989 | 'QST_order' => 5, |
990 | 990 | 'QST_admin_only' => 0, |
991 | 991 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -995,12 +995,12 @@ discard block |
||
995 | 995 | |
996 | 996 | case 'city': |
997 | 997 | $QST_values = array( |
998 | - 'QST_display_text' => __( 'City', 'event_espresso' ), |
|
999 | - 'QST_admin_label' => __( 'City - System Question', 'event_espresso' ), |
|
998 | + 'QST_display_text' => __('City', 'event_espresso'), |
|
999 | + 'QST_admin_label' => __('City - System Question', 'event_espresso'), |
|
1000 | 1000 | 'QST_system' => 'city', |
1001 | 1001 | 'QST_type' => 'TEXT', |
1002 | 1002 | 'QST_required' => 0, |
1003 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1003 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1004 | 1004 | 'QST_order' => 6, |
1005 | 1005 | 'QST_admin_only' => 0, |
1006 | 1006 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1010,12 +1010,12 @@ discard block |
||
1010 | 1010 | |
1011 | 1011 | case 'state': |
1012 | 1012 | $QST_values = array( |
1013 | - 'QST_display_text' => __( 'State/Province', 'event_espresso' ), |
|
1014 | - 'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ), |
|
1013 | + 'QST_display_text' => __('State/Province', 'event_espresso'), |
|
1014 | + 'QST_admin_label' => __('State/Province - System Question', 'event_espresso'), |
|
1015 | 1015 | 'QST_system' => 'state', |
1016 | 1016 | 'QST_type' => 'STATE', |
1017 | 1017 | 'QST_required' => 0, |
1018 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1018 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1019 | 1019 | 'QST_order' => 7, |
1020 | 1020 | 'QST_admin_only' => 0, |
1021 | 1021 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1025,12 +1025,12 @@ discard block |
||
1025 | 1025 | |
1026 | 1026 | case 'country' : |
1027 | 1027 | $QST_values = array( |
1028 | - 'QST_display_text' => __( 'Country', 'event_espresso' ), |
|
1029 | - 'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ), |
|
1028 | + 'QST_display_text' => __('Country', 'event_espresso'), |
|
1029 | + 'QST_admin_label' => __('Country - System Question', 'event_espresso'), |
|
1030 | 1030 | 'QST_system' => 'country', |
1031 | 1031 | 'QST_type' => 'COUNTRY', |
1032 | 1032 | 'QST_required' => 0, |
1033 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1033 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1034 | 1034 | 'QST_order' => 8, |
1035 | 1035 | 'QST_admin_only' => 0, |
1036 | 1036 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1040,12 +1040,12 @@ discard block |
||
1040 | 1040 | |
1041 | 1041 | case 'zip': |
1042 | 1042 | $QST_values = array( |
1043 | - 'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ), |
|
1044 | - 'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ), |
|
1043 | + 'QST_display_text' => __('Zip/Postal Code', 'event_espresso'), |
|
1044 | + 'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'), |
|
1045 | 1045 | 'QST_system' => 'zip', |
1046 | 1046 | 'QST_type' => 'TEXT', |
1047 | 1047 | 'QST_required' => 0, |
1048 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1048 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1049 | 1049 | 'QST_order' => 9, |
1050 | 1050 | 'QST_admin_only' => 0, |
1051 | 1051 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1055,12 +1055,12 @@ discard block |
||
1055 | 1055 | |
1056 | 1056 | case 'phone': |
1057 | 1057 | $QST_values = array( |
1058 | - 'QST_display_text' => __( 'Phone Number', 'event_espresso' ), |
|
1059 | - 'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ), |
|
1058 | + 'QST_display_text' => __('Phone Number', 'event_espresso'), |
|
1059 | + 'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'), |
|
1060 | 1060 | 'QST_system' => 'phone', |
1061 | 1061 | 'QST_type' => 'TEXT', |
1062 | 1062 | 'QST_required' => 0, |
1063 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1063 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1064 | 1064 | 'QST_order' => 10, |
1065 | 1065 | 'QST_admin_only' => 0, |
1066 | 1066 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1069,34 +1069,34 @@ discard block |
||
1069 | 1069 | break; |
1070 | 1070 | |
1071 | 1071 | } |
1072 | - if ( ! empty( $QST_values )) { |
|
1072 | + if ( ! empty($QST_values)) { |
|
1073 | 1073 | // insert system question |
1074 | 1074 | $wpdb->insert( |
1075 | 1075 | $table_name, |
1076 | 1076 | $QST_values, |
1077 | - array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' ) |
|
1077 | + array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d') |
|
1078 | 1078 | ); |
1079 | 1079 | $QST_ID = $wpdb->insert_id; |
1080 | 1080 | |
1081 | 1081 | // QUESTION GROUP QUESTIONS |
1082 | - if( in_array( $QST_system, array( 'fname', 'lname', 'email' ) ) ) { |
|
1082 | + if (in_array($QST_system, array('fname', 'lname', 'email'))) { |
|
1083 | 1083 | $system_question_we_want = EEM_Question_Group::system_personal; |
1084 | 1084 | } else { |
1085 | 1085 | $system_question_we_want = EEM_Question_Group::system_address; |
1086 | 1086 | } |
1087 | - if( isset( $QSG_IDs[ $system_question_we_want ] ) ) { |
|
1088 | - $QSG_ID = $QSG_IDs[ $system_question_we_want ]; |
|
1087 | + if (isset($QSG_IDs[$system_question_we_want])) { |
|
1088 | + $QSG_ID = $QSG_IDs[$system_question_we_want]; |
|
1089 | 1089 | } else { |
1090 | - $id_col = EEM_Question_Group::instance()->get_col( array( array( 'QSG_system' => $system_question_we_want ) ) ); |
|
1091 | - if( is_array( $id_col ) ) { |
|
1092 | - $QSG_ID = reset( $id_col ); |
|
1090 | + $id_col = EEM_Question_Group::instance()->get_col(array(array('QSG_system' => $system_question_we_want))); |
|
1091 | + if (is_array($id_col)) { |
|
1092 | + $QSG_ID = reset($id_col); |
|
1093 | 1093 | } else { |
1094 | 1094 | //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 |
1095 | 1095 | EE_Log::instance()->log( |
1096 | 1096 | __FILE__, |
1097 | 1097 | __FUNCTION__, |
1098 | 1098 | sprintf( |
1099 | - __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1099 | + __('Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1100 | 1100 | $QST_ID ), |
1101 | 1101 | 'error' ); |
1102 | 1102 | continue; |
@@ -1105,9 +1105,9 @@ discard block |
||
1105 | 1105 | |
1106 | 1106 | // add system questions to groups |
1107 | 1107 | $wpdb->insert( |
1108 | - EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group_question' ), |
|
1109 | - array( 'QSG_ID' => $QSG_ID , 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID==1)? $order_for_group_1++ : $order_for_group_2++ ), |
|
1110 | - array( '%d', '%d','%d' ) |
|
1108 | + EEH_Activation::ensure_table_name_has_prefix('esp_question_group_question'), |
|
1109 | + array('QSG_ID' => $QSG_ID, 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID == 1) ? $order_for_group_1++ : $order_for_group_2++), |
|
1110 | + array('%d', '%d', '%d') |
|
1111 | 1111 | ); |
1112 | 1112 | } |
1113 | 1113 | } |
@@ -1119,11 +1119,11 @@ discard block |
||
1119 | 1119 | * Makes sure the default payment method (Invoice) is active. |
1120 | 1120 | * This used to be done automatically as part of constructing the old gateways config |
1121 | 1121 | */ |
1122 | - public static function insert_default_payment_methods(){ |
|
1123 | - if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){ |
|
1124 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
1125 | - EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
|
1126 | - }else{ |
|
1122 | + public static function insert_default_payment_methods() { |
|
1123 | + if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) { |
|
1124 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
1125 | + EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice'); |
|
1126 | + } else { |
|
1127 | 1127 | EEM_Payment_Method::instance()->verify_button_urls(); |
1128 | 1128 | } |
1129 | 1129 | } |
@@ -1139,7 +1139,7 @@ discard block |
||
1139 | 1139 | |
1140 | 1140 | global $wpdb; |
1141 | 1141 | |
1142 | - if ( EEH_Activation::table_exists( EEM_Status::instance()->table() ) ) { |
|
1142 | + if (EEH_Activation::table_exists(EEM_Status::instance()->table())) { |
|
1143 | 1143 | |
1144 | 1144 | $table_name = EEM_Status::instance()->table(); |
1145 | 1145 | |
@@ -1205,35 +1205,35 @@ discard block |
||
1205 | 1205 | * @return boolean success of verifying upload directories exist |
1206 | 1206 | */ |
1207 | 1207 | public static function create_upload_directories() { |
1208 | - EE_Registry::instance()->load_helper( 'File' ); |
|
1208 | + EE_Registry::instance()->load_helper('File'); |
|
1209 | 1209 | // Create the required folders |
1210 | 1210 | $folders = array( |
1211 | 1211 | EVENT_ESPRESSO_TEMPLATE_DIR, |
1212 | 1212 | EVENT_ESPRESSO_GATEWAY_DIR, |
1213 | - EVENT_ESPRESSO_UPLOAD_DIR . 'logs/', |
|
1214 | - EVENT_ESPRESSO_UPLOAD_DIR . 'css/', |
|
1215 | - EVENT_ESPRESSO_UPLOAD_DIR . 'tickets/' |
|
1213 | + EVENT_ESPRESSO_UPLOAD_DIR.'logs/', |
|
1214 | + EVENT_ESPRESSO_UPLOAD_DIR.'css/', |
|
1215 | + EVENT_ESPRESSO_UPLOAD_DIR.'tickets/' |
|
1216 | 1216 | ); |
1217 | - foreach ( $folders as $folder ) { |
|
1217 | + foreach ($folders as $folder) { |
|
1218 | 1218 | try { |
1219 | - EEH_File::ensure_folder_exists_and_is_writable( $folder ); |
|
1220 | - @ chmod( $folder, 0755 ); |
|
1221 | - } catch( EE_Error $e ){ |
|
1219 | + EEH_File::ensure_folder_exists_and_is_writable($folder); |
|
1220 | + @ chmod($folder, 0755); |
|
1221 | + } catch (EE_Error $e) { |
|
1222 | 1222 | EE_Error::add_error( |
1223 | 1223 | sprintf( |
1224 | - __( 'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ), |
|
1224 | + __('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'), |
|
1225 | 1225 | $folder, |
1226 | - '<br />' . $e->getMessage() |
|
1226 | + '<br />'.$e->getMessage() |
|
1227 | 1227 | ), |
1228 | 1228 | __FILE__, __FUNCTION__, __LINE__ |
1229 | 1229 | ); |
1230 | 1230 | //indicate we'll need to fix this later |
1231 | - update_option( EEH_Activation::upload_directories_incomplete_option_name, true ); |
|
1231 | + update_option(EEH_Activation::upload_directories_incomplete_option_name, true); |
|
1232 | 1232 | return FALSE; |
1233 | 1233 | } |
1234 | 1234 | } |
1235 | 1235 | //remember EE's folders are all good |
1236 | - delete_option( EEH_Activation::upload_directories_incomplete_option_name ); |
|
1236 | + delete_option(EEH_Activation::upload_directories_incomplete_option_name); |
|
1237 | 1237 | return TRUE; |
1238 | 1238 | } |
1239 | 1239 | |
@@ -1246,7 +1246,7 @@ discard block |
||
1246 | 1246 | * @return boolean |
1247 | 1247 | */ |
1248 | 1248 | public static function upload_directories_incomplete() { |
1249 | - return get_option( EEH_Activation::upload_directories_incomplete_option_name, false ); |
|
1249 | + return get_option(EEH_Activation::upload_directories_incomplete_option_name, false); |
|
1250 | 1250 | } |
1251 | 1251 | |
1252 | 1252 | |
@@ -1265,16 +1265,16 @@ discard block |
||
1265 | 1265 | $installed_messengers = $default_messengers = array(); |
1266 | 1266 | |
1267 | 1267 | //include our helper |
1268 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
1268 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
1269 | 1269 | |
1270 | 1270 | //get all installed messenger objects |
1271 | 1271 | $installed = EEH_MSG_Template::get_installed_message_objects(); |
1272 | 1272 | |
1273 | 1273 | //let's setup the $installed messengers in an array AND the messengers that are set to be activated on install. |
1274 | - foreach ( $installed['messengers'] as $msgr ) { |
|
1275 | - if ( $msgr instanceof EE_messenger ) { |
|
1274 | + foreach ($installed['messengers'] as $msgr) { |
|
1275 | + if ($msgr instanceof EE_messenger) { |
|
1276 | 1276 | $installed_messengers[$msgr->name] = $msgr; |
1277 | - if ( $msgr->activate_on_install ) { |
|
1277 | + if ($msgr->activate_on_install) { |
|
1278 | 1278 | $default_messengers[] = $msgr->name; |
1279 | 1279 | } |
1280 | 1280 | } |
@@ -1284,36 +1284,36 @@ discard block |
||
1284 | 1284 | $active_messengers = EEH_MSG_Template::get_active_messengers_in_db(); |
1285 | 1285 | |
1286 | 1286 | //things that have already been activated before |
1287 | - $has_activated = get_option( 'ee_has_activated_messenger' ); |
|
1287 | + $has_activated = get_option('ee_has_activated_messenger'); |
|
1288 | 1288 | |
1289 | 1289 | //do an initial loop to determine if we need to continue |
1290 | 1290 | $def_ms = array(); |
1291 | - foreach ( $default_messengers as $msgr ) { |
|
1292 | - if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue; |
|
1291 | + foreach ($default_messengers as $msgr) { |
|
1292 | + if (isset($active_messengers[$msgr]) || isset($has_activated[$msgr])) continue; |
|
1293 | 1293 | $def_ms[] = $msgr; |
1294 | 1294 | } |
1295 | 1295 | |
1296 | 1296 | //setup the $installed_mts in an array |
1297 | - foreach ( $installed['message_types'] as $imt ) { |
|
1298 | - if ( $imt instanceof EE_message_type ) { |
|
1297 | + foreach ($installed['message_types'] as $imt) { |
|
1298 | + if ($imt instanceof EE_message_type) { |
|
1299 | 1299 | $installed_mts[$imt->name] = $imt; |
1300 | 1300 | } |
1301 | 1301 | } |
1302 | 1302 | |
1303 | 1303 | //loop through default array for default messengers (if present) |
1304 | - if ( ! empty( $def_ms ) ) { |
|
1305 | - foreach ( $def_ms as $messenger ) { |
|
1304 | + if ( ! empty($def_ms)) { |
|
1305 | + foreach ($def_ms as $messenger) { |
|
1306 | 1306 | //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. |
1307 | - if ( ! isset( $installed_messengers[$messenger] )) { |
|
1307 | + if ( ! isset($installed_messengers[$messenger])) { |
|
1308 | 1308 | continue; |
1309 | 1309 | } |
1310 | 1310 | /** @var EE_messenger[] $installed_messengers */ |
1311 | 1311 | $default_mts = $installed_messengers[$messenger]->get_default_message_types(); |
1312 | 1312 | $active_messengers[$messenger]['obj'] = $installed_messengers[$messenger]; |
1313 | - foreach ( $default_mts as $index => $mt ) { |
|
1313 | + foreach ($default_mts as $index => $mt) { |
|
1314 | 1314 | //is there an installed_mt matching the default string? If not then nothing to do here. |
1315 | - if ( ! isset( $installed_mts[$mt] ) ) { |
|
1316 | - unset( $default_mts[$index] ); |
|
1315 | + if ( ! isset($installed_mts[$mt])) { |
|
1316 | + unset($default_mts[$index]); |
|
1317 | 1317 | continue; |
1318 | 1318 | } |
1319 | 1319 | |
@@ -1322,41 +1322,41 @@ discard block |
||
1322 | 1322 | /** @var EE_message_type[] $installed_mts */ |
1323 | 1323 | $settings_fields = $installed_mts[$mt]->get_admin_settings_fields(); |
1324 | 1324 | $settings = array(); |
1325 | - if ( is_array( $settings_fields ) ) { |
|
1326 | - foreach ( $settings_fields as $field => $values ) { |
|
1327 | - if ( isset( $values['default'] ) ) { |
|
1325 | + if (is_array($settings_fields)) { |
|
1326 | + foreach ($settings_fields as $field => $values) { |
|
1327 | + if (isset($values['default'])) { |
|
1328 | 1328 | $settings[$field] = $values['default']; |
1329 | 1329 | } |
1330 | 1330 | } |
1331 | 1331 | } |
1332 | 1332 | |
1333 | - $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings; |
|
1333 | + $active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings; |
|
1334 | 1334 | $has_activated[$messenger][] = $mt; |
1335 | 1335 | } |
1336 | 1336 | |
1337 | 1337 | //setup any initial settings for the messenger |
1338 | 1338 | $msgr_settings = $installed_messengers[$messenger]->get_admin_settings_fields(); |
1339 | 1339 | |
1340 | - if ( !empty( $msgr_settings ) ) { |
|
1341 | - foreach ( $msgr_settings as $field => $value ) { |
|
1340 | + if ( ! empty($msgr_settings)) { |
|
1341 | + foreach ($msgr_settings as $field => $value) { |
|
1342 | 1342 | $active_messengers[$messenger]['settings'][$field] = $value; |
1343 | 1343 | } |
1344 | 1344 | } |
1345 | 1345 | |
1346 | 1346 | //now let's save the settings for this messenger! Must do now because the validator checks the db for active messengers to validate. |
1347 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
1347 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
1348 | 1348 | |
1349 | 1349 | //let's generate all the templates but only if the messenger has default_mts (otherwise its just activated). |
1350 | - if ( !empty( $default_mts ) ) { |
|
1351 | - $success = EEH_MSG_Template::generate_new_templates( $messenger, $default_mts, '', TRUE ); |
|
1350 | + if ( ! empty($default_mts)) { |
|
1351 | + $success = EEH_MSG_Template::generate_new_templates($messenger, $default_mts, '', TRUE); |
|
1352 | 1352 | } |
1353 | 1353 | } |
1354 | 1354 | } //end check for empty( $def_ms ) |
1355 | 1355 | |
1356 | 1356 | //still need to see if there are any message types to activate for active messengers |
1357 | - foreach ( $active_messengers as $messenger => $settings ) { |
|
1357 | + foreach ($active_messengers as $messenger => $settings) { |
|
1358 | 1358 | $msg_obj = $settings['obj']; |
1359 | - if ( ! $msg_obj instanceof EE_messenger ) { |
|
1359 | + if ( ! $msg_obj instanceof EE_messenger) { |
|
1360 | 1360 | continue; |
1361 | 1361 | } |
1362 | 1362 | |
@@ -1364,45 +1364,45 @@ discard block |
||
1364 | 1364 | $new_default_mts = array(); |
1365 | 1365 | |
1366 | 1366 | //loop through each default mt reported by the messenger and make sure its set in its active db entry. |
1367 | - foreach( $all_default_mts as $index => $mt ) { |
|
1367 | + foreach ($all_default_mts as $index => $mt) { |
|
1368 | 1368 | //already active? already has generated templates? || has already been activated before (we dont' want to reactivate things users intentionally deactivated). |
1369 | - 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 ) ) { |
|
1369 | + 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)) { |
|
1370 | 1370 | continue; |
1371 | 1371 | } |
1372 | 1372 | |
1373 | 1373 | //is there an installed_mt matching the default string? If not then nothing to do here. |
1374 | - if ( ! isset( $installed_mts[$mt] ) ) { |
|
1375 | - unset( $all_default_mts[$mt] ); |
|
1374 | + if ( ! isset($installed_mts[$mt])) { |
|
1375 | + unset($all_default_mts[$mt]); |
|
1376 | 1376 | continue; |
1377 | 1377 | } |
1378 | 1378 | |
1379 | 1379 | $settings_fields = $installed_mts[$mt]->get_admin_settings_fields(); |
1380 | 1380 | $settings = array(); |
1381 | - if ( is_array( $settings_fields ) ) { |
|
1382 | - foreach ( $settings_fields as $field => $values ) { |
|
1383 | - if ( isset( $values['default'] ) ) { |
|
1381 | + if (is_array($settings_fields)) { |
|
1382 | + foreach ($settings_fields as $field => $values) { |
|
1383 | + if (isset($values['default'])) { |
|
1384 | 1384 | $settings[$field] = $values['default']; |
1385 | 1385 | } |
1386 | 1386 | } |
1387 | 1387 | } |
1388 | 1388 | |
1389 | - $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings; |
|
1389 | + $active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings; |
|
1390 | 1390 | $new_default_mts[] = $mt; |
1391 | 1391 | $has_activated[$messenger][] = $mt; |
1392 | 1392 | } |
1393 | 1393 | |
1394 | 1394 | |
1395 | - if ( ! empty( $new_default_mts ) ) { |
|
1396 | - $success = EEH_MSG_Template::generate_new_templates( $messenger, $new_default_mts, '', TRUE ); |
|
1395 | + if ( ! empty($new_default_mts)) { |
|
1396 | + $success = EEH_MSG_Template::generate_new_templates($messenger, $new_default_mts, '', TRUE); |
|
1397 | 1397 | } |
1398 | 1398 | |
1399 | 1399 | } |
1400 | 1400 | |
1401 | 1401 | //now let's save the settings for this messenger! |
1402 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
1402 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
1403 | 1403 | |
1404 | 1404 | //update $has_activated record |
1405 | - update_option( 'ee_has_activated_messenger', $has_activated ); |
|
1405 | + update_option('ee_has_activated_messenger', $has_activated); |
|
1406 | 1406 | |
1407 | 1407 | //that's it! |
1408 | 1408 | return $success; |
@@ -1422,47 +1422,47 @@ discard block |
||
1422 | 1422 | */ |
1423 | 1423 | public static function validate_messages_system() { |
1424 | 1424 | //include our helper |
1425 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
1425 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
1426 | 1426 | |
1427 | 1427 | //get active and installed messengers/message types. |
1428 | 1428 | $active_messengers = EEH_MSG_Template::get_active_messengers_in_db(); |
1429 | 1429 | $installed = EEH_MSG_Template::get_installed_message_objects(); |
1430 | 1430 | $installed_messengers = $installed_mts = array(); |
1431 | 1431 | //set up the arrays so they can be handled easier. |
1432 | - foreach( $installed['messengers'] as $im ) { |
|
1433 | - if ( $im instanceof EE_messenger ) { |
|
1432 | + foreach ($installed['messengers'] as $im) { |
|
1433 | + if ($im instanceof EE_messenger) { |
|
1434 | 1434 | $installed_messengers[$im->name] = $im; |
1435 | 1435 | } |
1436 | 1436 | } |
1437 | - foreach( $installed['message_types'] as $imt ) { |
|
1438 | - if ( $imt instanceof EE_message_type ) { |
|
1437 | + foreach ($installed['message_types'] as $imt) { |
|
1438 | + if ($imt instanceof EE_message_type) { |
|
1439 | 1439 | $installed_mts[$imt->name] = $imt; |
1440 | 1440 | } |
1441 | 1441 | } |
1442 | 1442 | |
1443 | 1443 | //now let's loop through the active array and validate |
1444 | - foreach( $active_messengers as $messenger => $active_details ) { |
|
1444 | + foreach ($active_messengers as $messenger => $active_details) { |
|
1445 | 1445 | //first let's see if this messenger is installed. |
1446 | - if ( ! isset( $installed_messengers[$messenger] ) ) { |
|
1446 | + if ( ! isset($installed_messengers[$messenger])) { |
|
1447 | 1447 | //not set so let's just remove from actives and make sure templates are inactive. |
1448 | - unset( $active_messengers[$messenger] ); |
|
1449 | - EEH_MSG_Template::update_to_inactive( $messenger ); |
|
1448 | + unset($active_messengers[$messenger]); |
|
1449 | + EEH_MSG_Template::update_to_inactive($messenger); |
|
1450 | 1450 | continue; |
1451 | 1451 | } |
1452 | 1452 | |
1453 | 1453 | //messenger is active, so let's just make sure that any active message types not installed are deactivated. |
1454 | - $mts = ! empty( $active_details['settings'][$messenger . '-message_types'] ) ? $active_details['settings'][$messenger . '-message_types'] : array(); |
|
1455 | - foreach ( $mts as $mt_name => $mt ) { |
|
1456 | - if ( ! isset( $installed_mts[$mt_name] ) ) { |
|
1457 | - unset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt_name] ); |
|
1458 | - EEH_MSG_Template::update_to_inactive( $messenger, $mt_name ); |
|
1454 | + $mts = ! empty($active_details['settings'][$messenger.'-message_types']) ? $active_details['settings'][$messenger.'-message_types'] : array(); |
|
1455 | + foreach ($mts as $mt_name => $mt) { |
|
1456 | + if ( ! isset($installed_mts[$mt_name])) { |
|
1457 | + unset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt_name]); |
|
1458 | + EEH_MSG_Template::update_to_inactive($messenger, $mt_name); |
|
1459 | 1459 | } |
1460 | 1460 | } |
1461 | 1461 | } |
1462 | 1462 | |
1463 | 1463 | //all done! let's update the active_messengers. |
1464 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
1465 | - do_action( 'AHEE__EEH_Activation__validate_messages_system' ); |
|
1464 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
1465 | + do_action('AHEE__EEH_Activation__validate_messages_system'); |
|
1466 | 1466 | return; |
1467 | 1467 | } |
1468 | 1468 | |
@@ -1476,12 +1476,12 @@ discard block |
||
1476 | 1476 | * @static |
1477 | 1477 | * @return void |
1478 | 1478 | */ |
1479 | - public static function create_no_ticket_prices_array(){ |
|
1479 | + public static function create_no_ticket_prices_array() { |
|
1480 | 1480 | // this creates an array for tracking events that have no active ticket prices created |
1481 | 1481 | // this allows us to warn admins of the situation so that it can be corrected |
1482 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE ); |
|
1483 | - if ( ! $espresso_no_ticket_prices ) { |
|
1484 | - add_option( 'ee_no_ticket_prices', array(), '', FALSE ); |
|
1482 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE); |
|
1483 | + if ( ! $espresso_no_ticket_prices) { |
|
1484 | + add_option('ee_no_ticket_prices', array(), '', FALSE); |
|
1485 | 1485 | } |
1486 | 1486 | } |
1487 | 1487 | |
@@ -1503,24 +1503,24 @@ discard block |
||
1503 | 1503 | * Finds all our EE4 custom post types, and deletes them and their associated data (like post meta or term relations)/ |
1504 | 1504 | * @global wpdb $wpdb |
1505 | 1505 | */ |
1506 | - public static function delete_all_espresso_cpt_data(){ |
|
1506 | + public static function delete_all_espresso_cpt_data() { |
|
1507 | 1507 | global $wpdb; |
1508 | 1508 | //get all the CPT post_types |
1509 | 1509 | $ee_post_types = array(); |
1510 | - foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){ |
|
1511 | - if ( method_exists( $model_name, 'instance' )) { |
|
1512 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
1513 | - if ( $model_obj instanceof EEM_CPT_Base ) { |
|
1514 | - $ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type()); |
|
1510 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
1511 | + if (method_exists($model_name, 'instance')) { |
|
1512 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
1513 | + if ($model_obj instanceof EEM_CPT_Base) { |
|
1514 | + $ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type()); |
|
1515 | 1515 | } |
1516 | 1516 | } |
1517 | 1517 | } |
1518 | 1518 | //get all our CPTs |
1519 | - $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")"; |
|
1519 | + $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")"; |
|
1520 | 1520 | $cpt_ids = $wpdb->get_col($query); |
1521 | 1521 | //delete each post meta and term relations too |
1522 | - foreach($cpt_ids as $post_id){ |
|
1523 | - wp_delete_post($post_id,true); |
|
1522 | + foreach ($cpt_ids as $post_id) { |
|
1523 | + wp_delete_post($post_id, true); |
|
1524 | 1524 | } |
1525 | 1525 | } |
1526 | 1526 | |
@@ -1534,18 +1534,18 @@ discard block |
||
1534 | 1534 | * @param bool $remove_all |
1535 | 1535 | * @return void |
1536 | 1536 | */ |
1537 | - public static function delete_all_espresso_tables_and_data( $remove_all = true ) { |
|
1537 | + public static function delete_all_espresso_tables_and_data($remove_all = true) { |
|
1538 | 1538 | global $wpdb; |
1539 | 1539 | $undeleted_tables = array(); |
1540 | 1540 | |
1541 | 1541 | // load registry |
1542 | - foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){ |
|
1543 | - if ( method_exists( $model_name, 'instance' )) { |
|
1544 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
1545 | - if ( $model_obj instanceof EEM_Base ) { |
|
1546 | - foreach ( $model_obj->get_tables() as $table ) { |
|
1547 | - if ( strpos( $table->get_table_name(), 'esp_' )) { |
|
1548 | - switch ( EEH_Activation::delete_unused_db_table( $table->get_table_name() )) { |
|
1542 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
1543 | + if (method_exists($model_name, 'instance')) { |
|
1544 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
1545 | + if ($model_obj instanceof EEM_Base) { |
|
1546 | + foreach ($model_obj->get_tables() as $table) { |
|
1547 | + if (strpos($table->get_table_name(), 'esp_')) { |
|
1548 | + switch (EEH_Activation::delete_unused_db_table($table->get_table_name())) { |
|
1549 | 1549 | case false : |
1550 | 1550 | $undeleted_tables[] = $table->get_table_name(); |
1551 | 1551 | break; |
@@ -1570,8 +1570,8 @@ discard block |
||
1570 | 1570 | 'esp_promotion_rule', |
1571 | 1571 | 'esp_rule' |
1572 | 1572 | ); |
1573 | - foreach( $tables_without_models as $table ){ |
|
1574 | - EEH_Activation::delete_db_table_if_empty( $table ); |
|
1573 | + foreach ($tables_without_models as $table) { |
|
1574 | + EEH_Activation::delete_db_table_if_empty($table); |
|
1575 | 1575 | } |
1576 | 1576 | |
1577 | 1577 | |
@@ -1608,58 +1608,58 @@ discard block |
||
1608 | 1608 | 'ee_pers_admin_notices' => true, |
1609 | 1609 | 'ee_upload_directories_incomplete' => true, |
1610 | 1610 | ); |
1611 | - if( is_main_site() ) { |
|
1612 | - $wp_options_to_delete[ 'ee_network_config' ] = true; |
|
1611 | + if (is_main_site()) { |
|
1612 | + $wp_options_to_delete['ee_network_config'] = true; |
|
1613 | 1613 | } |
1614 | 1614 | |
1615 | 1615 | $undeleted_options = array(); |
1616 | - foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) { |
|
1616 | + foreach ($wp_options_to_delete as $option_name => $no_wildcard) { |
|
1617 | 1617 | |
1618 | - if( $no_wildcard ){ |
|
1619 | - if( ! delete_option( $option_name ) ){ |
|
1618 | + if ($no_wildcard) { |
|
1619 | + if ( ! delete_option($option_name)) { |
|
1620 | 1620 | $undeleted_options[] = $option_name; |
1621 | 1621 | } |
1622 | - }else{ |
|
1623 | - $option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" ); |
|
1624 | - foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){ |
|
1625 | - if( ! delete_option( $option_name_from_wildcard ) ){ |
|
1622 | + } else { |
|
1623 | + $option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'"); |
|
1624 | + foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) { |
|
1625 | + if ( ! delete_option($option_name_from_wildcard)) { |
|
1626 | 1626 | $undeleted_options[] = $option_name_from_wildcard; |
1627 | 1627 | } |
1628 | 1628 | } |
1629 | 1629 | } |
1630 | 1630 | } |
1631 | 1631 | //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
1632 | - remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1632 | + remove_action('shutdown', array(EE_Config::instance(), 'shutdown'), 10); |
|
1633 | 1633 | |
1634 | - if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) { |
|
1634 | + if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) { |
|
1635 | 1635 | $db_update_sans_ee4 = array(); |
1636 | - foreach($espresso_db_update as $version => $times_activated){ |
|
1637 | - if( $version[0] =='3'){//if its NON EE4 |
|
1636 | + foreach ($espresso_db_update as $version => $times_activated) { |
|
1637 | + if ($version[0] == '3') {//if its NON EE4 |
|
1638 | 1638 | $db_update_sans_ee4[$version] = $times_activated; |
1639 | 1639 | } |
1640 | 1640 | } |
1641 | - update_option( 'espresso_db_update', $db_update_sans_ee4 ); |
|
1641 | + update_option('espresso_db_update', $db_update_sans_ee4); |
|
1642 | 1642 | } |
1643 | 1643 | |
1644 | 1644 | $errors = ''; |
1645 | - if ( ! empty( $undeleted_tables )) { |
|
1645 | + if ( ! empty($undeleted_tables)) { |
|
1646 | 1646 | $errors .= sprintf( |
1647 | - __( 'The following tables could not be deleted: %s%s', 'event_espresso' ), |
|
1647 | + __('The following tables could not be deleted: %s%s', 'event_espresso'), |
|
1648 | 1648 | '<br/>', |
1649 | - implode( ',<br/>', $undeleted_tables ) |
|
1649 | + implode(',<br/>', $undeleted_tables) |
|
1650 | 1650 | ); |
1651 | 1651 | } |
1652 | - if ( ! empty( $undeleted_options )) { |
|
1653 | - $errors .= ! empty( $undeleted_tables ) ? '<br/>' : ''; |
|
1652 | + if ( ! empty($undeleted_options)) { |
|
1653 | + $errors .= ! empty($undeleted_tables) ? '<br/>' : ''; |
|
1654 | 1654 | $errors .= sprintf( |
1655 | - __( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ), |
|
1655 | + __('The following wp-options could not be deleted: %s%s', 'event_espresso'), |
|
1656 | 1656 | '<br/>', |
1657 | - implode( ',<br/>', $undeleted_options ) |
|
1657 | + implode(',<br/>', $undeleted_options) |
|
1658 | 1658 | ); |
1659 | 1659 | |
1660 | 1660 | } |
1661 | - if ( $errors != '' ) { |
|
1662 | - EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
1661 | + if ($errors != '') { |
|
1662 | + EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__); |
|
1663 | 1663 | } |
1664 | 1664 | } |
1665 | 1665 | |
@@ -1669,23 +1669,23 @@ discard block |
||
1669 | 1669 | * @param string $table_name with or without $wpdb->prefix |
1670 | 1670 | * @return boolean |
1671 | 1671 | */ |
1672 | - public static function table_exists( $table_name ){ |
|
1672 | + public static function table_exists($table_name) { |
|
1673 | 1673 | global $wpdb, $EZSQL_ERROR; |
1674 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
1674 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
1675 | 1675 | //ignore if this causes an sql error |
1676 | 1676 | $old_error = $wpdb->last_error; |
1677 | 1677 | $old_suppress_errors = $wpdb->suppress_errors(); |
1678 | - $old_show_errors_value = $wpdb->show_errors( FALSE ); |
|
1678 | + $old_show_errors_value = $wpdb->show_errors(FALSE); |
|
1679 | 1679 | $ezsql_error_cache = $EZSQL_ERROR; |
1680 | - $wpdb->get_results( "SELECT * from $table_name LIMIT 1"); |
|
1681 | - $wpdb->show_errors( $old_show_errors_value ); |
|
1682 | - $wpdb->suppress_errors( $old_suppress_errors ); |
|
1680 | + $wpdb->get_results("SELECT * from $table_name LIMIT 1"); |
|
1681 | + $wpdb->show_errors($old_show_errors_value); |
|
1682 | + $wpdb->suppress_errors($old_suppress_errors); |
|
1683 | 1683 | $new_error = $wpdb->last_error; |
1684 | 1684 | $wpdb->last_error = $old_error; |
1685 | 1685 | $EZSQL_ERROR = $ezsql_error_cache; |
1686 | - if( empty( $new_error ) ){ |
|
1686 | + if (empty($new_error)) { |
|
1687 | 1687 | return TRUE; |
1688 | - }else{ |
|
1688 | + } else { |
|
1689 | 1689 | return FALSE; |
1690 | 1690 | } |
1691 | 1691 | } |
@@ -1693,7 +1693,7 @@ discard block |
||
1693 | 1693 | /** |
1694 | 1694 | * Resets the cache on EEH_Activation |
1695 | 1695 | */ |
1696 | - public static function reset(){ |
|
1696 | + public static function reset() { |
|
1697 | 1697 | self::$_default_creator_id = NULL; |
1698 | 1698 | self::$_initialized_db_content_already_in_this_request = false; |
1699 | 1699 | } |
@@ -1092,14 +1092,14 @@ discard block |
||
1092 | 1092 | $QSG_ID = reset( $id_col ); |
1093 | 1093 | } else { |
1094 | 1094 | //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 |
1095 | - EE_Log::instance()->log( |
|
1096 | - __FILE__, |
|
1097 | - __FUNCTION__, |
|
1098 | - sprintf( |
|
1099 | - __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1100 | - $QST_ID ), |
|
1101 | - 'error' ); |
|
1102 | - continue; |
|
1095 | + EE_Log::instance()->log( |
|
1096 | + __FILE__, |
|
1097 | + __FUNCTION__, |
|
1098 | + sprintf( |
|
1099 | + __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1100 | + $QST_ID ), |
|
1101 | + 'error' ); |
|
1102 | + continue; |
|
1103 | 1103 | } |
1104 | 1104 | } |
1105 | 1105 | |
@@ -1629,8 +1629,8 @@ discard block |
||
1629 | 1629 | } |
1630 | 1630 | } |
1631 | 1631 | } |
1632 | - //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
|
1633 | - remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1632 | + //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
|
1633 | + remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1634 | 1634 | |
1635 | 1635 | if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) { |
1636 | 1636 | $db_update_sans_ee4 = array(); |
@@ -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 |
@@ -7,7 +7,7 @@ |
||
7 | 7 | <li><strong><?php _e('Set a custom title for the event list', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS title="My Super Event List"]</li> |
8 | 8 | <li><strong><?php _e('Limit (paginate) the number of events that are shown in the event list on a page or post', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS limit="5"]</li> |
9 | 9 | <li><strong><?php _e('Add a custom CSS class to each event post/article', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS css_class="my-custom-class"]</li> |
10 | - <li><strong><?php _e('Filter the event list by month and year', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS month="<?php echo date( 'F Y' ); ?>"]</li> |
|
10 | + <li><strong><?php _e('Filter the event list by month and year', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS month="<?php echo date('F Y'); ?>"]</li> |
|
11 | 11 | <li><strong><?php _e('Show expired events in the event list', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS show_expired="true"]</li> |
12 | 12 | <li><strong><?php _e('Sorts the event list in ascending order', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS sort="ASC"]</li> |
13 | 13 | <li><strong><?php _e('Sorts the event list in descending order', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS sort="DESC"]</li> |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param EEM_Transaction constant $status What status is set (by class) |
84 | 84 | * @return string The status legend with the related status highlighted |
85 | 85 | */ |
86 | - private function _transaction_status_legend( $status ) { |
|
86 | + private function _transaction_status_legend($status) { |
|
87 | 87 | |
88 | 88 | $status_array = array( |
89 | 89 | 'overpaid' => EEM_Transaction::overpaid_status_code, |
@@ -92,6 +92,6 @@ discard block |
||
92 | 92 | 'failed' => EEM_Transaction::failed_status_code, |
93 | 93 | ); |
94 | 94 | |
95 | - return EEH_Template::status_legend( $status_array, $status ); |
|
95 | + return EEH_Template::status_legend($status_array, $status); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | \ No newline at end of file |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | /** |
204 | 204 | * column_REG_att_checked_in |
205 | - */ |
|
205 | + */ |
|
206 | 206 | function column__REG_att_checked_in(EE_Registration $item){ |
207 | 207 | $attendee = $item->attendee(); |
208 | 208 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | /** |
290 | 290 | * column_REG_final_price |
291 | - */ |
|
291 | + */ |
|
292 | 292 | function column__REG_final_price(EE_Registration $item){ |
293 | 293 | return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>'; |
294 | 294 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | |
300 | 300 | /** |
301 | 301 | * column_TXN_paid |
302 | - */ |
|
302 | + */ |
|
303 | 303 | function column_TXN_paid(EE_Registration $item){ |
304 | 304 | |
305 | 305 | if ( $item->count() == 1 ) { |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | |
327 | 327 | /** |
328 | 328 | * column_TXN_total |
329 | - */ |
|
329 | + */ |
|
330 | 330 | function column_TXN_total(EE_Registration $item){ |
331 | 331 | $txn = $item->transaction(); |
332 | 332 | $view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL ); |
@@ -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 | |
4 | 6 | class EE_Event_Registrations_List_Table extends EE_Admin_List_Table { |
@@ -126,8 +128,9 @@ discard block |
||
126 | 128 | $evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') ); |
127 | 129 | foreach ( $events as $evt ) { |
128 | 130 | //any registrations for this event? |
129 | - if ( ! $evt->get_count_of_all_registrations() ) |
|
130 | - continue; |
|
131 | + if ( ! $evt->get_count_of_all_registrations() ) { |
|
132 | + continue; |
|
133 | + } |
|
131 | 134 | $evts[] = array( 'id' => $evt->ID(), 'text' => $evt->get('EVT_name') ); |
132 | 135 | } |
133 | 136 | $filters[] = EEH_Form_Fields::select_input( 'event_id', $evts ); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | |
18 | 18 | |
19 | - public function __construct( $admin_page ) { |
|
19 | + public function __construct($admin_page) { |
|
20 | 20 | parent::__construct($admin_page); |
21 | 21 | $this->_status = $this->_admin_page->get_registration_status_array(); |
22 | 22 | } |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | |
26 | 26 | |
27 | 27 | protected function _setup_data() { |
28 | - $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page ) : $this->_admin_page->get_event_attendees( $this->_per_page, FALSE, TRUE ); |
|
29 | - $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page, TRUE ) : $this->_admin_page->get_event_attendees( $this->_per_page, TRUE, TRUE); |
|
28 | + $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) : $this->_admin_page->get_event_attendees($this->_per_page, FALSE, TRUE); |
|
29 | + $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page, TRUE) : $this->_admin_page->get_event_attendees($this->_per_page, TRUE, TRUE); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | 35 | protected function _set_properties() { |
36 | - $evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL; |
|
36 | + $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL; |
|
37 | 37 | |
38 | 38 | $this->_wp_list_args = array( |
39 | 39 | 'singular' => __('registrant', 'event_espresso'), |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | $columns = array(); |
46 | 46 | //$columns['_Reg_Status'] = ''; |
47 | - if ( !empty( $evt_id ) ) { |
|
47 | + if ( ! empty($evt_id)) { |
|
48 | 48 | $columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text |
49 | 49 | $this->_has_checkbox_column = true; |
50 | 50 | } |
@@ -60,40 +60,40 @@ discard block |
||
60 | 60 | 'TXN_total' => __('Total', 'event_espresso') |
61 | 61 | ); |
62 | 62 | |
63 | - $this->_columns = array_merge( $columns, $this->_columns); |
|
63 | + $this->_columns = array_merge($columns, $this->_columns); |
|
64 | 64 | |
65 | 65 | $this->_primary_column = '_REG_att_checked_in'; |
66 | 66 | |
67 | - if ( !empty( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id ) ) { |
|
67 | + if ( ! empty($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id)) { |
|
68 | 68 | $this->_bottom_buttons = array( |
69 | 69 | 'report'=> array( |
70 | 70 | 'route' => 'registrations_report', |
71 | - 'extra_request' => !empty($evt_id) ? array('EVT_ID'=>$evt_id) : NULL |
|
71 | + 'extra_request' => ! empty($evt_id) ? array('EVT_ID'=>$evt_id) : NULL |
|
72 | 72 | ) |
73 | 73 | ); |
74 | 74 | } |
75 | 75 | |
76 | 76 | $this->_sortable_columns = array( |
77 | 77 | //true means its already sorted |
78 | - 'ATT_name' => array( 'ATT_name' => TRUE ), |
|
79 | - 'Event' => array( 'Event.EVT.Name' => FALSE ) |
|
78 | + 'ATT_name' => array('ATT_name' => TRUE), |
|
79 | + 'Event' => array('Event.EVT.Name' => FALSE) |
|
80 | 80 | ); |
81 | 81 | |
82 | 82 | $this->_hidden_columns = array(); |
83 | 83 | |
84 | 84 | $this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id); |
85 | - $this->_dtts_for_event = !empty($evt_id) ? $this->_evt->datetimes_ordered() : array(); |
|
85 | + $this->_dtts_for_event = ! empty($evt_id) ? $this->_evt->datetimes_ordered() : array(); |
|
86 | 86 | |
87 | 87 | } |
88 | 88 | |
89 | 89 | |
90 | 90 | |
91 | 91 | |
92 | - protected function _get_row_class( $item ) { |
|
93 | - $class = parent::_get_row_class( $item ); |
|
92 | + protected function _get_row_class($item) { |
|
93 | + $class = parent::_get_row_class($item); |
|
94 | 94 | //add status class |
95 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
96 | - if ( $this->_has_checkbox_column ) { |
|
95 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
96 | + if ($this->_has_checkbox_column) { |
|
97 | 97 | $class .= ' has-checkbox-column'; |
98 | 98 | } |
99 | 99 | return $class; |
@@ -104,44 +104,44 @@ discard block |
||
104 | 104 | protected function _get_table_filters() { |
105 | 105 | $filters = $where = array(); |
106 | 106 | |
107 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
107 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
108 | 108 | |
109 | - if ( empty( $this->_dtts_for_event ) ) { |
|
109 | + if (empty($this->_dtts_for_event)) { |
|
110 | 110 | //this means we don't have an event so let's setup a filter dropdown for all the events to select |
111 | 111 | //note possible capability restrictions |
112 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events') ) { |
|
113 | - $where['status**'] = array( '!=', 'private' ); |
|
112 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
113 | + $where['status**'] = array('!=', 'private'); |
|
114 | 114 | } |
115 | 115 | |
116 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
117 | - $where['EVT_wp_user'] = get_current_user_id(); |
|
116 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
117 | + $where['EVT_wp_user'] = get_current_user_id(); |
|
118 | 118 | } |
119 | 119 | |
120 | - $events = EEM_Event::instance()->get_all(array( $where, 'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ) ) ); |
|
121 | - $evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') ); |
|
122 | - foreach ( $events as $evt ) { |
|
120 | + $events = EEM_Event::instance()->get_all(array($where, 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'))); |
|
121 | + $evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso')); |
|
122 | + foreach ($events as $evt) { |
|
123 | 123 | //any registrations for this event? |
124 | - if ( ! $evt->get_count_of_all_registrations() ) |
|
124 | + if ( ! $evt->get_count_of_all_registrations()) |
|
125 | 125 | continue; |
126 | 126 | $evts[] = array( |
127 | 127 | 'id' => $evt->ID(), |
128 | - 'text' => $evt->get( 'EVT_name' ), |
|
128 | + 'text' => $evt->get('EVT_name'), |
|
129 | 129 | 'class' => $evt->is_expired() ? 'ee-expired-event' : '' |
130 | 130 | ); |
131 | 131 | } |
132 | 132 | $event_filter = '<div class="ee-event-filter">'; |
133 | - $event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts ); |
|
134 | - $event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>' . ' ' . __( 'Hide Expired Events', 'event_espresso' ) . '</span>'; |
|
133 | + $event_filter .= EEH_Form_Fields::select_input('event_id', $evts); |
|
134 | + $event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>'.' '.__('Hide Expired Events', 'event_espresso').'</span>'; |
|
135 | 135 | $event_filter .= '</div>'; |
136 | 136 | $filters[] = $event_filter; |
137 | 137 | |
138 | 138 | } else { |
139 | 139 | //DTT datetimes filter |
140 | - $cur_dtt = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID(); |
|
140 | + $cur_dtt = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID(); |
|
141 | 141 | $dtts = array(); |
142 | - foreach ( $this->_dtts_for_event as $dtt ) { |
|
143 | - $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time(); |
|
144 | - $dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string ); |
|
142 | + foreach ($this->_dtts_for_event as $dtt) { |
|
143 | + $datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time(); |
|
144 | + $dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string); |
|
145 | 145 | } |
146 | 146 | $filters[] = EEH_Form_Fields::select_input('DTT_ID', $dtts, $cur_dtt); |
147 | 147 | } |
@@ -162,19 +162,19 @@ discard block |
||
162 | 162 | |
163 | 163 | |
164 | 164 | protected function _get_total_event_attendees() { |
165 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
166 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
165 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
166 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
167 | 167 | $query_params = array(); |
168 | - if ($EVT_ID){ |
|
169 | - $query_params[0]['EVT_ID']=$EVT_ID; |
|
168 | + if ($EVT_ID) { |
|
169 | + $query_params[0]['EVT_ID'] = $EVT_ID; |
|
170 | 170 | } |
171 | 171 | //if DTT is included we do multiple datetimes. Otherwise we just do primary datetime |
172 | - if ( $DTT_ID ) { |
|
172 | + if ($DTT_ID) { |
|
173 | 173 | $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
174 | 174 | } |
175 | - $status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) ); |
|
175 | + $status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)); |
|
176 | 176 | |
177 | - $query_params[0]['STS_ID']= array('IN', $status_ids_array ); |
|
177 | + $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
178 | 178 | |
179 | 179 | return EEM_Registration::instance()->count($query_params); |
180 | 180 | } |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | |
186 | 186 | |
187 | 187 | |
188 | - function column__Reg_Status( EE_Registration $item ) { |
|
189 | - return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>'; |
|
188 | + function column__Reg_Status(EE_Registration $item) { |
|
189 | + return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>'; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | |
195 | 195 | |
196 | 196 | function column_cb($item) { |
197 | - return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() ); |
|
197 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID()); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -207,18 +207,18 @@ discard block |
||
207 | 207 | /** |
208 | 208 | * column_REG_att_checked_in |
209 | 209 | */ |
210 | - function column__REG_att_checked_in(EE_Registration $item){ |
|
210 | + function column__REG_att_checked_in(EE_Registration $item) { |
|
211 | 211 | $attendee = $item->attendee(); |
212 | 212 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
213 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0; |
|
213 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0; |
|
214 | 214 | $checkinstatus = $item->check_in_status_for_datetime($DTT_ID); |
215 | 215 | $nonce = wp_create_nonce('checkin_nonce'); |
216 | - $evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL; |
|
217 | - $toggle_active = !empty ( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID() ) ? ' clickable trigger-checkin' : ''; |
|
216 | + $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL; |
|
217 | + $toggle_active = ! empty ($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID()) ? ' clickable trigger-checkin' : ''; |
|
218 | 218 | |
219 | - $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>'; |
|
219 | + $mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>'; |
|
220 | 220 | |
221 | - return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '" data-_regid="' . $item->ID() . '" data-dttid="' . $DTT_ID . '" data-nonce="' . $nonce . '"></span>' . $mobile_view_content; |
|
221 | + return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'" data-_regid="'.$item->ID().'" data-dttid="'.$DTT_ID.'" data-nonce="'.$nonce.'"></span>'.$mobile_view_content; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -227,43 +227,43 @@ discard block |
||
227 | 227 | |
228 | 228 | function column_ATT_name(EE_Registration $item) { |
229 | 229 | $attendee = $item->attendee(); |
230 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
230 | + if ( ! $attendee instanceof EE_Attendee) { |
|
231 | 231 | return __('No contact record for this registration.', 'event_espresso'); |
232 | 232 | } |
233 | 233 | |
234 | 234 | // edit attendee link |
235 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
236 | - $name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_contacts', 'espresso_registrations_edit_attendee' ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">' . $item->attendee()->full_name() . '</a>' : $item->attendee()->full_name(); |
|
235 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
236 | + $name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact', 'event_espresso').'">'.$item->attendee()->full_name().'</a>' : $item->attendee()->full_name(); |
|
237 | 237 | $name_link .= $item->count() == 1 ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup> ' : ''; |
238 | 238 | |
239 | 239 | //add group details |
240 | - $name_link .= ' ' . sprintf(__( '(%s of %s)', 'event_espresso' ),$item->count(), $item->group_size()); |
|
240 | + $name_link .= ' '.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
241 | 241 | |
242 | 242 | //add regcode |
243 | - $link = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), REG_ADMIN_URL ); |
|
243 | + $link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $item->ID()), REG_ADMIN_URL); |
|
244 | 244 | $name_link .= '<br>'; |
245 | - $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID() ) |
|
246 | - ? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') .'">' . $item->reg_code() . '</a>' |
|
245 | + $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID()) |
|
246 | + ? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$item->reg_code().'</a>' |
|
247 | 247 | : $item->reg_code(); |
248 | 248 | |
249 | 249 | //status |
250 | - $name_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
250 | + $name_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
251 | 251 | |
252 | 252 | $actions = array(); |
253 | - $DTT_ID = !empty( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
254 | - $DTT_ID = empty( $DTT_ID ) && !empty( $this->_req_data['event_id'] ) ? EEM_Event::instance()->get_one_by_ID( $this->_req_data['event_id'] )->primary_datetime()->ID() : $DTT_ID; |
|
253 | + $DTT_ID = ! empty($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
254 | + $DTT_ID = empty($DTT_ID) && ! empty($this->_req_data['event_id']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['event_id'])->primary_datetime()->ID() : $DTT_ID; |
|
255 | 255 | |
256 | - if ( !empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ) { |
|
257 | - $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID)); |
|
258 | - $actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso' ) . '">' . __('View', 'event_espresso') . '</a>'; |
|
256 | + if ( ! empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins')) { |
|
257 | + $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID)); |
|
258 | + $actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso').'">'.__('View', 'event_espresso').'</a>'; |
|
259 | 259 | } |
260 | 260 | |
261 | - return !empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions($actions) ) : $name_link; |
|
261 | + return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link; |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
265 | 265 | |
266 | - function column_ATT_email( EE_Registration $item ) { |
|
266 | + function column_ATT_email(EE_Registration $item) { |
|
267 | 267 | $attendee = $item->attendee(); |
268 | 268 | return $attendee instanceof EE_Attendee ? $attendee->email() : ''; |
269 | 269 | return $item->get_first_related('Attendee')->email(); |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | |
276 | 276 | function column_Event(EE_Registration $item) { |
277 | 277 | $event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event(); |
278 | - $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$event->ID() ), REG_ADMIN_URL ); |
|
279 | - $event_label = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ? '<a href="'.$chkin_lnk_url.'" title="' . esc_attr__( 'View Checkins for this Event', 'event_espresso' ) . '">' . $event->name() . '</a>' : $event->name(); |
|
278 | + $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$event->ID()), REG_ADMIN_URL); |
|
279 | + $event_label = EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins') ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__('View Checkins for this Event', 'event_espresso').'">'.$event->name().'</a>' : $event->name(); |
|
280 | 280 | return $event_label; |
281 | 281 | } |
282 | 282 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | |
286 | 286 | |
287 | - function column_PRC_name(EE_Registration $item){ |
|
287 | + function column_PRC_name(EE_Registration $item) { |
|
288 | 288 | return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso"); |
289 | 289 | } |
290 | 290 | |
@@ -296,8 +296,8 @@ discard block |
||
296 | 296 | /** |
297 | 297 | * column_REG_final_price |
298 | 298 | */ |
299 | - function column__REG_final_price(EE_Registration $item){ |
|
300 | - return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>'; |
|
299 | + function column__REG_final_price(EE_Registration $item) { |
|
300 | + return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>'; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | |
@@ -307,20 +307,20 @@ discard block |
||
307 | 307 | /** |
308 | 308 | * column_TXN_paid |
309 | 309 | */ |
310 | - function column_TXN_paid(EE_Registration $item){ |
|
310 | + function column_TXN_paid(EE_Registration $item) { |
|
311 | 311 | |
312 | - if ( $item->count() == 1 ) { |
|
312 | + if ($item->count() == 1) { |
|
313 | 313 | |
314 | - if ( $item->transaction()->paid() >= $item->transaction()->total() ) { |
|
314 | + if ($item->transaction()->paid() >= $item->transaction()->total()) { |
|
315 | 315 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
316 | 316 | } else { |
317 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
318 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? ' |
|
317 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
318 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? ' |
|
319 | 319 | <span class="reg-pad-rght"> |
320 | - <a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '"> |
|
321 | - ' . $item->transaction()->pretty_paid(). ' |
|
320 | + <a class="status-'. $item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"> |
|
321 | + ' . $item->transaction()->pretty_paid().' |
|
322 | 322 | </a> |
323 | - <span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
323 | + <span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
324 | 324 | } |
325 | 325 | } else { |
326 | 326 | return '<span class="reg-pad-rght"></span>'; |
@@ -334,13 +334,13 @@ discard block |
||
334 | 334 | /** |
335 | 335 | * column_TXN_total |
336 | 336 | */ |
337 | - function column_TXN_total(EE_Registration $item){ |
|
337 | + function column_TXN_total(EE_Registration $item) { |
|
338 | 338 | $txn = $item->transaction(); |
339 | - $view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL ); |
|
340 | - if ( $item->get('REG_count') == 1 ) { |
|
339 | + $view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL); |
|
340 | + if ($item->get('REG_count') == 1) { |
|
341 | 341 | $line_total_obj = $txn->total_line_item(); |
342 | 342 | $txn_total = $line_total_obj instanceof EE_Line_Item ? $line_total_obj->get_pretty('LIN_total') : __('View Transaction', 'event_espresso'); |
343 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? '<a href="' . $view_txn_url . '" title="' . esc_attr__('View Transaction', 'event_espresso') . '"><span class="reg-pad-rght">'. $txn_total .'</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>'; |
|
343 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_txn_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"><span class="reg-pad-rght">'.$txn_total.'</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>'; |
|
344 | 344 | } else { |
345 | 345 | return '<span class="reg-pad-rght"></span>'; |
346 | 346 | } |