@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | |
43 | - public function __construct( $routing = TRUE ) { |
|
44 | - parent::__construct( $routing ); |
|
43 | + public function __construct($routing = TRUE) { |
|
44 | + parent::__construct($routing); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | |
58 | 58 | |
59 | 59 | protected function _ajax_hooks() { |
60 | - add_action('wp_ajax_espresso_display_country_settings', array( $this, 'display_country_settings')); |
|
61 | - add_action('wp_ajax_espresso_display_country_states', array( $this, 'display_country_states')); |
|
62 | - add_action('wp_ajax_espresso_delete_state', array( $this, 'delete_state'), 10, 3 ); |
|
63 | - add_action('wp_ajax_espresso_add_new_state', array( $this, 'add_new_state')); |
|
60 | + add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings')); |
|
61 | + add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states')); |
|
62 | + add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3); |
|
63 | + add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state')); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
@@ -153,14 +153,14 @@ discard block |
||
153 | 153 | 'label' => __('Critical Pages', 'event_espresso'), |
154 | 154 | 'order' => 50 |
155 | 155 | ), |
156 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
156 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
157 | 157 | 'help_tabs' => array( |
158 | 158 | 'general_settings_critical_pages_help_tab' => array( |
159 | 159 | 'title' => __('Critical Pages', 'event_espresso'), |
160 | 160 | 'filename' => 'general_settings_critical_pages' |
161 | 161 | ) |
162 | 162 | ), |
163 | - 'help_tour' => array( 'Critical_Pages_Help_Tour' ), |
|
163 | + 'help_tour' => array('Critical_Pages_Help_Tour'), |
|
164 | 164 | 'require_nonce' => FALSE |
165 | 165 | ), |
166 | 166 | 'default' => array( |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | 'filename' => 'general_settings_your_organization' |
175 | 175 | ) |
176 | 176 | ), |
177 | - 'help_tour' => array( 'Your_Organization_Help_Tour' ), |
|
178 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
177 | + 'help_tour' => array('Your_Organization_Help_Tour'), |
|
178 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
179 | 179 | 'require_nonce' => FALSE |
180 | 180 | ), |
181 | 181 | 'admin_option_settings' => array( |
@@ -183,14 +183,14 @@ discard block |
||
183 | 183 | 'label' => __('Admin Options', 'event_espresso'), |
184 | 184 | 'order' => 60 |
185 | 185 | ), |
186 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
186 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
187 | 187 | 'help_tabs' => array( |
188 | 188 | 'general_settings_admin_options_help_tab' => array( |
189 | 189 | 'title' => __('Admin Options', 'event_espresso'), |
190 | 190 | 'filename' => 'general_settings_admin_options' |
191 | 191 | ) |
192 | 192 | ), |
193 | - 'help_tour' => array( 'Admin_Options_Help_Tour' ), |
|
193 | + 'help_tour' => array('Admin_Options_Help_Tour'), |
|
194 | 194 | 'require_nonce' => FALSE |
195 | 195 | ), |
196 | 196 | 'country_settings' => array( |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | 'filename' => 'general_settings_countries' |
205 | 205 | ) |
206 | 206 | ), |
207 | - 'help_tour' => array( 'Countries_Help_Tour' ), |
|
207 | + 'help_tour' => array('Countries_Help_Tour'), |
|
208 | 208 | 'require_nonce' => FALSE |
209 | 209 | ) |
210 | 210 | ); |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | } |
223 | 223 | |
224 | 224 | public function admin_init() { |
225 | - EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = __( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' ); |
|
226 | - EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' ); |
|
227 | - EE_Registry::$i18n_js_strings[ 'confirm_delete_state' ] = __( 'Are you sure you want to delete this State / Province?', 'event_espresso' ); |
|
228 | - $protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://'; |
|
229 | - EE_Registry::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php?page=espresso_general_settings', $protocol ); |
|
225 | + EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso'); |
|
226 | + EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso'); |
|
227 | + EE_Registry::$i18n_js_strings['confirm_delete_state'] = __('Are you sure you want to delete this State / Province?', 'event_espresso'); |
|
228 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
229 | + EE_Registry::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php?page=espresso_general_settings', $protocol); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | public function admin_notices() {} |
@@ -239,21 +239,21 @@ discard block |
||
239 | 239 | //scripts |
240 | 240 | wp_enqueue_script('media-upload'); |
241 | 241 | wp_enqueue_script('thickbox'); |
242 | - wp_register_script( 'organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js', array( 'jquery','media-upload','thickbox' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
243 | - wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION ); |
|
244 | - wp_enqueue_script( 'organization_settings' ); |
|
245 | - wp_enqueue_style( 'organization-css' ); |
|
246 | - $confirm_image_delete = array( 'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso')); |
|
247 | - wp_localize_script( 'organization_settings', 'confirm_image_delete', $confirm_image_delete ); |
|
242 | + wp_register_script('organization_settings', GEN_SET_ASSETS_URL.'your_organization_settings.js', array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, TRUE); |
|
243 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
244 | + wp_enqueue_script('organization_settings'); |
|
245 | + wp_enqueue_style('organization-css'); |
|
246 | + $confirm_image_delete = array('text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso')); |
|
247 | + wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete); |
|
248 | 248 | |
249 | 249 | } |
250 | 250 | |
251 | 251 | public function load_scripts_styles_country_settings() { |
252 | 252 | //scripts |
253 | - wp_register_script( 'gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js', array( 'ee_admin_js' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
254 | - wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION ); |
|
255 | - wp_enqueue_script( 'gen_settings_countries' ); |
|
256 | - wp_enqueue_style( 'organization-css' ); |
|
253 | + wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL.'gen_settings_countries.js', array('ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
254 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
255 | + wp_enqueue_script('gen_settings_countries'); |
|
256 | + wp_enqueue_style('organization-css'); |
|
257 | 257 | |
258 | 258 | } |
259 | 259 | |
@@ -270,31 +270,31 @@ discard block |
||
270 | 270 | $this->_transient_garbage_collection(); |
271 | 271 | $this->_template_args['values'] = $this->_yes_no_values; |
272 | 272 | |
273 | - $this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ?EE_Registry::instance()->CFG->core->reg_page_id : NULL; |
|
274 | - $this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id ) : FALSE; |
|
273 | + $this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? EE_Registry::instance()->CFG->core->reg_page_id : NULL; |
|
274 | + $this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id) : FALSE; |
|
275 | 275 | |
276 | - $this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ?EE_Registry::instance()->CFG->core->txn_page_id : NULL; |
|
277 | - $this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id ) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id ) : FALSE; |
|
276 | + $this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? EE_Registry::instance()->CFG->core->txn_page_id : NULL; |
|
277 | + $this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id) : FALSE; |
|
278 | 278 | |
279 | - $this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ?EE_Registry::instance()->CFG->core->thank_you_page_id : NULL; |
|
280 | - $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id ) : FALSE; |
|
279 | + $this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? EE_Registry::instance()->CFG->core->thank_you_page_id : NULL; |
|
280 | + $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id) : FALSE; |
|
281 | 281 | |
282 | - $this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ?EE_Registry::instance()->CFG->core->cancel_page_id : NULL; |
|
283 | - $this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id ) : FALSE; |
|
282 | + $this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? EE_Registry::instance()->CFG->core->cancel_page_id : NULL; |
|
283 | + $this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id) : FALSE; |
|
284 | 284 | |
285 | - $this->_set_add_edit_form_tags( 'update_espresso_page_settings' ); |
|
286 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
287 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', $this->_template_args, TRUE ); |
|
285 | + $this->_set_add_edit_form_tags('update_espresso_page_settings'); |
|
286 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
287 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php', $this->_template_args, TRUE); |
|
288 | 288 | $this->display_admin_page_with_sidebar(); |
289 | 289 | |
290 | 290 | } |
291 | 291 | |
292 | 292 | protected function _update_espresso_page_settings() { |
293 | 293 | // capture incoming request data |
294 | - $reg_page_id = isset( $this->_req_data['reg_page_id'] ) ? absint( $this->_req_data['reg_page_id'] ) : EE_Registry::instance()->CFG->core->reg_page_id; |
|
295 | - $txn_page_id = isset( $this->_req_data['txn_page_id'] ) ? absint( $this->_req_data['txn_page_id'] ) : EE_Registry::instance()->CFG->core->txn_page_id; |
|
296 | - $thank_you_page_id = isset( $this->_req_data['thank_you_page_id'] ) ? absint( $this->_req_data['thank_you_page_id'] ) : EE_Registry::instance()->CFG->core->thank_you_page_id; |
|
297 | - $cancel_page_id = isset( $this->_req_data['cancel_page_id'] ) ? absint( $this->_req_data['cancel_page_id'] ) : EE_Registry::instance()->CFG->core->cancel_page_id; |
|
294 | + $reg_page_id = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id; |
|
295 | + $txn_page_id = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id; |
|
296 | + $thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id; |
|
297 | + $cancel_page_id = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id; |
|
298 | 298 | // pack critical_pages into an array |
299 | 299 | $critical_pages = array( |
300 | 300 | 'reg_page_id' => $reg_page_id, |
@@ -302,17 +302,17 @@ discard block |
||
302 | 302 | 'thank_you_page_id' => $thank_you_page_id, |
303 | 303 | 'cancel_page_id' => $cancel_page_id |
304 | 304 | ); |
305 | - foreach ( $critical_pages as $critical_page_name => $critical_page_id ) { |
|
305 | + foreach ($critical_pages as $critical_page_name => $critical_page_id) { |
|
306 | 306 | // has the page changed ? |
307 | - if ( EE_Registry::instance()->CFG->core->{$critical_page_name} !== $critical_page_id ) { |
|
307 | + if (EE_Registry::instance()->CFG->core->{$critical_page_name} !== $critical_page_id) { |
|
308 | 308 | // grab post object for old page |
309 | - $post = get_post( EE_Registry::instance()->CFG->core->{$critical_page_name} ); |
|
309 | + $post = get_post(EE_Registry::instance()->CFG->core->{$critical_page_name} ); |
|
310 | 310 | // update post shortcodes for old page |
311 | - EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $critical_page_id, $post ); |
|
311 | + EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post); |
|
312 | 312 | // grab post object for new page |
313 | - $post = get_post( $critical_page_id ); |
|
313 | + $post = get_post($critical_page_id); |
|
314 | 314 | // update post shortcodes for new page |
315 | - EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $critical_page_id, $post ); |
|
315 | + EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post); |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 | // set page IDs |
@@ -321,14 +321,14 @@ discard block |
||
321 | 321 | EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id; |
322 | 322 | EE_Registry::instance()->CFG->core->cancel_page_id = $cancel_page_id; |
323 | 323 | |
324 | - EE_Registry::instance()->CFG->core = apply_filters( 'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data ); |
|
324 | + EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data); |
|
325 | 325 | |
326 | 326 | $what = __('Critical Pages & Shortcodes', 'event_espresso'); |
327 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__ ); |
|
327 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__); |
|
328 | 328 | $query_args = array( |
329 | 329 | 'action' => 'critical_pages' |
330 | 330 | ); |
331 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
331 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
332 | 332 | |
333 | 333 | } |
334 | 334 | |
@@ -343,34 +343,34 @@ discard block |
||
343 | 343 | |
344 | 344 | protected function _your_organization_settings() { |
345 | 345 | |
346 | - $this->_template_args['site_license_key'] = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->get_pretty( 'site_license_key' ) : ''; |
|
347 | - $this->_template_args['organization_name'] = isset( EE_Registry::instance()->CFG->organization->name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : ''; |
|
348 | - $this->_template_args['organization_address_1'] = isset( EE_Registry::instance()->CFG->organization->address_1 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ) : ''; |
|
349 | - $this->_template_args['organization_address_2'] = isset( EE_Registry::instance()->CFG->organization->address_2 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ) : ''; |
|
350 | - $this->_template_args['organization_city'] = isset( EE_Registry::instance()->CFG->organization->city ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'city' ) : ''; |
|
351 | - $this->_template_args['organization_zip'] = isset( EE_Registry::instance()->CFG->organization->zip ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ) : ''; |
|
352 | - $this->_template_args['organization_email'] = isset( EE_Registry::instance()->CFG->organization->email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : ''; |
|
353 | - $this->_template_args['organization_phone'] = isset( EE_Registry::instance()->CFG->organization->phone ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ) : ''; |
|
354 | - $this->_template_args['organization_vat'] = isset( EE_Registry::instance()->CFG->organization->vat ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'vat' ) : ''; |
|
355 | - $this->_template_args['currency_sign'] = isset( EE_Registry::instance()->CFG->currency->sign ) ? EE_Registry::instance()->CFG->currency->get_pretty( 'sign' ) : '$'; |
|
356 | - $this->_template_args['organization_logo_url'] = isset( EE_Registry::instance()->CFG->organization->logo_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) : FALSE; |
|
357 | - $this->_template_args['organization_facebook'] = isset( EE_Registry::instance()->CFG->organization->facebook ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : ''; |
|
358 | - $this->_template_args['organization_twitter'] = isset( EE_Registry::instance()->CFG->organization->twitter ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : ''; |
|
359 | - $this->_template_args['organization_linkedin'] = isset( EE_Registry::instance()->CFG->organization->linkedin ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ) : ''; |
|
360 | - $this->_template_args['organization_pinterest'] = isset( EE_Registry::instance()->CFG->organization->pinterest ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ) : ''; |
|
361 | - $this->_template_args['organization_google'] = isset( EE_Registry::instance()->CFG->organization->google ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'google' ) : ''; |
|
362 | - $this->_template_args['organization_instagram'] = isset( EE_Registry::instance()->CFG->organization->instagram ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ) : ''; |
|
346 | + $this->_template_args['site_license_key'] = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : ''; |
|
347 | + $this->_template_args['organization_name'] = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : ''; |
|
348 | + $this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : ''; |
|
349 | + $this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : ''; |
|
350 | + $this->_template_args['organization_city'] = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : ''; |
|
351 | + $this->_template_args['organization_zip'] = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : ''; |
|
352 | + $this->_template_args['organization_email'] = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : ''; |
|
353 | + $this->_template_args['organization_phone'] = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : ''; |
|
354 | + $this->_template_args['organization_vat'] = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : ''; |
|
355 | + $this->_template_args['currency_sign'] = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$'; |
|
356 | + $this->_template_args['organization_logo_url'] = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : FALSE; |
|
357 | + $this->_template_args['organization_facebook'] = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : ''; |
|
358 | + $this->_template_args['organization_twitter'] = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : ''; |
|
359 | + $this->_template_args['organization_linkedin'] = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : ''; |
|
360 | + $this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : ''; |
|
361 | + $this->_template_args['organization_google'] = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : ''; |
|
362 | + $this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : ''; |
|
363 | 363 | //UXIP settings |
364 | - $this->_template_args['ee_ueip_optin'] = isset( EE_Registry::instance()->CFG->core->ee_ueip_optin ) ? EE_Registry::instance()->CFG->core->get_pretty( 'ee_ueip_optin' ) : TRUE; |
|
364 | + $this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : TRUE; |
|
365 | 365 | |
366 | - $STA_ID = isset( EE_Registry::instance()->CFG->organization->STA_ID ) ? EE_Registry::instance()->CFG->organization->STA_ID : 4; |
|
366 | + $STA_ID = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4; |
|
367 | 367 | $this->_template_args['states'] = new EE_Question_Form_Input( |
368 | - EE_Question::new_instance ( array( |
|
368 | + EE_Question::new_instance(array( |
|
369 | 369 | 'QST_ID'=> 0, |
370 | 370 | 'QST_display_text'=> __('State/Province', 'event_espresso'), |
371 | 371 | 'QST_system'=>'admin-state' |
372 | 372 | )), |
373 | - EE_Answer::new_instance ( array( |
|
373 | + EE_Answer::new_instance(array( |
|
374 | 374 | 'ANS_ID' => 0, |
375 | 375 | 'ANS_value' => $STA_ID |
376 | 376 | )), |
@@ -382,14 +382,14 @@ discard block |
||
382 | 382 | ) |
383 | 383 | ); |
384 | 384 | |
385 | - $CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
385 | + $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
386 | 386 | $this->_template_args['countries'] = new EE_Question_Form_Input( |
387 | - EE_Question::new_instance ( array( |
|
387 | + EE_Question::new_instance(array( |
|
388 | 388 | 'QST_ID'=> 0, |
389 | 389 | 'QST_display_text'=> __('Country', 'event_espresso'), |
390 | 390 | 'QST_system'=>'admin-country' |
391 | 391 | )), |
392 | - EE_Answer::new_instance ( array( |
|
392 | + EE_Answer::new_instance(array( |
|
393 | 393 | 'ANS_ID' => 0, |
394 | 394 | 'ANS_value' => $CNT_ISO |
395 | 395 | )), |
@@ -401,51 +401,51 @@ discard block |
||
401 | 401 | ) |
402 | 402 | ); |
403 | 403 | |
404 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 ); |
|
405 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 ); |
|
404 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
405 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
406 | 406 | |
407 | 407 | //PUE verification stuff |
408 | - $ver_option_key = 'puvererr_' . basename( EE_PLUGIN_BASENAME ); |
|
409 | - $verify_fail = get_option( $ver_option_key ); |
|
410 | - $this->_template_args['site_license_key_verified'] = $verify_fail || !empty( $verify_fail ) || ( empty( $this->_template_args['site_license_key'] ) && empty( $verify_fail ) )? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>'; |
|
408 | + $ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME); |
|
409 | + $verify_fail = get_option($ver_option_key); |
|
410 | + $this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>'; |
|
411 | 411 | |
412 | - $this->_set_add_edit_form_tags( 'update_your_organization_settings' ); |
|
413 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
414 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php', $this->_template_args, TRUE ); |
|
412 | + $this->_set_add_edit_form_tags('update_your_organization_settings'); |
|
413 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
414 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'your_organization_settings.template.php', $this->_template_args, TRUE); |
|
415 | 415 | |
416 | 416 | $this->display_admin_page_with_sidebar(); |
417 | 417 | } |
418 | 418 | |
419 | 419 | protected function _update_your_organization_settings() { |
420 | - if ( is_main_site() ) |
|
421 | - EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key; |
|
422 | - EE_Registry::instance()->CFG->organization->name = isset( $this->_req_data['organization_name'] ) ? sanitize_text_field( $this->_req_data['organization_name'] ) : EE_Registry::instance()->CFG->organization->name; |
|
423 | - EE_Registry::instance()->CFG->organization->address_1 = isset( $this->_req_data['organization_address_1'] ) ? sanitize_text_field( $this->_req_data['organization_address_1'] ) : EE_Registry::instance()->CFG->organization->address_1; |
|
424 | - EE_Registry::instance()->CFG->organization->address_2 = isset( $this->_req_data['organization_address_2'] ) ? sanitize_text_field( $this->_req_data['organization_address_2'] ) : EE_Registry::instance()->CFG->organization->address_2; |
|
425 | - EE_Registry::instance()->CFG->organization->city = isset( $this->_req_data['organization_city'] ) ? sanitize_text_field( $this->_req_data['organization_city'] ) : EE_Registry::instance()->CFG->organization->city; |
|
426 | - EE_Registry::instance()->CFG->organization->STA_ID = isset( $this->_req_data['organization_state'] ) ? absint( $this->_req_data['organization_state'] ) : EE_Registry::instance()->CFG->organization->STA_ID; |
|
427 | - EE_Registry::instance()->CFG->organization->CNT_ISO = isset( $this->_req_data['organization_country'] ) ? sanitize_text_field( $this->_req_data['organization_country'] ) : EE_Registry::instance()->CFG->organization->CNT_ISO; |
|
428 | - EE_Registry::instance()->CFG->organization->zip = isset( $this->_req_data['organization_zip'] ) ? sanitize_text_field( $this->_req_data['organization_zip'] ) : EE_Registry::instance()->CFG->organization->zip; |
|
429 | - EE_Registry::instance()->CFG->organization->email = isset( $this->_req_data['organization_email'] ) ? sanitize_email( $this->_req_data['organization_email'] ) : EE_Registry::instance()->CFG->organization->email; |
|
430 | - EE_Registry::instance()->CFG->organization->vat = isset( $this->_req_data['organization_vat'] ) ? sanitize_text_field( $this->_req_data['organization_vat'] ) : EE_Registry::instance()->CFG->organization->vat; |
|
431 | - EE_Registry::instance()->CFG->organization->phone = isset( $this->_req_data['organization_phone'] ) ? sanitize_text_field( $this->_req_data['organization_phone'] ) : EE_Registry::instance()->CFG->organization->phone; |
|
432 | - EE_Registry::instance()->CFG->organization->logo_url = isset( $this->_req_data['organization_logo_url'] ) ? esc_url_raw( $this->_req_data['organization_logo_url'] ) : EE_Registry::instance()->CFG->organization->logo_url; |
|
433 | - EE_Registry::instance()->CFG->organization->facebook = isset( $this->_req_data['organization_facebook'] ) ? esc_url_raw( $this->_req_data['organization_facebook'] ) : EE_Registry::instance()->CFG->organization->facebook; |
|
434 | - EE_Registry::instance()->CFG->organization->twitter = isset( $this->_req_data['organization_twitter'] ) ? esc_url_raw( $this->_req_data['organization_twitter'] ) : EE_Registry::instance()->CFG->organization->twitter; |
|
435 | - EE_Registry::instance()->CFG->organization->linkedin = isset( $this->_req_data['organization_linkedin'] ) ? esc_url_raw( $this->_req_data['organization_linkedin'] ) : EE_Registry::instance()->CFG->organization->linkedin; |
|
436 | - EE_Registry::instance()->CFG->organization->pinterest = isset( $this->_req_data['organization_pinterest'] ) ? esc_url_raw( $this->_req_data['organization_pinterest'] ) : EE_Registry::instance()->CFG->organization->pinterest; |
|
437 | - EE_Registry::instance()->CFG->organization->google = isset( $this->_req_data['organization_google'] ) ? esc_url_raw( $this->_req_data['organization_google'] ) : EE_Registry::instance()->CFG->organization->google; |
|
438 | - EE_Registry::instance()->CFG->organization->instagram = isset( $this->_req_data['organization_instagram'] ) ? esc_url_raw( $this->_req_data['organization_instagram'] ) : EE_Registry::instance()->CFG->organization->instagram; |
|
439 | - EE_Registry::instance()->CFG->core->ee_ueip_optin = isset( $this->_req_data['ueip_optin'] ) && !empty( $this->_req_data['ueip_optin'] ) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin; |
|
440 | - |
|
441 | - EE_Registry::instance()->CFG->currency = new EE_Currency_Config( EE_Registry::instance()->CFG->organization->CNT_ISO ); |
|
442 | - |
|
443 | - EE_Registry::instance()->CFG = apply_filters( 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG ); |
|
420 | + if (is_main_site()) |
|
421 | + EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key; |
|
422 | + EE_Registry::instance()->CFG->organization->name = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name; |
|
423 | + EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1; |
|
424 | + EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2; |
|
425 | + EE_Registry::instance()->CFG->organization->city = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city; |
|
426 | + EE_Registry::instance()->CFG->organization->STA_ID = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID; |
|
427 | + EE_Registry::instance()->CFG->organization->CNT_ISO = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO; |
|
428 | + EE_Registry::instance()->CFG->organization->zip = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip; |
|
429 | + EE_Registry::instance()->CFG->organization->email = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email; |
|
430 | + EE_Registry::instance()->CFG->organization->vat = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat; |
|
431 | + EE_Registry::instance()->CFG->organization->phone = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone; |
|
432 | + EE_Registry::instance()->CFG->organization->logo_url = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url; |
|
433 | + EE_Registry::instance()->CFG->organization->facebook = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook; |
|
434 | + EE_Registry::instance()->CFG->organization->twitter = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter; |
|
435 | + EE_Registry::instance()->CFG->organization->linkedin = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin; |
|
436 | + EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest; |
|
437 | + EE_Registry::instance()->CFG->organization->google = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google; |
|
438 | + EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram; |
|
439 | + EE_Registry::instance()->CFG->core->ee_ueip_optin = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin; |
|
440 | + |
|
441 | + EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO); |
|
442 | + |
|
443 | + EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG); |
|
444 | 444 | |
445 | 445 | $what = 'Your Organization Settings'; |
446 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ ); |
|
446 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__); |
|
447 | 447 | |
448 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default' ) ); |
|
448 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'default')); |
|
449 | 449 | |
450 | 450 | } |
451 | 451 | |
@@ -456,36 +456,36 @@ discard block |
||
456 | 456 | protected function _admin_option_settings() { |
457 | 457 | |
458 | 458 | $this->_template_args['values'] = $this->_yes_no_values; |
459 | - $this->_template_args['use_personnel_manager'] = isset( EE_Registry::instance()->CFG->admin->use_personnel_manager ) ? absint( EE_Registry::instance()->CFG->admin->use_personnel_manager ) : FALSE; |
|
460 | - $this->_template_args['use_dashboard_widget'] = isset( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) ? absint( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) : TRUE; |
|
461 | - $this->_template_args['events_in_dashboard'] = isset( EE_Registry::instance()->CFG->admin->events_in_dashboard ) ? absint( EE_Registry::instance()->CFG->admin->events_in_dashboard ) : 30; |
|
462 | - $this->_template_args['use_event_timezones'] = isset( EE_Registry::instance()->CFG->admin->use_event_timezones ) ? absint( EE_Registry::instance()->CFG->admin->use_event_timezones ) : FALSE; |
|
463 | - $this->_template_args['show_reg_footer'] = isset( EE_Registry::instance()->CFG->admin->show_reg_footer ) ? absint( EE_Registry::instance()->CFG->admin->show_reg_footer ) : TRUE; |
|
464 | - $this->_template_args['affiliate_id'] = isset( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : ''; |
|
465 | - $this->_template_args['help_tour_activation'] = isset( EE_Registry::instance()->CFG->admin->help_tour_activation ) ? absint( EE_Registry::instance()->CFG->admin->help_tour_activation ): 1; |
|
466 | - |
|
467 | - $this->_set_add_edit_form_tags( 'update_admin_option_settings' ); |
|
468 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
459 | + $this->_template_args['use_personnel_manager'] = isset(EE_Registry::instance()->CFG->admin->use_personnel_manager) ? absint(EE_Registry::instance()->CFG->admin->use_personnel_manager) : FALSE; |
|
460 | + $this->_template_args['use_dashboard_widget'] = isset(EE_Registry::instance()->CFG->admin->use_dashboard_widget) ? absint(EE_Registry::instance()->CFG->admin->use_dashboard_widget) : TRUE; |
|
461 | + $this->_template_args['events_in_dashboard'] = isset(EE_Registry::instance()->CFG->admin->events_in_dashboard) ? absint(EE_Registry::instance()->CFG->admin->events_in_dashboard) : 30; |
|
462 | + $this->_template_args['use_event_timezones'] = isset(EE_Registry::instance()->CFG->admin->use_event_timezones) ? absint(EE_Registry::instance()->CFG->admin->use_event_timezones) : FALSE; |
|
463 | + $this->_template_args['show_reg_footer'] = isset(EE_Registry::instance()->CFG->admin->show_reg_footer) ? absint(EE_Registry::instance()->CFG->admin->show_reg_footer) : TRUE; |
|
464 | + $this->_template_args['affiliate_id'] = isset(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : ''; |
|
465 | + $this->_template_args['help_tour_activation'] = isset(EE_Registry::instance()->CFG->admin->help_tour_activation) ? absint(EE_Registry::instance()->CFG->admin->help_tour_activation) : 1; |
|
466 | + |
|
467 | + $this->_set_add_edit_form_tags('update_admin_option_settings'); |
|
468 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
469 | 469 | $this->_template_args['template_args'] = $this->_template_args; |
470 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'admin_option_settings.template.php', $this->_template_args, TRUE ); |
|
470 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'admin_option_settings.template.php', $this->_template_args, TRUE); |
|
471 | 471 | $this->display_admin_page_with_sidebar(); |
472 | 472 | } |
473 | 473 | |
474 | 474 | protected function _update_admin_option_settings() { |
475 | - EE_Registry::instance()->CFG->admin->use_personnel_manager = isset( $this->_req_data['use_personnel_manager'] ) ? absint( $this->_req_data['use_personnel_manager'] ) : EE_Registry::instance()->CFG->admin->use_personnel_manager; |
|
476 | - EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset( $this->_req_data['use_dashboard_widget'] ) ? absint( $this->_req_data['use_dashboard_widget'] ) : EE_Registry::instance()->CFG->admin->use_dashboard_widget; |
|
477 | - EE_Registry::instance()->CFG->admin->events_in_dashboard = isset( $this->_req_data['events_in_dashboard'] ) ? absint( $this->_req_data['events_in_dashboard'] ) : EE_Registry::instance()->CFG->admin->events_in_dashboard; |
|
478 | - EE_Registry::instance()->CFG->admin->use_event_timezones = isset( $this->_req_data['use_event_timezones'] ) ? absint( $this->_req_data['use_event_timezones'] ) : EE_Registry::instance()->CFG->admin->use_event_timezones; |
|
479 | - EE_Registry::instance()->CFG->admin->show_reg_footer = isset( $this->_req_data['show_reg_footer'] ) ? absint( $this->_req_data['show_reg_footer'] ) : EE_Registry::instance()->CFG->admin->show_reg_footer; |
|
480 | - EE_Registry::instance()->CFG->admin->affiliate_id = isset( $this->_req_data['affiliate_id'] ) ? sanitize_text_field( $this->_req_data['affiliate_id'] ) : EE_Registry::instance()->CFG->admin->affiliate_id; |
|
481 | - EE_Registry::instance()->CFG->admin->help_tour_activation = isset( $this->_req_data['help_tour_activation'] ) ? absint( $this->_req_data['help_tour_activation'] ) : EE_Registry::instance()->CFG->admin->help_tour_activation; |
|
475 | + EE_Registry::instance()->CFG->admin->use_personnel_manager = isset($this->_req_data['use_personnel_manager']) ? absint($this->_req_data['use_personnel_manager']) : EE_Registry::instance()->CFG->admin->use_personnel_manager; |
|
476 | + EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset($this->_req_data['use_dashboard_widget']) ? absint($this->_req_data['use_dashboard_widget']) : EE_Registry::instance()->CFG->admin->use_dashboard_widget; |
|
477 | + EE_Registry::instance()->CFG->admin->events_in_dashboard = isset($this->_req_data['events_in_dashboard']) ? absint($this->_req_data['events_in_dashboard']) : EE_Registry::instance()->CFG->admin->events_in_dashboard; |
|
478 | + EE_Registry::instance()->CFG->admin->use_event_timezones = isset($this->_req_data['use_event_timezones']) ? absint($this->_req_data['use_event_timezones']) : EE_Registry::instance()->CFG->admin->use_event_timezones; |
|
479 | + EE_Registry::instance()->CFG->admin->show_reg_footer = isset($this->_req_data['show_reg_footer']) ? absint($this->_req_data['show_reg_footer']) : EE_Registry::instance()->CFG->admin->show_reg_footer; |
|
480 | + EE_Registry::instance()->CFG->admin->affiliate_id = isset($this->_req_data['affiliate_id']) ? sanitize_text_field($this->_req_data['affiliate_id']) : EE_Registry::instance()->CFG->admin->affiliate_id; |
|
481 | + EE_Registry::instance()->CFG->admin->help_tour_activation = isset($this->_req_data['help_tour_activation']) ? absint($this->_req_data['help_tour_activation']) : EE_Registry::instance()->CFG->admin->help_tour_activation; |
|
482 | 482 | |
483 | - EE_Registry::instance()->CFG->admin = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin ); |
|
483 | + EE_Registry::instance()->CFG->admin = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin); |
|
484 | 484 | |
485 | 485 | $what = 'Admin Options'; |
486 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__ ); |
|
487 | - $success = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success ); |
|
488 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'admin_option_settings' ) ); |
|
486 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__); |
|
487 | + $success = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success); |
|
488 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'admin_option_settings')); |
|
489 | 489 | |
490 | 490 | } |
491 | 491 | |
@@ -498,20 +498,20 @@ discard block |
||
498 | 498 | |
499 | 499 | protected function _country_settings() { |
500 | 500 | |
501 | - $CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
502 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO; |
|
501 | + $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
502 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO; |
|
503 | 503 | |
504 | 504 | //load field generator helper |
505 | 505 | |
506 | 506 | $this->_template_args['values'] = $this->_yes_no_values; |
507 | 507 | |
508 | 508 | $this->_template_args['countries'] = new EE_Question_Form_Input( |
509 | - EE_Question::new_instance ( array( |
|
509 | + EE_Question::new_instance(array( |
|
510 | 510 | 'QST_ID'=> 0, |
511 | 511 | 'QST_display_text'=> __('Select Country', 'event_espresso'), |
512 | 512 | 'QST_system'=>'admin-country' |
513 | 513 | )), |
514 | - EE_Answer::new_instance ( array( |
|
514 | + EE_Answer::new_instance(array( |
|
515 | 515 | 'ANS_ID' => 0, |
516 | 516 | 'ANS_value' => $CNT_ISO |
517 | 517 | )), |
@@ -524,14 +524,14 @@ discard block |
||
524 | 524 | ); |
525 | 525 | // EEH_Debug_Tools::printr( $this->_template_args['countries'], 'countries <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
526 | 526 | |
527 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 ); |
|
528 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 ); |
|
527 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
528 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
529 | 529 | $this->_template_args['country_details_settings'] = $this->display_country_settings(); |
530 | 530 | $this->_template_args['country_states_settings'] = $this->display_country_states(); |
531 | 531 | |
532 | - $this->_set_add_edit_form_tags( 'update_country_settings' ); |
|
533 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
534 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', $this->_template_args, TRUE ); |
|
532 | + $this->_set_add_edit_form_tags('update_country_settings'); |
|
533 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
534 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'countries_settings.template.php', $this->_template_args, TRUE); |
|
535 | 535 | $this->display_admin_page_with_no_sidebar(); |
536 | 536 | } |
537 | 537 | |
@@ -544,43 +544,43 @@ discard block |
||
544 | 544 | * @param string $CNT_ISO |
545 | 545 | * @return mixed string | array |
546 | 546 | */ |
547 | - public function display_country_settings( $CNT_ISO = '' ) { |
|
547 | + public function display_country_settings($CNT_ISO = '') { |
|
548 | 548 | |
549 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO; |
|
550 | - if ( ! $CNT_ISO ) { |
|
549 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO; |
|
550 | + if ( ! $CNT_ISO) { |
|
551 | 551 | return ''; |
552 | 552 | } |
553 | 553 | |
554 | 554 | // for ajax |
555 | - remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' ); |
|
556 | - remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' ); |
|
557 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 ); |
|
558 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 ); |
|
559 | - $country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO ); |
|
555 | + remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
556 | + remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
557 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
558 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
559 | + $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
560 | 560 | //EEH_Debug_Tools::printr( $country, '$country <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
561 | 561 | $country_input_types = array( |
562 | - 'CNT_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ), |
|
563 | - 'CNT_ISO' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
564 | - 'CNT_ISO3' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
565 | - 'RGN_ID' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
566 | - 'CNT_name' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'regular-text' ), |
|
567 | - 'CNT_cur_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
568 | - 'CNT_cur_single' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ), |
|
569 | - 'CNT_cur_plural' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ), |
|
570 | - 'CNT_cur_sign' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text', 'htmlentities' => FALSE ), |
|
571 | - 'CNT_cur_sign_b4' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ), |
|
572 | - 'CNT_cur_dec_plc' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => 0, 'text' => '' ), array( 'id' => 1, 'text' => '' ), array( 'id' => 2, 'text' => '' ), array( 'id' => 3, 'text' => '' ))), |
|
573 | - 'CNT_cur_dec_mrk' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ), |
|
574 | - 'CNT_cur_thsnds' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ), |
|
575 | - 'CNT_tel_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
576 | - 'CNT_is_EU' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ) |
|
562 | + 'CNT_active' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE), |
|
563 | + 'CNT_ISO' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
564 | + 'CNT_ISO3' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
565 | + 'RGN_ID' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
566 | + 'CNT_name' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'regular-text'), |
|
567 | + 'CNT_cur_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
568 | + 'CNT_cur_single' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'), |
|
569 | + 'CNT_cur_plural' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'), |
|
570 | + 'CNT_cur_sign' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text', 'htmlentities' => FALSE), |
|
571 | + 'CNT_cur_sign_b4' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE), |
|
572 | + 'CNT_cur_dec_plc' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => 0, 'text' => ''), array('id' => 1, 'text' => ''), array('id' => 2, 'text' => ''), array('id' => 3, 'text' => ''))), |
|
573 | + 'CNT_cur_dec_mrk' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE), |
|
574 | + 'CNT_cur_thsnds' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE), |
|
575 | + 'CNT_tel_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
576 | + 'CNT_is_EU' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE) |
|
577 | 577 | ); |
578 | - $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $country, $country_input_types ); |
|
579 | - $country_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', $this->_template_args, TRUE ); |
|
578 | + $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country, $country_input_types); |
|
579 | + $country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php', $this->_template_args, TRUE); |
|
580 | 580 | |
581 | - if ( defined( 'DOING_AJAX' )) { |
|
582 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE ); |
|
583 | - echo json_encode( array( 'return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] )); |
|
581 | + if (defined('DOING_AJAX')) { |
|
582 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE); |
|
583 | + echo json_encode(array('return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'])); |
|
584 | 584 | die(); |
585 | 585 | } else { |
586 | 586 | return $country_details_settings; |
@@ -598,49 +598,49 @@ discard block |
||
598 | 598 | * @param string $CNT_ISO |
599 | 599 | * @return string |
600 | 600 | */ |
601 | - public function display_country_states( $CNT_ISO = '' ) { |
|
601 | + public function display_country_states($CNT_ISO = '') { |
|
602 | 602 | |
603 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? sanitize_text_field( $this->_req_data['country'] ) : $CNT_ISO; |
|
603 | + $CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO; |
|
604 | 604 | |
605 | - if ( ! $CNT_ISO ) { |
|
605 | + if ( ! $CNT_ISO) { |
|
606 | 606 | return ''; |
607 | 607 | } |
608 | 608 | // for ajax |
609 | - remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' ); |
|
610 | - remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' ); |
|
611 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'state_form_field_label_wrap' ), 10, 2 ); |
|
612 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'state_form_field_input__wrap' ), 10, 2 ); |
|
613 | - $states = EEM_State::instance()->get_all_states_for_these_countries( array( $CNT_ISO => $CNT_ISO )); |
|
609 | + remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
610 | + remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
611 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2); |
|
612 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2); |
|
613 | + $states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO)); |
|
614 | 614 | |
615 | 615 | // echo '<h4>$CNT_ISO : ' . $CNT_ISO . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
616 | 616 | // global $wpdb; |
617 | 617 | // echo '<h4>' . $wpdb->last_query . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
618 | 618 | // EEH_Debug_Tools::printr( $states, '$states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
619 | - if ( $states ) { |
|
620 | - foreach ( $states as $STA_ID => $state ) { |
|
621 | - if ( $state instanceof EE_State ) { |
|
619 | + if ($states) { |
|
620 | + foreach ($states as $STA_ID => $state) { |
|
621 | + if ($state instanceof EE_State) { |
|
622 | 622 | //STA_abbrev STA_name STA_active |
623 | 623 | $state_input_types = array( |
624 | - 'STA_abbrev' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'mid-text' ), |
|
625 | - 'STA_name' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'regular-text' ), |
|
626 | - 'STA_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'states[' . $STA_ID . ']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true ) |
|
624 | + 'STA_abbrev' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'mid-text'), |
|
625 | + 'STA_name' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'regular-text'), |
|
626 | + 'STA_active' => array('type' => 'RADIO_BTN', 'input_name' => 'states['.$STA_ID.']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true) |
|
627 | 627 | ); |
628 | - $this->_template_args[ 'states' ][ $STA_ID ][ 'inputs' ] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $state, $state_input_types ); |
|
629 | - $query_args = array( 'action' => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev() ); |
|
630 | - $this->_template_args[ 'states' ][ $STA_ID ][ 'delete_state_url' ] = EE_Admin_Page::add_query_args_and_nonce( $query_args, GEN_SET_ADMIN_URL ); |
|
628 | + $this->_template_args['states'][$STA_ID]['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($state, $state_input_types); |
|
629 | + $query_args = array('action' => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev()); |
|
630 | + $this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, GEN_SET_ADMIN_URL); |
|
631 | 631 | } |
632 | 632 | } |
633 | 633 | } else { |
634 | 634 | $this->_template_args['states'] = FALSE; |
635 | 635 | } |
636 | 636 | // EEH_Debug_Tools::printr( $this->_template_args['states'], 'states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
637 | - $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'add_new_state' ), GEN_SET_ADMIN_URL ); |
|
637 | + $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'), GEN_SET_ADMIN_URL); |
|
638 | 638 | |
639 | - $state_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', $this->_template_args, TRUE ); |
|
639 | + $state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php', $this->_template_args, TRUE); |
|
640 | 640 | |
641 | - if ( defined( 'DOING_AJAX' )) { |
|
642 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE ); |
|
643 | - echo json_encode( array( 'return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] )); |
|
641 | + if (defined('DOING_AJAX')) { |
|
642 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE); |
|
643 | + echo json_encode(array('return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'])); |
|
644 | 644 | die(); |
645 | 645 | } else { |
646 | 646 | return $state_details_settings; |
@@ -661,40 +661,39 @@ discard block |
||
661 | 661 | |
662 | 662 | $success = TRUE; |
663 | 663 | |
664 | - $CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE; |
|
665 | - if ( ! $CNT_ISO ) { |
|
666 | - EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
664 | + $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE; |
|
665 | + if ( ! $CNT_ISO) { |
|
666 | + EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
667 | 667 | $success = FALSE; |
668 | 668 | } |
669 | - $STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE; |
|
670 | - if ( ! $STA_abbrev ) { |
|
671 | - EE_Error::add_error( __( 'No State ISO code or an invalid State ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
669 | + $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE; |
|
670 | + if ( ! $STA_abbrev) { |
|
671 | + EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
672 | 672 | $success = FALSE; |
673 | 673 | } |
674 | - $STA_name = isset( $this->_req_data['STA_name'] ) ? sanitize_text_field( $this->_req_data['STA_name'] ) : |
|
675 | - FALSE; |
|
676 | - if ( ! $STA_name ) { |
|
677 | - EE_Error::add_error( __( 'No State name or an invalid State name was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
674 | + $STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) : FALSE; |
|
675 | + if ( ! $STA_name) { |
|
676 | + EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
678 | 677 | $success = FALSE; |
679 | 678 | } |
680 | 679 | |
681 | - if ( $success ) { |
|
680 | + if ($success) { |
|
682 | 681 | $cols_n_values = array( |
683 | 682 | 'CNT_ISO' => $CNT_ISO, |
684 | 683 | 'STA_abbrev' => $STA_abbrev, |
685 | 684 | 'STA_name' => $STA_name, |
686 | 685 | 'STA_active' => TRUE |
687 | 686 | ); |
688 | - $success = EEM_State::instance()->insert ( $cols_n_values ); |
|
689 | - EE_Error::add_success( __( 'The State was added successfully.', 'event_espresso' ) ); |
|
687 | + $success = EEM_State::instance()->insert($cols_n_values); |
|
688 | + EE_Error::add_success(__('The State was added successfully.', 'event_espresso')); |
|
690 | 689 | } |
691 | 690 | |
692 | - if ( defined( 'DOING_AJAX' )) { |
|
693 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE ); |
|
694 | - echo json_encode( array_merge( $notices, array( 'return_data' => $CNT_ISO ) ) ); |
|
691 | + if (defined('DOING_AJAX')) { |
|
692 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE); |
|
693 | + echo json_encode(array_merge($notices, array('return_data' => $CNT_ISO))); |
|
695 | 694 | die(); |
696 | 695 | } else { |
697 | - $this->_redirect_after_action( $success, 'State', 'added', array( 'action' => 'country_settings' ) ); |
|
696 | + $this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings')); |
|
698 | 697 | } |
699 | 698 | } |
700 | 699 | |
@@ -707,25 +706,25 @@ discard block |
||
707 | 706 | * @return boolean | void |
708 | 707 | */ |
709 | 708 | public function delete_state() { |
710 | - $CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE; |
|
711 | - $STA_ID = isset( $this->_req_data['STA_ID'] ) ? sanitize_text_field( $this->_req_data['STA_ID'] ) : FALSE; |
|
712 | - $STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE; |
|
713 | - if ( ! $STA_ID ) { |
|
714 | - EE_Error::add_error( __( 'No State ID or an invalid State ID was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
709 | + $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE; |
|
710 | + $STA_ID = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : FALSE; |
|
711 | + $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE; |
|
712 | + if ( ! $STA_ID) { |
|
713 | + EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
715 | 714 | return FALSE; |
716 | 715 | } |
717 | - $success = EEM_State::instance()->delete_by_ID( $STA_ID ); |
|
718 | - if ( $success !== FALSE ) { |
|
719 | - do_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array( 'STA_abbrev' => $STA_abbrev )); |
|
720 | - EE_Error::add_success( __( 'The State was deleted successfully.', 'event_espresso' )); |
|
716 | + $success = EEM_State::instance()->delete_by_ID($STA_ID); |
|
717 | + if ($success !== FALSE) { |
|
718 | + do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array('STA_abbrev' => $STA_abbrev)); |
|
719 | + EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso')); |
|
721 | 720 | } |
722 | - if ( defined( 'DOING_AJAX' )) { |
|
723 | - $notices = EE_Error::get_notices( FALSE, FALSE ); |
|
721 | + if (defined('DOING_AJAX')) { |
|
722 | + $notices = EE_Error::get_notices(FALSE, FALSE); |
|
724 | 723 | $notices['return_data'] = TRUE; |
725 | - echo json_encode( $notices ); |
|
724 | + echo json_encode($notices); |
|
726 | 725 | die(); |
727 | 726 | } else { |
728 | - $this->_redirect_after_action( $success, 'State', 'deleted', array( 'action' => 'country_settings' ) ); |
|
727 | + $this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings')); |
|
729 | 728 | } |
730 | 729 | } |
731 | 730 | |
@@ -741,63 +740,63 @@ discard block |
||
741 | 740 | protected function _update_country_settings() { |
742 | 741 | // EEH_Debug_Tools::printr( $this->_req_data, '$this->_req_data <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
743 | 742 | // grab the country ISO code |
744 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : FALSE; |
|
745 | - if ( ! $CNT_ISO ) { |
|
746 | - EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
743 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : FALSE; |
|
744 | + if ( ! $CNT_ISO) { |
|
745 | + EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
747 | 746 | return; |
748 | 747 | } |
749 | 748 | $cols_n_values = array(); |
750 | - $cols_n_values['CNT_ISO3'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] )) : FALSE; |
|
751 | - $cols_n_values['RGN_ID'] = isset( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) : NULL; |
|
752 | - $cols_n_values['CNT_name'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) : NULL; |
|
753 | - $cols_n_values['CNT_cur_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] )) : 'USD'; |
|
754 | - $cols_n_values['CNT_cur_single'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) : 'dollar'; |
|
755 | - $cols_n_values['CNT_cur_plural'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) : 'dollars'; |
|
756 | - $cols_n_values['CNT_cur_sign'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) : '$'; |
|
757 | - $cols_n_values['CNT_cur_sign_b4'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) : TRUE; |
|
758 | - $cols_n_values['CNT_cur_dec_plc'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) : 2; |
|
759 | - $cols_n_values['CNT_cur_dec_mrk'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) : '.'; |
|
760 | - $cols_n_values['CNT_cur_thsnds'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) : ','; |
|
761 | - $cols_n_values['CNT_tel_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) : NULL; |
|
762 | - $cols_n_values['CNT_is_EU'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) : FALSE; |
|
763 | - $cols_n_values['CNT_active'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) : FALSE; |
|
749 | + $cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : FALSE; |
|
750 | + $cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : NULL; |
|
751 | + $cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : NULL; |
|
752 | + $cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD'; |
|
753 | + $cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar'; |
|
754 | + $cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars'; |
|
755 | + $cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$'; |
|
756 | + $cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : TRUE; |
|
757 | + $cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2; |
|
758 | + $cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.'; |
|
759 | + $cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ','; |
|
760 | + $cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : NULL; |
|
761 | + $cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : FALSE; |
|
762 | + $cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : FALSE; |
|
764 | 763 | // allow filtering of country data |
765 | - $cols_n_values = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values ); |
|
764 | + $cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values); |
|
766 | 765 | //EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
767 | 766 | // where values |
768 | - $where_cols_n_values = array( array( 'CNT_ISO' => $CNT_ISO )); |
|
767 | + $where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO)); |
|
769 | 768 | // run the update |
770 | - $success = EEM_Country::instance()->update( $cols_n_values, $where_cols_n_values ); |
|
769 | + $success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values); |
|
771 | 770 | // global $wpdb; |
772 | 771 | // echo '<h4>' . $wpdb->last_query . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
773 | 772 | // echo '<h4>$success : ' . $success . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
774 | - if ( isset( $this->_req_data['states'] ) && is_array( $this->_req_data['states'] ) && $success !== FALSE ) { |
|
773 | + if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== FALSE) { |
|
775 | 774 | // allow filtering of states data |
776 | - $states = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states'] ); |
|
775 | + $states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states']); |
|
777 | 776 | // EEH_Debug_Tools::printr( $states, '$states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
778 | 777 | // loop thru state data ( looks like : states[75][STA_name] ) |
779 | - foreach( $states as $STA_ID => $state ) { |
|
778 | + foreach ($states as $STA_ID => $state) { |
|
780 | 779 | $cols_n_values = array( |
781 | 780 | 'CNT_ISO' => $CNT_ISO, |
782 | - 'STA_abbrev' => sanitize_text_field( $state['STA_abbrev'] ), |
|
783 | - 'STA_name' => sanitize_text_field( $state['STA_name'] ), |
|
784 | - 'STA_active' => (bool)absint( $state['STA_active'] ) |
|
781 | + 'STA_abbrev' => sanitize_text_field($state['STA_abbrev']), |
|
782 | + 'STA_name' => sanitize_text_field($state['STA_name']), |
|
783 | + 'STA_active' => (bool) absint($state['STA_active']) |
|
785 | 784 | ); |
786 | 785 | // where values |
787 | - $where_cols_n_values = array( array( 'STA_ID' => $STA_ID )); |
|
786 | + $where_cols_n_values = array(array('STA_ID' => $STA_ID)); |
|
788 | 787 | // run the update |
789 | - $success = EEM_State::instance()->update( $cols_n_values, $where_cols_n_values ); |
|
790 | - if ( $success !== FALSE ) { |
|
791 | - do_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values ); |
|
788 | + $success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values); |
|
789 | + if ($success !== FALSE) { |
|
790 | + do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values); |
|
792 | 791 | } |
793 | 792 | } |
794 | 793 | } |
795 | 794 | // check if country being edited matches org option country, and if so, then update EE_Config with new settings |
796 | - if ( isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO ) { |
|
797 | - EE_Registry::instance()->CFG->currency = new EE_Currency_Config( $CNT_ISO ); |
|
795 | + if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) { |
|
796 | + EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO); |
|
798 | 797 | EE_Registry::instance()->CFG->update_espresso_config(); |
799 | 798 | } |
800 | - $this->_redirect_after_action( $success, 'Countries', 'updated', array( 'action' => 'country_settings', 'country' => $CNT_ISO )); |
|
799 | + $this->_redirect_after_action($success, 'Countries', 'updated', array('action' => 'country_settings', 'country' => $CNT_ISO)); |
|
801 | 800 | } |
802 | 801 | |
803 | 802 | |
@@ -811,11 +810,11 @@ discard block |
||
811 | 810 | * @param string $label |
812 | 811 | * @return string |
813 | 812 | */ |
814 | - public function country_form_field_label_wrap( $label, $required_text ) { |
|
813 | + public function country_form_field_label_wrap($label, $required_text) { |
|
815 | 814 | return ' |
816 | 815 | <tr> |
817 | 816 | <th> |
818 | - ' . $label . ' |
|
817 | + ' . $label.' |
|
819 | 818 | </th>'; |
820 | 819 | } |
821 | 820 | |
@@ -829,10 +828,10 @@ discard block |
||
829 | 828 | * @param string $label |
830 | 829 | * @return string |
831 | 830 | */ |
832 | - public function country_form_field_input__wrap( $input, $label ) { |
|
831 | + public function country_form_field_input__wrap($input, $label) { |
|
833 | 832 | return ' |
834 | 833 | <td class="general-settings-country-input-td"> |
835 | - ' . $input . ' |
|
834 | + ' . $input.' |
|
836 | 835 | </td> |
837 | 836 | </tr>'; |
838 | 837 | } |
@@ -848,7 +847,7 @@ discard block |
||
848 | 847 | * @param string $required_text |
849 | 848 | * @return string |
850 | 849 | */ |
851 | - public function state_form_field_label_wrap( $label, $required_text ) { |
|
850 | + public function state_form_field_label_wrap($label, $required_text) { |
|
852 | 851 | return $required_text; |
853 | 852 | } |
854 | 853 | |
@@ -862,10 +861,10 @@ discard block |
||
862 | 861 | * @param string $label |
863 | 862 | * @return string |
864 | 863 | */ |
865 | - public function state_form_field_input__wrap( $input, $label ) { |
|
864 | + public function state_form_field_input__wrap($input, $label) { |
|
866 | 865 | return ' |
867 | 866 | <td class="general-settings-country-state-input-td"> |
868 | - ' . $input . ' |
|
867 | + ' . $input.' |
|
869 | 868 | </td>'; |
870 | 869 | |
871 | 870 | } |
@@ -888,10 +887,10 @@ discard block |
||
888 | 887 | * @param int $ee_page_id |
889 | 888 | * @return string |
890 | 889 | */ |
891 | - public static function edit_view_links( $ee_page_id ) { |
|
892 | - $links = '<a href="' . add_query_arg( array( 'post' => $ee_page_id, 'action' => 'edit' ), admin_url( 'post.php' )) . '" >' . __('Edit', 'event_espresso') . '</a>'; |
|
890 | + public static function edit_view_links($ee_page_id) { |
|
891 | + $links = '<a href="'.add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), admin_url('post.php')).'" >'.__('Edit', 'event_espresso').'</a>'; |
|
893 | 892 | $links .= ' | '; |
894 | - $links .= '<a href="' . get_permalink( $ee_page_id ) . '" >' . __('View', 'event_espresso') . '</a>'; |
|
893 | + $links .= '<a href="'.get_permalink($ee_page_id).'" >'.__('View', 'event_espresso').'</a>'; |
|
895 | 894 | return $links; |
896 | 895 | } |
897 | 896 | |
@@ -904,27 +903,27 @@ discard block |
||
904 | 903 | * @param WP page object $ee_page |
905 | 904 | * @return string |
906 | 905 | */ |
907 | - public static function page_and_shortcode_status( $ee_page, $shortcode ) { |
|
906 | + public static function page_and_shortcode_status($ee_page, $shortcode) { |
|
908 | 907 | |
909 | 908 | // page status |
910 | - if ( isset( $ee_page->post_status ) && $ee_page->post_status == 'publish') { |
|
909 | + if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') { |
|
911 | 910 | $pg_colour = 'green'; |
912 | - $pg_status = sprintf( __('Page%sStatus%sOK', 'event_espresso'), ' ' , ' ' ); |
|
911 | + $pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), ' ', ' '); |
|
913 | 912 | } else { |
914 | 913 | $pg_colour = 'red'; |
915 | - $pg_status = sprintf( __('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' ' ); |
|
914 | + $pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' '); |
|
916 | 915 | } |
917 | 916 | |
918 | 917 | // shortcode status |
919 | - if ( isset( $ee_page->post_content ) && strpos( $ee_page->post_content, $shortcode ) !== FALSE ) { |
|
918 | + if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== FALSE) { |
|
920 | 919 | $sc_colour = 'green'; |
921 | - $sc_status = sprintf( __('Shortcode%sOK', 'event_espresso'), ' ' ); |
|
920 | + $sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), ' '); |
|
922 | 921 | } else { |
923 | 922 | $sc_colour = 'red'; |
924 | - $sc_status = sprintf( __('Shortcode%sProblem', 'event_espresso'), ' ' ); |
|
923 | + $sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), ' '); |
|
925 | 924 | } |
926 | 925 | |
927 | - return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>'; |
|
926 | + return '<span style="color:'.$pg_colour.'; margin-right:2em;"><strong>'.$pg_status.'</strong></span><span style="color:'.$sc_colour.'"><strong>'.$sc_status.'</strong></span>'; |
|
928 | 927 | |
929 | 928 | } |
930 | 929 | |
@@ -939,20 +938,20 @@ discard block |
||
939 | 938 | * @param unknown_type $level |
940 | 939 | * @return unknown |
941 | 940 | */ |
942 | - public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) { |
|
941 | + public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0) { |
|
943 | 942 | global $wpdb; |
944 | - $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent) ); |
|
943 | + $items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent)); |
|
945 | 944 | |
946 | - if ( $items ) { |
|
947 | - foreach ( $items as $item ) { |
|
948 | - $pad = str_repeat( ' ', $level * 3 ); |
|
949 | - if ( $item->ID == $default) |
|
945 | + if ($items) { |
|
946 | + foreach ($items as $item) { |
|
947 | + $pad = str_repeat(' ', $level * 3); |
|
948 | + if ($item->ID == $default) |
|
950 | 949 | $current = ' selected="selected"'; |
951 | 950 | else |
952 | 951 | $current = ''; |
953 | 952 | |
954 | - echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>"; |
|
955 | - parent_dropdown( $default, $item->ID, $level +1 ); |
|
953 | + echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad ".esc_html($item->post_title)."</option>"; |
|
954 | + parent_dropdown($default, $item->ID, $level + 1); |
|
956 | 955 | } |
957 | 956 | } else { |
958 | 957 | return false; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * to indicate it successfully migrate some data, and has nothing left to do; or EE_Data_Migration_Manager::status_fatal_error to indicate |
22 | 22 | * an error occurred which means the ajax script should probably stop executing. |
23 | 23 | */ |
24 | -class EE_Data_Migration_Manager{ |
|
24 | +class EE_Data_Migration_Manager { |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * of this EE installation. Keys should be the name of the version the script upgraded to |
79 | 79 | * @var EE_Data_Migration_Script_Base[] |
80 | 80 | */ |
81 | - private $_data_migrations_ran =null; |
|
81 | + private $_data_migrations_ran = null; |
|
82 | 82 | /** |
83 | 83 | * The last ran script. It's nice to store this somewhere accessible, as its easiest |
84 | 84 | * to know which was the last run by which is the newest wp option; but in most of the code |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public static function instance() { |
124 | 124 | // check if class object is instantiated |
125 | - if ( ! self::$_instance instanceof EE_Data_Migration_Manager ) { |
|
125 | + if ( ! self::$_instance instanceof EE_Data_Migration_Manager) { |
|
126 | 126 | self::$_instance = new self(); |
127 | 127 | } |
128 | 128 | return self::$_instance; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * all new usages of the singleton should be made with Classname::instance()) and returns it |
133 | 133 | * @return EE_Data_Migration_Manager |
134 | 134 | */ |
135 | - public static function reset(){ |
|
135 | + public static function reset() { |
|
136 | 136 | self::$_instance = NULL; |
137 | 137 | return self::instance(); |
138 | 138 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | /** |
143 | 143 | * constructor |
144 | 144 | */ |
145 | - private function __construct(){ |
|
145 | + private function __construct() { |
|
146 | 146 | $this->stati_that_indicate_to_continue_migrations = array( |
147 | 147 | self::status_continue, |
148 | 148 | self::status_completed |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | ); |
162 | 162 | //make sure we've included the base migration script, because we may need the EE_DMS_Unknown_1_0_0 class |
163 | 163 | //to be defined, because right now it doesn't get autoloaded on its own |
164 | - EE_Registry::instance()->load_core( 'Data_Migration_Class_Base', array(), TRUE ); |
|
165 | - EE_Registry::instance()->load_core( 'Data_Migration_Script_Base', array(), TRUE ); |
|
166 | - EE_Registry::instance()->load_core( 'DMS_Unknown_1_0_0', array(), TRUE ); |
|
167 | - EE_Registry::instance()->load_core( 'Data_Migration_Script_Stage', array(), TRUE ); |
|
168 | - EE_Registry::instance()->load_core( 'Data_Migration_Script_Stage_Table', array(), TRUE ); |
|
164 | + EE_Registry::instance()->load_core('Data_Migration_Class_Base', array(), TRUE); |
|
165 | + EE_Registry::instance()->load_core('Data_Migration_Script_Base', array(), TRUE); |
|
166 | + EE_Registry::instance()->load_core('DMS_Unknown_1_0_0', array(), TRUE); |
|
167 | + EE_Registry::instance()->load_core('Data_Migration_Script_Stage', array(), TRUE); |
|
168 | + EE_Registry::instance()->load_core('Data_Migration_Script_Stage_Table', array(), TRUE); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | |
@@ -178,21 +178,21 @@ discard block |
||
178 | 178 | * @param string $option_name (see EE_Data_Migration_Manage::_save_migrations_ran() where the option name is set) |
179 | 179 | * @return array where the first item is the plugin slug (eg 'Core','Calendar',etc) and the 2nd is the version of that plugin (eg '4.1.0') |
180 | 180 | */ |
181 | - private function _get_plugin_slug_and_version_string_from_dms_option_name($option_name){ |
|
181 | + private function _get_plugin_slug_and_version_string_from_dms_option_name($option_name) { |
|
182 | 182 | $plugin_slug_and_version_string = str_replace(EE_Data_Migration_Manager::data_migration_script_option_prefix, "", $option_name); |
183 | 183 | //check if $plugin_slug_and_version_string is like '4.1.0' (4.1-style) or 'Core.4.1.0' (4.2-style) |
184 | - $parts = explode(".",$plugin_slug_and_version_string); |
|
184 | + $parts = explode(".", $plugin_slug_and_version_string); |
|
185 | 185 | |
186 | - if(count($parts) == 4){ |
|
186 | + if (count($parts) == 4) { |
|
187 | 187 | //it's 4.2-style.eg Core.4.1.0 |
188 | - $plugin_slug = $parts[0];//eg Core |
|
188 | + $plugin_slug = $parts[0]; //eg Core |
|
189 | 189 | $version_string = $parts[1].".".$parts[2].".".$parts[3]; //eg 4.1.0 |
190 | - }else{ |
|
190 | + } else { |
|
191 | 191 | //it's 4.1-style: eg 4.1.0 |
192 | 192 | $plugin_slug = 'Core'; |
193 | - $version_string = $plugin_slug_and_version_string;//eg 4.1.0 |
|
193 | + $version_string = $plugin_slug_and_version_string; //eg 4.1.0 |
|
194 | 194 | } |
195 | - return array($plugin_slug,$version_string); |
|
195 | + return array($plugin_slug, $version_string); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -203,21 +203,21 @@ discard block |
||
203 | 203 | * @return EE_Data_Migration_Script_Base |
204 | 204 | * @throws EE_Error |
205 | 205 | */ |
206 | - private function _get_dms_class_from_wp_option($dms_option_name,$dms_option_value){ |
|
206 | + private function _get_dms_class_from_wp_option($dms_option_name, $dms_option_value) { |
|
207 | 207 | $data_migration_data = maybe_unserialize($dms_option_value); |
208 | - if(isset($data_migration_data['class']) && class_exists($data_migration_data['class'])){ |
|
208 | + if (isset($data_migration_data['class']) && class_exists($data_migration_data['class'])) { |
|
209 | 209 | $class = new $data_migration_data['class']; |
210 | - if($class instanceof EE_Data_Migration_Script_Base){ |
|
210 | + if ($class instanceof EE_Data_Migration_Script_Base) { |
|
211 | 211 | $class->instantiate_from_array_of_properties($data_migration_data); |
212 | 212 | return $class; |
213 | - }else{ |
|
213 | + } else { |
|
214 | 214 | //huh, so its an object but not a data migration script?? that shouldn't happen |
215 | 215 | //just leave it as an array (which will probably just get ignored) |
216 | - throw new EE_Error(sprintf(__("Trying to retrieve DMS class from wp option. No DMS by the name '%s' exists", 'event_espresso'),$data_migration_data['class'])); |
|
216 | + throw new EE_Error(sprintf(__("Trying to retrieve DMS class from wp option. No DMS by the name '%s' exists", 'event_espresso'), $data_migration_data['class'])); |
|
217 | 217 | } |
218 | - }else{ |
|
218 | + } else { |
|
219 | 219 | //so the data doesn't specify a class. So it must either be a legacy array of info or some array (which we'll probably just ignore), or a class that no longer exists |
220 | - throw new EE_Error(sprintf(__("The wp option with key '%s' does not represent a DMS", 'event_espresso'),$dms_option_name)); |
|
220 | + throw new EE_Error(sprintf(__("The wp option with key '%s' does not represent a DMS", 'event_espresso'), $dms_option_name)); |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 | /** |
@@ -225,34 +225,34 @@ discard block |
||
225 | 225 | * the last ran which hasn't finished yet |
226 | 226 | * @return array where each element should be an array of EE_Data_Migration_Script_Base (but also has a few legacy arrays in there - which should probably be ignored) |
227 | 227 | */ |
228 | - public function get_data_migrations_ran(){ |
|
229 | - if( ! $this->_data_migrations_ran ){ |
|
228 | + public function get_data_migrations_ran() { |
|
229 | + if ( ! $this->_data_migrations_ran) { |
|
230 | 230 | //setup autoloaders for each of the scripts in there |
231 | 231 | $this->get_all_data_migration_scripts_available(); |
232 | - $data_migrations_options = $this->get_all_migration_script_options();//get_option(EE_Data_Migration_Manager::data_migrations_option_name,get_option('espresso_data_migrations',array())); |
|
232 | + $data_migrations_options = $this->get_all_migration_script_options(); //get_option(EE_Data_Migration_Manager::data_migrations_option_name,get_option('espresso_data_migrations',array())); |
|
233 | 233 | |
234 | 234 | $data_migrations_ran = array(); |
235 | 235 | //convert into data migration script classes where possible |
236 | - foreach($data_migrations_options as $data_migration_option){ |
|
237 | - list($plugin_slug,$version_string) = $this->_get_plugin_slug_and_version_string_from_dms_option_name($data_migration_option['option_name']); |
|
236 | + foreach ($data_migrations_options as $data_migration_option) { |
|
237 | + list($plugin_slug, $version_string) = $this->_get_plugin_slug_and_version_string_from_dms_option_name($data_migration_option['option_name']); |
|
238 | 238 | |
239 | - try{ |
|
240 | - $class = $this->_get_dms_class_from_wp_option($data_migration_option['option_name'],$data_migration_option['option_value']); |
|
239 | + try { |
|
240 | + $class = $this->_get_dms_class_from_wp_option($data_migration_option['option_name'], $data_migration_option['option_value']); |
|
241 | 241 | $data_migrations_ran[$plugin_slug][$version_string] = $class; |
242 | 242 | //ok so far THIS is the 'last-ran-script'... unless we find another on next iteration |
243 | 243 | $this->_last_ran_script = $class; |
244 | - if( ! $class->is_completed()){ |
|
244 | + if ( ! $class->is_completed()) { |
|
245 | 245 | //sometimes we also like to know which was the last incomplete script (or if there are any at all) |
246 | 246 | $this->_last_ran_incomplete_script = $class; |
247 | 247 | } |
248 | - }catch(EE_Error $e){ |
|
248 | + } catch (EE_Error $e) { |
|
249 | 249 | //ok so its not a DMS. We'll just keep it, although other code will need to expect non-DMSs |
250 | 250 | $data_migrations_ran[$plugin_slug][$version_string] = maybe_unserialize($data_migration_option['option_value']); |
251 | 251 | } |
252 | 252 | } |
253 | 253 | //so here the array of $data_migrations_ran is actually a mix of classes and a few legacy arrays |
254 | 254 | $this->_data_migrations_ran = $data_migrations_ran; |
255 | - if ( ! $this->_data_migrations_ran || ! is_array($this->_data_migrations_ran) ){ |
|
255 | + if ( ! $this->_data_migrations_ran || ! is_array($this->_data_migrations_ran)) { |
|
256 | 256 | $this->_data_migrations_ran = array(); |
257 | 257 | } |
258 | 258 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * @param $new_table |
270 | 270 | * @return mixed string or int |
271 | 271 | */ |
272 | - public function get_mapping_new_pk( $script_name, $old_table, $old_pk, $new_table){ |
|
272 | + public function get_mapping_new_pk($script_name, $old_table, $old_pk, $new_table) { |
|
273 | 273 | $script = EE_Registry::instance()->load_dms($script_name); |
274 | 274 | $mapping = $script->get_mapping_new_pk($old_table, $old_pk, $new_table); |
275 | 275 | return $mapping; |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | * option returned in this array is the most-recently ran DMS option |
281 | 281 | * @return array |
282 | 282 | */ |
283 | - public function get_all_migration_script_options(){ |
|
283 | + public function get_all_migration_script_options() { |
|
284 | 284 | global $wpdb; |
285 | - return $wpdb->get_results("SELECT * FROM {$wpdb->options} WHERE option_name like '".EE_Data_Migration_Manager::data_migration_script_option_prefix."%' ORDER BY option_id ASC",ARRAY_A); |
|
285 | + return $wpdb->get_results("SELECT * FROM {$wpdb->options} WHERE option_name like '".EE_Data_Migration_Manager::data_migration_script_option_prefix."%' ORDER BY option_id ASC", ARRAY_A); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | /** |
@@ -290,8 +290,8 @@ discard block |
||
290 | 290 | * @return array where each value is the full folder path of a folder containing data migration scripts, WITH slashes at the end of the |
291 | 291 | * folder name. |
292 | 292 | */ |
293 | - public function get_data_migration_script_folders(){ |
|
294 | - return apply_filters( 'FHEE__EE_Data_Migration_Manager__get_data_migration_script_folders',array(EE_CORE.'data_migration_scripts') ); |
|
293 | + public function get_data_migration_script_folders() { |
|
294 | + return apply_filters('FHEE__EE_Data_Migration_Manager__get_data_migration_script_folders', array(EE_CORE.'data_migration_scripts')); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -303,11 +303,11 @@ discard block |
||
303 | 303 | * } |
304 | 304 | * @throws EE_Error |
305 | 305 | */ |
306 | - public function script_migrates_to_version($migration_script_name){ |
|
306 | + public function script_migrates_to_version($migration_script_name) { |
|
307 | 307 | $dms_info = $this->parse_dms_classname($migration_script_name); |
308 | 308 | return array( |
309 | - 'slug'=> $dms_info[ 'slug' ], |
|
310 | - 'version'=> $dms_info[ 'major_version' ] . "." . $dms_info[ 'minor_version' ] . "." . $dms_info[ 'micro_version' ] ); |
|
309 | + 'slug'=> $dms_info['slug'], |
|
310 | + 'version'=> $dms_info['major_version'].".".$dms_info['minor_version'].".".$dms_info['micro_version'] ); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -316,13 +316,13 @@ discard block |
||
316 | 316 | * @return array with keys 'slug','major_version','minor_version', and 'micro_version' (the last 3 are ints) |
317 | 317 | * @throws EE_Error |
318 | 318 | */ |
319 | - public function parse_dms_classname($classname){ |
|
319 | + public function parse_dms_classname($classname) { |
|
320 | 320 | $matches = array(); |
321 | - preg_match('~EE_DMS_(.*)_([0-9]*)_([0-9]*)_([0-9]*)~',$classname,$matches); |
|
322 | - if( ! $matches || ! (isset($matches[1]) && isset($matches[2]) && isset($matches[3]))){ |
|
323 | - throw new EE_Error(sprintf(__("%s is not a valid Data Migration Script. The classname should be like EE_DMS_w_x_y_z, where w is either 'Core' or the slug of an addon and x, y and z are numbers, ", "event_espresso"),$classname)); |
|
321 | + preg_match('~EE_DMS_(.*)_([0-9]*)_([0-9]*)_([0-9]*)~', $classname, $matches); |
|
322 | + if ( ! $matches || ! (isset($matches[1]) && isset($matches[2]) && isset($matches[3]))) { |
|
323 | + throw new EE_Error(sprintf(__("%s is not a valid Data Migration Script. The classname should be like EE_DMS_w_x_y_z, where w is either 'Core' or the slug of an addon and x, y and z are numbers, ", "event_espresso"), $classname)); |
|
324 | 324 | } |
325 | - return array('slug'=>$matches[1],'major_version'=>intval($matches[2]),'minor_version'=>intval($matches[3]),'micro_version'=>intval($matches[4])); |
|
325 | + return array('slug'=>$matches[1], 'major_version'=>intval($matches[2]), 'minor_version'=>intval($matches[3]), 'micro_version'=>intval($matches[4])); |
|
326 | 326 | } |
327 | 327 | /** |
328 | 328 | * Ensures that the option indicating the current DB version is set. This should only be |
@@ -331,33 +331,33 @@ discard block |
||
331 | 331 | * to 4.1.x. |
332 | 332 | * @return string of current db state |
333 | 333 | */ |
334 | - public function ensure_current_database_state_is_set(){ |
|
335 | - $espresso_db_core_updates = get_option( 'espresso_db_update', array() ); |
|
334 | + public function ensure_current_database_state_is_set() { |
|
335 | + $espresso_db_core_updates = get_option('espresso_db_update', array()); |
|
336 | 336 | $db_state = get_option(EE_Data_Migration_Manager::current_database_state); |
337 | - if( ! $db_state ){ |
|
337 | + if ( ! $db_state) { |
|
338 | 338 | //mark the DB as being in the state as the last version in there. |
339 | 339 | //this is done to trigger maintenance mode and do data migration scripts |
340 | 340 | //if the admin installed this version of EE over 3.1.x or 4.0.x |
341 | 341 | //otherwise, the normal maintenance mode code is fine |
342 | 342 | $previous_versions_installed = array_keys($espresso_db_core_updates); |
343 | 343 | $previous_version_installed = end($previous_versions_installed); |
344 | - if(version_compare('4.1.0', $previous_version_installed)){ |
|
344 | + if (version_compare('4.1.0', $previous_version_installed)) { |
|
345 | 345 | //last installed version was less than 4.1 |
346 | 346 | //so we want the data migrations to happen. SO, we're going to say the DB is at that state |
347 | 347 | // echo "4.1.0 is greater than $previous_version_installed! update the option"; |
348 | 348 | $db_state = array('Core'=>$previous_version_installed); |
349 | - }else{ |
|
349 | + } else { |
|
350 | 350 | // echo "4.1.0 is SMALLER than $previous_version_installed"; |
351 | 351 | $db_state = array('Core'=>EVENT_ESPRESSO_VERSION); |
352 | 352 | } |
353 | - update_option(EE_Data_Migration_Manager::current_database_state,$db_state); |
|
353 | + update_option(EE_Data_Migration_Manager::current_database_state, $db_state); |
|
354 | 354 | } |
355 | 355 | //in 4.1, $db_state would have only been a simple string like '4.1.0', |
356 | 356 | //but in 4.2+ it should be an array with at least key 'Core' and the value of that plugin's |
357 | 357 | //db, and possibly other keys for other addons like 'Calendar','Permissions',etc |
358 | - if( ! is_array($db_state)){ |
|
358 | + if ( ! is_array($db_state)) { |
|
359 | 359 | $db_state = array('Core'=>$db_state); |
360 | - update_option(EE_Data_Migration_Manager::current_database_state,$db_state); |
|
360 | + update_option(EE_Data_Migration_Manager::current_database_state, $db_state); |
|
361 | 361 | } |
362 | 362 | return $db_state; |
363 | 363 | } |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * or they don't apply), returns an empty array |
369 | 369 | * @return EE_Data_Migration_Script_Base[] |
370 | 370 | */ |
371 | - public function check_for_applicable_data_migration_scripts(){ |
|
371 | + public function check_for_applicable_data_migration_scripts() { |
|
372 | 372 | //get the option describing what options have already run |
373 | 373 | $scripts_ran = $this->get_data_migrations_ran(); |
374 | 374 | //$scripts_ran = array('4.1.0.core'=>array('monkey'=>null)); |
@@ -381,62 +381,62 @@ discard block |
||
381 | 381 | $iteration = 0; |
382 | 382 | $next_database_state_to_consider = $current_database_state; |
383 | 383 | $theoretical_database_state = NULL; |
384 | - do{ |
|
384 | + do { |
|
385 | 385 | //the next state after the currently-considered one will start off looking the same as the current, but we may make additions... |
386 | 386 | $theoretical_database_state = $next_database_state_to_consider; |
387 | 387 | //the next db state to consider is "what would the DB be like had we run all the scripts we found that applied last time?) |
388 | - foreach($script_class_and_filepaths_available as $classname => $filepath){ |
|
388 | + foreach ($script_class_and_filepaths_available as $classname => $filepath) { |
|
389 | 389 | |
390 | 390 | $migrates_to_version = $this->script_migrates_to_version($classname); |
391 | - $script_converts_plugin_slug = $migrates_to_version[ 'slug' ]; |
|
392 | - $script_converts_to_version = $migrates_to_version[ 'version' ]; |
|
391 | + $script_converts_plugin_slug = $migrates_to_version['slug']; |
|
392 | + $script_converts_to_version = $migrates_to_version['version']; |
|
393 | 393 | //check if this version script is DONE or not; or if it's never been ran |
394 | - if( ! $scripts_ran || |
|
394 | + if ( ! $scripts_ran || |
|
395 | 395 | ! isset($scripts_ran[$script_converts_plugin_slug]) || |
396 | - ! isset($scripts_ran[$script_converts_plugin_slug][$script_converts_to_version])){ |
|
396 | + ! isset($scripts_ran[$script_converts_plugin_slug][$script_converts_to_version])) { |
|
397 | 397 | //we haven't ran this conversion script before |
398 | 398 | //now check if it applies... note that we've added an autoloader for it on get_all_data_migration_scripts_available |
399 | 399 | $script = new $classname; |
400 | 400 | /* @var $script EE_Data_Migration_Script_Base */ |
401 | 401 | $can_migrate = $script->can_migrate_from_version($theoretical_database_state); |
402 | - if($can_migrate){ |
|
402 | + if ($can_migrate) { |
|
403 | 403 | $script_classes_that_should_run_per_iteration[$iteration][$script->priority()][] = $script; |
404 | 404 | $migrates_to_version = $script->migrates_to_version(); |
405 | - $next_database_state_to_consider[ $migrates_to_version[ 'slug' ] ] = $migrates_to_version[ 'version' ]; |
|
405 | + $next_database_state_to_consider[$migrates_to_version['slug']] = $migrates_to_version['version']; |
|
406 | 406 | unset($script_class_and_filepaths_available[$classname]); |
407 | 407 | } |
408 | - } elseif($scripts_ran[$script_converts_plugin_slug][$script_converts_to_version] instanceof EE_Data_Migration_Script_Base){ |
|
408 | + } elseif ($scripts_ran[$script_converts_plugin_slug][$script_converts_to_version] instanceof EE_Data_Migration_Script_Base) { |
|
409 | 409 | //this script has been ran, or at least started |
410 | 410 | $script = $scripts_ran[$script_converts_plugin_slug][$script_converts_to_version]; |
411 | - if( $script->get_status() != self::status_completed){ |
|
411 | + if ($script->get_status() != self::status_completed) { |
|
412 | 412 | //this script is already underway... keep going with it |
413 | 413 | $script_classes_that_should_run_per_iteration[$iteration][$script->priority()][] = $script; |
414 | 414 | $migrates_to_version = $script->migrates_to_version(); |
415 | - $next_database_state_to_consider[ $migrates_to_version[ 'slug' ] ] = $migrates_to_version[ 'version' ]; |
|
415 | + $next_database_state_to_consider[$migrates_to_version['slug']] = $migrates_to_version['version']; |
|
416 | 416 | unset($script_class_and_filepaths_available[$classname]); |
417 | - }else{ |
|
417 | + } else { |
|
418 | 418 | //it must have a status that indicates it has finished, so we don't want to try and run it again |
419 | 419 | } |
420 | - }else{ |
|
420 | + } else { |
|
421 | 421 | //it exists but it's not a proper data migration script |
422 | 422 | //maybe the script got renamed? or was simply removed from EE? |
423 | 423 | //either way, its certainly not runnable! |
424 | 424 | } |
425 | 425 | } |
426 | 426 | $iteration++; |
427 | - }while( $next_database_state_to_consider != $theoretical_database_state && $iteration<6); |
|
427 | + }while ($next_database_state_to_consider != $theoretical_database_state && $iteration < 6); |
|
428 | 428 | //ok we have all the scripts that should run, now let's make them into flat array |
429 | 429 | $scripts_that_should_run = array(); |
430 | - foreach($script_classes_that_should_run_per_iteration as $scripts_at_priority){ |
|
430 | + foreach ($script_classes_that_should_run_per_iteration as $scripts_at_priority) { |
|
431 | 431 | ksort($scripts_at_priority); |
432 | - foreach($scripts_at_priority as $scripts){ |
|
433 | - foreach($scripts as $script){ |
|
432 | + foreach ($scripts_at_priority as $scripts) { |
|
433 | + foreach ($scripts as $script) { |
|
434 | 434 | $scripts_that_should_run[get_class($script)] = $script; |
435 | 435 | } |
436 | 436 | } |
437 | 437 | } |
438 | 438 | |
439 | - do_action( 'AHEE__EE_Data_Migration_Manager__check_for_applicable_data_migration_scripts__scripts_that_should_run', $scripts_that_should_run ); |
|
439 | + do_action('AHEE__EE_Data_Migration_Manager__check_for_applicable_data_migration_scripts__scripts_that_should_run', $scripts_that_should_run); |
|
440 | 440 | return $scripts_that_should_run; |
441 | 441 | } |
442 | 442 | |
@@ -450,14 +450,14 @@ discard block |
||
450 | 450 | * @param bool $include_completed_scripts |
451 | 451 | * @return EE_Data_Migration_Script_Base |
452 | 452 | */ |
453 | - public function get_last_ran_script($include_completed_scripts = false){ |
|
453 | + public function get_last_ran_script($include_completed_scripts = false) { |
|
454 | 454 | //make sure we've setup the class properties _last_ran_script and _last_ran_incomplete_script |
455 | - if( ! $this->_data_migrations_ran){ |
|
455 | + if ( ! $this->_data_migrations_ran) { |
|
456 | 456 | $this->get_data_migrations_ran(); |
457 | 457 | } |
458 | - if($include_completed_scripts){ |
|
458 | + if ($include_completed_scripts) { |
|
459 | 459 | return $this->_last_ran_script; |
460 | - }else{ |
|
460 | + } else { |
|
461 | 461 | return $this->_last_ran_incomplete_script; |
462 | 462 | } |
463 | 463 | } |
@@ -480,19 +480,19 @@ discard block |
||
480 | 480 | * @type string $message string describing what was done during this step |
481 | 481 | * } |
482 | 482 | */ |
483 | - public function migration_step( $step_size = 0 ){ |
|
483 | + public function migration_step($step_size = 0) { |
|
484 | 484 | |
485 | 485 | //bandaid fix for issue https://events.codebasehq.com/projects/event-espresso/tickets/7535 |
486 | - if ( class_exists( 'EE_CPT_Strategy' ) ) { |
|
487 | - remove_action( 'pre_get_posts', array( EE_CPT_Strategy::instance(), 'pre_get_posts' ), 5 ); |
|
486 | + if (class_exists('EE_CPT_Strategy')) { |
|
487 | + remove_action('pre_get_posts', array(EE_CPT_Strategy::instance(), 'pre_get_posts'), 5); |
|
488 | 488 | } |
489 | 489 | |
490 | - try{ |
|
490 | + try { |
|
491 | 491 | $currently_executing_script = $this->get_last_ran_script(); |
492 | - if( ! $currently_executing_script){ |
|
492 | + if ( ! $currently_executing_script) { |
|
493 | 493 | //Find the next script that needs to execute |
494 | 494 | $scripts = $this->check_for_applicable_data_migration_scripts(); |
495 | - if( ! $scripts ){ |
|
495 | + if ( ! $scripts) { |
|
496 | 496 | //huh, no more scripts to run... apparently we're done! |
497 | 497 | //but dont forget to make sure initial data is there |
498 | 498 | //we should be good to allow them to exit maintenance mode now |
@@ -513,18 +513,18 @@ discard block |
||
513 | 513 | //and add to the array/wp option showing the scripts ran |
514 | 514 | // $this->_data_migrations_ran[$this->script_migrates_to_version(get_class($currently_executing_script))] = $currently_executing_script; |
515 | 515 | $migrates_to = $this->script_migrates_to_version(get_class($currently_executing_script)); |
516 | - $plugin_slug = $migrates_to[ 'slug' ]; |
|
517 | - $version = $migrates_to[ 'version' ]; |
|
516 | + $plugin_slug = $migrates_to['slug']; |
|
517 | + $version = $migrates_to['version']; |
|
518 | 518 | $this->_data_migrations_ran[$plugin_slug][$version] = $currently_executing_script; |
519 | 519 | } |
520 | 520 | $current_script_name = get_class($currently_executing_script); |
521 | - }catch(Exception $e){ |
|
521 | + } catch (Exception $e) { |
|
522 | 522 | //an exception occurred while trying to get migration scripts |
523 | 523 | |
524 | - $message = sprintf( __("Error Message: %sStack Trace:%s", "event_espresso"), $e->getMessage() . '<br>', $e->getTraceAsString() ); |
|
524 | + $message = sprintf(__("Error Message: %sStack Trace:%s", "event_espresso"), $e->getMessage().'<br>', $e->getTraceAsString()); |
|
525 | 525 | //record it on the array of data migration scripts ran. This will be overwritten next time we try and try to run data migrations |
526 | 526 | //but that's ok-- it's just an FYI to support that we couldn't even run any data migrations |
527 | - $this->add_error_to_migrations_ran(sprintf(__("Could not run data migrations because: %s", "event_espresso"),$message)); |
|
527 | + $this->add_error_to_migrations_ran(sprintf(__("Could not run data migrations because: %s", "event_espresso"), $message)); |
|
528 | 528 | return array( |
529 | 529 | 'records_to_migrate'=>1, |
530 | 530 | 'records_migrated'=>0, |
@@ -534,16 +534,16 @@ discard block |
||
534 | 534 | ); |
535 | 535 | } |
536 | 536 | //ok so we definitely have a data migration script |
537 | - try{ |
|
537 | + try { |
|
538 | 538 | //how big of a bite do we want to take? Allow users to easily override via their wp-config |
539 | - if( ! absint( $step_size ) > 0 ){ |
|
540 | - $step_size = defined( 'EE_MIGRATION_STEP_SIZE' ) && absint( EE_MIGRATION_STEP_SIZE ) ? EE_MIGRATION_STEP_SIZE : EE_Data_Migration_Manager::step_size; |
|
539 | + if ( ! absint($step_size) > 0) { |
|
540 | + $step_size = defined('EE_MIGRATION_STEP_SIZE') && absint(EE_MIGRATION_STEP_SIZE) ? EE_MIGRATION_STEP_SIZE : EE_Data_Migration_Manager::step_size; |
|
541 | 541 | } |
542 | 542 | //do what we came to do! |
543 | 543 | $currently_executing_script->migration_step($step_size); |
544 | 544 | //can we wrap it up and verify default data? |
545 | 545 | $init_dbs = false; |
546 | - switch($currently_executing_script->get_status()){ |
|
546 | + switch ($currently_executing_script->get_status()) { |
|
547 | 547 | case EE_Data_Migration_Manager::status_continue: |
548 | 548 | $response_array = array( |
549 | 549 | 'records_to_migrate'=>$currently_executing_script->count_records_to_migrate(), |
@@ -555,16 +555,16 @@ discard block |
||
555 | 555 | case EE_Data_Migration_Manager::status_completed: |
556 | 556 | //ok so THAT script has completed |
557 | 557 | $this->update_current_database_state_to($this->script_migrates_to_version($current_script_name)); |
558 | - $response_array = array( |
|
558 | + $response_array = array( |
|
559 | 559 | 'records_to_migrate'=>$currently_executing_script->count_records_to_migrate(), |
560 | 560 | 'records_migrated'=>$currently_executing_script->count_records_migrated(), |
561 | 561 | 'status'=> EE_Data_Migration_Manager::status_completed, |
562 | 562 | 'message'=>$currently_executing_script->get_feedback_message(), |
563 | - 'script'=> sprintf(__("%s Completed",'event_espresso'),$currently_executing_script->pretty_name()) |
|
563 | + 'script'=> sprintf(__("%s Completed", 'event_espresso'), $currently_executing_script->pretty_name()) |
|
564 | 564 | ); |
565 | 565 | //check if there are any more after this one. |
566 | 566 | $scripts_remaining = $this->check_for_applicable_data_migration_scripts(); |
567 | - if( ! $scripts_remaining ){ |
|
567 | + if ( ! $scripts_remaining) { |
|
568 | 568 | //we should be good to allow them to exit maintenance mode now |
569 | 569 | EE_Maintenance_Mode::instance()->set_maintenance_level(intval(EE_Maintenance_Mode::level_0_not_in_maintenance)); |
570 | 570 | ////huh, no more scripts to run... apparently we're done! |
@@ -578,39 +578,39 @@ discard block |
||
578 | 578 | 'records_to_migrate'=>$currently_executing_script->count_records_to_migrate(), |
579 | 579 | 'records_migrated'=>$currently_executing_script->count_records_migrated(), |
580 | 580 | 'status'=> $currently_executing_script->get_status(), |
581 | - 'message'=> sprintf(__("Minor errors occurred during %s: %s", "event_espresso"), $currently_executing_script->pretty_name(), implode(", ",$currently_executing_script->get_errors())), |
|
581 | + 'message'=> sprintf(__("Minor errors occurred during %s: %s", "event_espresso"), $currently_executing_script->pretty_name(), implode(", ", $currently_executing_script->get_errors())), |
|
582 | 582 | 'script'=>$currently_executing_script->pretty_name() |
583 | 583 | ); |
584 | 584 | break; |
585 | 585 | } |
586 | - }catch(Exception $e){ |
|
586 | + } catch (Exception $e) { |
|
587 | 587 | //ok so some exception was thrown which killed the data migration script |
588 | 588 | //double-check we have a real script |
589 | - if($currently_executing_script instanceof EE_Data_Migration_Script_Base){ |
|
589 | + if ($currently_executing_script instanceof EE_Data_Migration_Script_Base) { |
|
590 | 590 | $script_name = $currently_executing_script->pretty_name(); |
591 | 591 | $currently_executing_script->set_broken(); |
592 | 592 | $currently_executing_script->add_error($e->getMessage()); |
593 | - }else{ |
|
593 | + } else { |
|
594 | 594 | $script_name = __("Error getting Migration Script", "event_espresso"); |
595 | 595 | } |
596 | 596 | $response_array = array( |
597 | 597 | 'records_to_migrate'=>1, |
598 | 598 | 'records_migrated'=>0, |
599 | 599 | 'status'=>self::status_fatal_error, |
600 | - 'message'=> sprintf(__("A fatal error occurred during the migration: %s", "event_espresso"),$e->getMessage()), |
|
600 | + 'message'=> sprintf(__("A fatal error occurred during the migration: %s", "event_espresso"), $e->getMessage()), |
|
601 | 601 | 'script'=>$script_name |
602 | 602 | ); |
603 | 603 | } |
604 | 604 | $successful_save = $this->_save_migrations_ran(); |
605 | - if($successful_save !== TRUE){ |
|
605 | + if ($successful_save !== TRUE) { |
|
606 | 606 | //ok so the current wp option didn't save. that's tricky, because we'd like to update it |
607 | 607 | //and mark it as having a fatal error, but remember- WE CAN'T SAVE THIS WP OPTION! |
608 | 608 | //however, if we throw an exception, and return that, then the next request |
609 | 609 | //won't have as much info in it, and it may be able to save |
610 | - throw new EE_Error(sprintf(__("The error '%s' occurred updating the status of the migration. This is a FATAL ERROR, but the error is preventing the system from remembering that. Please contact event espresso support.", "event_espresso"),$successful_save)); |
|
610 | + throw new EE_Error(sprintf(__("The error '%s' occurred updating the status of the migration. This is a FATAL ERROR, but the error is preventing the system from remembering that. Please contact event espresso support.", "event_espresso"), $successful_save)); |
|
611 | 611 | } |
612 | 612 | //if we're all done, initialize EE plugins' default data etc. |
613 | - if( $init_dbs ) { |
|
613 | + if ($init_dbs) { |
|
614 | 614 | $this->initialize_db_for_enqueued_ee_plugins(); |
615 | 615 | } |
616 | 616 | return $response_array; |
@@ -628,23 +628,23 @@ discard block |
||
628 | 628 | * 'message'=>a string, containing any message you want to show to the user. We may decide to split this up into errors, notifications, and successes |
629 | 629 | * 'script'=>a pretty name of the script currently running |
630 | 630 | */ |
631 | - public function response_to_migration_ajax_request(){ |
|
631 | + public function response_to_migration_ajax_request() { |
|
632 | 632 | // //start output buffer just to make sure we don't mess up the json |
633 | 633 | ob_start(); |
634 | - try{ |
|
634 | + try { |
|
635 | 635 | $response = $this->migration_step(); |
636 | - }catch(Exception $e){ |
|
636 | + } catch (Exception $e) { |
|
637 | 637 | $response = array( |
638 | 638 | 'records_to_migrate'=>0, |
639 | 639 | 'records_migrated'=>0, |
640 | 640 | 'status'=> EE_Data_Migration_Manager::status_fatal_error, |
641 | - 'message'=> sprintf(__("Unknown fatal error occurred: %s", "event_espresso"),$e->getMessage()), |
|
641 | + 'message'=> sprintf(__("Unknown fatal error occurred: %s", "event_espresso"), $e->getMessage()), |
|
642 | 642 | 'script'=>'Unknown'); |
643 | 643 | $this->add_error_to_migrations_ran($e->getMessage()."; Stack trace:".$e->getTraceAsString()); |
644 | 644 | } |
645 | 645 | $warnings_etc = @ob_get_contents(); |
646 | 646 | ob_end_clean(); |
647 | - $response['message'] .=$warnings_etc; |
|
647 | + $response['message'] .= $warnings_etc; |
|
648 | 648 | return $response; |
649 | 649 | } |
650 | 650 | |
@@ -657,14 +657,14 @@ discard block |
||
657 | 657 | * } |
658 | 658 | * @return void |
659 | 659 | */ |
660 | - public function update_current_database_state_to($slug_and_version = null){ |
|
661 | - if( ! $slug_and_version ){ |
|
660 | + public function update_current_database_state_to($slug_and_version = null) { |
|
661 | + if ( ! $slug_and_version) { |
|
662 | 662 | //no version was provided, assume it should be at the current code version |
663 | 663 | $slug_and_version = array('slug' => 'Core', 'version' => espresso_version()); |
664 | 664 | } |
665 | 665 | $current_database_state = get_option(self::current_database_state); |
666 | - $current_database_state[ $slug_and_version[ 'slug' ] ]=$slug_and_version[ 'version' ]; |
|
667 | - update_option(self::current_database_state,$current_database_state); |
|
666 | + $current_database_state[$slug_and_version['slug']] = $slug_and_version['version']; |
|
667 | + update_option(self::current_database_state, $current_database_state); |
|
668 | 668 | } |
669 | 669 | |
670 | 670 | /** |
@@ -675,20 +675,20 @@ discard block |
||
675 | 675 | * } |
676 | 676 | * @return boolean |
677 | 677 | */ |
678 | - public function database_needs_updating_to( $slug_and_version ) { |
|
678 | + public function database_needs_updating_to($slug_and_version) { |
|
679 | 679 | |
680 | - $slug = $slug_and_version[ 'slug' ]; |
|
681 | - $version = $slug_and_version[ 'version' ]; |
|
680 | + $slug = $slug_and_version['slug']; |
|
681 | + $version = $slug_and_version['version']; |
|
682 | 682 | $current_database_state = get_option(self::current_database_state); |
683 | - if( ! isset( $current_database_state[ $slug ] ) ) { |
|
683 | + if ( ! isset($current_database_state[$slug])) { |
|
684 | 684 | return true; |
685 | - }else{ |
|
685 | + } else { |
|
686 | 686 | //just compare the first 3 parts of version string, eg "4.7.1", not "4.7.1.dev.032" because DBs shouldn't change on nano version changes |
687 | - $version_parts_current_db_state = array_slice( explode('.', $current_database_state[ $slug ] ), 0, 3); |
|
688 | - $version_parts_of_provided_db_state = array_slice( explode( '.', $version ), 0, 3 ); |
|
687 | + $version_parts_current_db_state = array_slice(explode('.', $current_database_state[$slug]), 0, 3); |
|
688 | + $version_parts_of_provided_db_state = array_slice(explode('.', $version), 0, 3); |
|
689 | 689 | $needs_updating = false; |
690 | - foreach($version_parts_current_db_state as $offset => $version_part_in_current_db_state ) { |
|
691 | - if( $version_part_in_current_db_state < $version_parts_of_provided_db_state[ $offset ] ) { |
|
690 | + foreach ($version_parts_current_db_state as $offset => $version_part_in_current_db_state) { |
|
691 | + if ($version_part_in_current_db_state < $version_parts_of_provided_db_state[$offset]) { |
|
692 | 692 | $needs_updating = true; |
693 | 693 | break; |
694 | 694 | } |
@@ -702,29 +702,29 @@ discard block |
||
702 | 702 | * in addons. Has the side effect of adding them for autoloading |
703 | 703 | * @return array keys are expected classnames, values are their filepaths |
704 | 704 | */ |
705 | - public function get_all_data_migration_scripts_available(){ |
|
706 | - if( ! $this->_data_migration_class_to_filepath_map){ |
|
705 | + public function get_all_data_migration_scripts_available() { |
|
706 | + if ( ! $this->_data_migration_class_to_filepath_map) { |
|
707 | 707 | $this->_data_migration_class_to_filepath_map = array(); |
708 | - foreach($this->get_data_migration_script_folders() as $folder_path){ |
|
709 | - if($folder_path[count($folder_path-1)] != DS ){ |
|
710 | - $folder_path.= DS; |
|
708 | + foreach ($this->get_data_migration_script_folders() as $folder_path) { |
|
709 | + if ($folder_path[count($folder_path - 1)] != DS) { |
|
710 | + $folder_path .= DS; |
|
711 | 711 | } |
712 | - $files = glob( $folder_path. '*.dms.php' ); |
|
712 | + $files = glob($folder_path.'*.dms.php'); |
|
713 | 713 | |
714 | - if ( empty( $files ) ) { |
|
714 | + if (empty($files)) { |
|
715 | 715 | continue; |
716 | 716 | } |
717 | 717 | |
718 | - foreach($files as $file){ |
|
719 | - $pos_of_last_slash = strrpos($file,DS); |
|
720 | - $classname = str_replace(".dms.php","", substr($file, $pos_of_last_slash+1)); |
|
721 | - $migrates_to = $this->script_migrates_to_version( $classname ); |
|
722 | - $slug = $migrates_to[ 'slug' ]; |
|
718 | + foreach ($files as $file) { |
|
719 | + $pos_of_last_slash = strrpos($file, DS); |
|
720 | + $classname = str_replace(".dms.php", "", substr($file, $pos_of_last_slash + 1)); |
|
721 | + $migrates_to = $this->script_migrates_to_version($classname); |
|
722 | + $slug = $migrates_to['slug']; |
|
723 | 723 | //check that the slug as contained in the DMS is associated with |
724 | 724 | //the slug of an addon or core |
725 | - if( $slug != 'Core' ){ |
|
726 | - if( ! EE_Registry::instance()->get_addon_by_name( $slug ) ) { |
|
727 | - EE_Error::doing_it_wrong(__FUNCTION__, sprintf( __( 'The data migration script "%s" migrates the "%s" data, but there is no EE addon with that name. There is only: %s. ', 'event_espresso' ),$classname,$slug,implode(",", array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ), '4.3.0.alpha.019' ); |
|
725 | + if ($slug != 'Core') { |
|
726 | + if ( ! EE_Registry::instance()->get_addon_by_name($slug)) { |
|
727 | + EE_Error::doing_it_wrong(__FUNCTION__, sprintf(__('The data migration script "%s" migrates the "%s" data, but there is no EE addon with that name. There is only: %s. ', 'event_espresso'), $classname, $slug, implode(",", array_keys(EE_Registry::instance()->get_addons_by_name()))), '4.3.0.alpha.019'); |
|
728 | 728 | } |
729 | 729 | } |
730 | 730 | $this->_data_migration_class_to_filepath_map[$classname] = $file; |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | * from each addon, and check if they need updating, |
745 | 745 | * @return boolean |
746 | 746 | */ |
747 | - public function addons_need_updating(){ |
|
747 | + public function addons_need_updating() { |
|
748 | 748 | return false; |
749 | 749 | } |
750 | 750 | /** |
@@ -753,25 +753,25 @@ discard block |
||
753 | 753 | * @param string $error_message |
754 | 754 | * @throws EE_Error |
755 | 755 | */ |
756 | - public function add_error_to_migrations_ran($error_message){ |
|
756 | + public function add_error_to_migrations_ran($error_message) { |
|
757 | 757 | //get last-ran migration script |
758 | 758 | global $wpdb; |
759 | - $last_migration_script_option = $wpdb->get_row("SELECT * FROM $wpdb->options WHERE option_name like '".EE_Data_Migration_Manager::data_migration_script_option_prefix."%' ORDER BY option_id DESC LIMIT 1",ARRAY_A); |
|
759 | + $last_migration_script_option = $wpdb->get_row("SELECT * FROM $wpdb->options WHERE option_name like '".EE_Data_Migration_Manager::data_migration_script_option_prefix."%' ORDER BY option_id DESC LIMIT 1", ARRAY_A); |
|
760 | 760 | |
761 | 761 | $last_ran_migration_script_properties = isset($last_migration_script_option['option_value']) ? maybe_unserialize($last_migration_script_option['option_value']) : null; |
762 | 762 | //now, tread lightly because we're here because a FATAL non-catchable error |
763 | 763 | //was thrown last time when we were trying to run a data migration script |
764 | 764 | //so the fatal error could have happened while getting the migration script |
765 | 765 | //or doing running it... |
766 | - $versions_migrated_to = isset($last_migration_script_option['option_name']) ? str_replace(EE_Data_Migration_Manager::data_migration_script_option_prefix,"",$last_migration_script_option['option_name']) : null; |
|
766 | + $versions_migrated_to = isset($last_migration_script_option['option_name']) ? str_replace(EE_Data_Migration_Manager::data_migration_script_option_prefix, "", $last_migration_script_option['option_name']) : null; |
|
767 | 767 | |
768 | 768 | //check if it THINKS its a data migration script and especially if it's one that HASN'T finished yet |
769 | 769 | //because if it has finished, then it obviously couldn't be the cause of this error, right? (because its all done) |
770 | - if(isset($last_ran_migration_script_properties['class']) && isset($last_ran_migration_script_properties['_status']) && $last_ran_migration_script_properties['_status'] != self::status_completed){ |
|
770 | + if (isset($last_ran_migration_script_properties['class']) && isset($last_ran_migration_script_properties['_status']) && $last_ran_migration_script_properties['_status'] != self::status_completed) { |
|
771 | 771 | //ok then just add this error to its list of errors |
772 | 772 | $last_ran_migration_script_properties['_errors'][] = $error_message; |
773 | 773 | $last_ran_migration_script_properties['_status'] = self::status_fatal_error; |
774 | - }else{ |
|
774 | + } else { |
|
775 | 775 | //so we don't even know which script was last running |
776 | 776 | //use the data migration error stub, which is designed specifically for this type of thing |
777 | 777 | $general_migration_error = new EE_DMS_Unknown_1_0_0(); |
@@ -781,39 +781,39 @@ discard block |
||
781 | 781 | $versions_migrated_to = 'Unknown.1.0.0'; |
782 | 782 | //now just to make sure appears as last (in case the were previously a fatal error like this) |
783 | 783 | //delete the old one |
784 | - delete_option( self::data_migration_script_option_prefix . $versions_migrated_to ); |
|
784 | + delete_option(self::data_migration_script_option_prefix.$versions_migrated_to); |
|
785 | 785 | } |
786 | - update_option(self::data_migration_script_option_prefix.$versions_migrated_to,$last_ran_migration_script_properties); |
|
786 | + update_option(self::data_migration_script_option_prefix.$versions_migrated_to, $last_ran_migration_script_properties); |
|
787 | 787 | |
788 | 788 | } |
789 | 789 | /** |
790 | 790 | * saves what data migrations have ran to the database |
791 | 791 | * @return mixed TRUE if successfully saved migrations ran, string if an error occurred |
792 | 792 | */ |
793 | - protected function _save_migrations_ran(){ |
|
794 | - if($this->_data_migrations_ran == null){ |
|
793 | + protected function _save_migrations_ran() { |
|
794 | + if ($this->_data_migrations_ran == null) { |
|
795 | 795 | $this->get_data_migrations_ran(); |
796 | 796 | } |
797 | 797 | //now, we don't want to save actual classes to the DB because that's messy |
798 | 798 | $successful_updates = true; |
799 | - foreach($this->_data_migrations_ran as $plugin_slug => $migrations_ran_for_plugin){ |
|
800 | - foreach($migrations_ran_for_plugin as $version_string => $array_or_migration_obj){ |
|
799 | + foreach ($this->_data_migrations_ran as $plugin_slug => $migrations_ran_for_plugin) { |
|
800 | + foreach ($migrations_ran_for_plugin as $version_string => $array_or_migration_obj) { |
|
801 | 801 | // echo "saving migration script to $version_string<br>"; |
802 | 802 | $plugin_slug_for_use_in_option_name = $plugin_slug."."; |
803 | 803 | $option_name = self::data_migration_script_option_prefix.$plugin_slug_for_use_in_option_name.$version_string; |
804 | 804 | $old_option_value = get_option($option_name); |
805 | - if($array_or_migration_obj instanceof EE_Data_Migration_Script_Base){ |
|
805 | + if ($array_or_migration_obj instanceof EE_Data_Migration_Script_Base) { |
|
806 | 806 | $script_array_for_saving = $array_or_migration_obj->properties_as_array(); |
807 | - if( $old_option_value != $script_array_for_saving){ |
|
808 | - $successful_updates = update_option($option_name,$script_array_for_saving); |
|
807 | + if ($old_option_value != $script_array_for_saving) { |
|
808 | + $successful_updates = update_option($option_name, $script_array_for_saving); |
|
809 | 809 | } |
810 | - }else{//we don't know what this array-thing is. So just save it as-is |
|
810 | + } else {//we don't know what this array-thing is. So just save it as-is |
|
811 | 811 | // $array_of_migrations[$version_string] = $array_or_migration_obj; |
812 | - if($old_option_value != $array_or_migration_obj){ |
|
813 | - $successful_updates = update_option($option_name,$array_or_migration_obj); |
|
812 | + if ($old_option_value != $array_or_migration_obj) { |
|
813 | + $successful_updates = update_option($option_name, $array_or_migration_obj); |
|
814 | 814 | } |
815 | 815 | } |
816 | - if( ! $successful_updates ){ |
|
816 | + if ( ! $successful_updates) { |
|
817 | 817 | global $wpdb; |
818 | 818 | return $wpdb->last_error; |
819 | 819 | } |
@@ -837,17 +837,17 @@ discard block |
||
837 | 837 | * @return EE_Data_Migration_Script_Base |
838 | 838 | * @throws EE_Error |
839 | 839 | */ |
840 | - function _instantiate_script_from_properties_array($properties_array){ |
|
841 | - if( ! isset($properties_array['class'])){ |
|
842 | - throw new EE_Error(sprintf(__("Properties array has no 'class' properties. Here's what it has: %s", "event_espresso"),implode(",",$properties_array))); |
|
840 | + function _instantiate_script_from_properties_array($properties_array) { |
|
841 | + if ( ! isset($properties_array['class'])) { |
|
842 | + throw new EE_Error(sprintf(__("Properties array has no 'class' properties. Here's what it has: %s", "event_espresso"), implode(",", $properties_array))); |
|
843 | 843 | } |
844 | 844 | $class_name = $properties_array['class']; |
845 | - if( ! class_exists($class_name)){ |
|
846 | - throw new EE_Error(sprintf(__("There is no migration script named %s", "event_espresso"),$class_name)); |
|
845 | + if ( ! class_exists($class_name)) { |
|
846 | + throw new EE_Error(sprintf(__("There is no migration script named %s", "event_espresso"), $class_name)); |
|
847 | 847 | } |
848 | 848 | $class = new $class_name; |
849 | - if( ! $class instanceof EE_Data_Migration_Script_Base){ |
|
850 | - throw new EE_Error(sprintf(__("Class '%s' is supposed to be a migration script. Its not, its a '%s'", "event_espresso"),$class_name,get_class($class))); |
|
849 | + if ( ! $class instanceof EE_Data_Migration_Script_Base) { |
|
850 | + throw new EE_Error(sprintf(__("Class '%s' is supposed to be a migration script. Its not, its a '%s'", "event_espresso"), $class_name, get_class($class))); |
|
851 | 851 | } |
852 | 852 | $class->instantiate_from_array_of_properties($properties_array); |
853 | 853 | return $class; |
@@ -859,25 +859,25 @@ discard block |
||
859 | 859 | * @param string $plugin_slug the slug for the ee plugin we are searching for. Default is 'Core' |
860 | 860 | * @return string |
861 | 861 | */ |
862 | - public function get_most_up_to_date_dms($plugin_slug = 'Core'){ |
|
862 | + public function get_most_up_to_date_dms($plugin_slug = 'Core') { |
|
863 | 863 | $class_to_filepath_map = $this->get_all_data_migration_scripts_available(); |
864 | 864 | $most_up_to_date_dms_classname = NULL; |
865 | - foreach($class_to_filepath_map as $classname => $filepath){ |
|
866 | - if($most_up_to_date_dms_classname === NULL){ |
|
865 | + foreach ($class_to_filepath_map as $classname => $filepath) { |
|
866 | + if ($most_up_to_date_dms_classname === NULL) { |
|
867 | 867 | $migrates_to = $this->script_migrates_to_version($classname); |
868 | - $this_plugin_slug = $migrates_to[ 'slug' ]; |
|
868 | + $this_plugin_slug = $migrates_to['slug']; |
|
869 | 869 | // $version_string = $migrates_to[ 'version' ]; |
870 | 870 | // $details = $this->parse_dms_classname($classname); |
871 | - if($this_plugin_slug == $plugin_slug){ |
|
871 | + if ($this_plugin_slug == $plugin_slug) { |
|
872 | 872 | //if it's for core, it wins |
873 | 873 | $most_up_to_date_dms_classname = $classname; |
874 | 874 | } |
875 | 875 | //if it wasn't for core, we must keep searching for one that is! |
876 | 876 | continue; |
877 | - }else{ |
|
878 | - $champion_migrates_to= $this->script_migrates_to_version($most_up_to_date_dms_classname); |
|
877 | + } else { |
|
878 | + $champion_migrates_to = $this->script_migrates_to_version($most_up_to_date_dms_classname); |
|
879 | 879 | $contender_migrates_to = $this->script_migrates_to_version($classname); |
880 | - if($contender_migrates_to[ 'slug' ] == $plugin_slug && version_compare($champion_migrates_to[ 'version' ], $contender_migrates_to[ 'version' ], '<')){ |
|
880 | + if ($contender_migrates_to['slug'] == $plugin_slug && version_compare($champion_migrates_to['version'], $contender_migrates_to['version'], '<')) { |
|
881 | 881 | //so the contenders version is higher and its for Core |
882 | 882 | $most_up_to_date_dms_classname = $classname; |
883 | 883 | } |
@@ -897,11 +897,11 @@ discard block |
||
897 | 897 | * @param string $plugin_slug like 'Core', 'Mailchimp', 'Calendar', etc |
898 | 898 | * @return EE_Data_Migration_Script_Base |
899 | 899 | */ |
900 | - public function get_migration_ran( $version, $plugin_slug = 'Core' ) { |
|
900 | + public function get_migration_ran($version, $plugin_slug = 'Core') { |
|
901 | 901 | $migrations_ran = $this->get_data_migrations_ran(); |
902 | - if( isset( $migrations_ran[ $plugin_slug ] ) && isset( $migrations_ran[ $plugin_slug ][ $version ] ) ){ |
|
903 | - return $migrations_ran[ $plugin_slug ][ $version ]; |
|
904 | - }else{ |
|
902 | + if (isset($migrations_ran[$plugin_slug]) && isset($migrations_ran[$plugin_slug][$version])) { |
|
903 | + return $migrations_ran[$plugin_slug][$version]; |
|
904 | + } else { |
|
905 | 905 | return NULL; |
906 | 906 | } |
907 | 907 | } |
@@ -913,20 +913,20 @@ discard block |
||
913 | 913 | * @return bool |
914 | 914 | * @throws \EE_Error |
915 | 915 | */ |
916 | - public function reattempt(){ |
|
916 | + public function reattempt() { |
|
917 | 917 | //find if the last-ran script was borked |
918 | 918 | //set it as being non-borked (we shouldn't ever get DMSs that we don't recognize) |
919 | 919 | //add an 'error' saying that we attempted to reset |
920 | 920 | //does it have a stage that was borked too? if so make it no longer borked |
921 | 921 | //add an 'error' saying we attempted to reset |
922 | 922 | $last_ran_script = $this->get_last_ran_script(); |
923 | - if( $last_ran_script instanceof EE_DMS_Unknown_1_0_0 ){ |
|
923 | + if ($last_ran_script instanceof EE_DMS_Unknown_1_0_0) { |
|
924 | 924 | //if it was an error DMS, just mark it as complete (if another error occurs it will overwrite it) |
925 | 925 | $last_ran_script->set_completed(); |
926 | - }elseif( $last_ran_script instanceof EE_Data_Migration_Script_Base ) { |
|
926 | + }elseif ($last_ran_script instanceof EE_Data_Migration_Script_Base) { |
|
927 | 927 | $last_ran_script->reattempt(); |
928 | - }else{ |
|
929 | - throw new EE_Error( sprintf( __( 'Unable to reattempt the last ran migration script because it was not a valid migration script. || It was %s', 'event_espresso' ), print_r( $last_ran_script ) ) ); |
|
928 | + } else { |
|
929 | + throw new EE_Error(sprintf(__('Unable to reattempt the last ran migration script because it was not a valid migration script. || It was %s', 'event_espresso'), print_r($last_ran_script))); |
|
930 | 930 | } |
931 | 931 | return $this->_save_migrations_ran(); |
932 | 932 | } |
@@ -936,19 +936,19 @@ discard block |
||
936 | 936 | * @param string $plugin_slug like 'Core', 'Mailchimp', 'Calendar', etc |
937 | 937 | * @return boolean |
938 | 938 | */ |
939 | - public function migration_has_ran( $version, $plugin_slug = 'Core' ) { |
|
940 | - return $this->get_migration_ran( $version, $plugin_slug ) !== NULL; |
|
939 | + public function migration_has_ran($version, $plugin_slug = 'Core') { |
|
940 | + return $this->get_migration_ran($version, $plugin_slug) !== NULL; |
|
941 | 941 | } |
942 | 942 | /** |
943 | 943 | * Enqueues this ee plugin to have its data initialized |
944 | 944 | * @param string $plugin_slug either 'Core' or EE_Addon::name()'s return value |
945 | 945 | */ |
946 | - public function enqueue_db_initialization_for( $plugin_slug ) { |
|
946 | + public function enqueue_db_initialization_for($plugin_slug) { |
|
947 | 947 | $queue = $this->get_db_initialization_queue(); |
948 | - if( ! in_array( $plugin_slug, $queue ) ) { |
|
948 | + if ( ! in_array($plugin_slug, $queue)) { |
|
949 | 949 | $queue[] = $plugin_slug; |
950 | 950 | } |
951 | - update_option( self::db_init_queue_option_name, $queue ); |
|
951 | + update_option(self::db_init_queue_option_name, $queue); |
|
952 | 952 | } |
953 | 953 | /** |
954 | 954 | * Calls EE_Addon::initialize_db_if_no_migrations_required() on each addon |
@@ -958,26 +958,26 @@ discard block |
||
958 | 958 | public function initialize_db_for_enqueued_ee_plugins() { |
959 | 959 | // EEH_Debug_Tools::instance()->start_timer( 'initialize_db_for_enqueued_ee_plugins' ); |
960 | 960 | $queue = $this->get_db_initialization_queue(); |
961 | - foreach( $queue as $plugin_slug ) { |
|
962 | - $most_up_to_date_dms = $this->get_most_up_to_date_dms( $plugin_slug ); |
|
963 | - if( ! $most_up_to_date_dms ) { |
|
961 | + foreach ($queue as $plugin_slug) { |
|
962 | + $most_up_to_date_dms = $this->get_most_up_to_date_dms($plugin_slug); |
|
963 | + if ( ! $most_up_to_date_dms) { |
|
964 | 964 | //if there is NO DMS for this plugin, obviously there's no schema to verify anyways |
965 | 965 | $verify_db = false; |
966 | - }else{ |
|
967 | - $most_up_to_date_dms_migrates_to = $this->script_migrates_to_version( $most_up_to_date_dms ); |
|
968 | - $verify_db = $this->database_needs_updating_to( $most_up_to_date_dms_migrates_to ); |
|
966 | + } else { |
|
967 | + $most_up_to_date_dms_migrates_to = $this->script_migrates_to_version($most_up_to_date_dms); |
|
968 | + $verify_db = $this->database_needs_updating_to($most_up_to_date_dms_migrates_to); |
|
969 | 969 | } |
970 | - if( $plugin_slug == 'Core' ){ |
|
970 | + if ($plugin_slug == 'Core') { |
|
971 | 971 | EE_System::instance()->initialize_db_if_no_migrations_required( |
972 | 972 | false, |
973 | 973 | $verify_db |
974 | 974 | ); |
975 | - }else{ |
|
975 | + } else { |
|
976 | 976 | //just loop through the addons to make sure their database is setup |
977 | - foreach( EE_Registry::instance()->addons as $addon ) { |
|
978 | - if( $addon->name() == $plugin_slug ) { |
|
977 | + foreach (EE_Registry::instance()->addons as $addon) { |
|
978 | + if ($addon->name() == $plugin_slug) { |
|
979 | 979 | |
980 | - $addon->initialize_db_if_no_migrations_required( $verify_db ); |
|
980 | + $addon->initialize_db_if_no_migrations_required($verify_db); |
|
981 | 981 | break; |
982 | 982 | } |
983 | 983 | } |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | // EEH_Debug_Tools::instance()->show_times(); |
988 | 988 | //because we just initialized the DBs for the enqueued ee plugins |
989 | 989 | //we don't need to keep remembering which ones needed to be initialized |
990 | - delete_option( self::db_init_queue_option_name ); |
|
990 | + delete_option(self::db_init_queue_option_name); |
|
991 | 991 | } |
992 | 992 | |
993 | 993 | /** |
@@ -996,7 +996,7 @@ discard block |
||
996 | 996 | * 'Core', or the return value of EE_Addon::name() for an addon |
997 | 997 | * @return array |
998 | 998 | */ |
999 | - public function get_db_initialization_queue(){ |
|
1000 | - return get_option ( self::db_init_queue_option_name, array() ); |
|
999 | + public function get_db_initialization_queue() { |
|
1000 | + return get_option(self::db_init_queue_option_name, array()); |
|
1001 | 1001 | } |
1002 | 1002 | } |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * Class EE_Select_Reveal_Input |
4 | 4 | * |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @since 4.6 |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Select_Reveal_Input extends EE_Select_Input{ |
|
14 | +class EE_Select_Reveal_Input extends EE_Select_Input { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @param array $answer_options Array keys which match a sibling section's name |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param array $input_settings |
28 | 28 | */ |
29 | - public function __construct( $answer_options, $input_settings = array() ){ |
|
30 | - parent::__construct( $answer_options, $input_settings ); |
|
29 | + public function __construct($answer_options, $input_settings = array()) { |
|
30 | + parent::__construct($answer_options, $input_settings); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function sibling_sections_controlled() { |
38 | 38 | $sibling_sections = array(); |
39 | - foreach( $this->options() as $sibling_section_name => $sibling_section ) { |
|
39 | + foreach ($this->options() as $sibling_section_name => $sibling_section) { |
|
40 | 40 | //if it's an empty string just leave it alone |
41 | - if( empty( $sibling_section_name ) ) { |
|
41 | + if (empty($sibling_section_name)) { |
|
42 | 42 | continue; |
43 | 43 | } |
44 | - $sibling_section = $this->find_section_from_path( '../' . $sibling_section_name ); |
|
45 | - if( |
|
44 | + $sibling_section = $this->find_section_from_path('../'.$sibling_section_name); |
|
45 | + if ( |
|
46 | 46 | $sibling_section instanceof EE_Form_Section_Base |
47 | - && ! empty( $sibling_section_name ) |
|
47 | + && ! empty($sibling_section_name) |
|
48 | 48 | ) { |
49 | - $sibling_sections[ $sibling_section_name ] = $sibling_section; |
|
49 | + $sibling_sections[$sibling_section_name] = $sibling_section; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | return $sibling_sections; |
@@ -59,16 +59,16 @@ discard block |
||
59 | 59 | * @param array $form_other_js_data |
60 | 60 | * @return array |
61 | 61 | */ |
62 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
63 | - $form_other_js_data = parent::get_other_js_data( $form_other_js_data ); |
|
64 | - if( ! isset($form_other_js_data[ 'select_reveal_inputs' ] ) ) { |
|
65 | - $form_other_js_data[ 'select_reveal_inputs' ] = array(); |
|
62 | + public function get_other_js_data($form_other_js_data = array()) { |
|
63 | + $form_other_js_data = parent::get_other_js_data($form_other_js_data); |
|
64 | + if ( ! isset($form_other_js_data['select_reveal_inputs'])) { |
|
65 | + $form_other_js_data['select_reveal_inputs'] = array(); |
|
66 | 66 | } |
67 | 67 | $sibling_input_to_html_id_map = array(); |
68 | - foreach( $this->sibling_sections_controlled() as $sibling_section_path => $sibling_section ) { |
|
69 | - $sibling_input_to_html_id_map[ $sibling_section_path ] = $sibling_section->html_id(); |
|
68 | + foreach ($this->sibling_sections_controlled() as $sibling_section_path => $sibling_section) { |
|
69 | + $sibling_input_to_html_id_map[$sibling_section_path] = $sibling_section->html_id(); |
|
70 | 70 | } |
71 | - $form_other_js_data[ 'select_reveal_inputs' ][ $this->html_id() ] = $sibling_input_to_html_id_map; |
|
71 | + $form_other_js_data['select_reveal_inputs'][$this->html_id()] = $sibling_input_to_html_id_map; |
|
72 | 72 | return $form_other_js_data; |
73 | 73 | } |
74 | 74 |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @return string |
15 | 15 | */ |
16 | - public function layout_form_begin( $additional_args = array() ) { |
|
16 | + public function layout_form_begin($additional_args = array()) { |
|
17 | 17 | $this->_form_section->set_html_class('form-table'); |
18 | - return parent::layout_form_begin( $additional_args ); |
|
18 | + return parent::layout_form_begin($additional_args); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | * @param EE_Form_Section_Proper $form_section |
26 | 26 | * @return string |
27 | 27 | */ |
28 | - public function layout_subsection( $form_section ){ |
|
29 | - if ( $form_section instanceof EE_Form_Section_Proper ) { |
|
30 | - return EEH_HTML::no_row( $form_section->get_html(), 2 ); |
|
31 | - } else if ( $form_section instanceof EE_Form_Section_HTML ) { |
|
28 | + public function layout_subsection($form_section) { |
|
29 | + if ($form_section instanceof EE_Form_Section_Proper) { |
|
30 | + return EEH_HTML::no_row($form_section->get_html(), 2); |
|
31 | + } else if ($form_section instanceof EE_Form_Section_HTML) { |
|
32 | 32 | return $form_section->get_html(); |
33 | 33 | } |
34 | 34 | return ''; |
@@ -41,30 +41,30 @@ discard block |
||
41 | 41 | * @param EE_Form_Input_Base $input |
42 | 42 | * @return string |
43 | 43 | */ |
44 | - public function layout_input( $input ) { |
|
44 | + public function layout_input($input) { |
|
45 | 45 | |
46 | 46 | if ( |
47 | 47 | $input->get_display_strategy() instanceof EE_Text_Area_Display_Strategy || |
48 | 48 | $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy || |
49 | 49 | $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy |
50 | 50 | ) { |
51 | - $input->set_html_class( $input->html_class() . ' large-text' ); |
|
51 | + $input->set_html_class($input->html_class().' large-text'); |
|
52 | 52 | } |
53 | - if ( $input instanceof EE_Text_Area_Input ) { |
|
54 | - $input->set_rows( 4 ); |
|
55 | - $input->set_cols( 60 ); |
|
53 | + if ($input instanceof EE_Text_Area_Input) { |
|
54 | + $input->set_rows(4); |
|
55 | + $input->set_cols(60); |
|
56 | 56 | } |
57 | 57 | $input_html = $input->get_html_for_input(); |
58 | 58 | // maybe add errors and help text ? |
59 | - $input_html .= $input->get_html_for_errors() != '' ? EEH_HTML::nl() . $input->get_html_for_errors() : ''; |
|
60 | - $input_html .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : ''; |
|
59 | + $input_html .= $input->get_html_for_errors() != '' ? EEH_HTML::nl().$input->get_html_for_errors() : ''; |
|
60 | + $input_html .= $input->get_html_for_help() != '' ? EEH_HTML::nl().$input->get_html_for_help() : ''; |
|
61 | 61 | //overriding parent to add wp admin specific things. |
62 | 62 | $html = ''; |
63 | - if ( $input instanceof EE_Hidden_Input ) { |
|
64 | - $html .= EEH_HTML::no_row( $input->get_html_for_input(), 2 ); |
|
63 | + if ($input instanceof EE_Hidden_Input) { |
|
64 | + $html .= EEH_HTML::no_row($input->get_html_for_input(), 2); |
|
65 | 65 | } else { |
66 | 66 | $html .= EEH_HTML::tr( |
67 | - EEH_HTML::th( $input->get_html_for_label(), '', '', '', 'scope="row"' ) . EEH_HTML::td( $input_html ) |
|
67 | + EEH_HTML::th($input->get_html_for_label(), '', '', '', 'scope="row"').EEH_HTML::td($input_html) |
|
68 | 68 | ); |
69 | 69 | } |
70 | 70 | return $html; |
@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class EE_Two_Column_Layout extends EE_Form_Section_Layout_Base{ |
|
3 | +class EE_Two_Column_Layout extends EE_Form_Section_Layout_Base { |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Should be used to start teh form section (Eg a table tag, or a div tag, etc.) |
7 | 7 | * @param array $additional_args |
8 | 8 | * @return string |
9 | 9 | */ |
10 | - public function layout_form_begin( $additional_args = array() ) { |
|
11 | - return EEH_HTML::table( '', $this->_form_section->html_id(), $this->_form_section->html_class(), $this->_form_section->html_style() ) . EEH_HTML::tbody(); |
|
10 | + public function layout_form_begin($additional_args = array()) { |
|
11 | + return EEH_HTML::table('', $this->_form_section->html_id(), $this->_form_section->html_class(), $this->_form_section->html_style()).EEH_HTML::tbody(); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | * @param array $additional_args |
19 | 19 | * @return string |
20 | 20 | */ |
21 | - public function layout_form_end( $additional_args = array() ) { |
|
22 | - return EEH_HTML::tbodyx() . EEH_HTML::tablex( $this->_form_section->html_id() ); |
|
21 | + public function layout_form_end($additional_args = array()) { |
|
22 | + return EEH_HTML::tbodyx().EEH_HTML::tablex($this->_form_section->html_id()); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
@@ -29,17 +29,17 @@ discard block |
||
29 | 29 | * @param EE_Form_Input_Base $input |
30 | 30 | * @return string |
31 | 31 | */ |
32 | - public function layout_input( $input ) { |
|
32 | + public function layout_input($input) { |
|
33 | 33 | $html = ''; |
34 | - if ( $input instanceof EE_Hidden_Input ) { |
|
34 | + if ($input instanceof EE_Hidden_Input) { |
|
35 | 35 | $html .= $input->get_html_for_input(); |
36 | 36 | } else { |
37 | 37 | $html_for_input = $input->get_html_for_input(); |
38 | - $html_for_input .= $input->get_html_for_errors() != '' ? EEH_HTML::nl() . $input->get_html_for_errors() : ''; |
|
39 | - $html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : ''; |
|
38 | + $html_for_input .= $input->get_html_for_errors() != '' ? EEH_HTML::nl().$input->get_html_for_errors() : ''; |
|
39 | + $html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl().$input->get_html_for_help() : ''; |
|
40 | 40 | $html .= EEH_HTML::tr( |
41 | - EEH_HTML::th( $input->get_html_for_label() ) . |
|
42 | - EEH_HTML::td( $html_for_input ) |
|
41 | + EEH_HTML::th($input->get_html_for_label()). |
|
42 | + EEH_HTML::td($html_for_input) |
|
43 | 43 | ); |
44 | 44 | } |
45 | 45 | return $html; |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | * @param EE_Form_Section_Proper $form_section |
53 | 53 | * @return string |
54 | 54 | */ |
55 | - public function layout_subsection( $form_section ){ |
|
55 | + public function layout_subsection($form_section) { |
|
56 | 56 | $html = ''; |
57 | - if ( $form_section instanceof EE_Form_Section_HTML ) { |
|
57 | + if ($form_section instanceof EE_Form_Section_HTML) { |
|
58 | 58 | $html .= $form_section->get_html(); |
59 | 59 | } else { |
60 | 60 | $html .= EEH_HTML::tr( |
61 | - EEH_HTML::td( $form_section->get_html(), '', '', '', 'colspan="2"' ) |
|
61 | + EEH_HTML::td($form_section->get_html(), '', '', '', 'colspan="2"') |
|
62 | 62 | ); |
63 | 63 | } |
64 | 64 | return $html; |
@@ -26,31 +26,31 @@ discard block |
||
26 | 26 | * @param EE_Form_Input_Base $input |
27 | 27 | * @return string |
28 | 28 | */ |
29 | - public function layout_input( $input ) { |
|
29 | + public function layout_input($input) { |
|
30 | 30 | $html = ''; |
31 | - if ( $input instanceof EE_Hidden_Input ) { |
|
32 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
33 | - } else if ( $input instanceof EE_Submit_Input ) { |
|
31 | + if ($input instanceof EE_Hidden_Input) { |
|
32 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
33 | + } else if ($input instanceof EE_Submit_Input) { |
|
34 | 34 | $html .= EEH_HTML::br(); |
35 | 35 | $html .= $input->get_html_for_input(); |
36 | - } else if ( $input instanceof EE_Select_Input ) { |
|
36 | + } else if ($input instanceof EE_Select_Input) { |
|
37 | 37 | $html .= EEH_HTML::br(); |
38 | - $html .= EEH_HTML::nl(1) . $input->get_html_for_label(); |
|
39 | - $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
40 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
41 | - $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
38 | + $html .= EEH_HTML::nl(1).$input->get_html_for_label(); |
|
39 | + $html .= EEH_HTML::nl().$input->get_html_for_errors(); |
|
40 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
41 | + $html .= EEH_HTML::nl().$input->get_html_for_help(); |
|
42 | 42 | $html .= EEH_HTML::br(); |
43 | - } else if ( $input instanceof EE_Form_Input_With_Options_Base ) { |
|
43 | + } else if ($input instanceof EE_Form_Input_With_Options_Base) { |
|
44 | 44 | $html .= EEH_HTML::br(); |
45 | - $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
46 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
47 | - $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
45 | + $html .= EEH_HTML::nl().$input->get_html_for_errors(); |
|
46 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
47 | + $html .= EEH_HTML::nl().$input->get_html_for_help(); |
|
48 | 48 | } else { |
49 | 49 | $html .= EEH_HTML::br(); |
50 | - $html .= EEH_HTML::nl(1) . $input->get_html_for_label(); |
|
51 | - $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
52 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
53 | - $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
50 | + $html .= EEH_HTML::nl(1).$input->get_html_for_label(); |
|
51 | + $html .= EEH_HTML::nl().$input->get_html_for_errors(); |
|
52 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
53 | + $html .= EEH_HTML::nl().$input->get_html_for_help(); |
|
54 | 54 | } |
55 | 55 | $html .= EEH_HTML::nl(-1); |
56 | 56 | return $html; |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | * @param EE_Form_Section_Proper $form_section |
64 | 64 | * @return string |
65 | 65 | */ |
66 | - public function layout_subsection( $form_section ){ |
|
66 | + public function layout_subsection($form_section) { |
|
67 | 67 | // d( $form_section ); |
68 | - return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1); |
|
68 | + return EEH_HTML::nl(1).$form_section->get_html().EEH_HTML::nl(-1); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * closing div tag for a form |
74 | 74 | * @return string |
75 | 75 | */ |
76 | - public function layout_form_end(){ |
|
76 | + public function layout_form_end() { |
|
77 | 77 | return EEH_HTML::nl(-1); |
78 | 78 | } |
79 | 79 | } |
80 | 80 | \ No newline at end of file |
@@ -10,14 +10,14 @@ discard block |
||
10 | 10 | * @since 4.6.0 |
11 | 11 | * |
12 | 12 | */ |
13 | -class EE_Div_Per_Section_Layout extends EE_Form_Section_Layout_Base{ |
|
13 | +class EE_Div_Per_Section_Layout extends EE_Form_Section_Layout_Base { |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * opening div tag for a form |
17 | 17 | * @return string |
18 | 18 | */ |
19 | 19 | public function layout_form_begin() { |
20 | - return EEH_HTML::div( '', $this->_form_section->html_id(), $this->_form_section->html_class(), $this->_form_section->html_style() ); |
|
20 | + return EEH_HTML::div('', $this->_form_section->html_id(), $this->_form_section->html_class(), $this->_form_section->html_style()); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -26,38 +26,38 @@ discard block |
||
26 | 26 | * @param EE_Form_Input_Base $input |
27 | 27 | * @return string |
28 | 28 | */ |
29 | - public function layout_input( $input ) { |
|
29 | + public function layout_input($input) { |
|
30 | 30 | $html = ''; |
31 | - if ( $input instanceof EE_Hidden_Input ) { |
|
32 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
33 | - } else if ( $input instanceof EE_Submit_Input ) { |
|
34 | - $html .= EEH_HTML::div( $input->get_html_for_input(), $input->html_id() . '-submit-dv', $input->html_class() . '-submit-dv' ); |
|
35 | - } else if ( $input instanceof EE_Select_Input ) { |
|
31 | + if ($input instanceof EE_Hidden_Input) { |
|
32 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
33 | + } else if ($input instanceof EE_Submit_Input) { |
|
34 | + $html .= EEH_HTML::div($input->get_html_for_input(), $input->html_id().'-submit-dv', $input->html_class().'-submit-dv'); |
|
35 | + } else if ($input instanceof EE_Select_Input) { |
|
36 | 36 | $html .= EEH_HTML::div( |
37 | - EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
38 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
39 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
40 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
41 | - $input->html_id() . '-input-dv', |
|
42 | - $input->html_class() . '-input-dv' |
|
37 | + EEH_HTML::nl(1).$input->get_html_for_label(). |
|
38 | + EEH_HTML::nl().$input->get_html_for_errors(). |
|
39 | + EEH_HTML::nl().$input->get_html_for_input(). |
|
40 | + EEH_HTML::nl().$input->get_html_for_help(), |
|
41 | + $input->html_id().'-input-dv', |
|
42 | + $input->html_class().'-input-dv' |
|
43 | 43 | ); |
44 | - } else if ( $input instanceof EE_Form_Input_With_Options_Base ) { |
|
44 | + } else if ($input instanceof EE_Form_Input_With_Options_Base) { |
|
45 | 45 | $html .= EEH_HTML::div( |
46 | - EEH_HTML::nl() . $this->_display_label_for_option_type_question( $input ) . |
|
47 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
48 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
49 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
50 | - $input->html_id() . '-input-dv', |
|
51 | - $input->html_class() . '-input-dv' |
|
46 | + EEH_HTML::nl().$this->_display_label_for_option_type_question($input). |
|
47 | + EEH_HTML::nl().$input->get_html_for_errors(). |
|
48 | + EEH_HTML::nl().$input->get_html_for_input(). |
|
49 | + EEH_HTML::nl().$input->get_html_for_help(), |
|
50 | + $input->html_id().'-input-dv', |
|
51 | + $input->html_class().'-input-dv' |
|
52 | 52 | ); |
53 | 53 | } else { |
54 | 54 | $html .= EEH_HTML::div( |
55 | - EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
56 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
57 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
58 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
59 | - $input->html_id() . '-input-dv', |
|
60 | - $input->html_class() . '-input-dv' |
|
55 | + EEH_HTML::nl(1).$input->get_html_for_label(). |
|
56 | + EEH_HTML::nl().$input->get_html_for_errors(). |
|
57 | + EEH_HTML::nl().$input->get_html_for_input(). |
|
58 | + EEH_HTML::nl().$input->get_html_for_help(), |
|
59 | + $input->html_id().'-input-dv', |
|
60 | + $input->html_class().'-input-dv' |
|
61 | 61 | ); |
62 | 62 | } |
63 | 63 | return $html; |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | * @param EE_Form_Input_With_Options_Base $input |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - protected function _display_label_for_option_type_question( EE_Form_Input_With_Options_Base $input ){ |
|
78 | - if ( $input->display_html_label_text() != '' ) { |
|
79 | - $class = $input->required() ? 'ee-required-label ' . $input->html_label_class() : $input->html_label_class(); |
|
80 | - $label_text = $input->required() ? $input->html_label_text() . '<span class="ee-asterisk">*</span>' : $input->html_label_text(); |
|
81 | - $html = '<div id="' . $input->html_label_id() . '"'; |
|
82 | - $html .= ' class="' . $class . '"'; |
|
83 | - $html .= ' style="' . $input->html_label_style() . '">'; |
|
84 | - $html .= $label_text . '</div>'; |
|
77 | + protected function _display_label_for_option_type_question(EE_Form_Input_With_Options_Base $input) { |
|
78 | + if ($input->display_html_label_text() != '') { |
|
79 | + $class = $input->required() ? 'ee-required-label '.$input->html_label_class() : $input->html_label_class(); |
|
80 | + $label_text = $input->required() ? $input->html_label_text().'<span class="ee-asterisk">*</span>' : $input->html_label_text(); |
|
81 | + $html = '<div id="'.$input->html_label_id().'"'; |
|
82 | + $html .= ' class="'.$class.'"'; |
|
83 | + $html .= ' style="'.$input->html_label_style().'">'; |
|
84 | + $html .= $label_text.'</div>'; |
|
85 | 85 | return $html; |
86 | 86 | } else { |
87 | 87 | return ''; |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @param EE_Form_Section_Proper $form_section |
96 | 96 | * @return string |
97 | 97 | */ |
98 | - public function layout_subsection( $form_section ){ |
|
98 | + public function layout_subsection($form_section) { |
|
99 | 99 | // d( $form_section ); |
100 | - return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1); |
|
100 | + return EEH_HTML::nl(1).$form_section->get_html().EEH_HTML::nl(-1); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * closing div tag for a form |
106 | 106 | * @return string |
107 | 107 | */ |
108 | - public function layout_form_end(){ |
|
109 | - return EEH_HTML::divx( $this->_form_section->html_id(), $this->_form_section->html_class() ); |
|
108 | + public function layout_form_end() { |
|
109 | + return EEH_HTML::divx($this->_form_section->html_id(), $this->_form_section->html_class()); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')){ |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('No direct script access allowed'); |
4 | 4 | } |
5 | 5 | /** |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | * @type $name string the name for this form section, if you want to explicitly define it |
80 | 80 | * } |
81 | 81 | */ |
82 | - public function __construct( $options_array = array() ) { |
|
82 | + public function __construct($options_array = array()) { |
|
83 | 83 | // used by display strategies |
84 | 84 | // assign incoming values to properties |
85 | - foreach( $options_array as $key => $value ) { |
|
86 | - $key = '_' . $key; |
|
87 | - if ( property_exists( $this, $key ) && empty( $this->{$key} )) { |
|
85 | + foreach ($options_array as $key => $value) { |
|
86 | + $key = '_'.$key; |
|
87 | + if (property_exists($this, $key) && empty($this->{$key} )) { |
|
88 | 88 | $this->{$key} = $value; |
89 | 89 | } |
90 | 90 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param $name |
98 | 98 | * @throws \EE_Error |
99 | 99 | */ |
100 | - protected function _construct_finalize( $parent_form_section, $name ){ |
|
100 | + protected function _construct_finalize($parent_form_section, $name) { |
|
101 | 101 | $this->_construction_finalized = TRUE; |
102 | 102 | $this->_parent_section = $parent_form_section; |
103 | 103 | $this->_name = $name; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | /** |
119 | 119 | * @param string $action |
120 | 120 | */ |
121 | - public function set_action( $action ) { |
|
121 | + public function set_action($action) { |
|
122 | 122 | $this->_action = $action; |
123 | 123 | } |
124 | 124 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @return string |
129 | 129 | */ |
130 | 130 | public function method() { |
131 | - return ! empty( $this->_method ) ? $this->_method : 'POST'; |
|
131 | + return ! empty($this->_method) ? $this->_method : 'POST'; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | /** |
137 | 137 | * @param string $method |
138 | 138 | */ |
139 | - public function set_method( $method ) { |
|
140 | - switch ( $method ) { |
|
139 | + public function set_method($method) { |
|
140 | + switch ($method) { |
|
141 | 141 | case 'get' : |
142 | 142 | case 'GET' : |
143 | 143 | $this->_method = 'GET'; |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @throws \EE_Error |
158 | 158 | */ |
159 | - protected function _set_default_html_id_if_empty(){ |
|
160 | - if( ! $this->_html_id ){ |
|
161 | - if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper ){ |
|
162 | - $this->_html_id = $this->_parent_section->html_id() . '-' . $this->_prep_name_for_html_id( $this->name() ); |
|
163 | - }else{ |
|
164 | - $this->_html_id = $this->_prep_name_for_html_id( $this->name() ); |
|
159 | + protected function _set_default_html_id_if_empty() { |
|
160 | + if ( ! $this->_html_id) { |
|
161 | + if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) { |
|
162 | + $this->_html_id = $this->_parent_section->html_id().'-'.$this->_prep_name_for_html_id($this->name()); |
|
163 | + } else { |
|
164 | + $this->_html_id = $this->_prep_name_for_html_id($this->name()); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @param $name |
174 | 174 | * @return string |
175 | 175 | */ |
176 | - private function _prep_name_for_html_id( $name ) { |
|
177 | - return sanitize_key( str_replace( array( ' ', ' ', '_' ), '-', $name )); |
|
176 | + private function _prep_name_for_html_id($name) { |
|
177 | + return sanitize_key(str_replace(array(' ', ' ', '_'), '-', $name)); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * Enqueueing JS after "wp_enqueue_scripts" action may not work |
186 | 186 | * @return string |
187 | 187 | */ |
188 | - public function get_html_and_js(){ |
|
188 | + public function get_html_and_js() { |
|
189 | 189 | return $this->get_html(); |
190 | 190 | } |
191 | 191 | |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | * @param bool $add_pound_sign |
202 | 202 | * @return string |
203 | 203 | */ |
204 | - public function html_id( $add_pound_sign = FALSE ){ |
|
205 | - return $add_pound_sign ? '#' . $this->_html_id : $this->_html_id; |
|
204 | + public function html_id($add_pound_sign = FALSE) { |
|
205 | + return $add_pound_sign ? '#'.$this->_html_id : $this->_html_id; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | /** |
211 | 211 | * @return string |
212 | 212 | */ |
213 | - public function html_class(){ |
|
213 | + public function html_class() { |
|
214 | 214 | return $this->_html_class; |
215 | 215 | } |
216 | 216 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | /** |
220 | 220 | * @return string |
221 | 221 | */ |
222 | - public function html_style(){ |
|
222 | + public function html_style() { |
|
223 | 223 | return $this->_html_style; |
224 | 224 | } |
225 | 225 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | /** |
229 | 229 | * @param mixed $html_class |
230 | 230 | */ |
231 | - public function set_html_class( $html_class ) { |
|
231 | + public function set_html_class($html_class) { |
|
232 | 232 | $this->_html_class = $html_class; |
233 | 233 | } |
234 | 234 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | /** |
238 | 238 | * @param mixed $html_id |
239 | 239 | */ |
240 | - public function set_html_id( $html_id ) { |
|
240 | + public function set_html_id($html_id) { |
|
241 | 241 | $this->_html_id = $html_id; |
242 | 242 | } |
243 | 243 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | /** |
247 | 247 | * @param mixed $html_style |
248 | 248 | */ |
249 | - public function set_html_style( $html_style ) { |
|
249 | + public function set_html_style($html_style) { |
|
250 | 250 | $this->_html_style = $html_style; |
251 | 251 | } |
252 | 252 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | /** |
256 | 256 | * @param string $other_html_attributes |
257 | 257 | */ |
258 | - public function set_other_html_attributes( $other_html_attributes ) { |
|
258 | + public function set_other_html_attributes($other_html_attributes) { |
|
259 | 259 | $this->_other_html_attributes = $other_html_attributes; |
260 | 260 | } |
261 | 261 | |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | * @throws EE_Error |
276 | 276 | * @return string |
277 | 277 | */ |
278 | - public function name(){ |
|
279 | - if( ! $this->_construction_finalized ){ |
|
280 | - throw new EE_Error(sprintf( __( 'You cannot use the form section\s name until _construct_finalize has been called on it (when we set the name). It was called on a form section of type \'s\'', 'event_espresso' ), get_class($this) ) ); |
|
278 | + public function name() { |
|
279 | + if ( ! $this->_construction_finalized) { |
|
280 | + throw new EE_Error(sprintf(__('You cannot use the form section\s name until _construct_finalize has been called on it (when we set the name). It was called on a form section of type \'s\'', 'event_espresso'), get_class($this))); |
|
281 | 281 | } |
282 | 282 | return $this->_name; |
283 | 283 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * Gets the parent section |
289 | 289 | * @return EE_Form_Section_Proper |
290 | 290 | */ |
291 | - public function parent_section(){ |
|
291 | + public function parent_section() { |
|
292 | 292 | return $this->_parent_section; |
293 | 293 | } |
294 | 294 | |
@@ -301,18 +301,18 @@ discard block |
||
301 | 301 | * @param string $other_attributes anything else added to the form open tag, MUST BE VALID HTML |
302 | 302 | * @return string |
303 | 303 | */ |
304 | - public function form_open( $action = '', $method = '', $other_attributes = '' ) { |
|
305 | - if ( ! empty( $action )) { |
|
306 | - $this->set_action( $action ); |
|
304 | + public function form_open($action = '', $method = '', $other_attributes = '') { |
|
305 | + if ( ! empty($action)) { |
|
306 | + $this->set_action($action); |
|
307 | 307 | } |
308 | - if ( ! empty( $method )) { |
|
309 | - $this->set_method( $method ); |
|
308 | + if ( ! empty($method)) { |
|
309 | + $this->set_method($method); |
|
310 | 310 | } |
311 | - $html = EEH_HTML::nl( 1, 'form' ) . '<form'; |
|
312 | - $html .= $this->html_id() !== '' ? ' id="' . $this->html_id() . '"' : ''; |
|
313 | - $html .= ' action="' . $this->action() . '"'; |
|
314 | - $html .= ' method="' . $this->method() . '"'; |
|
315 | - $html .= $other_attributes . '>'; |
|
311 | + $html = EEH_HTML::nl(1, 'form').'<form'; |
|
312 | + $html .= $this->html_id() !== '' ? ' id="'.$this->html_id().'"' : ''; |
|
313 | + $html .= ' action="'.$this->action().'"'; |
|
314 | + $html .= ' method="'.$this->method().'"'; |
|
315 | + $html .= $other_attributes.'>'; |
|
316 | 316 | return $html; |
317 | 317 | } |
318 | 318 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * @return string |
324 | 324 | */ |
325 | 325 | public function form_close() { |
326 | - return EEH_HTML::nl( -1, 'form' ) . '</form>' . EEH_HTML::nl() . '<!-- end of ee-' . $this->html_id() . '-form -->' . EEH_HTML::nl(); |
|
326 | + return EEH_HTML::nl( -1, 'form' ).'</form>'.EEH_HTML::nl().'<!-- end of ee-'.$this->html_id().'-form -->'.EEH_HTML::nl(); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * Default does nothing, but child classes can override |
333 | 333 | * @return string |
334 | 334 | */ |
335 | - public function enqueue_js(){ |
|
335 | + public function enqueue_js() { |
|
336 | 336 | //defaults to enqueue NO js or css |
337 | 337 | } |
338 | 338 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * @param array $form_other_js_data |
349 | 349 | * @return array |
350 | 350 | */ |
351 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
351 | + public function get_other_js_data($form_other_js_data = array()) { |
|
352 | 352 | return $form_other_js_data; |
353 | 353 | } |
354 | 354 | |
@@ -366,20 +366,20 @@ discard block |
||
366 | 366 | * @param string|false $form_section_path we accept false also because substr( '../', '../' ) = false |
367 | 367 | * @return EE_Form_Section_Base |
368 | 368 | */ |
369 | - public function find_section_from_path( $form_section_path ) { |
|
370 | - if( strpos( $form_section_path, '/' ) === 0 ) { |
|
371 | - $form_section_path = substr( $form_section_path, strlen( '/' ) ); |
|
369 | + public function find_section_from_path($form_section_path) { |
|
370 | + if (strpos($form_section_path, '/') === 0) { |
|
371 | + $form_section_path = substr($form_section_path, strlen('/')); |
|
372 | 372 | } |
373 | - if( empty( $form_section_path ) ) { |
|
373 | + if (empty($form_section_path)) { |
|
374 | 374 | return $this; |
375 | 375 | } |
376 | - if( strpos( $form_section_path, '../' ) === 0 ) { |
|
376 | + if (strpos($form_section_path, '../') === 0) { |
|
377 | 377 | $parent = $this->parent_section(); |
378 | 378 | |
379 | - $form_section_path = substr( $form_section_path, strlen( '../' ) ); |
|
380 | - if( $parent instanceof EE_Form_Section_Base ) { |
|
381 | - return $parent->find_section_from_path( $form_section_path ); |
|
382 | - } elseif( empty( $form_section_path ) ) { |
|
379 | + $form_section_path = substr($form_section_path, strlen('../')); |
|
380 | + if ($parent instanceof EE_Form_Section_Base) { |
|
381 | + return $parent->find_section_from_path($form_section_path); |
|
382 | + } elseif (empty($form_section_path)) { |
|
383 | 383 | return $this; |
384 | 384 | } |
385 | 385 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * @param null $validation_error_message |
24 | 24 | */ |
25 | - public function __construct( $validation_error_message = null ) { |
|
25 | + public function __construct($validation_error_message = null) { |
|
26 | 26 | $this->_validation_error_message = $validation_error_message === null |
27 | - ? __( 'Input invalid', 'event_espresso' ) |
|
27 | + ? __('Input invalid', 'event_espresso') |
|
28 | 28 | : $validation_error_message; |
29 | 29 | parent::__construct(); |
30 | 30 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * this validation strategy is the 'required' validation strategy, |
42 | 42 | * most should be OK with a null, empty string, etc) |
43 | 43 | */ |
44 | - public function validate( $normalized_value ) { |
|
44 | + public function validate($normalized_value) { |
|
45 | 45 | //by default, the validation strategy does no validation. this should be implemented |
46 | 46 | } |
47 | 47 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * in each form's "other_data" javascript object. |
89 | 89 | * @return array |
90 | 90 | */ |
91 | - public function get_other_js_data( $other_js_data = array() ) { |
|
91 | + public function get_other_js_data($other_js_data = array()) { |
|
92 | 92 | return $other_js_data; |
93 | 93 | } |
94 | 94 |