@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -123,7 +123,7 @@ |
||
123 | 123 | * @access public |
124 | 124 | * @param EE_Template_Config $CFG |
125 | 125 | * @param array $REQ |
126 | - * @return EE_Events_Archive_Config |
|
126 | + * @return EE_Template_Config |
|
127 | 127 | */ |
128 | 128 | public static function update_template_settings( $CFG, $REQ ) { |
129 | 129 | $config = new EE_Events_Archive_Config(); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @return EED_Events_Archive_Caff |
29 | 29 | */ |
30 | 30 | public static function instance() { |
31 | - return parent::get_instance( __CLASS__ ); |
|
31 | + return parent::get_instance(__CLASS__); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public static function set_hooks_admin() { |
52 | - define( 'EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
53 | - define( 'EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
54 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Events_Archive_Caff', 'template_settings_form' ), 10 ); |
|
55 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Events_Archive_Caff', 'update_template_settings' ), 10, 2 ); |
|
52 | + define('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
53 | + define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
54 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Events_Archive_Caff', 'template_settings_form'), 10); |
|
55 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Events_Archive_Caff', 'update_template_settings'), 10, 2); |
|
56 | 56 | // AJAX |
57 | - add_action( 'wp_ajax_espresso_update_event_archive_order', array( 'EED_Events_Archive_Caff', 'update_event_archive_order' ) ); |
|
58 | - add_action( 'wp_ajax_nopriv_espresso_update_event_archive_order', array( 'EED_Events_Archive_Caff', 'update_event_archive_order' ) ); |
|
57 | + add_action('wp_ajax_espresso_update_event_archive_order', array('EED_Events_Archive_Caff', 'update_event_archive_order')); |
|
58 | + add_action('wp_ajax_nopriv_espresso_update_event_archive_order', array('EED_Events_Archive_Caff', 'update_event_archive_order')); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param WP $WP |
69 | 69 | * @return void |
70 | 70 | */ |
71 | - public function run( $WP ) { |
|
71 | + public function run($WP) { |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -83,33 +83,33 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public static function template_settings_form() { |
85 | 85 | // grab general settings admin page and remove the existing hook callback |
86 | - $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object( 'general_settings' ); |
|
87 | - if ( $gen_set_admin instanceof General_Settings_Admin_Page ) { |
|
88 | - remove_action( 'AHEE__template_settings__template__before_settings_form', array( $gen_set_admin, 'template_settings_caff_features' ), 100 ); |
|
86 | + $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object('general_settings'); |
|
87 | + if ($gen_set_admin instanceof General_Settings_Admin_Page) { |
|
88 | + remove_action('AHEE__template_settings__template__before_settings_form', array($gen_set_admin, 'template_settings_caff_features'), 100); |
|
89 | 89 | } |
90 | 90 | // first just grab the template settings |
91 | 91 | $config = EE_Registry::instance()->CFG->template_settings; |
92 | 92 | // then if the Event Archive config is valid, use that, else create a new one |
93 | - $config = isset( $config->EED_Events_Archive ) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config ? $config->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
94 | - $config = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config ); |
|
95 | - $config->display_status_banner = isset( $config->display_status_banner ) ? $config->display_status_banner : 0; |
|
96 | - $config->display_description = isset( $config->display_description ) ? $config->display_description : 1; |
|
97 | - $config->display_ticket_selector = isset( $config->display_ticket_selector ) ? $config->display_ticket_selector : 0; |
|
98 | - $config->display_datetimes = isset( $config->display_datetimes ) ? $config->display_datetimes : 1; |
|
99 | - $config->display_venue = isset( $config->display_venue ) ? $config->display_venue : 0; |
|
100 | - $config->display_expired_events = isset( $config->display_expired_events ) ? $config->display_expired_events : 0; |
|
93 | + $config = isset($config->EED_Events_Archive) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config ? $config->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
94 | + $config = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config); |
|
95 | + $config->display_status_banner = isset($config->display_status_banner) ? $config->display_status_banner : 0; |
|
96 | + $config->display_description = isset($config->display_description) ? $config->display_description : 1; |
|
97 | + $config->display_ticket_selector = isset($config->display_ticket_selector) ? $config->display_ticket_selector : 0; |
|
98 | + $config->display_datetimes = isset($config->display_datetimes) ? $config->display_datetimes : 1; |
|
99 | + $config->display_venue = isset($config->display_venue) ? $config->display_venue : 0; |
|
100 | + $config->display_expired_events = isset($config->display_expired_events) ? $config->display_expired_events : 0; |
|
101 | 101 | // display order options |
102 | - $config->use_sortable_display_order = isset( $config->use_sortable_display_order )? $config->use_sortable_display_order : false; |
|
103 | - $config->display_order_tickets = isset( $config->display_order_tickets )? $config->display_order_tickets : 100; |
|
104 | - $config->display_order_datetimes = isset( $config->display_order_datetimes )? $config->display_order_datetimes : 110; |
|
105 | - $config->display_order_event = isset( $config->display_order_event )? $config->display_order_event : 120; |
|
106 | - $config->display_order_venue = isset( $config->display_order_venue )? $config->display_order_venue : 130; |
|
102 | + $config->use_sortable_display_order = isset($config->use_sortable_display_order) ? $config->use_sortable_display_order : false; |
|
103 | + $config->display_order_tickets = isset($config->display_order_tickets) ? $config->display_order_tickets : 100; |
|
104 | + $config->display_order_datetimes = isset($config->display_order_datetimes) ? $config->display_order_datetimes : 110; |
|
105 | + $config->display_order_event = isset($config->display_order_event) ? $config->display_order_event : 120; |
|
106 | + $config->display_order_venue = isset($config->display_order_venue) ? $config->display_order_venue : 130; |
|
107 | 107 | // get template parts |
108 | - $template_parts = EED_Events_Archive::instance()->initialize_template_parts( $config ); |
|
108 | + $template_parts = EED_Events_Archive::instance()->initialize_template_parts($config); |
|
109 | 109 | // convert to array so that we can add more properties |
110 | - $config = get_object_vars( $config ); |
|
111 | - $config[ 'event_archive_display_order' ] = $template_parts->generate_sortable_list_of_template_parts( 'event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js' ); |
|
112 | - EEH_Template::display_template( EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $config ); |
|
110 | + $config = get_object_vars($config); |
|
111 | + $config['event_archive_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js'); |
|
112 | + EEH_Template::display_template(EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH.'admin-event-list-settings.template.php', $config); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -125,24 +125,24 @@ discard block |
||
125 | 125 | * @param array $REQ |
126 | 126 | * @return EE_Events_Archive_Config |
127 | 127 | */ |
128 | - public static function update_template_settings( $CFG, $REQ ) { |
|
128 | + public static function update_template_settings($CFG, $REQ) { |
|
129 | 129 | $config = new EE_Events_Archive_Config(); |
130 | 130 | // unless we are resetting the config... |
131 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
132 | - $config->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
133 | - $config->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
134 | - $config->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
135 | - $config->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
136 | - $config->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
137 | - $config->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; |
|
138 | - $config->use_sortable_display_order = isset( $REQ['EED_Events_Archive_use_sortable_display_order'] ) ? absint( $REQ['EED_Events_Archive_use_sortable_display_order'] ) : 0; |
|
139 | - $config->display_order_tickets = isset( $CFG->EED_Events_Archive->display_order_tickets ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_tickets : 100; |
|
140 | - $config->display_order_datetimes = isset( $CFG->EED_Events_Archive->display_order_datetimes ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_datetimes : 110; |
|
141 | - $config->display_order_event = isset( $CFG->EED_Events_Archive->display_order_event ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_event : 120; |
|
142 | - $config->display_order_venue = isset( $CFG->EED_Events_Archive->display_order_venue ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_venue : 130; |
|
131 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
132 | + $config->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
133 | + $config->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
134 | + $config->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
135 | + $config->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
136 | + $config->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
137 | + $config->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; |
|
138 | + $config->use_sortable_display_order = isset($REQ['EED_Events_Archive_use_sortable_display_order']) ? absint($REQ['EED_Events_Archive_use_sortable_display_order']) : 0; |
|
139 | + $config->display_order_tickets = isset($CFG->EED_Events_Archive->display_order_tickets) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_tickets : 100; |
|
140 | + $config->display_order_datetimes = isset($CFG->EED_Events_Archive->display_order_datetimes) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_datetimes : 110; |
|
141 | + $config->display_order_event = isset($CFG->EED_Events_Archive->display_order_event) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_event : 120; |
|
142 | + $config->display_order_venue = isset($CFG->EED_Events_Archive->display_order_venue) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_venue : 130; |
|
143 | 143 | } |
144 | 144 | $CFG->EED_Events_Archive = $config; |
145 | - do_action( 'AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ ); |
|
145 | + do_action('AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ); |
|
146 | 146 | return $CFG; |
147 | 147 | } |
148 | 148 | |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public static function update_event_archive_order() { |
158 | 158 | $config_saved = false; |
159 | - $template_parts = sanitize_text_field( $_POST[ 'elements' ] ); |
|
160 | - if ( ! empty( $template_parts ) ) { |
|
161 | - $template_parts = explode( ',', trim( $template_parts, ',' ) ); |
|
162 | - foreach ( $template_parts as $key => $template_part ) { |
|
159 | + $template_parts = sanitize_text_field($_POST['elements']); |
|
160 | + if ( ! empty($template_parts)) { |
|
161 | + $template_parts = explode(',', trim($template_parts, ',')); |
|
162 | + foreach ($template_parts as $key => $template_part) { |
|
163 | 163 | $template_part = "display_order_$template_part"; |
164 | - $priority = ( $key * 10 ) + 100; |
|
164 | + $priority = ($key * 10) + 100; |
|
165 | 165 | if ( |
166 | 166 | property_exists( |
167 | 167 | EE_Registry::instance()->CFG->template_settings->EED_Events_Archive, |
@@ -170,16 +170,16 @@ discard block |
||
170 | 170 | ) { |
171 | 171 | EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->$template_part = $priority; |
172 | 172 | } |
173 | - do_action( "AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority ); |
|
173 | + do_action("AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority); |
|
174 | 174 | } |
175 | - $config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false ); |
|
175 | + $config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false); |
|
176 | 176 | } |
177 | - if ( $config_saved ) { |
|
178 | - EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) ); |
|
177 | + if ($config_saved) { |
|
178 | + EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso')); |
|
179 | 179 | } else { |
180 | - EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
180 | + EE_Error::add_error(__('Display Order was not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
181 | 181 | } |
182 | - echo wp_json_encode( EE_Error::get_notices( false ) ); |
|
182 | + echo wp_json_encode(EE_Error::get_notices(false)); |
|
183 | 183 | exit(); |
184 | 184 | } |
185 | 185 |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | /** |
6 | 7 | * Event Espresso |
7 | 8 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_PMT_Aim extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Aim extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | |
31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | require_once($this->file_folder().'EEG_Aim.gateway.php'); |
38 | 38 | $this->_gateway = new EEG_AIM(); |
39 | 39 | $this->_pretty_name = __("Authorize.net AIM", 'event_espresso'); |
40 | - $this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' ); |
|
40 | + $this->_default_description = __('Please provide the following billing information.', 'event_espresso'); |
|
41 | 41 | $this->_requires_https = true; |
42 | 42 | parent::__construct($pm_instance); |
43 | 43 | } |
@@ -47,60 +47,60 @@ discard block |
||
47 | 47 | * @param \EE_Transaction $transaction |
48 | 48 | * @return EE_Billing_Info_Form |
49 | 49 | */ |
50 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
51 | - $billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance,array( |
|
50 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
51 | + $billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance, array( |
|
52 | 52 | 'name'=>'AIM_Form', |
53 | 53 | 'subsections'=>array( |
54 | 54 | 'credit_card'=>new EE_Credit_Card_Input(array( |
55 | 55 | 'required'=>true, |
56 | - 'html_label_text' => __( 'Card Number', 'event_espresso' ) |
|
56 | + 'html_label_text' => __('Card Number', 'event_espresso') |
|
57 | 57 | )), |
58 | 58 | 'exp_month'=>new EE_Credit_Card_Month_Input(true, array( |
59 | 59 | 'required'=>true, |
60 | - 'html_label_text' => __( 'Expiry Month', 'event_espresso' ) |
|
60 | + 'html_label_text' => __('Expiry Month', 'event_espresso') |
|
61 | 61 | )), |
62 | - 'exp_year'=>new EE_Credit_Card_Year_Input( array( |
|
62 | + 'exp_year'=>new EE_Credit_Card_Year_Input(array( |
|
63 | 63 | 'required'=>true, |
64 | - 'html_label_text' => __( 'Expiry Year', 'event_espresso' ) |
|
64 | + 'html_label_text' => __('Expiry Year', 'event_espresso') |
|
65 | 65 | )), |
66 | - 'cvv'=>new EE_CVV_Input( array( |
|
66 | + 'cvv'=>new EE_CVV_Input(array( |
|
67 | 67 | 'required'=>true, |
68 | - 'html_label_text' => __( 'CVV', 'event_espresso' ) ) ), |
|
68 | + 'html_label_text' => __('CVV', 'event_espresso') )), |
|
69 | 69 | ) |
70 | 70 | )); |
71 | - $billing_form->add_subsections( array( |
|
72 | - 'company' => new EE_Text_Input( array( |
|
71 | + $billing_form->add_subsections(array( |
|
72 | + 'company' => new EE_Text_Input(array( |
|
73 | 73 | 'html_label_text' => __('Company', 'event_espresso') |
74 | 74 | )) |
75 | - ), 'email', false ); |
|
75 | + ), 'email', false); |
|
76 | 76 | $billing_form->add_subsections( |
77 | 77 | array( |
78 | - 'fax' => new EE_Text_Input( array( |
|
78 | + 'fax' => new EE_Text_Input(array( |
|
79 | 79 | 'html_label_text' => __('Fax', 'event_espresso') |
80 | 80 | )) |
81 | 81 | ), |
82 | 82 | 'phone', |
83 | 83 | false ); |
84 | 84 | $settings_form = $this->settings_form(); |
85 | - if( $settings_form->get_input( 'excluded_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) { |
|
86 | - $billing_form->exclude( $settings_form->get_input( 'excluded_billing_inputs' )->normalized_value() ); |
|
85 | + if ($settings_form->get_input('excluded_billing_inputs') instanceof EE_Checkbox_Multi_Input) { |
|
86 | + $billing_form->exclude($settings_form->get_input('excluded_billing_inputs')->normalized_value()); |
|
87 | 87 | } |
88 | - if( $settings_form->get_input( 'required_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) { |
|
88 | + if ($settings_form->get_input('required_billing_inputs') instanceof EE_Checkbox_Multi_Input) { |
|
89 | 89 | $required_inputs = array_merge( |
90 | 90 | array( |
91 | 91 | 'credit_card', |
92 | 92 | 'exp_month', |
93 | 93 | 'exp_year' ), |
94 | - $settings_form->get_input( 'required_billing_inputs' )->normalized_value() ); |
|
95 | - foreach( $billing_form->inputs() as $input_name => $input ) { |
|
96 | - if( in_array( $input_name, $required_inputs ) ) { |
|
97 | - $input->set_required( true ); |
|
94 | + $settings_form->get_input('required_billing_inputs')->normalized_value() ); |
|
95 | + foreach ($billing_form->inputs() as $input_name => $input) { |
|
96 | + if (in_array($input_name, $required_inputs)) { |
|
97 | + $input->set_required(true); |
|
98 | 98 | } else { |
99 | - $input->set_required( false ); |
|
99 | + $input->set_required(false); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
103 | - return $this->apply_billing_form_debug_settings( $billing_form ); |
|
103 | + return $this->apply_billing_form_debug_settings($billing_form); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -112,19 +112,19 @@ discard block |
||
112 | 112 | * @param \EE_Billing_Info_Form $billing_form |
113 | 113 | * @return \EE_Billing_Info_Form |
114 | 114 | */ |
115 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
116 | - if ( $this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta( 'test_transactions', TRUE, FALSE )) { |
|
117 | - $billing_form->get_input( 'credit_card' )->set_default( '4007000000027' ); |
|
118 | - $billing_form->get_input( 'exp_year' )->set_default( '2020' ); |
|
119 | - if( $billing_form->get_subsection( 'cvv' ) instanceof EE_Form_Input_Base ) { |
|
120 | - $billing_form->get_input( 'cvv' )->set_default(( '123' )); |
|
115 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
116 | + if ($this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta('test_transactions', TRUE, FALSE)) { |
|
117 | + $billing_form->get_input('credit_card')->set_default('4007000000027'); |
|
118 | + $billing_form->get_input('exp_year')->set_default('2020'); |
|
119 | + if ($billing_form->get_subsection('cvv') instanceof EE_Form_Input_Base) { |
|
120 | + $billing_form->get_input('cvv')->set_default(('123')); |
|
121 | 121 | } |
122 | 122 | $billing_form->add_subsections( |
123 | - array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ), |
|
123 | + array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()), |
|
124 | 124 | 'credit_card' |
125 | 125 | ); |
126 | 126 | $billing_form->add_subsections( |
127 | - array( 'debug_content' => new EE_Form_Section_HTML_From_Template( dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php' )), |
|
127 | + array('debug_content' => new EE_Form_Section_HTML_From_Template(dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php')), |
|
128 | 128 | 'first_name' |
129 | 129 | ); |
130 | 130 | } |
@@ -144,17 +144,17 @@ discard block |
||
144 | 144 | 'extra_meta_inputs'=>array( |
145 | 145 | 'login_id'=>new EE_Text_Input( |
146 | 146 | array( |
147 | - 'html_label_text'=> sprintf( __("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link() ), |
|
147 | + 'html_label_text'=> sprintf(__("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link()), |
|
148 | 148 | 'required' => true ) |
149 | 149 | ), |
150 | 150 | 'transaction_key'=>new EE_Text_Input( |
151 | 151 | array( |
152 | - 'html_label_text'=> sprintf( __("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link() ), |
|
152 | + 'html_label_text'=> sprintf(__("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link()), |
|
153 | 153 | 'required' => true ) |
154 | 154 | ), |
155 | 155 | 'test_transactions'=>new EE_Yes_No_Input( |
156 | 156 | array( |
157 | - 'html_label_text'=> sprintf( __("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
157 | + 'html_label_text'=> sprintf(__("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link()), |
|
158 | 158 | 'html_help_text'=> __("Send test transactions, even to live server", 'event_espresso'), |
159 | 159 | 'default' => false, |
160 | 160 | 'required' => true |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | 'excluded_billing_inputs' => new EE_Checkbox_Multi_Input( |
164 | 164 | $billing_input_names, |
165 | 165 | array( |
166 | - 'html_label_text' => sprintf( __("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
166 | + 'html_label_text' => sprintf(__("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), |
|
167 | 167 | 'default' => array( |
168 | 168 | 'company', |
169 | 169 | 'fax', |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | 'required_billing_inputs' => new EE_Checkbox_Multi_Input( |
173 | 173 | $billing_input_names, |
174 | 174 | array( |
175 | - 'html_label_text' => sprintf( __("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
175 | + 'html_label_text' => sprintf(__("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), |
|
176 | 176 | 'default' => array_diff( |
177 | - array_keys( $billing_input_names ), |
|
178 | - array( 'address2', 'phone', 'company', 'fax' ) |
|
177 | + array_keys($billing_input_names), |
|
178 | + array('address2', 'phone', 'company', 'fax') |
|
179 | 179 | ), |
180 | 180 | 'html_help_text' => __('Note: if fields are excluded they cannot be required.', 'event_espresso') |
181 | 181 | )), |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function billing_input_names() { |
193 | 193 | return array( |
194 | - 'first_name' => __( 'First Name', 'event_espresso' ), |
|
194 | + 'first_name' => __('First Name', 'event_espresso'), |
|
195 | 195 | 'last_name' => __('Last Name', 'event_espresso'), |
196 | - 'email' => __( 'Email', 'event_espresso' ), |
|
197 | - 'company' => __( 'Company', 'event_espresso' ), |
|
196 | + 'email' => __('Email', 'event_espresso'), |
|
197 | + 'company' => __('Company', 'event_espresso'), |
|
198 | 198 | 'address' => __('Address', 'event_espresso'), |
199 | 199 | 'address2' => __('Address2', 'event_espresso'), |
200 | 200 | 'city' => __('City', 'event_espresso'), |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | 'country' => __('Country', 'event_espresso'), |
203 | 203 | 'zip' => __('Zip', 'event_espresso'), |
204 | 204 | 'phone' => __('Phone', 'event_espresso'), |
205 | - 'fax' => __( 'Fax', 'event_espresso' ), |
|
205 | + 'fax' => __('Fax', 'event_espresso'), |
|
206 | 206 | 'cvv' => __('CVV', 'event_espresso') |
207 | 207 | ); |
208 | 208 | } |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | * @param type $billing_form |
214 | 214 | * @return array |
215 | 215 | */ |
216 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
216 | + protected function _get_billing_values_from_form($billing_form) { |
|
217 | 217 | $all_billing_values_empty = array(); |
218 | - foreach( array_keys( $this->billing_input_names() ) as $input_name ) { |
|
219 | - $all_billing_values_empty[ $input_name ] = ''; |
|
218 | + foreach (array_keys($this->billing_input_names()) as $input_name) { |
|
219 | + $all_billing_values_empty[$input_name] = ''; |
|
220 | 220 | } |
221 | 221 | return array_merge( |
222 | 222 | $all_billing_values_empty, |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @see EE_PMT_Base::help_tabs_config() |
232 | 232 | * @return array |
233 | 233 | */ |
234 | - public function help_tabs_config(){ |
|
234 | + public function help_tabs_config() { |
|
235 | 235 | return array( |
236 | 236 | $this->get_help_tab_name() => array( |
237 | 237 | 'title' => __('Authorize.net AIM Settings', 'event_espresso'), |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @param array $arguments |
40 | 40 | * @return \EE_CPT_Event_Strategy |
41 | 41 | */ |
42 | - public function __construct( $arguments = array() ) { |
|
43 | - $this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL; |
|
44 | - $WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL; |
|
42 | + public function __construct($arguments = array()) { |
|
43 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL; |
|
44 | + $WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL; |
|
45 | 45 | |
46 | 46 | // !!!!!!!!!! IMPORTANT !!!!!!!!!!!! |
47 | 47 | // here's the list of available filters in the WP_Query object |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | // 'posts_fields' |
56 | 56 | // 'posts_join' |
57 | 57 | $this->_add_filters(); |
58 | - if ( $WP_Query instanceof WP_Query ) { |
|
59 | - $WP_Query->is_espresso_event_single = is_singular() && isset( $WP_Query->query->post_type ) && $WP_Query->query->post_type == 'espresso_events' ? TRUE : FALSE; |
|
58 | + if ($WP_Query instanceof WP_Query) { |
|
59 | + $WP_Query->is_espresso_event_single = is_singular() && isset($WP_Query->query->post_type) && $WP_Query->query->post_type == 'espresso_events' ? TRUE : FALSE; |
|
60 | 60 | $WP_Query->is_espresso_event_archive = is_post_type_archive('espresso_events') ? TRUE : FALSE; |
61 | - $WP_Query->is_espresso_event_taxonomy = is_tax( 'espresso_event_categories' ) ? TRUE : FALSE; |
|
61 | + $WP_Query->is_espresso_event_taxonomy = is_tax('espresso_event_categories') ? TRUE : FALSE; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | } |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | * (which will get removed in case the next call to get_posts ISN'T |
71 | 71 | * for event CPTs) |
72 | 72 | */ |
73 | - protected function _add_filters(){ |
|
74 | - add_filter( 'posts_fields', array( $this, 'posts_fields' ), 1, 2 ); |
|
75 | - add_filter( 'posts_join', array( $this, 'posts_join' ), 1, 2 ); |
|
76 | - add_filter( 'posts_where', array( $this, 'posts_where' ), 10, 2 ); |
|
77 | - add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 ); |
|
78 | - add_filter( 'posts_orderby', array( $this, 'posts_orderby' ), 1, 2 ); |
|
79 | - add_filter( 'posts_groupby', array( $this, 'posts_groupby' ), 1, 2 ); |
|
73 | + protected function _add_filters() { |
|
74 | + add_filter('posts_fields', array($this, 'posts_fields'), 1, 2); |
|
75 | + add_filter('posts_join', array($this, 'posts_join'), 1, 2); |
|
76 | + add_filter('posts_where', array($this, 'posts_where'), 10, 2); |
|
77 | + add_filter('the_posts', array($this, 'the_posts'), 1, 2); |
|
78 | + add_filter('posts_orderby', array($this, 'posts_orderby'), 1, 2); |
|
79 | + add_filter('posts_groupby', array($this, 'posts_groupby'), 1, 2); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | * This is to avoid applying this CPT strategy for other posts or CPTs (eg, |
87 | 87 | * we don't want to join to the datetime table when querying for venues, do we!?) |
88 | 88 | */ |
89 | - protected function _remove_filters(){ |
|
90 | - remove_filter( 'posts_fields', array( $this, 'posts_fields' ), 1 ); |
|
91 | - remove_filter( 'posts_join', array( $this, 'posts_join' ), 1 ); |
|
92 | - remove_filter( 'posts_where', array( $this, 'posts_where' ), 10 ); |
|
93 | - remove_filter( 'the_posts', array( $this, 'the_posts' ), 1 ); |
|
94 | - remove_filter( 'posts_orderby', array( $this, 'posts_orderby' ), 1 ); |
|
95 | - remove_filter( 'posts_groupby', array( $this, 'posts_groupby' ), 1 ); |
|
89 | + protected function _remove_filters() { |
|
90 | + remove_filter('posts_fields', array($this, 'posts_fields'), 1); |
|
91 | + remove_filter('posts_join', array($this, 'posts_join'), 1); |
|
92 | + remove_filter('posts_where', array($this, 'posts_where'), 10); |
|
93 | + remove_filter('the_posts', array($this, 'the_posts'), 1); |
|
94 | + remove_filter('posts_orderby', array($this, 'posts_orderby'), 1); |
|
95 | + remove_filter('posts_groupby', array($this, 'posts_groupby'), 1); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @param WP_Query $wp_query |
106 | 106 | * @return string |
107 | 107 | */ |
108 | - public function posts_fields( $SQL, WP_Query $wp_query ) { |
|
108 | + public function posts_fields($SQL, WP_Query $wp_query) { |
|
109 | 109 | if ( |
110 | 110 | $wp_query instanceof WP_Query |
111 | 111 | && |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | ) |
117 | 117 | ) { |
118 | 118 | // adds something like ", wp_esp_datetime.* " to WP Query SELECT statement |
119 | - $SQL .= ', ' . EEM_Datetime::instance()->table() . '.* ' ; |
|
120 | - if ( $wp_query->is_espresso_event_archive || $wp_query->is_espresso_event_taxonomy ) { |
|
119 | + $SQL .= ', '.EEM_Datetime::instance()->table().'.* '; |
|
120 | + if ($wp_query->is_espresso_event_archive || $wp_query->is_espresso_event_taxonomy) { |
|
121 | 121 | // because we only want to retrieve the next upcoming datetime for each event: |
122 | 122 | // add something like ", MIN( wp_esp_datetime.DTT_EVT_start ) as event_start_date " to WP Query SELECT statement |
123 | - $SQL .= ', MIN( ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start ) as event_start_date ' ; |
|
123 | + $SQL .= ', MIN( '.EEM_Datetime::instance()->table().'.DTT_EVT_start ) as event_start_date '; |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | return $SQL; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @internal param \WP_Query $WP_Query |
138 | 138 | * @return string |
139 | 139 | */ |
140 | - public function posts_join( $SQL, WP_Query $wp_query ) { |
|
140 | + public function posts_join($SQL, WP_Query $wp_query) { |
|
141 | 141 | if ( |
142 | 142 | $wp_query instanceof WP_Query |
143 | 143 | && |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | ) |
149 | 149 | ) { |
150 | 150 | // adds something like " LEFT JOIN wp_esp_datetime ON ( wp_esp_datetime.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement |
151 | - $SQL .= ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . EEM_Event::instance()->table() . '.ID = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name() . ' ) '; |
|
151 | + $SQL .= ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.EEM_Event::instance()->table().'.ID = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name().' ) '; |
|
152 | 152 | } |
153 | 153 | return $SQL; |
154 | 154 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @param WP_Query $wp_query |
164 | 164 | * @return string |
165 | 165 | */ |
166 | - public function posts_where( $SQL, WP_Query $wp_query ) { |
|
166 | + public function posts_where($SQL, WP_Query $wp_query) { |
|
167 | 167 | // global $wpdb; |
168 | 168 | if ( |
169 | 169 | $wp_query instanceof WP_Query |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | || $wp_query->is_espresso_event_taxonomy |
174 | 174 | ) |
175 | 175 | ) { |
176 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive ) || ! isset( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events ) || ! EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events ) { |
|
177 | - $SQL .= ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end > "' . current_time( 'mysql', true ) . '" '; |
|
176 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive) || ! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events) || ! EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events) { |
|
177 | + $SQL .= ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end > "'.current_time('mysql', true).'" '; |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | return $SQL; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @param WP_Query $wp_query |
191 | 191 | * @return string |
192 | 192 | */ |
193 | - public function posts_orderby( $SQL, WP_Query $wp_query ) { |
|
193 | + public function posts_orderby($SQL, WP_Query $wp_query) { |
|
194 | 194 | if ( |
195 | 195 | $wp_query instanceof WP_Query |
196 | 196 | && |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @param WP_Query $wp_query |
215 | 215 | * @return string |
216 | 216 | */ |
217 | - public function posts_groupby( $SQL, WP_Query $wp_query ) { |
|
217 | + public function posts_groupby($SQL, WP_Query $wp_query) { |
|
218 | 218 | if ( |
219 | 219 | $wp_query instanceof WP_Query |
220 | 220 | && |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | // we're joining to the datetimes table, where there can be MANY datetimes for a single event, but we want to only show each event only once |
228 | 228 | // (whereas if we didn't group them by the post's ID, then we would end up with many repeats) |
229 | 229 | global $wpdb; |
230 | - $SQL = $wpdb->posts . '.ID '; |
|
230 | + $SQL = $wpdb->posts.'.ID '; |
|
231 | 231 | } |
232 | 232 | return $SQL; |
233 | 233 | } |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | * @param WP_Query $wp_query |
243 | 243 | * @return array |
244 | 244 | */ |
245 | - public function the_posts( $posts, WP_Query $wp_query ) { |
|
246 | - if ( $wp_query instanceof WP_Query && isset( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] == 'espresso_events' ) { |
|
245 | + public function the_posts($posts, WP_Query $wp_query) { |
|
246 | + if ($wp_query instanceof WP_Query && isset($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'espresso_events') { |
|
247 | 247 | // automagically load the EEH_Event_View helper so that it's functions are available |
248 | 248 | EE_Registry::instance()->load_helper('Event_View'); |
249 | 249 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @param $single |
263 | 263 | * @return string |
264 | 264 | */ |
265 | - public function get_EE_post_type_metadata( $meta_value = NULL, $post_id, $meta_key, $single ) { |
|
265 | + public function get_EE_post_type_metadata($meta_value = NULL, $post_id, $meta_key, $single) { |
|
266 | 266 | return $meta_value; |
267 | 267 | } |
268 | 268 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param WP $WP |
43 | 43 | * @return void |
44 | 44 | */ |
45 | - public abstract function run( WP $WP ); |
|
45 | + public abstract function run(WP $WP); |
|
46 | 46 | |
47 | 47 | |
48 | 48 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param array $attributes |
55 | 55 | * @return mixed |
56 | 56 | */ |
57 | - public abstract function process_shortcode( $attributes = array() ); |
|
57 | + public abstract function process_shortcode($attributes = array()); |
|
58 | 58 | |
59 | 59 | |
60 | 60 | |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | * @param string $shortcode_class |
66 | 66 | * @return \EES_Shortcode |
67 | 67 | */ |
68 | - final public static function instance( $shortcode_class = NULL ) { |
|
69 | - $shortcode_class = ! empty( $shortcode_class ) ? $shortcode_class : get_called_class(); |
|
70 | - if ( $shortcode_class == 'EES_Shortcode' || empty( $shortcode_class )) { |
|
68 | + final public static function instance($shortcode_class = NULL) { |
|
69 | + $shortcode_class = ! empty($shortcode_class) ? $shortcode_class : get_called_class(); |
|
70 | + if ($shortcode_class == 'EES_Shortcode' || empty($shortcode_class)) { |
|
71 | 71 | return NULL; |
72 | 72 | } |
73 | - $shortcode = str_replace( 'EES_', '', strtoupper( $shortcode_class )); |
|
74 | - $shortcode_obj = isset( EE_Registry::instance()->shortcodes->{$shortcode} ) ? EE_Registry::instance()->shortcodes->{$shortcode} : NULL; |
|
73 | + $shortcode = str_replace('EES_', '', strtoupper($shortcode_class)); |
|
74 | + $shortcode_obj = isset(EE_Registry::instance()->shortcodes->{$shortcode} ) ? EE_Registry::instance()->shortcodes->{$shortcode} : NULL; |
|
75 | 75 | return $shortcode_obj instanceof $shortcode_class || $shortcode_class == 'self' ? $shortcode_obj : new $shortcode_class(); |
76 | 76 | } |
77 | 77 | |
@@ -86,23 +86,23 @@ discard block |
||
86 | 86 | * @param $attributes |
87 | 87 | * @return mixed |
88 | 88 | */ |
89 | - final public static function fallback_shortcode_processor( $attributes ) { |
|
90 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
89 | + final public static function fallback_shortcode_processor($attributes) { |
|
90 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
91 | 91 | return null; |
92 | 92 | } |
93 | 93 | // what shortcode was actually parsed ? |
94 | 94 | $shortcode_class = get_called_class(); |
95 | 95 | // notify rest of system that fallback processor was triggered |
96 | - add_filter( 'FHEE__fallback_shortcode_processor__' . $shortcode_class, '__return_true' ); |
|
96 | + add_filter('FHEE__fallback_shortcode_processor__'.$shortcode_class, '__return_true'); |
|
97 | 97 | // get instance of actual shortcode |
98 | - $shortcode_obj = self::instance( $shortcode_class ); |
|
98 | + $shortcode_obj = self::instance($shortcode_class); |
|
99 | 99 | // verify class |
100 | - if ( $shortcode_obj instanceof EES_Shortcode ) { |
|
100 | + if ($shortcode_obj instanceof EES_Shortcode) { |
|
101 | 101 | global $wp; |
102 | - $shortcode_obj->run( $wp ); |
|
102 | + $shortcode_obj->run($wp); |
|
103 | 103 | // set attributes and run the shortcode |
104 | - $shortcode_obj->_attributes = (array)$attributes; |
|
105 | - return $shortcode_obj->process_shortcode( $shortcode_obj->_attributes ); |
|
104 | + $shortcode_obj->_attributes = (array) $attributes; |
|
105 | + return $shortcode_obj->process_shortcode($shortcode_obj->_attributes); |
|
106 | 106 | } else { |
107 | 107 | return NULL; |
108 | 108 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @param $attributes |
119 | 119 | * @return string |
120 | 120 | */ |
121 | - final public static function invalid_shortcode_processor( $attributes ) { |
|
121 | + final public static function invalid_shortcode_processor($attributes) { |
|
122 | 122 | return ''; |
123 | 123 | } |
124 | 124 | |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | */ |
133 | 133 | final public function __construct() { |
134 | 134 | // get classname, remove EES_prefix, and convert to UPPERCASE |
135 | - $shortcode = strtoupper( str_replace( 'EES_', '', get_class( $this ))); |
|
135 | + $shortcode = strtoupper(str_replace('EES_', '', get_class($this))); |
|
136 | 136 | // assign shortcode to the preferred callback, which overwrites the "fallback shortcode processor" assigned earlier |
137 | - add_shortcode( $shortcode, array( $this, 'process_shortcode' )); |
|
137 | + add_shortcode($shortcode, array($this, 'process_shortcode')); |
|
138 | 138 | // make sure system knows this is an EE page |
139 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
139 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * @ override magic methods |
34 | 34 | * @ return void |
35 | 35 | */ |
36 | - public function __set($a,$b) { return FALSE; } |
|
36 | + public function __set($a, $b) { return FALSE; } |
|
37 | 37 | public function __get($a) { return FALSE; } |
38 | 38 | public function __isset($a) { return FALSE; } |
39 | 39 | public function __unset($a) { return FALSE; } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * |
4 | 6 | * Class EE_Payment_Method_Manager |
@@ -139,7 +141,7 @@ discard block |
||
139 | 141 | if(isset($this->_payment_method_types[$payment_method_name])){ |
140 | 142 | require_once($this->_payment_method_types[$payment_method_name]); |
141 | 143 | return true; |
142 | - }else{ |
|
144 | + } else{ |
|
143 | 145 | return false; |
144 | 146 | } |
145 | 147 | } |
@@ -159,7 +161,7 @@ discard block |
||
159 | 161 | $payment_methods[] = $this->payment_method_class_from_type($classname); |
160 | 162 | } |
161 | 163 | return $payment_methods; |
162 | - }else{ |
|
164 | + } else{ |
|
163 | 165 | return array_keys($this->_payment_method_types); |
164 | 166 | } |
165 | 167 | } |
@@ -242,7 +244,7 @@ discard block |
||
242 | 244 | } |
243 | 245 | } |
244 | 246 | |
245 | - }else{ |
|
247 | + } else{ |
|
246 | 248 | $payment_method->set_active(); |
247 | 249 | $payment_method->save(); |
248 | 250 | } |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | public $map_settings = null; |
90 | 90 | |
91 | 91 | /** |
92 | - * |
|
93 | - * @deprecated |
|
94 | - * @var EE_Gateway_Config |
|
95 | - */ |
|
92 | + * |
|
93 | + * @deprecated |
|
94 | + * @var EE_Gateway_Config |
|
95 | + */ |
|
96 | 96 | public $gateway = null; |
97 | 97 | |
98 | 98 | /** |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | |
583 | 583 | /** |
584 | 584 | * update_config |
585 | - * Important: the config object must ALREADY be set, otherwise this will produce an error. |
|
585 | + * Important: the config object must ALREADY be set, otherwise this will produce an error. |
|
586 | 586 | * |
587 | 587 | * @access public |
588 | 588 | * @param string $section |
@@ -1606,51 +1606,51 @@ discard block |
||
1606 | 1606 | class EE_Organization_Config extends EE_Config_Base { |
1607 | 1607 | |
1608 | 1608 | /** |
1609 | - * @var string $name |
|
1610 | - * eg EE4.1 |
|
1611 | - */ |
|
1609 | + * @var string $name |
|
1610 | + * eg EE4.1 |
|
1611 | + */ |
|
1612 | 1612 | public $name; |
1613 | 1613 | |
1614 | 1614 | /** |
1615 | - * @var string $address_1 |
|
1616 | - * eg 123 Onna Road |
|
1617 | - */ |
|
1615 | + * @var string $address_1 |
|
1616 | + * eg 123 Onna Road |
|
1617 | + */ |
|
1618 | 1618 | public $address_1; |
1619 | 1619 | |
1620 | 1620 | /** |
1621 | - * @var string $address_2 |
|
1622 | - * eg PO Box 123 |
|
1623 | - */ |
|
1621 | + * @var string $address_2 |
|
1622 | + * eg PO Box 123 |
|
1623 | + */ |
|
1624 | 1624 | public $address_2; |
1625 | 1625 | |
1626 | 1626 | /** |
1627 | - * @var string $city |
|
1628 | - * eg Inna City |
|
1629 | - */ |
|
1627 | + * @var string $city |
|
1628 | + * eg Inna City |
|
1629 | + */ |
|
1630 | 1630 | public $city; |
1631 | 1631 | |
1632 | 1632 | /** |
1633 | - * @var int $STA_ID |
|
1634 | - * eg 4 |
|
1635 | - */ |
|
1633 | + * @var int $STA_ID |
|
1634 | + * eg 4 |
|
1635 | + */ |
|
1636 | 1636 | public $STA_ID; |
1637 | 1637 | |
1638 | 1638 | /** |
1639 | - * @var string $CNT_ISO |
|
1640 | - * eg US |
|
1641 | - */ |
|
1639 | + * @var string $CNT_ISO |
|
1640 | + * eg US |
|
1641 | + */ |
|
1642 | 1642 | public $CNT_ISO; |
1643 | 1643 | |
1644 | 1644 | /** |
1645 | - * @var string $zip |
|
1646 | - * eg 12345 or V1A 2B3 |
|
1647 | - */ |
|
1645 | + * @var string $zip |
|
1646 | + * eg 12345 or V1A 2B3 |
|
1647 | + */ |
|
1648 | 1648 | public $zip; |
1649 | 1649 | |
1650 | 1650 | /** |
1651 | - * @var string $email |
|
1652 | - * eg [email protected] |
|
1653 | - */ |
|
1651 | + * @var string $email |
|
1652 | + * eg [email protected] |
|
1653 | + */ |
|
1654 | 1654 | public $email; |
1655 | 1655 | |
1656 | 1656 | |
@@ -1669,9 +1669,9 @@ discard block |
||
1669 | 1669 | public $vat; |
1670 | 1670 | |
1671 | 1671 | /** |
1672 | - * @var string $logo_url |
|
1673 | - * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg |
|
1674 | - */ |
|
1672 | + * @var string $logo_url |
|
1673 | + * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg |
|
1674 | + */ |
|
1675 | 1675 | public $logo_url; |
1676 | 1676 | |
1677 | 1677 | |
@@ -1765,55 +1765,55 @@ discard block |
||
1765 | 1765 | class EE_Currency_Config extends EE_Config_Base { |
1766 | 1766 | |
1767 | 1767 | /** |
1768 | - * @var string $code |
|
1769 | - * eg 'US' |
|
1770 | - */ |
|
1768 | + * @var string $code |
|
1769 | + * eg 'US' |
|
1770 | + */ |
|
1771 | 1771 | public $code; |
1772 | 1772 | |
1773 | 1773 | /** |
1774 | - * @var string $name |
|
1775 | - * eg 'Dollar' |
|
1776 | - */ |
|
1774 | + * @var string $name |
|
1775 | + * eg 'Dollar' |
|
1776 | + */ |
|
1777 | 1777 | public $name; |
1778 | 1778 | |
1779 | 1779 | /** |
1780 | - * plural name |
|
1781 | - * @var string $plural |
|
1782 | - * eg 'Dollars' |
|
1783 | - */ |
|
1780 | + * plural name |
|
1781 | + * @var string $plural |
|
1782 | + * eg 'Dollars' |
|
1783 | + */ |
|
1784 | 1784 | public $plural; |
1785 | 1785 | |
1786 | 1786 | /** |
1787 | - * currency sign |
|
1788 | - * @var string $sign |
|
1789 | - * eg '$' |
|
1790 | - */ |
|
1787 | + * currency sign |
|
1788 | + * @var string $sign |
|
1789 | + * eg '$' |
|
1790 | + */ |
|
1791 | 1791 | public $sign; |
1792 | 1792 | |
1793 | 1793 | /** |
1794 | - * Whether the currency sign should come before the number or not |
|
1795 | - * @var boolean $sign_b4 |
|
1796 | - */ |
|
1794 | + * Whether the currency sign should come before the number or not |
|
1795 | + * @var boolean $sign_b4 |
|
1796 | + */ |
|
1797 | 1797 | public $sign_b4; |
1798 | 1798 | |
1799 | 1799 | /** |
1800 | - * How many digits should come after the decimal place |
|
1801 | - * @var int $dec_plc |
|
1802 | - */ |
|
1800 | + * How many digits should come after the decimal place |
|
1801 | + * @var int $dec_plc |
|
1802 | + */ |
|
1803 | 1803 | public $dec_plc; |
1804 | 1804 | |
1805 | 1805 | /** |
1806 | - * Symbol to use for decimal mark |
|
1807 | - * @var string $dec_mrk |
|
1808 | - * eg '.' |
|
1809 | - */ |
|
1806 | + * Symbol to use for decimal mark |
|
1807 | + * @var string $dec_mrk |
|
1808 | + * eg '.' |
|
1809 | + */ |
|
1810 | 1810 | public $dec_mrk; |
1811 | 1811 | |
1812 | 1812 | /** |
1813 | - * Symbol to use for thousands |
|
1814 | - * @var string $thsnds |
|
1815 | - * eg ',' |
|
1816 | - */ |
|
1813 | + * Symbol to use for thousands |
|
1814 | + * @var string $thsnds |
|
1815 | + * eg ',' |
|
1816 | + */ |
|
1817 | 1817 | public $thsnds; |
1818 | 1818 | |
1819 | 1819 | |
@@ -1881,13 +1881,13 @@ discard block |
||
1881 | 1881 | * whether or not to show alternate payment options during the reg process if payment status is pending |
1882 | 1882 | * @var boolean $show_pending_payment_options |
1883 | 1883 | */ |
1884 | - public $show_pending_payment_options; |
|
1884 | + public $show_pending_payment_options; |
|
1885 | 1885 | |
1886 | 1886 | /** |
1887 | 1887 | * Whether to skip the registration confirmation page |
1888 | 1888 | * @var boolean $skip_reg_confirmation |
1889 | 1889 | */ |
1890 | - public $skip_reg_confirmation; |
|
1890 | + public $skip_reg_confirmation; |
|
1891 | 1891 | |
1892 | 1892 | /** |
1893 | 1893 | * an array of SPCO reg steps where: |
@@ -1898,64 +1898,64 @@ discard block |
||
1898 | 1898 | * "slug" => the URL param used to trigger the reg step |
1899 | 1899 | * @var array $reg_steps |
1900 | 1900 | */ |
1901 | - public $reg_steps; |
|
1901 | + public $reg_steps; |
|
1902 | 1902 | |
1903 | 1903 | /** |
1904 | 1904 | * Whether registration confirmation should be the last page of SPCO |
1905 | 1905 | * @var boolean $reg_confirmation_last |
1906 | 1906 | */ |
1907 | - public $reg_confirmation_last; |
|
1907 | + public $reg_confirmation_last; |
|
1908 | 1908 | |
1909 | 1909 | /** |
1910 | 1910 | * Whether or not to enable the EE Bot Trap |
1911 | 1911 | * @var boolean $use_bot_trap |
1912 | 1912 | */ |
1913 | - public $use_bot_trap; |
|
1913 | + public $use_bot_trap; |
|
1914 | 1914 | |
1915 | 1915 | /** |
1916 | 1916 | * Whether or not to encrypt some data sent by the EE Bot Trap |
1917 | 1917 | * @var boolean $use_encryption |
1918 | 1918 | */ |
1919 | - public $use_encryption; |
|
1919 | + public $use_encryption; |
|
1920 | 1920 | |
1921 | 1921 | /** |
1922 | 1922 | * Whether or not to use ReCaptcha |
1923 | 1923 | * @var boolean $use_captcha |
1924 | 1924 | */ |
1925 | - public $use_captcha; |
|
1925 | + public $use_captcha; |
|
1926 | 1926 | |
1927 | 1927 | /** |
1928 | 1928 | * ReCaptcha Theme |
1929 | 1929 | * @var string $recaptcha_theme |
1930 | 1930 | * options: 'dark ', 'light' |
1931 | 1931 | */ |
1932 | - public $recaptcha_theme; |
|
1932 | + public $recaptcha_theme; |
|
1933 | 1933 | |
1934 | 1934 | /** |
1935 | 1935 | * ReCaptcha Type |
1936 | 1936 | * @var string $recaptcha_type |
1937 | 1937 | * options: 'audio', 'image' |
1938 | 1938 | */ |
1939 | - public $recaptcha_type; |
|
1939 | + public $recaptcha_type; |
|
1940 | 1940 | |
1941 | 1941 | /** |
1942 | 1942 | * ReCaptcha language |
1943 | 1943 | * @var string $recaptcha_language |
1944 | 1944 | * eg 'en' |
1945 | 1945 | */ |
1946 | - public $recaptcha_language; |
|
1946 | + public $recaptcha_language; |
|
1947 | 1947 | |
1948 | 1948 | /** |
1949 | 1949 | * ReCaptcha public key |
1950 | 1950 | * @var string $recaptcha_publickey |
1951 | 1951 | */ |
1952 | - public $recaptcha_publickey; |
|
1952 | + public $recaptcha_publickey; |
|
1953 | 1953 | |
1954 | 1954 | /** |
1955 | 1955 | * ReCaptcha private key |
1956 | 1956 | * @var string $recaptcha_privatekey |
1957 | 1957 | */ |
1958 | - public $recaptcha_privatekey; |
|
1958 | + public $recaptcha_privatekey; |
|
1959 | 1959 | |
1960 | 1960 | /** |
1961 | 1961 | * ReCaptcha width |
@@ -2021,58 +2021,58 @@ discard block |
||
2021 | 2021 | class EE_Admin_Config extends EE_Config_Base { |
2022 | 2022 | |
2023 | 2023 | /** |
2024 | - * @var boolean $use_personnel_manager |
|
2025 | - */ |
|
2024 | + * @var boolean $use_personnel_manager |
|
2025 | + */ |
|
2026 | 2026 | public $use_personnel_manager; |
2027 | 2027 | |
2028 | 2028 | /** |
2029 | - * @var boolean $use_dashboard_widget |
|
2030 | - */ |
|
2029 | + * @var boolean $use_dashboard_widget |
|
2030 | + */ |
|
2031 | 2031 | public $use_dashboard_widget; |
2032 | 2032 | |
2033 | 2033 | /** |
2034 | - * @var int $events_in_dashboard |
|
2035 | - */ |
|
2034 | + * @var int $events_in_dashboard |
|
2035 | + */ |
|
2036 | 2036 | public $events_in_dashboard; |
2037 | 2037 | |
2038 | 2038 | /** |
2039 | - * @var boolean $use_event_timezones |
|
2040 | - */ |
|
2039 | + * @var boolean $use_event_timezones |
|
2040 | + */ |
|
2041 | 2041 | public $use_event_timezones; |
2042 | 2042 | |
2043 | 2043 | /** |
2044 | - * @var boolean $use_full_logging |
|
2045 | - */ |
|
2044 | + * @var boolean $use_full_logging |
|
2045 | + */ |
|
2046 | 2046 | public $use_full_logging; |
2047 | 2047 | |
2048 | 2048 | /** |
2049 | - * @var string $log_file_name |
|
2050 | - */ |
|
2049 | + * @var string $log_file_name |
|
2050 | + */ |
|
2051 | 2051 | public $log_file_name; |
2052 | 2052 | |
2053 | 2053 | /** |
2054 | - * @var string $debug_file_name |
|
2055 | - */ |
|
2054 | + * @var string $debug_file_name |
|
2055 | + */ |
|
2056 | 2056 | public $debug_file_name; |
2057 | 2057 | |
2058 | 2058 | /** |
2059 | - * @var boolean $use_remote_logging |
|
2060 | - */ |
|
2059 | + * @var boolean $use_remote_logging |
|
2060 | + */ |
|
2061 | 2061 | public $use_remote_logging; |
2062 | 2062 | |
2063 | 2063 | /** |
2064 | - * @var string $remote_logging_url |
|
2065 | - */ |
|
2064 | + * @var string $remote_logging_url |
|
2065 | + */ |
|
2066 | 2066 | public $remote_logging_url; |
2067 | 2067 | |
2068 | 2068 | /** |
2069 | - * @var boolean $show_reg_footer |
|
2070 | - */ |
|
2069 | + * @var boolean $show_reg_footer |
|
2070 | + */ |
|
2071 | 2071 | public $show_reg_footer; |
2072 | 2072 | |
2073 | 2073 | /** |
2074 | - * @var string $affiliate_id |
|
2075 | - */ |
|
2074 | + * @var string $affiliate_id |
|
2075 | + */ |
|
2076 | 2076 | public $affiliate_id; |
2077 | 2077 | |
2078 | 2078 | |
@@ -2146,43 +2146,43 @@ discard block |
||
2146 | 2146 | class EE_Template_Config extends EE_Config_Base { |
2147 | 2147 | |
2148 | 2148 | /** |
2149 | - * @var boolean $enable_default_style |
|
2150 | - */ |
|
2149 | + * @var boolean $enable_default_style |
|
2150 | + */ |
|
2151 | 2151 | public $enable_default_style; |
2152 | 2152 | |
2153 | 2153 | /** |
2154 | - * @var string $custom_style_sheet |
|
2155 | - */ |
|
2154 | + * @var string $custom_style_sheet |
|
2155 | + */ |
|
2156 | 2156 | public $custom_style_sheet; |
2157 | 2157 | |
2158 | 2158 | /** |
2159 | - * @var boolean $display_address_in_regform |
|
2160 | - */ |
|
2159 | + * @var boolean $display_address_in_regform |
|
2160 | + */ |
|
2161 | 2161 | public $display_address_in_regform; |
2162 | 2162 | |
2163 | 2163 | /** |
2164 | - * @var int $display_description_on_multi_reg_page |
|
2165 | - */ |
|
2164 | + * @var int $display_description_on_multi_reg_page |
|
2165 | + */ |
|
2166 | 2166 | public $display_description_on_multi_reg_page; |
2167 | 2167 | |
2168 | 2168 | /** |
2169 | - * @var boolean $use_custom_templates |
|
2170 | - */ |
|
2169 | + * @var boolean $use_custom_templates |
|
2170 | + */ |
|
2171 | 2171 | public $use_custom_templates; |
2172 | 2172 | |
2173 | 2173 | /** |
2174 | - * @var string $current_espresso_theme |
|
2175 | - */ |
|
2174 | + * @var string $current_espresso_theme |
|
2175 | + */ |
|
2176 | 2176 | public $current_espresso_theme; |
2177 | 2177 | |
2178 | 2178 | /** |
2179 | - * @var EE_Event_Single_Config $EED_Event_Single |
|
2180 | - */ |
|
2179 | + * @var EE_Event_Single_Config $EED_Event_Single |
|
2180 | + */ |
|
2181 | 2181 | public $EED_Event_Single; |
2182 | 2182 | |
2183 | 2183 | /** |
2184 | - * @var EE_Events_Archive_Config $EED_Events_Archive |
|
2185 | - */ |
|
2184 | + * @var EE_Events_Archive_Config $EED_Events_Archive |
|
2185 | + */ |
|
2186 | 2186 | public $EED_Events_Archive; |
2187 | 2187 | |
2188 | 2188 | |
@@ -2215,78 +2215,78 @@ discard block |
||
2215 | 2215 | class EE_Map_Config extends EE_Config_Base { |
2216 | 2216 | |
2217 | 2217 | /** |
2218 | - * @var boolean $use_google_maps |
|
2219 | - */ |
|
2218 | + * @var boolean $use_google_maps |
|
2219 | + */ |
|
2220 | 2220 | public $use_google_maps; |
2221 | 2221 | |
2222 | 2222 | /** |
2223 | - * @var int $event_details_map_width |
|
2224 | - */ |
|
2223 | + * @var int $event_details_map_width |
|
2224 | + */ |
|
2225 | 2225 | public $event_details_map_width; |
2226 | 2226 | |
2227 | 2227 | /** |
2228 | - * @var int $event_details_map_height |
|
2229 | - */ |
|
2228 | + * @var int $event_details_map_height |
|
2229 | + */ |
|
2230 | 2230 | public $event_details_map_height; |
2231 | 2231 | |
2232 | 2232 | /** |
2233 | - * @var int $event_details_map_zoom |
|
2234 | - */ |
|
2233 | + * @var int $event_details_map_zoom |
|
2234 | + */ |
|
2235 | 2235 | public $event_details_map_zoom; |
2236 | 2236 | |
2237 | 2237 | /** |
2238 | - * @var boolean $event_details_display_nav |
|
2239 | - */ |
|
2238 | + * @var boolean $event_details_display_nav |
|
2239 | + */ |
|
2240 | 2240 | public $event_details_display_nav; |
2241 | 2241 | |
2242 | 2242 | /** |
2243 | - * @var boolean $event_details_nav_size |
|
2244 | - */ |
|
2243 | + * @var boolean $event_details_nav_size |
|
2244 | + */ |
|
2245 | 2245 | public $event_details_nav_size; |
2246 | 2246 | |
2247 | 2247 | /** |
2248 | - * @var string $event_details_control_type |
|
2249 | - */ |
|
2248 | + * @var string $event_details_control_type |
|
2249 | + */ |
|
2250 | 2250 | public $event_details_control_type; |
2251 | 2251 | |
2252 | 2252 | /** |
2253 | - * @var string $event_details_map_align |
|
2254 | - */ |
|
2253 | + * @var string $event_details_map_align |
|
2254 | + */ |
|
2255 | 2255 | public $event_details_map_align; |
2256 | 2256 | |
2257 | 2257 | /** |
2258 | - * @var int $event_list_map_width |
|
2259 | - */ |
|
2258 | + * @var int $event_list_map_width |
|
2259 | + */ |
|
2260 | 2260 | public $event_list_map_width; |
2261 | 2261 | |
2262 | 2262 | /** |
2263 | - * @var int $event_list_map_height |
|
2264 | - */ |
|
2263 | + * @var int $event_list_map_height |
|
2264 | + */ |
|
2265 | 2265 | public $event_list_map_height; |
2266 | 2266 | |
2267 | 2267 | /** |
2268 | - * @var int $event_list_map_zoom |
|
2269 | - */ |
|
2268 | + * @var int $event_list_map_zoom |
|
2269 | + */ |
|
2270 | 2270 | public $event_list_map_zoom; |
2271 | 2271 | |
2272 | 2272 | /** |
2273 | - * @var boolean $event_list_display_nav |
|
2274 | - */ |
|
2273 | + * @var boolean $event_list_display_nav |
|
2274 | + */ |
|
2275 | 2275 | public $event_list_display_nav; |
2276 | 2276 | |
2277 | 2277 | /** |
2278 | - * @var boolean $event_list_nav_size |
|
2279 | - */ |
|
2278 | + * @var boolean $event_list_nav_size |
|
2279 | + */ |
|
2280 | 2280 | public $event_list_nav_size; |
2281 | 2281 | |
2282 | 2282 | /** |
2283 | - * @var string $event_list_control_type |
|
2284 | - */ |
|
2283 | + * @var string $event_list_control_type |
|
2284 | + */ |
|
2285 | 2285 | public $event_list_control_type; |
2286 | 2286 | |
2287 | 2287 | /** |
2288 | - * @var string $event_list_map_align |
|
2289 | - */ |
|
2288 | + * @var string $event_list_map_align |
|
2289 | + */ |
|
2290 | 2290 | public $event_list_map_align; |
2291 | 2291 | |
2292 | 2292 |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | * update_espresso_config |
364 | 364 | * |
365 | 365 | * @access public |
366 | - * @return bool |
|
366 | + * @return boolean|null |
|
367 | 367 | */ |
368 | 368 | protected function _reset_espresso_addon_config() { |
369 | 369 | $this->_config_option_names = array(); |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | * @param string $name |
444 | 444 | * @param string $config_class |
445 | 445 | * @param EE_Config_Base $config_obj |
446 | - * @param array $tests_to_run |
|
446 | + * @param integer[] $tests_to_run |
|
447 | 447 | * @param bool $display_errors |
448 | 448 | * @return bool TRUE on success, FALSE on fail |
449 | 449 | */ |
@@ -1592,7 +1592,7 @@ discard block |
||
1592 | 1592 | |
1593 | 1593 | |
1594 | 1594 | /** |
1595 | - * @return array |
|
1595 | + * @return integer[] |
|
1596 | 1596 | */ |
1597 | 1597 | public function get_critical_pages_array() { |
1598 | 1598 | return array( |
@@ -1605,7 +1605,7 @@ discard block |
||
1605 | 1605 | |
1606 | 1606 | |
1607 | 1607 | /** |
1608 | - * @return array |
|
1608 | + * @return string[] |
|
1609 | 1609 | */ |
1610 | 1610 | public function get_critical_pages_shortcodes_array() { |
1611 | 1611 | return array( |
@@ -1928,7 +1928,7 @@ discard block |
||
1928 | 1928 | * class constructor |
1929 | 1929 | * |
1930 | 1930 | * @access public |
1931 | - * @param null $CNT_ISO |
|
1931 | + * @param string $CNT_ISO |
|
1932 | 1932 | * @return \EE_Currency_Config |
1933 | 1933 | */ |
1934 | 1934 | public function __construct( $CNT_ISO = NULL ) { |
@@ -2567,7 +2567,7 @@ discard block |
||
2567 | 2567 | * |
2568 | 2568 | * @param int $input_count the count of input vars. |
2569 | 2569 | * |
2570 | - * @return array { |
|
2570 | + * @return string { |
|
2571 | 2571 | * An array that represents whether available space and if no available space the error message. |
2572 | 2572 | * @type bool $has_space whether more inputs can be added. |
2573 | 2573 | * @type string $msg Any message to be displayed. |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public static function instance() { |
130 | 130 | // check if class object is instantiated, and instantiated properly |
131 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
131 | + if ( ! self::$_instance instanceof EE_Config) { |
|
132 | 132 | self::$_instance = new self(); |
133 | 133 | } |
134 | 134 | return self::$_instance; |
@@ -145,22 +145,22 @@ discard block |
||
145 | 145 | * not be ready to instantiate EE_Config currently (eg if the site was put into maintenance mode) |
146 | 146 | * @return EE_Config |
147 | 147 | */ |
148 | - public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE ){ |
|
149 | - if ( $hard_reset ) { |
|
148 | + public static function reset($hard_reset = FALSE, $reinstantiate = TRUE) { |
|
149 | + if ($hard_reset) { |
|
150 | 150 | self::$_instance->_config_option_names = array(); |
151 | 151 | self::$_instance->_initialize_config(); |
152 | 152 | self::$_instance->update_espresso_config(); |
153 | 153 | } |
154 | - if( self::$_instance instanceof EE_Config ){ |
|
154 | + if (self::$_instance instanceof EE_Config) { |
|
155 | 155 | self::$_instance->shutdown(); |
156 | 156 | } |
157 | 157 | self::$_instance = NULL; |
158 | 158 | //we don't need to reset the static properties imo because those should |
159 | 159 | //only change when a module is added or removed. Currently we don't |
160 | 160 | //support removing a module during a request when it previously existed |
161 | - if( $reinstantiate ){ |
|
161 | + if ($reinstantiate) { |
|
162 | 162 | return self::instance(); |
163 | - }else{ |
|
163 | + } else { |
|
164 | 164 | return NULL; |
165 | 165 | } |
166 | 166 | } |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | * @return \EE_Config |
175 | 175 | */ |
176 | 176 | private function __construct() { |
177 | - do_action( 'AHEE__EE_Config__construct__begin',$this ); |
|
178 | - $this->_config_option_names = get_option( 'ee_config_option_names', array() ); |
|
177 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
178 | + $this->_config_option_names = get_option('ee_config_option_names', array()); |
|
179 | 179 | // setup empty config classes |
180 | 180 | $this->_initialize_config(); |
181 | 181 | // load existing EE site settings |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | // confirm everything loaded correctly and set filtered defaults if not |
184 | 184 | $this->_verify_config(); |
185 | 185 | // register shortcodes and modules |
186 | - add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 ); |
|
186 | + add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999); |
|
187 | 187 | // initialize shortcodes and modules |
188 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' )); |
|
188 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
189 | 189 | // register widgets |
190 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
190 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
191 | 191 | // shutdown |
192 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
192 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
193 | 193 | // construct__end hook |
194 | - do_action( 'AHEE__EE_Config__construct__end',$this ); |
|
194 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
195 | 195 | // hardcoded hack |
196 | 196 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
197 | 197 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @return string current theme set. |
205 | 205 | */ |
206 | 206 | public static function get_current_theme() { |
207 | - return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
207 | + return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -238,27 +238,27 @@ discard block |
||
238 | 238 | */ |
239 | 239 | private function _load_core_config() { |
240 | 240 | // load_core_config__start hook |
241 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
241 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
242 | 242 | $espresso_config = $this->get_espresso_config(); |
243 | - foreach ( $espresso_config as $config => $settings ) { |
|
243 | + foreach ($espresso_config as $config => $settings) { |
|
244 | 244 | // load_core_config__start hook |
245 | - $settings = apply_filters( 'FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this ); |
|
246 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
247 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
245 | + $settings = apply_filters('FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this); |
|
246 | + if (is_object($settings) && property_exists($this, $config)) { |
|
247 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
248 | 248 | //call configs populate method to ensure any defaults are set for empty values. |
249 | - if ( method_exists( $settings, 'populate' ) ) { |
|
249 | + if (method_exists($settings, 'populate')) { |
|
250 | 250 | $this->{$config}->populate(); |
251 | 251 | } |
252 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
252 | + if (method_exists($settings, 'do_hooks')) { |
|
253 | 253 | $this->{$config}->do_hooks(); |
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
257 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', FALSE ) ) { |
|
257 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', FALSE)) { |
|
258 | 258 | $this->update_espresso_config(); |
259 | 259 | } |
260 | 260 | // load_core_config__end hook |
261 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
261 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -272,40 +272,40 @@ discard block |
||
272 | 272 | protected function _verify_config() { |
273 | 273 | |
274 | 274 | $this->core = $this->core instanceof EE_Core_Config |
275 | - ? $this->core : new EE_Core_Config(); |
|
276 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
275 | + ? $this->core : new EE_Core_Config(); |
|
276 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
277 | 277 | |
278 | 278 | $this->organization = $this->organization instanceof EE_Organization_Config |
279 | - ? $this->organization : new EE_Organization_Config(); |
|
280 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
279 | + ? $this->organization : new EE_Organization_Config(); |
|
280 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
281 | 281 | |
282 | 282 | $this->currency = $this->currency instanceof EE_Currency_Config |
283 | 283 | ? $this->currency : new EE_Currency_Config(); |
284 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
284 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
285 | 285 | |
286 | 286 | $this->registration = $this->registration instanceof EE_Registration_Config |
287 | 287 | ? $this->registration : new EE_Registration_Config(); |
288 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
288 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
289 | 289 | |
290 | 290 | $this->admin = $this->admin instanceof EE_Admin_Config |
291 | 291 | ? $this->admin : new EE_Admin_Config(); |
292 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
292 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
293 | 293 | |
294 | 294 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
295 | 295 | ? $this->template_settings : new EE_Template_Config(); |
296 | - $this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', $this->template_settings ); |
|
296 | + $this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', $this->template_settings); |
|
297 | 297 | |
298 | 298 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
299 | 299 | ? $this->map_settings : new EE_Map_Config(); |
300 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
300 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
301 | 301 | |
302 | 302 | $this->environment = $this->environment instanceof EE_Environment_Config |
303 | 303 | ? $this->environment : new EE_Environment_Config(); |
304 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
304 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
305 | 305 | |
306 | 306 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
307 | 307 | ? $this->gateway : new EE_Gateway_Config(); |
308 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
308 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
309 | 309 | |
310 | 310 | } |
311 | 311 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | public function get_espresso_config() { |
321 | 321 | // grab espresso configuration |
322 | - return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() )); |
|
322 | + return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array())); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -332,12 +332,12 @@ discard block |
||
332 | 332 | * @param $old_value |
333 | 333 | * @param $value |
334 | 334 | */ |
335 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
335 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
336 | 336 | // make sure we're checking the ee config |
337 | - if ( $option == 'ee_config' ) { |
|
337 | + if ($option == 'ee_config') { |
|
338 | 338 | // run a loose comparison of the old value against the new value for type and properties, |
339 | 339 | // but NOT exact instance like WP update_option does |
340 | - if ( $value != $old_value ) { |
|
340 | + if ($value != $old_value) { |
|
341 | 341 | // if they are NOT the same, then remove the hook, |
342 | 342 | // which means the subsequent update results will be based solely on the update query results |
343 | 343 | // the reason we do this is because, as stated above, |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | // the string it sees in the db looks the same as the new one it has been passed!!! |
353 | 353 | // This results in the query returning an "affected rows" value of ZERO, |
354 | 354 | // which gets returned immediately by WP update_option and looks like an error. |
355 | - remove_action( 'update_option', array( $this, 'check_config_updated' )); |
|
355 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 | } |
@@ -367,11 +367,11 @@ discard block |
||
367 | 367 | */ |
368 | 368 | protected function _reset_espresso_addon_config() { |
369 | 369 | $this->_config_option_names = array(); |
370 | - foreach( $this->addons as $addon_name => $addon_config_obj ) { |
|
371 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
372 | - $config_class = get_class( $addon_config_obj ); |
|
373 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
374 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE ); |
|
370 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
371 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
372 | + $config_class = get_class($addon_config_obj); |
|
373 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
374 | + $this->update_config('addons', $addon_name, $addon_config_obj, FALSE); |
|
375 | 375 | } |
376 | 376 | $this->addons->{$addon_name} = NULL; |
377 | 377 | } |
@@ -387,17 +387,17 @@ discard block |
||
387 | 387 | * @param bool $add_error |
388 | 388 | * @return bool |
389 | 389 | */ |
390 | - public function update_espresso_config( $add_success = FALSE, $add_error = TRUE ) { |
|
390 | + public function update_espresso_config($add_success = FALSE, $add_error = TRUE) { |
|
391 | 391 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
392 | 392 | //$clone = clone( self::$_instance ); |
393 | 393 | //self::$_instance = NULL; |
394 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this ); |
|
394 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
395 | 395 | $this->_reset_espresso_addon_config(); |
396 | 396 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
397 | 397 | // but BEFORE the actual update occurs |
398 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
398 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
399 | 399 | // now update "ee_config" |
400 | - $saved = update_option( 'ee_config', $this ); |
|
400 | + $saved = update_option('ee_config', $this); |
|
401 | 401 | // if not saved... check if the hook we just added still exists; |
402 | 402 | // if it does, it means one of two things: |
403 | 403 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -408,25 +408,25 @@ discard block |
||
408 | 408 | // but just means no update occurred, so don't display an error to the user. |
409 | 409 | // BUT... if update_option returns FALSE, AND the hook is missing, |
410 | 410 | // then it means that something truly went wrong |
411 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved; |
|
411 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
412 | 412 | // remove our action since we don't want it in the system anymore |
413 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
414 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
413 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
414 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
415 | 415 | //self::$_instance = $clone; |
416 | 416 | //unset( $clone ); |
417 | 417 | // if config remains the same or was updated successfully |
418 | - if ( $saved ) { |
|
419 | - if ( $add_success ) { |
|
418 | + if ($saved) { |
|
419 | + if ($add_success) { |
|
420 | 420 | EE_Error::add_success( |
421 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
421 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
422 | 422 | __FILE__, __FUNCTION__, __LINE__ |
423 | 423 | ); |
424 | 424 | } |
425 | 425 | return TRUE; |
426 | 426 | } else { |
427 | - if ( $add_error ) { |
|
427 | + if ($add_error) { |
|
428 | 428 | EE_Error::add_error( |
429 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
429 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
430 | 430 | __FILE__, __FUNCTION__, __LINE__ |
431 | 431 | ); |
432 | 432 | } |
@@ -452,20 +452,20 @@ discard block |
||
452 | 452 | $name = '', |
453 | 453 | $config_class = '', |
454 | 454 | $config_obj = NULL, |
455 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
455 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
456 | 456 | $display_errors = TRUE |
457 | 457 | ) { |
458 | 458 | try { |
459 | - foreach ( $tests_to_run as $test ) { |
|
460 | - switch ( $test ) { |
|
459 | + foreach ($tests_to_run as $test) { |
|
460 | + switch ($test) { |
|
461 | 461 | |
462 | 462 | // TEST #1 : check that section was set |
463 | 463 | case 1 : |
464 | - if ( empty( $section ) ) { |
|
465 | - if ( $display_errors ) { |
|
464 | + if (empty($section)) { |
|
465 | + if ($display_errors) { |
|
466 | 466 | throw new EE_Error( |
467 | 467 | sprintf( |
468 | - __( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ), |
|
468 | + __('No configuration section has been provided while attempting to save "%s".', 'event_espresso'), |
|
469 | 469 | $config_class |
470 | 470 | ) |
471 | 471 | ); |
@@ -476,11 +476,11 @@ discard block |
||
476 | 476 | |
477 | 477 | // TEST #2 : check that settings section exists |
478 | 478 | case 2 : |
479 | - if ( ! isset( $this->{$section} ) ) { |
|
480 | - if ( $display_errors ) { |
|
479 | + if ( ! isset($this->{$section} )) { |
|
480 | + if ($display_errors) { |
|
481 | 481 | throw new EE_Error( |
482 | - sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
483 | - $section ) |
|
482 | + sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'), |
|
483 | + $section) |
|
484 | 484 | ); |
485 | 485 | } |
486 | 486 | return false; |
@@ -490,12 +490,12 @@ discard block |
||
490 | 490 | // TEST #3 : check that section is the proper format |
491 | 491 | case 3 : |
492 | 492 | if ( |
493 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
493 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
494 | 494 | ) { |
495 | - if ( $display_errors ) { |
|
495 | + if ($display_errors) { |
|
496 | 496 | throw new EE_Error( |
497 | 497 | sprintf( |
498 | - __( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ), |
|
498 | + __('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'), |
|
499 | 499 | $section |
500 | 500 | ) |
501 | 501 | ); |
@@ -506,10 +506,10 @@ discard block |
||
506 | 506 | |
507 | 507 | // TEST #4 : check that config section name has been set |
508 | 508 | case 4 : |
509 | - if ( empty( $name ) ) { |
|
510 | - if ( $display_errors ) { |
|
509 | + if (empty($name)) { |
|
510 | + if ($display_errors) { |
|
511 | 511 | throw new EE_Error( |
512 | - __( 'No name has been provided for the specific configuration section.', 'event_espresso' ) |
|
512 | + __('No name has been provided for the specific configuration section.', 'event_espresso') |
|
513 | 513 | ); |
514 | 514 | } |
515 | 515 | return false; |
@@ -518,10 +518,10 @@ discard block |
||
518 | 518 | |
519 | 519 | // TEST #5 : check that a config class name has been set |
520 | 520 | case 5 : |
521 | - if ( empty( $config_class ) ) { |
|
522 | - if ( $display_errors ) { |
|
521 | + if (empty($config_class)) { |
|
522 | + if ($display_errors) { |
|
523 | 523 | throw new EE_Error( |
524 | - __( 'No class name has been provided for the specific configuration section.', 'event_espresso' ) |
|
524 | + __('No class name has been provided for the specific configuration section.', 'event_espresso') |
|
525 | 525 | ); |
526 | 526 | } |
527 | 527 | return false; |
@@ -530,11 +530,11 @@ discard block |
||
530 | 530 | |
531 | 531 | // TEST #6 : verify config class is accessible |
532 | 532 | case 6 : |
533 | - if ( ! class_exists( $config_class ) ) { |
|
534 | - if ( $display_errors ) { |
|
533 | + if ( ! class_exists($config_class)) { |
|
534 | + if ($display_errors) { |
|
535 | 535 | throw new EE_Error( |
536 | 536 | sprintf( |
537 | - __( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ), |
|
537 | + __('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'), |
|
538 | 538 | $config_class |
539 | 539 | ) |
540 | 540 | ); |
@@ -545,11 +545,11 @@ discard block |
||
545 | 545 | |
546 | 546 | // TEST #7 : check that config has even been set |
547 | 547 | case 7 : |
548 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
549 | - if ( $display_errors ) { |
|
548 | + if ( ! isset($this->{$section}->{$name} )) { |
|
549 | + if ($display_errors) { |
|
550 | 550 | throw new EE_Error( |
551 | 551 | sprintf( |
552 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
552 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
553 | 553 | $section, |
554 | 554 | $name |
555 | 555 | ) |
@@ -558,17 +558,17 @@ discard block |
||
558 | 558 | return false; |
559 | 559 | } else { |
560 | 560 | // and make sure it's not serialized |
561 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
561 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
562 | 562 | } |
563 | 563 | break; |
564 | 564 | |
565 | 565 | // TEST #8 : check that config is the requested type |
566 | 566 | case 8 : |
567 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
568 | - if ( $display_errors ) { |
|
567 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
568 | + if ($display_errors) { |
|
569 | 569 | throw new EE_Error( |
570 | 570 | sprintf( |
571 | - __( 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso' ), |
|
571 | + __('The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso'), |
|
572 | 572 | $section, |
573 | 573 | $name, |
574 | 574 | $config_class |
@@ -581,12 +581,12 @@ discard block |
||
581 | 581 | |
582 | 582 | // TEST #9 : verify config object |
583 | 583 | case 9 : |
584 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
585 | - if ( $display_errors ) { |
|
584 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
585 | + if ($display_errors) { |
|
586 | 586 | throw new EE_Error( |
587 | 587 | sprintf( |
588 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
589 | - print_r( $config_obj, true ) |
|
588 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
589 | + print_r($config_obj, true) |
|
590 | 590 | ) |
591 | 591 | ); |
592 | 592 | } |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | } |
598 | 598 | } |
599 | 599 | |
600 | - } catch( EE_Error $e ) { |
|
600 | + } catch (EE_Error $e) { |
|
601 | 601 | $e->get_error(); |
602 | 602 | } |
603 | 603 | // you have successfully run the gauntlet |
@@ -614,8 +614,8 @@ discard block |
||
614 | 614 | * @param string $name |
615 | 615 | * @return string |
616 | 616 | */ |
617 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
618 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
617 | + private function _generate_config_option_name($section = '', $name = '') { |
|
618 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | |
@@ -629,10 +629,10 @@ discard block |
||
629 | 629 | * @param string $name |
630 | 630 | * @return string |
631 | 631 | */ |
632 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
633 | - return ! empty( $config_class ) |
|
632 | + private function _set_config_class($config_class = '', $name = '') { |
|
633 | + return ! empty($config_class) |
|
634 | 634 | ? $config_class |
635 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
635 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | |
@@ -646,34 +646,34 @@ discard block |
||
646 | 646 | * @param EE_Config_Base $config_obj |
647 | 647 | * @return EE_Config_Base |
648 | 648 | */ |
649 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
649 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
650 | 650 | // ensure config class is set to something |
651 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
651 | + $config_class = $this->_set_config_class($config_class, $name); |
|
652 | 652 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
653 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ))) { |
|
653 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
654 | 654 | return null; |
655 | 655 | } |
656 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
656 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
657 | 657 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
658 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
659 | - $this->_config_option_names[ $config_option_name ] = $config_class; |
|
658 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
659 | + $this->_config_option_names[$config_option_name] = $config_class; |
|
660 | 660 | } |
661 | 661 | // verify the incoming config object but suppress errors |
662 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false )) { |
|
662 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
663 | 663 | $config_obj = new $config_class(); |
664 | 664 | } |
665 | - if ( get_option( $config_option_name ) ) { |
|
666 | - update_option( $config_option_name, $config_obj ); |
|
665 | + if (get_option($config_option_name)) { |
|
666 | + update_option($config_option_name, $config_obj); |
|
667 | 667 | $this->{$section}->{$name} = $config_obj; |
668 | 668 | return $this->{$section}->{$name}; |
669 | 669 | } else { |
670 | 670 | // create a wp-option for this config |
671 | - if ( add_option( $config_option_name, $config_obj, '', 'no' )) { |
|
672 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
671 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
672 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
673 | 673 | return $this->{$section}->{$name}; |
674 | 674 | } else { |
675 | 675 | EE_Error::add_error( |
676 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
676 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
677 | 677 | __FILE__, __FUNCTION__, __LINE__ |
678 | 678 | ); |
679 | 679 | return null; |
@@ -694,37 +694,37 @@ discard block |
||
694 | 694 | * @param bool $throw_errors |
695 | 695 | * @return bool |
696 | 696 | */ |
697 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
698 | - $config_obj = maybe_unserialize( $config_obj ); |
|
697 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
698 | + $config_obj = maybe_unserialize($config_obj); |
|
699 | 699 | // get class name of the incoming object |
700 | - $config_class = get_class( $config_obj ); |
|
700 | + $config_class = get_class($config_obj); |
|
701 | 701 | // run tests 1-5 and 9 to verify config |
702 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) { |
|
702 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) { |
|
703 | 703 | return false; |
704 | 704 | } |
705 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
705 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
706 | 706 | // check if config object has been added to db by seeing if config option name is in $this->_config_option_names array |
707 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
707 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
708 | 708 | // save new config to db |
709 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
709 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
710 | 710 | } else { |
711 | 711 | // first check if the record already exists |
712 | - $existing_config = get_option( $config_option_name ); |
|
713 | - $config_obj = serialize( $config_obj ); |
|
712 | + $existing_config = get_option($config_option_name); |
|
713 | + $config_obj = serialize($config_obj); |
|
714 | 714 | // just return if db record is already up to date |
715 | - if ( $existing_config == $config_obj ) { |
|
715 | + if ($existing_config == $config_obj) { |
|
716 | 716 | $this->{$section}->{$name} = $config_obj; |
717 | 717 | return true; |
718 | - } else if ( update_option( $config_option_name, $config_obj )) { |
|
718 | + } else if (update_option($config_option_name, $config_obj)) { |
|
719 | 719 | // update wp-option for this config class |
720 | 720 | $this->{$section}->{$name} = $config_obj; |
721 | 721 | return true; |
722 | - } elseif ( $throw_errors ) { |
|
722 | + } elseif ($throw_errors) { |
|
723 | 723 | EE_Error::add_error( |
724 | 724 | sprintf( |
725 | - __( 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso' ), |
|
725 | + __('The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso'), |
|
726 | 726 | $config_class, |
727 | - 'EE_Config->' . $section . '->' . $name |
|
727 | + 'EE_Config->'.$section.'->'.$name |
|
728 | 728 | ), |
729 | 729 | __FILE__, __FUNCTION__, __LINE__ |
730 | 730 | ); |
@@ -744,34 +744,34 @@ discard block |
||
744 | 744 | * @param string $config_class |
745 | 745 | * @return mixed EE_Config_Base | NULL |
746 | 746 | */ |
747 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
747 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
748 | 748 | // ensure config class is set to something |
749 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
749 | + $config_class = $this->_set_config_class($config_class, $name); |
|
750 | 750 | // run tests 1-4, 6 and 7 to verify that all params have been set |
751 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) { |
|
751 | + if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) { |
|
752 | 752 | return NULL; |
753 | 753 | } |
754 | 754 | // now test if the requested config object exists, but suppress errors |
755 | - if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) { |
|
755 | + if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) { |
|
756 | 756 | // config already exists, so pass it back |
757 | 757 | return $this->{$section}->{$name}; |
758 | 758 | } |
759 | 759 | // load config option from db if it exists |
760 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name )); |
|
760 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
761 | 761 | // verify the newly retrieved config object, but suppress errors |
762 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) { |
|
762 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) { |
|
763 | 763 | // config is good, so set it and pass it back |
764 | 764 | $this->{$section}->{$name} = $config_obj; |
765 | 765 | return $this->{$section}->{$name}; |
766 | 766 | } |
767 | 767 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
768 | - $config_obj =$this->set_config( $section, $name, $config_class ); |
|
768 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
769 | 769 | // verify the newly created config object |
770 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) { |
|
770 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
771 | 771 | return $this->{$section}->{$name}; |
772 | 772 | } else { |
773 | 773 | EE_Error::add_error( |
774 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
774 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
775 | 775 | __FILE__, __FUNCTION__, __LINE__ |
776 | 776 | ); |
777 | 777 | } |
@@ -786,9 +786,9 @@ discard block |
||
786 | 786 | * @param string $config_option_name |
787 | 787 | * @return mixed EE_Config_Base | FALSE |
788 | 788 | */ |
789 | - public function get_config_option( $config_option_name = '' ) { |
|
789 | + public function get_config_option($config_option_name = '') { |
|
790 | 790 | // retrieve the wp-option for this config class. |
791 | - return maybe_unserialize( get_option( $config_option_name )); |
|
791 | + return maybe_unserialize(get_option($config_option_name)); |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | |
@@ -801,45 +801,45 @@ discard block |
||
801 | 801 | * @param $page_for_posts |
802 | 802 | * @return void |
803 | 803 | */ |
804 | - public function update_post_shortcodes( $page_for_posts = '' ) { |
|
804 | + public function update_post_shortcodes($page_for_posts = '') { |
|
805 | 805 | // make sure page_for_posts is set |
806 | - $page_for_posts = ! empty( $page_for_posts ) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
806 | + $page_for_posts = ! empty($page_for_posts) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
807 | 807 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
808 | 808 | $critical_shortcodes = $this->core->get_critical_pages_shortcodes_array(); |
809 | 809 | // allow others to mess stuff up :D |
810 | - do_action( 'AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts ); |
|
810 | + do_action('AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts); |
|
811 | 811 | // verify that post_shortcodes is set |
812 | - $this->core->post_shortcodes = isset( $this->core->post_shortcodes ) && is_array( $this->core->post_shortcodes ) ? $this->core->post_shortcodes : array(); |
|
812 | + $this->core->post_shortcodes = isset($this->core->post_shortcodes) && is_array($this->core->post_shortcodes) ? $this->core->post_shortcodes : array(); |
|
813 | 813 | // cycle thru post_shortcodes |
814 | - foreach( $this->core->post_shortcodes as $post_name => $shortcodes ){ |
|
814 | + foreach ($this->core->post_shortcodes as $post_name => $shortcodes) { |
|
815 | 815 | // are there any shortcodes to track ? |
816 | - if ( ! empty( $shortcodes )) { |
|
816 | + if ( ! empty($shortcodes)) { |
|
817 | 817 | // loop thru list of tracked shortcodes |
818 | - foreach( $shortcodes as $shortcode => $post_id ) { |
|
818 | + foreach ($shortcodes as $shortcode => $post_id) { |
|
819 | 819 | // if shortcode is for a critical page, BUT this is NOT the corresponding critical page for that shortcode |
820 | - if ( isset( $critical_shortcodes[ $post_id ] ) && $post_name == $page_for_posts ) { |
|
820 | + if (isset($critical_shortcodes[$post_id]) && $post_name == $page_for_posts) { |
|
821 | 821 | // then remove this shortcode, because we don't want critical page shortcodes like ESPRESSO_TXN_PAGE running on the "Posts Page" (blog) |
822 | - unset( $this->core->post_shortcodes[ $post_name ][ $shortcode ] ); |
|
822 | + unset($this->core->post_shortcodes[$post_name][$shortcode]); |
|
823 | 823 | } |
824 | 824 | // skip the posts page, because we want all shortcodes registered for it |
825 | - if ( $post_name == $page_for_posts ) { |
|
825 | + if ($post_name == $page_for_posts) { |
|
826 | 826 | continue; |
827 | 827 | } |
828 | 828 | // make sure post still exists |
829 | - $post = get_post( $post_id ); |
|
830 | - if ( $post ) { |
|
829 | + $post = get_post($post_id); |
|
830 | + if ($post) { |
|
831 | 831 | // check that the post name matches what we have saved |
832 | - if ( $post->post_name == $post_name ) { |
|
832 | + if ($post->post_name == $post_name) { |
|
833 | 833 | // if so, then break before hitting the unset below |
834 | 834 | continue; |
835 | 835 | } |
836 | 836 | } |
837 | 837 | // we don't like missing posts around here >:( |
838 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
838 | + unset($this->core->post_shortcodes[$post_name]); |
|
839 | 839 | } |
840 | 840 | } else { |
841 | 841 | // you got no shortcodes to keep track of ! |
842 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
842 | + unset($this->core->post_shortcodes[$post_name]); |
|
843 | 843 | } |
844 | 844 | } |
845 | 845 | //only show errors |
@@ -858,14 +858,14 @@ discard block |
||
858 | 858 | * @return string |
859 | 859 | */ |
860 | 860 | public static function get_page_for_posts() { |
861 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
862 | - if ( ! $page_for_posts ) { |
|
861 | + $page_for_posts = get_option('page_for_posts'); |
|
862 | + if ( ! $page_for_posts) { |
|
863 | 863 | return 'posts'; |
864 | 864 | } |
865 | 865 | /** @type WPDB $wpdb */ |
866 | 866 | global $wpdb; |
867 | 867 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
868 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts )); |
|
868 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
869 | 869 | } |
870 | 870 | |
871 | 871 | |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | */ |
883 | 883 | public function register_shortcodes_and_modules() { |
884 | 884 | // allow shortcodes to register with WP and to set hooks for the rest of the system |
885 | - EE_Registry::instance()->shortcodes =$this->_register_shortcodes(); |
|
885 | + EE_Registry::instance()->shortcodes = $this->_register_shortcodes(); |
|
886 | 886 | // allow modules to set hooks for the rest of the system |
887 | 887 | EE_Registry::instance()->modules = $this->_register_modules(); |
888 | 888 | } |
@@ -914,21 +914,21 @@ discard block |
||
914 | 914 | public function widgets_init() { |
915 | 915 | //only init widgets on admin pages when not in complete maintenance, and |
916 | 916 | //on frontend when not in any maintenance mode |
917 | - if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level() ) { |
|
917 | + if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) { |
|
918 | 918 | // grab list of installed widgets |
919 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
919 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
920 | 920 | // filter list of modules to register |
921 | - $widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register ); |
|
921 | + $widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register); |
|
922 | 922 | |
923 | - if ( ! empty( $widgets_to_register ) ) { |
|
923 | + if ( ! empty($widgets_to_register)) { |
|
924 | 924 | // cycle thru widget folders |
925 | - foreach ( $widgets_to_register as $widget_path ) { |
|
925 | + foreach ($widgets_to_register as $widget_path) { |
|
926 | 926 | // add to list of installed widget modules |
927 | - EE_Config::register_ee_widget( $widget_path ); |
|
927 | + EE_Config::register_ee_widget($widget_path); |
|
928 | 928 | } |
929 | 929 | } |
930 | 930 | // filter list of installed modules |
931 | - EE_Registry::instance()->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets ); |
|
931 | + EE_Registry::instance()->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets); |
|
932 | 932 | } |
933 | 933 | } |
934 | 934 | |
@@ -941,54 +941,54 @@ discard block |
||
941 | 941 | * @param string $widget_path - full path up to and including widget folder |
942 | 942 | * @return void |
943 | 943 | */ |
944 | - public static function register_ee_widget( $widget_path = NULL ) { |
|
945 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
944 | + public static function register_ee_widget($widget_path = NULL) { |
|
945 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
946 | 946 | $widget_ext = '.widget.php'; |
947 | 947 | // make all separators match |
948 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
948 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
949 | 949 | // does the file path INCLUDE the actual file name as part of the path ? |
950 | - if ( strpos( $widget_path, $widget_ext ) !== FALSE ) { |
|
950 | + if (strpos($widget_path, $widget_ext) !== FALSE) { |
|
951 | 951 | // grab and shortcode file name from directory name and break apart at dots |
952 | - $file_name = explode( '.', basename( $widget_path )); |
|
952 | + $file_name = explode('.', basename($widget_path)); |
|
953 | 953 | // take first segment from file name pieces and remove class prefix if it exists |
954 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
954 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
955 | 955 | // sanitize shortcode directory name |
956 | - $widget = sanitize_key( $widget ); |
|
956 | + $widget = sanitize_key($widget); |
|
957 | 957 | // now we need to rebuild the shortcode path |
958 | - $widget_path = explode( DS, $widget_path ); |
|
958 | + $widget_path = explode(DS, $widget_path); |
|
959 | 959 | // remove last segment |
960 | - array_pop( $widget_path ); |
|
960 | + array_pop($widget_path); |
|
961 | 961 | // glue it back together |
962 | - $widget_path = implode( DS, $widget_path ); |
|
962 | + $widget_path = implode(DS, $widget_path); |
|
963 | 963 | } else { |
964 | 964 | // grab and sanitize widget directory name |
965 | - $widget = sanitize_key( basename( $widget_path )); |
|
965 | + $widget = sanitize_key(basename($widget_path)); |
|
966 | 966 | } |
967 | 967 | // create classname from widget directory name |
968 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ))); |
|
968 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
969 | 969 | // add class prefix |
970 | - $widget_class = 'EEW_' . $widget; |
|
970 | + $widget_class = 'EEW_'.$widget; |
|
971 | 971 | // does the widget exist ? |
972 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) { |
|
972 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
973 | 973 | $msg = sprintf( |
974 | - __( 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso' ), |
|
974 | + __('The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'), |
|
975 | 975 | $widget_class, |
976 | - $widget_path . DS . $widget_class . $widget_ext |
|
976 | + $widget_path.DS.$widget_class.$widget_ext |
|
977 | 977 | ); |
978 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
978 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
979 | 979 | return; |
980 | 980 | } |
981 | 981 | // load the widget class file |
982 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
982 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
983 | 983 | // verify that class exists |
984 | - if ( ! class_exists( $widget_class )) { |
|
985 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
986 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
984 | + if ( ! class_exists($widget_class)) { |
|
985 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
986 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
987 | 987 | return; |
988 | 988 | } |
989 | - register_widget( $widget_class ); |
|
989 | + register_widget($widget_class); |
|
990 | 990 | // add to array of registered widgets |
991 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
991 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
992 | 992 | } |
993 | 993 | |
994 | 994 | |
@@ -1001,18 +1001,18 @@ discard block |
||
1001 | 1001 | */ |
1002 | 1002 | private function _register_shortcodes() { |
1003 | 1003 | // grab list of installed shortcodes |
1004 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1004 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1005 | 1005 | // filter list of modules to register |
1006 | - $shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register ); |
|
1007 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1006 | + $shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register); |
|
1007 | + if ( ! empty($shortcodes_to_register)) { |
|
1008 | 1008 | // cycle thru shortcode folders |
1009 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1009 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1010 | 1010 | // add to list of installed shortcode modules |
1011 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1011 | + EE_Config::register_shortcode($shortcode_path); |
|
1012 | 1012 | } |
1013 | 1013 | } |
1014 | 1014 | // filter list of installed modules |
1015 | - return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes ); |
|
1015 | + return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes); |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | |
@@ -1024,56 +1024,56 @@ discard block |
||
1024 | 1024 | * @param string $shortcode_path - full path up to and including shortcode folder |
1025 | 1025 | * @return bool |
1026 | 1026 | */ |
1027 | - public static function register_shortcode( $shortcode_path = NULL ) { |
|
1028 | - do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path ); |
|
1027 | + public static function register_shortcode($shortcode_path = NULL) { |
|
1028 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1029 | 1029 | $shortcode_ext = '.shortcode.php'; |
1030 | 1030 | // make all separators match |
1031 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1031 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1032 | 1032 | // does the file path INCLUDE the actual file name as part of the path ? |
1033 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) { |
|
1033 | + if (strpos($shortcode_path, $shortcode_ext) !== FALSE) { |
|
1034 | 1034 | // grab shortcode file name from directory name and break apart at dots |
1035 | - $shortcode_file = explode( '.', basename( $shortcode_path )); |
|
1035 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1036 | 1036 | // take first segment from file name pieces and remove class prefix if it exists |
1037 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0]; |
|
1037 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0]; |
|
1038 | 1038 | // sanitize shortcode directory name |
1039 | - $shortcode = sanitize_key( $shortcode ); |
|
1039 | + $shortcode = sanitize_key($shortcode); |
|
1040 | 1040 | // now we need to rebuild the shortcode path |
1041 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1041 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1042 | 1042 | // remove last segment |
1043 | - array_pop( $shortcode_path ); |
|
1043 | + array_pop($shortcode_path); |
|
1044 | 1044 | // glue it back together |
1045 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1045 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1046 | 1046 | } else { |
1047 | 1047 | // we need to generate the filename based off of the folder name |
1048 | 1048 | // grab and sanitize shortcode directory name |
1049 | - $shortcode = sanitize_key( basename( $shortcode_path )); |
|
1050 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1049 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1050 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1051 | 1051 | } |
1052 | 1052 | // create classname from shortcode directory or file name |
1053 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ))); |
|
1053 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1054 | 1054 | // add class prefix |
1055 | - $shortcode_class = 'EES_' . $shortcode; |
|
1055 | + $shortcode_class = 'EES_'.$shortcode; |
|
1056 | 1056 | // does the shortcode exist ? |
1057 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) { |
|
1057 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1058 | 1058 | $msg = sprintf( |
1059 | - __( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ), |
|
1059 | + __('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'), |
|
1060 | 1060 | $shortcode_class, |
1061 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1061 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1062 | 1062 | ); |
1063 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1063 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1064 | 1064 | return FALSE; |
1065 | 1065 | } |
1066 | 1066 | // load the shortcode class file |
1067 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1067 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1068 | 1068 | // verify that class exists |
1069 | - if ( ! class_exists( $shortcode_class )) { |
|
1070 | - $msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class ); |
|
1071 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1069 | + if ( ! class_exists($shortcode_class)) { |
|
1070 | + $msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class); |
|
1071 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1072 | 1072 | return FALSE; |
1073 | 1073 | } |
1074 | - $shortcode = strtoupper( $shortcode ); |
|
1074 | + $shortcode = strtoupper($shortcode); |
|
1075 | 1075 | // add to array of registered shortcodes |
1076 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1076 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1077 | 1077 | return TRUE; |
1078 | 1078 | } |
1079 | 1079 | |
@@ -1088,23 +1088,23 @@ discard block |
||
1088 | 1088 | */ |
1089 | 1089 | private function _register_modules() { |
1090 | 1090 | // grab list of installed modules |
1091 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1091 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1092 | 1092 | // filter list of modules to register |
1093 | - $modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register ); |
|
1093 | + $modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register); |
|
1094 | 1094 | |
1095 | 1095 | |
1096 | - if ( ! empty( $modules_to_register ) ) { |
|
1096 | + if ( ! empty($modules_to_register)) { |
|
1097 | 1097 | // loop through folders |
1098 | - foreach ( $modules_to_register as $module_path ) { |
|
1098 | + foreach ($modules_to_register as $module_path) { |
|
1099 | 1099 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1100 | - if ( $module_path != EE_MODULES . 'zzz-copy-this-module-template' && $module_path != EE_MODULES . 'gateways' ) { |
|
1100 | + if ($module_path != EE_MODULES.'zzz-copy-this-module-template' && $module_path != EE_MODULES.'gateways') { |
|
1101 | 1101 | // add to list of installed modules |
1102 | - EE_Config::register_module( $module_path ); |
|
1102 | + EE_Config::register_module($module_path); |
|
1103 | 1103 | } |
1104 | 1104 | } |
1105 | 1105 | } |
1106 | 1106 | // filter list of installed modules |
1107 | - return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules ); |
|
1107 | + return apply_filters('FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules); |
|
1108 | 1108 | } |
1109 | 1109 | |
1110 | 1110 | |
@@ -1117,54 +1117,54 @@ discard block |
||
1117 | 1117 | * @param string $module_path - full path up to and including module folder |
1118 | 1118 | * @return bool |
1119 | 1119 | */ |
1120 | - public static function register_module( $module_path = NULL ) { |
|
1121 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1120 | + public static function register_module($module_path = NULL) { |
|
1121 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1122 | 1122 | $module_ext = '.module.php'; |
1123 | 1123 | // make all separators match |
1124 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1124 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1125 | 1125 | // does the file path INCLUDE the actual file name as part of the path ? |
1126 | - if ( strpos( $module_path, $module_ext ) !== FALSE ) { |
|
1126 | + if (strpos($module_path, $module_ext) !== FALSE) { |
|
1127 | 1127 | // grab and shortcode file name from directory name and break apart at dots |
1128 | - $module_file = explode( '.', basename( $module_path )); |
|
1128 | + $module_file = explode('.', basename($module_path)); |
|
1129 | 1129 | // now we need to rebuild the shortcode path |
1130 | - $module_path = explode( DS, $module_path ); |
|
1130 | + $module_path = explode(DS, $module_path); |
|
1131 | 1131 | // remove last segment |
1132 | - array_pop( $module_path ); |
|
1132 | + array_pop($module_path); |
|
1133 | 1133 | // glue it back together |
1134 | - $module_path = implode( DS, $module_path ) . DS; |
|
1134 | + $module_path = implode(DS, $module_path).DS; |
|
1135 | 1135 | // take first segment from file name pieces and sanitize it |
1136 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1136 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1137 | 1137 | // ensure class prefix is added |
1138 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1138 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1139 | 1139 | } else { |
1140 | 1140 | // we need to generate the filename based off of the folder name |
1141 | 1141 | // grab and sanitize module name |
1142 | - $module = strtolower( basename( $module_path )); |
|
1143 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module); |
|
1142 | + $module = strtolower(basename($module_path)); |
|
1143 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1144 | 1144 | // like trailingslashit() |
1145 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1145 | + $module_path = rtrim($module_path, DS).DS; |
|
1146 | 1146 | // create classname from module directory name |
1147 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ))); |
|
1147 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1148 | 1148 | // add class prefix |
1149 | - $module_class = 'EED_' . $module; |
|
1149 | + $module_class = 'EED_'.$module; |
|
1150 | 1150 | } |
1151 | 1151 | // does the module exist ? |
1152 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) { |
|
1153 | - $msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module ); |
|
1154 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1152 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1153 | + $msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module); |
|
1154 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1155 | 1155 | return FALSE; |
1156 | 1156 | } |
1157 | 1157 | // load the module class file |
1158 | - require_once( $module_path . $module_class . $module_ext ); |
|
1158 | + require_once($module_path.$module_class.$module_ext); |
|
1159 | 1159 | // verify that class exists |
1160 | - if ( ! class_exists( $module_class )) { |
|
1161 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1162 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1160 | + if ( ! class_exists($module_class)) { |
|
1161 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1162 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1163 | 1163 | return FALSE; |
1164 | 1164 | } |
1165 | 1165 | // add to array of registered modules |
1166 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1167 | - do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->{$module_class} ); |
|
1166 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1167 | + do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->{$module_class} ); |
|
1168 | 1168 | return TRUE; |
1169 | 1169 | } |
1170 | 1170 | |
@@ -1178,23 +1178,23 @@ discard block |
||
1178 | 1178 | */ |
1179 | 1179 | private function _initialize_shortcodes() { |
1180 | 1180 | // cycle thru shortcode folders |
1181 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1181 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1182 | 1182 | // add class prefix |
1183 | - $shortcode_class = 'EES_' . $shortcode; |
|
1183 | + $shortcode_class = 'EES_'.$shortcode; |
|
1184 | 1184 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1185 | 1185 | // which set hooks ? |
1186 | - if ( is_admin() ) { |
|
1186 | + if (is_admin()) { |
|
1187 | 1187 | // fire immediately |
1188 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' )); |
|
1188 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1189 | 1189 | } else { |
1190 | 1190 | // delay until other systems are online |
1191 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' )); |
|
1191 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks')); |
|
1192 | 1192 | // convert classname to UPPERCASE and create WP shortcode. |
1193 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1193 | + $shortcode_tag = strtoupper($shortcode); |
|
1194 | 1194 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1195 | - if ( ! shortcode_exists( $shortcode_tag )) { |
|
1195 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1196 | 1196 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1197 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' )); |
|
1197 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1198 | 1198 | } |
1199 | 1199 | } |
1200 | 1200 | } |
@@ -1211,15 +1211,15 @@ discard block |
||
1211 | 1211 | */ |
1212 | 1212 | private function _initialize_modules() { |
1213 | 1213 | // cycle thru shortcode folders |
1214 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1214 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1215 | 1215 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1216 | 1216 | // which set hooks ? |
1217 | - if ( is_admin() ) { |
|
1217 | + if (is_admin()) { |
|
1218 | 1218 | // fire immediately |
1219 | - call_user_func( array( $module_class, 'set_hooks_admin' )); |
|
1219 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1220 | 1220 | } else { |
1221 | 1221 | // delay until other systems are online |
1222 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' )); |
|
1222 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks')); |
|
1223 | 1223 | } |
1224 | 1224 | } |
1225 | 1225 | } |
@@ -1237,26 +1237,26 @@ discard block |
||
1237 | 1237 | * @param string $key - url param key indicating a route is being called |
1238 | 1238 | * @return bool |
1239 | 1239 | */ |
1240 | - public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) { |
|
1241 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1242 | - $module = str_replace( 'EED_', '', $module ); |
|
1243 | - $module_class = 'EED_' . $module; |
|
1244 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} )) { |
|
1245 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1246 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1240 | + public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') { |
|
1241 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1242 | + $module = str_replace('EED_', '', $module); |
|
1243 | + $module_class = 'EED_'.$module; |
|
1244 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1245 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1246 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1247 | 1247 | return FALSE; |
1248 | 1248 | } |
1249 | - if ( empty( $route )) { |
|
1250 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1251 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1249 | + if (empty($route)) { |
|
1250 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1251 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1252 | 1252 | return FALSE; |
1253 | 1253 | } |
1254 | - if ( ! method_exists ( 'EED_' . $module, $method_name )) { |
|
1255 | - $msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route ); |
|
1256 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1254 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1255 | + $msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route); |
|
1256 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1257 | 1257 | return FALSE; |
1258 | 1258 | } |
1259 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1259 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1260 | 1260 | return TRUE; |
1261 | 1261 | } |
1262 | 1262 | |
@@ -1270,11 +1270,11 @@ discard block |
||
1270 | 1270 | * @param string $key - url param key indicating a route is being called |
1271 | 1271 | * @return string |
1272 | 1272 | */ |
1273 | - public static function get_route( $route = NULL, $key = 'ee' ) { |
|
1274 | - do_action( 'AHEE__EE_Config__get_route__begin',$route ); |
|
1275 | - $route = apply_filters( 'FHEE__EE_Config__get_route',$route ); |
|
1276 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) { |
|
1277 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1273 | + public static function get_route($route = NULL, $key = 'ee') { |
|
1274 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1275 | + $route = apply_filters('FHEE__EE_Config__get_route', $route); |
|
1276 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1277 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1278 | 1278 | } |
1279 | 1279 | return NULL; |
1280 | 1280 | } |
@@ -1303,35 +1303,35 @@ discard block |
||
1303 | 1303 | * @param string $key - url param key indicating a route is being called |
1304 | 1304 | * @return bool |
1305 | 1305 | */ |
1306 | - public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) { |
|
1307 | - do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward ); |
|
1308 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1309 | - $msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route ); |
|
1310 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1306 | + public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') { |
|
1307 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1308 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1309 | + $msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route); |
|
1310 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1311 | 1311 | return FALSE; |
1312 | 1312 | } |
1313 | - if ( empty( $forward )) { |
|
1314 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1315 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1313 | + if (empty($forward)) { |
|
1314 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1315 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1316 | 1316 | return FALSE; |
1317 | 1317 | } |
1318 | - if ( is_array( $forward )) { |
|
1319 | - if ( ! isset( $forward[1] )) { |
|
1320 | - $msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route ); |
|
1321 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1318 | + if (is_array($forward)) { |
|
1319 | + if ( ! isset($forward[1])) { |
|
1320 | + $msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route); |
|
1321 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1322 | 1322 | return FALSE; |
1323 | 1323 | } |
1324 | - if ( ! method_exists( $forward[0], $forward[1] )) { |
|
1325 | - $msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route ); |
|
1326 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1324 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1325 | + $msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route); |
|
1326 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1327 | 1327 | return FALSE; |
1328 | 1328 | } |
1329 | - } else if ( ! function_exists( $forward )) { |
|
1330 | - $msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route ); |
|
1331 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1329 | + } else if ( ! function_exists($forward)) { |
|
1330 | + $msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route); |
|
1331 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1332 | 1332 | return FALSE; |
1333 | 1333 | } |
1334 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1334 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1335 | 1335 | return TRUE; |
1336 | 1336 | } |
1337 | 1337 | |
@@ -1346,10 +1346,10 @@ discard block |
||
1346 | 1346 | * @param string $key - url param key indicating a route is being called |
1347 | 1347 | * @return string |
1348 | 1348 | */ |
1349 | - public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1350 | - do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status ); |
|
1351 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) { |
|
1352 | - return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1349 | + public static function get_forward($route = NULL, $status = 0, $key = 'ee') { |
|
1350 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1351 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1352 | + return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status); |
|
1353 | 1353 | } |
1354 | 1354 | return NULL; |
1355 | 1355 | } |
@@ -1366,19 +1366,19 @@ discard block |
||
1366 | 1366 | * @param string $key - url param key indicating a route is being called |
1367 | 1367 | * @return bool |
1368 | 1368 | */ |
1369 | - public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) { |
|
1370 | - do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view ); |
|
1371 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1372 | - $msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route ); |
|
1373 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1369 | + public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') { |
|
1370 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1371 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1372 | + $msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route); |
|
1373 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1374 | 1374 | return FALSE; |
1375 | 1375 | } |
1376 | - if ( ! is_readable( $view )) { |
|
1377 | - $msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view ); |
|
1378 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1376 | + if ( ! is_readable($view)) { |
|
1377 | + $msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view); |
|
1378 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1379 | 1379 | return FALSE; |
1380 | 1380 | } |
1381 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1381 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1382 | 1382 | return TRUE; |
1383 | 1383 | } |
1384 | 1384 | |
@@ -1395,10 +1395,10 @@ discard block |
||
1395 | 1395 | * @param string $key - url param key indicating a route is being called |
1396 | 1396 | * @return string |
1397 | 1397 | */ |
1398 | - public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1399 | - do_action( 'AHEE__EE_Config__get_view__begin',$route,$status ); |
|
1400 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) { |
|
1401 | - return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1398 | + public static function get_view($route = NULL, $status = 0, $key = 'ee') { |
|
1399 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1400 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1401 | + return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status); |
|
1402 | 1402 | } |
1403 | 1403 | return NULL; |
1404 | 1404 | } |
@@ -1406,7 +1406,7 @@ discard block |
||
1406 | 1406 | |
1407 | 1407 | |
1408 | 1408 | public function shutdown() { |
1409 | - update_option( 'ee_config_option_names', $this->_config_option_names ); |
|
1409 | + update_option('ee_config_option_names', $this->_config_option_names); |
|
1410 | 1410 | } |
1411 | 1411 | |
1412 | 1412 | |
@@ -1422,7 +1422,7 @@ discard block |
||
1422 | 1422 | * magic functions in use, except we'll allow them to magically set and get stuff... |
1423 | 1423 | * basically, they should just be well-defined stdClasses |
1424 | 1424 | */ |
1425 | -class EE_Config_Base{ |
|
1425 | +class EE_Config_Base { |
|
1426 | 1426 | |
1427 | 1427 | /** |
1428 | 1428 | * Utility function for escaping the value of a property and returning. |
@@ -1431,13 +1431,13 @@ discard block |
||
1431 | 1431 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1432 | 1432 | * @throws \EE_Error |
1433 | 1433 | */ |
1434 | - public function get_pretty( $property ) { |
|
1435 | - if ( ! property_exists( $this, $property ) ) { |
|
1436 | - throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) ); |
|
1434 | + public function get_pretty($property) { |
|
1435 | + if ( ! property_exists($this, $property)) { |
|
1436 | + throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property)); |
|
1437 | 1437 | } |
1438 | 1438 | //just handling escaping of strings for now. |
1439 | - if ( is_string( $this->{$property} ) ) { |
|
1440 | - return stripslashes( $this->{$property} ); |
|
1439 | + if (is_string($this->{$property} )) { |
|
1440 | + return stripslashes($this->{$property} ); |
|
1441 | 1441 | } |
1442 | 1442 | return $this->{$property}; |
1443 | 1443 | } |
@@ -1446,19 +1446,19 @@ discard block |
||
1446 | 1446 | |
1447 | 1447 | public function populate() { |
1448 | 1448 | //grab defaults via a new instance of this class. |
1449 | - $class_name = get_class( $this ); |
|
1449 | + $class_name = get_class($this); |
|
1450 | 1450 | $defaults = new $class_name; |
1451 | 1451 | |
1452 | 1452 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1453 | 1453 | //default from our $defaults object. |
1454 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1455 | - if ( is_null( $this->{$property} ) ) { |
|
1454 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1455 | + if (is_null($this->{$property} )) { |
|
1456 | 1456 | $this->{$property} = $value; |
1457 | 1457 | } |
1458 | 1458 | } |
1459 | 1459 | |
1460 | 1460 | //cleanup |
1461 | - unset( $defaults ); |
|
1461 | + unset($defaults); |
|
1462 | 1462 | } |
1463 | 1463 | |
1464 | 1464 | |
@@ -1550,12 +1550,12 @@ discard block |
||
1550 | 1550 | */ |
1551 | 1551 | public function __construct() { |
1552 | 1552 | $current_network_main_site = is_multisite() ? get_current_site() : NULL; |
1553 | - $current_main_site_id = !empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1553 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1554 | 1554 | // set default organization settings |
1555 | 1555 | $this->current_blog_id = get_current_blog_id(); |
1556 | 1556 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1557 | - $this->ee_ueip_optin = is_main_site() ? get_option( 'ee_ueip_optin', TRUE ) : get_blog_option( $current_main_site_id, 'ee_ueip_optin', TRUE ); |
|
1558 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', FALSE ) : TRUE; |
|
1557 | + $this->ee_ueip_optin = is_main_site() ? get_option('ee_ueip_optin', TRUE) : get_blog_option($current_main_site_id, 'ee_ueip_optin', TRUE); |
|
1558 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', FALSE) : TRUE; |
|
1559 | 1559 | $this->post_shortcodes = array(); |
1560 | 1560 | $this->module_route_map = array(); |
1561 | 1561 | $this->module_forward_map = array(); |
@@ -1574,7 +1574,7 @@ discard block |
||
1574 | 1574 | $this->event_cpt_slug = __('events', 'event_espresso'); |
1575 | 1575 | |
1576 | 1576 | //ueip constant check |
1577 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1577 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1578 | 1578 | $this->ee_ueip_optin = FALSE; |
1579 | 1579 | $this->ee_ueip_has_notified = TRUE; |
1580 | 1580 | } |
@@ -1614,8 +1614,8 @@ discard block |
||
1614 | 1614 | * @return string |
1615 | 1615 | */ |
1616 | 1616 | public function reg_page_url() { |
1617 | - if ( ! $this->reg_page_url ) { |
|
1618 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
1617 | + if ( ! $this->reg_page_url) { |
|
1618 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
1619 | 1619 | } |
1620 | 1620 | return $this->reg_page_url; |
1621 | 1621 | } |
@@ -1628,12 +1628,12 @@ discard block |
||
1628 | 1628 | * @return string |
1629 | 1629 | */ |
1630 | 1630 | public function txn_page_url($query_args = array()) { |
1631 | - if ( ! $this->txn_page_url ) { |
|
1632 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1631 | + if ( ! $this->txn_page_url) { |
|
1632 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1633 | 1633 | } |
1634 | - if($query_args){ |
|
1635 | - return add_query_arg($query_args,$this->txn_page_url); |
|
1636 | - }else{ |
|
1634 | + if ($query_args) { |
|
1635 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1636 | + } else { |
|
1637 | 1637 | return $this->txn_page_url; |
1638 | 1638 | } |
1639 | 1639 | } |
@@ -1645,12 +1645,12 @@ discard block |
||
1645 | 1645 | * @return string |
1646 | 1646 | */ |
1647 | 1647 | public function thank_you_page_url($query_args = array()) { |
1648 | - if ( ! $this->thank_you_page_url ) { |
|
1649 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1648 | + if ( ! $this->thank_you_page_url) { |
|
1649 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1650 | 1650 | } |
1651 | - if($query_args){ |
|
1652 | - return add_query_arg($query_args,$this->thank_you_page_url); |
|
1653 | - }else{ |
|
1651 | + if ($query_args) { |
|
1652 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1653 | + } else { |
|
1654 | 1654 | return $this->thank_you_page_url; |
1655 | 1655 | } |
1656 | 1656 | } |
@@ -1661,8 +1661,8 @@ discard block |
||
1661 | 1661 | * @return string |
1662 | 1662 | */ |
1663 | 1663 | public function cancel_page_url() { |
1664 | - if ( ! $this->cancel_page_url ) { |
|
1665 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1664 | + if ( ! $this->cancel_page_url) { |
|
1665 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1666 | 1666 | } |
1667 | 1667 | return $this->cancel_page_url; |
1668 | 1668 | } |
@@ -1690,7 +1690,7 @@ discard block |
||
1690 | 1690 | //reset all url properties |
1691 | 1691 | $this->_reset_urls(); |
1692 | 1692 | //return what to save to db |
1693 | - return array_keys( get_object_vars( $this ) ); |
|
1693 | + return array_keys(get_object_vars($this)); |
|
1694 | 1694 | } |
1695 | 1695 | |
1696 | 1696 | } |
@@ -1922,39 +1922,39 @@ discard block |
||
1922 | 1922 | * @param null $CNT_ISO |
1923 | 1923 | * @return \EE_Currency_Config |
1924 | 1924 | */ |
1925 | - public function __construct( $CNT_ISO = NULL ) { |
|
1925 | + public function __construct($CNT_ISO = NULL) { |
|
1926 | 1926 | |
1927 | 1927 | // get country code from organization settings or use default |
1928 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
1928 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
1929 | 1929 | // but override if requested |
1930 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
1931 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
1930 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
1931 | + EE_Registry::instance()->load_helper('Activation'); |
|
1932 | 1932 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
1933 | - if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) { |
|
1933 | + if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) { |
|
1934 | 1934 | // retrieve the country settings from the db, just in case they have been customized |
1935 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
1936 | - if ( $country instanceof EE_Country ) { |
|
1937 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1938 | - $this->name = $country->currency_name_single(); // Dollar |
|
1939 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
1940 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
1941 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1942 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1943 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1944 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1935 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
1936 | + if ($country instanceof EE_Country) { |
|
1937 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1938 | + $this->name = $country->currency_name_single(); // Dollar |
|
1939 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
1940 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
1941 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1942 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1943 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1944 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1945 | 1945 | } |
1946 | 1946 | } |
1947 | 1947 | // fallback to hardcoded defaults, in case the above failed |
1948 | - if ( empty( $this->code )) { |
|
1948 | + if (empty($this->code)) { |
|
1949 | 1949 | // set default currency settings |
1950 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1951 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
1952 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
1953 | - $this->sign = '$'; // currency sign: $ |
|
1954 | - $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1955 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1956 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1957 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1950 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1951 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
1952 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
1953 | + $this->sign = '$'; // currency sign: $ |
|
1954 | + $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1955 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1956 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1957 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1958 | 1958 | } |
1959 | 1959 | } |
1960 | 1960 | } |
@@ -2094,7 +2094,7 @@ discard block |
||
2094 | 2094 | * @since 4.8.8.rc.019 |
2095 | 2095 | */ |
2096 | 2096 | public function do_hooks() { |
2097 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' )); |
|
2097 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2098 | 2098 | } |
2099 | 2099 | |
2100 | 2100 | |
@@ -2102,7 +2102,7 @@ discard block |
||
2102 | 2102 | * @return void |
2103 | 2103 | */ |
2104 | 2104 | public function set_default_reg_status_on_EEM_Event() { |
2105 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2105 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2106 | 2106 | } |
2107 | 2107 | |
2108 | 2108 | |
@@ -2207,10 +2207,10 @@ discard block |
||
2207 | 2207 | * @param bool $reset |
2208 | 2208 | * @return string |
2209 | 2209 | */ |
2210 | - public function log_file_name( $reset = FALSE ) { |
|
2211 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2212 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2213 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2210 | + public function log_file_name($reset = FALSE) { |
|
2211 | + if (empty($this->log_file_name) || $reset) { |
|
2212 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt'; |
|
2213 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2214 | 2214 | } |
2215 | 2215 | return $this->log_file_name; |
2216 | 2216 | } |
@@ -2222,10 +2222,10 @@ discard block |
||
2222 | 2222 | * @param bool $reset |
2223 | 2223 | * @return string |
2224 | 2224 | */ |
2225 | - public function debug_file_name( $reset = FALSE ) { |
|
2226 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2227 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2228 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2225 | + public function debug_file_name($reset = FALSE) { |
|
2226 | + if (empty($this->debug_file_name) || $reset) { |
|
2227 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt'; |
|
2228 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2229 | 2229 | } |
2230 | 2230 | return $this->debug_file_name; |
2231 | 2231 | } |
@@ -2398,21 +2398,21 @@ discard block |
||
2398 | 2398 | // set default map settings |
2399 | 2399 | $this->use_google_maps = TRUE; |
2400 | 2400 | // for event details pages (reg page) |
2401 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2402 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2403 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2404 | - $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2405 | - $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2406 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2407 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2401 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2402 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2403 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2404 | + $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2405 | + $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2406 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2407 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2408 | 2408 | // for event list pages |
2409 | - $this->event_list_map_width = 300; // ee_map_width |
|
2410 | - $this->event_list_map_height = 185; // ee_map_height |
|
2411 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2412 | - $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2413 | - $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2414 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2415 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2409 | + $this->event_list_map_width = 300; // ee_map_width |
|
2410 | + $this->event_list_map_height = 185; // ee_map_height |
|
2411 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2412 | + $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2413 | + $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2414 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2415 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2416 | 2416 | } |
2417 | 2417 | |
2418 | 2418 | } |
@@ -2423,7 +2423,7 @@ discard block |
||
2423 | 2423 | /** |
2424 | 2424 | * stores Events_Archive settings |
2425 | 2425 | */ |
2426 | -class EE_Events_Archive_Config extends EE_Config_Base{ |
|
2426 | +class EE_Events_Archive_Config extends EE_Config_Base { |
|
2427 | 2427 | |
2428 | 2428 | public $display_status_banner; |
2429 | 2429 | public $display_description; |
@@ -2442,7 +2442,7 @@ discard block |
||
2442 | 2442 | /** |
2443 | 2443 | * class constructor |
2444 | 2444 | */ |
2445 | - public function __construct(){ |
|
2445 | + public function __construct() { |
|
2446 | 2446 | $this->display_status_banner = 0; |
2447 | 2447 | $this->display_description = 1; |
2448 | 2448 | $this->display_ticket_selector = 0; |
@@ -2462,7 +2462,7 @@ discard block |
||
2462 | 2462 | /** |
2463 | 2463 | * Stores Event_Single_Config settings |
2464 | 2464 | */ |
2465 | -class EE_Event_Single_Config extends EE_Config_Base{ |
|
2465 | +class EE_Event_Single_Config extends EE_Config_Base { |
|
2466 | 2466 | |
2467 | 2467 | public $display_status_banner_single; |
2468 | 2468 | public $display_venue; |
@@ -2491,7 +2491,7 @@ discard block |
||
2491 | 2491 | /** |
2492 | 2492 | * Stores Ticket_Selector_Config settings |
2493 | 2493 | */ |
2494 | -class EE_Ticket_Selector_Config extends EE_Config_Base{ |
|
2494 | +class EE_Ticket_Selector_Config extends EE_Config_Base { |
|
2495 | 2495 | public $show_ticket_sale_columns; |
2496 | 2496 | public $show_ticket_details; |
2497 | 2497 | public $show_expired_tickets; |
@@ -2545,7 +2545,7 @@ discard block |
||
2545 | 2545 | * @return void |
2546 | 2546 | */ |
2547 | 2547 | protected function _set_php_values() { |
2548 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2548 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2549 | 2549 | $this->php->version = phpversion(); |
2550 | 2550 | } |
2551 | 2551 | |
@@ -2564,9 +2564,9 @@ discard block |
||
2564 | 2564 | * @type string $msg Any message to be displayed. |
2565 | 2565 | * } |
2566 | 2566 | */ |
2567 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2568 | - if ( ! empty( $this->php->max_input_vars ) && ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) { |
|
2569 | - return sprintf( __('The maximum number of inputs on this page has been exceeded. You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.', 'event_espresso'), '<br>', $input_count, $this->php->max_input_vars); |
|
2567 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2568 | + if ( ! empty($this->php->max_input_vars) && ($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) { |
|
2569 | + return sprintf(__('The maximum number of inputs on this page has been exceeded. You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.', 'event_espresso'), '<br>', $input_count, $this->php->max_input_vars); |
|
2570 | 2570 | } else { |
2571 | 2571 | return ''; |
2572 | 2572 | } |
@@ -2601,7 +2601,7 @@ discard block |
||
2601 | 2601 | * stores payment gateway info |
2602 | 2602 | * @deprecated |
2603 | 2603 | */ |
2604 | -class EE_Gateway_Config extends EE_Config_Base{ |
|
2604 | +class EE_Gateway_Config extends EE_Config_Base { |
|
2605 | 2605 | |
2606 | 2606 | /** |
2607 | 2607 | * Array with keys that are payment gateways slugs, and values are arrays |
@@ -2623,9 +2623,9 @@ discard block |
||
2623 | 2623 | * class constructor |
2624 | 2624 | * @deprecated |
2625 | 2625 | */ |
2626 | - public function __construct(){ |
|
2626 | + public function __construct() { |
|
2627 | 2627 | $this->payment_settings = array(); |
2628 | - $this->active_gateways = array( 'Invoice' => FALSE ); |
|
2628 | + $this->active_gateways = array('Invoice' => FALSE); |
|
2629 | 2629 | } |
2630 | 2630 | } |
2631 | 2631 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
3 | 5 | /** |
4 | 6 | * Event Espresso |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | 2 | /** |
3 | 3 | * EE_Encryption class |
4 | 4 | * |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @return \EE_Encryption |
30 | 30 | */ |
31 | 31 | private function __construct() { |
32 | - define( 'ESPRESSO_ENCRYPT', true ); |
|
33 | - if ( ! function_exists( 'mcrypt_encrypt' ) ) { |
|
32 | + define('ESPRESSO_ENCRYPT', true); |
|
33 | + if ( ! function_exists('mcrypt_encrypt')) { |
|
34 | 34 | $this->_use_mcrypt = false; |
35 | 35 | } |
36 | 36 | } |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | * @access public |
43 | 43 | * @return \EE_Encryption |
44 | 44 | */ |
45 | - public static function instance ( ) { |
|
45 | + public static function instance( ) { |
|
46 | 46 | // check if class object is instantiated |
47 | - if ( ! self::$_instance instanceof EE_Encryption ) { |
|
47 | + if ( ! self::$_instance instanceof EE_Encryption) { |
|
48 | 48 | self::$_instance = new self(); |
49 | 49 | } |
50 | 50 | return self::$_instance; |
@@ -59,15 +59,15 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function get_encryption_key() { |
61 | 61 | // if encryption key has not been set |
62 | - if ( empty( $this->_encryption_key )) { |
|
62 | + if (empty($this->_encryption_key)) { |
|
63 | 63 | // retrieve encryption_key from db |
64 | - $this->_encryption_key = get_option( 'ee_encryption_key', '' ); |
|
64 | + $this->_encryption_key = get_option('ee_encryption_key', ''); |
|
65 | 65 | // WHAT?? No encryption_key in the db ?? |
66 | - if ( $this->_encryption_key == '' ) { |
|
66 | + if ($this->_encryption_key == '') { |
|
67 | 67 | // let's make one. And md5 it to make it just the right size for a key |
68 | - $new_key = md5( self::generate_random_string() ); |
|
68 | + $new_key = md5(self::generate_random_string()); |
|
69 | 69 | // now save it to the db for later |
70 | - add_option( 'ee_encryption_key', $new_key ); |
|
70 | + add_option('ee_encryption_key', $new_key); |
|
71 | 71 | // here's the key - FINALLY ! |
72 | 72 | $this->_encryption_key = $new_key; |
73 | 73 | } |
@@ -83,15 +83,15 @@ discard block |
||
83 | 83 | * @param string $text_string - the text to be encrypted |
84 | 84 | * @return string |
85 | 85 | */ |
86 | - public function encrypt ( $text_string = '' ) { |
|
86 | + public function encrypt($text_string = '') { |
|
87 | 87 | // you give me nothing??? GET OUT ! |
88 | - if ( empty( $text_string )) { |
|
88 | + if (empty($text_string)) { |
|
89 | 89 | return $text_string; |
90 | 90 | } |
91 | - if ( $this->_use_mcrypt ) { |
|
92 | - $encrypted_text = $this->m_encrypt( $text_string ); |
|
91 | + if ($this->_use_mcrypt) { |
|
92 | + $encrypted_text = $this->m_encrypt($text_string); |
|
93 | 93 | } else { |
94 | - $encrypted_text = $this->acme_encrypt( $text_string ); |
|
94 | + $encrypted_text = $this->acme_encrypt($text_string); |
|
95 | 95 | } |
96 | 96 | return $encrypted_text; |
97 | 97 | } |
@@ -104,16 +104,16 @@ discard block |
||
104 | 104 | * @param string $encrypted_text - the text to be decrypted |
105 | 105 | * @return string |
106 | 106 | */ |
107 | - public function decrypt ( $encrypted_text = '' ) { |
|
107 | + public function decrypt($encrypted_text = '') { |
|
108 | 108 | // you give me nothing??? GET OUT ! |
109 | - if ( empty( $encrypted_text )) { |
|
109 | + if (empty($encrypted_text)) { |
|
110 | 110 | return $encrypted_text; |
111 | 111 | } |
112 | 112 | // if PHP's mcrypt functions are installed then we'll use them |
113 | - if ( $this->_use_mcrypt ) { |
|
114 | - $decrypted_text = $this->m_decrypt( $encrypted_text ); |
|
113 | + if ($this->_use_mcrypt) { |
|
114 | + $decrypted_text = $this->m_decrypt($encrypted_text); |
|
115 | 115 | } else { |
116 | - $decrypted_text = $this->acme_decrypt( $encrypted_text ); |
|
116 | + $decrypted_text = $this->acme_decrypt($encrypted_text); |
|
117 | 117 | } |
118 | 118 | return $decrypted_text; |
119 | 119 | } |
@@ -128,15 +128,15 @@ discard block |
||
128 | 128 | * @internal param $string - the text to be encoded |
129 | 129 | * @return string |
130 | 130 | */ |
131 | - public function base64_url_encode ( $text_string = '' ) { |
|
131 | + public function base64_url_encode($text_string = '') { |
|
132 | 132 | // you give me nothing??? GET OUT ! |
133 | - if ( ! $text_string ) { |
|
133 | + if ( ! $text_string) { |
|
134 | 134 | return $text_string; |
135 | 135 | } |
136 | 136 | // encode |
137 | - $encoded_string = base64_encode ( $text_string ); |
|
137 | + $encoded_string = base64_encode($text_string); |
|
138 | 138 | // remove chars to make encoding more URL friendly |
139 | - $encoded_string = strtr ( $encoded_string, '+/=', '-_,' ); |
|
139 | + $encoded_string = strtr($encoded_string, '+/=', '-_,'); |
|
140 | 140 | return $encoded_string; |
141 | 141 | } |
142 | 142 | |
@@ -150,15 +150,15 @@ discard block |
||
150 | 150 | * @internal param $string - the text to be decoded |
151 | 151 | * @return string |
152 | 152 | */ |
153 | - public function base64_url_decode ( $encoded_string = '' ) { |
|
153 | + public function base64_url_decode($encoded_string = '') { |
|
154 | 154 | // you give me nothing??? GET OUT ! |
155 | - if ( ! $encoded_string ) { |
|
155 | + if ( ! $encoded_string) { |
|
156 | 156 | return $encoded_string; |
157 | 157 | } |
158 | 158 | // replace previously removed characters |
159 | - $encoded_string = strtr ( $encoded_string, '-_,', '+/=' ); |
|
159 | + $encoded_string = strtr($encoded_string, '-_,', '+/='); |
|
160 | 160 | // decode |
161 | - $decoded_string = base64_decode ( $encoded_string ); |
|
161 | + $decoded_string = base64_decode($encoded_string); |
|
162 | 162 | return $decoded_string; |
163 | 163 | } |
164 | 164 | |
@@ -171,19 +171,19 @@ discard block |
||
171 | 171 | * @internal param $string - the text to be encrypted |
172 | 172 | * @return string |
173 | 173 | */ |
174 | - private function m_encrypt ( $text_string = '' ) { |
|
174 | + private function m_encrypt($text_string = '') { |
|
175 | 175 | // you give me nothing??? GET OUT ! |
176 | - if ( ! $text_string ) { |
|
176 | + if ( ! $text_string) { |
|
177 | 177 | return $text_string; |
178 | 178 | } |
179 | 179 | // get the initialization vector size |
180 | - $iv_size = mcrypt_get_iv_size ( MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB ); |
|
180 | + $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); |
|
181 | 181 | // initialization vector |
182 | - $iv = mcrypt_create_iv ( $iv_size, MCRYPT_RAND ); |
|
182 | + $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); |
|
183 | 183 | // encrypt it |
184 | - $encrypted_text = mcrypt_encrypt ( MCRYPT_RIJNDAEL_256, $this->get_encryption_key(), $text_string, MCRYPT_MODE_ECB, $iv ); |
|
184 | + $encrypted_text = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->get_encryption_key(), $text_string, MCRYPT_MODE_ECB, $iv); |
|
185 | 185 | // trim and encode |
186 | - $encrypted_text = trim ( base64_encode( $encrypted_text ) ); |
|
186 | + $encrypted_text = trim(base64_encode($encrypted_text)); |
|
187 | 187 | return $encrypted_text; |
188 | 188 | } |
189 | 189 | |
@@ -196,19 +196,19 @@ discard block |
||
196 | 196 | * @internal param $string - the text to be decrypted |
197 | 197 | * @return string |
198 | 198 | */ |
199 | - private function m_decrypt ( $encrypted_text = '' ) { |
|
199 | + private function m_decrypt($encrypted_text = '') { |
|
200 | 200 | // you give me nothing??? GET OUT ! |
201 | - if ( ! $encrypted_text ) { |
|
201 | + if ( ! $encrypted_text) { |
|
202 | 202 | return $encrypted_text; |
203 | 203 | } |
204 | 204 | // decode |
205 | - $encrypted_text = base64_decode ( $encrypted_text ); |
|
205 | + $encrypted_text = base64_decode($encrypted_text); |
|
206 | 206 | // get the initialization vector size |
207 | - $iv_size = mcrypt_get_iv_size ( MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB ); |
|
208 | - $iv = mcrypt_create_iv ( $iv_size, MCRYPT_RAND ); |
|
207 | + $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); |
|
208 | + $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); |
|
209 | 209 | // decrypt it |
210 | - $decrypted_text = mcrypt_decrypt ( MCRYPT_RIJNDAEL_256, $this->get_encryption_key(), $encrypted_text, MCRYPT_MODE_ECB, $iv ); |
|
211 | - $decrypted_text = trim ( $decrypted_text ); |
|
210 | + $decrypted_text = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $this->get_encryption_key(), $encrypted_text, MCRYPT_MODE_ECB, $iv); |
|
211 | + $decrypted_text = trim($decrypted_text); |
|
212 | 212 | return $decrypted_text; |
213 | 213 | } |
214 | 214 | |
@@ -222,18 +222,18 @@ discard block |
||
222 | 222 | * @internal param $string - the text to be decrypted |
223 | 223 | * @return string |
224 | 224 | */ |
225 | - private function acme_encrypt ( $text_string = '' ) { |
|
225 | + private function acme_encrypt($text_string = '') { |
|
226 | 226 | // you give me nothing??? GET OUT ! |
227 | - if ( ! $text_string ) { |
|
227 | + if ( ! $text_string) { |
|
228 | 228 | return $text_string; |
229 | 229 | } |
230 | - $key_bits = str_split ( str_pad ( '', strlen( $text_string ), $this->get_encryption_key(), STR_PAD_RIGHT )); |
|
231 | - $string_bits = str_split( $text_string ); |
|
232 | - foreach ( $string_bits as $k =>$v ) { |
|
233 | - $temp = ord( $v ) + ord ( $key_bits[$k] ); |
|
234 | - $string_bits[$k] = chr ( $temp > 255 ? ( $temp - 256 ) : $temp ); |
|
230 | + $key_bits = str_split(str_pad('', strlen($text_string), $this->get_encryption_key(), STR_PAD_RIGHT)); |
|
231 | + $string_bits = str_split($text_string); |
|
232 | + foreach ($string_bits as $k =>$v) { |
|
233 | + $temp = ord($v) + ord($key_bits[$k]); |
|
234 | + $string_bits[$k] = chr($temp > 255 ? ($temp - 256) : $temp); |
|
235 | 235 | } |
236 | - $encrypted = base64_encode( join( '', $string_bits ) ); |
|
236 | + $encrypted = base64_encode(join('', $string_bits)); |
|
237 | 237 | return $encrypted; |
238 | 238 | } |
239 | 239 | |
@@ -247,19 +247,19 @@ discard block |
||
247 | 247 | * @internal param $string - the text to be decrypted |
248 | 248 | * @return string |
249 | 249 | */ |
250 | - private function acme_decrypt ( $encrypted_text = false ) { |
|
250 | + private function acme_decrypt($encrypted_text = false) { |
|
251 | 251 | // you give me nothing??? GET OUT ! |
252 | - if ( ! $encrypted_text ) { |
|
252 | + if ( ! $encrypted_text) { |
|
253 | 253 | return false; |
254 | 254 | } |
255 | - $encrypted_text = base64_decode ( $encrypted_text ); |
|
256 | - $key_bits = str_split ( str_pad ( '', strlen ( $encrypted_text ), $this->get_encryption_key(), STR_PAD_RIGHT )); |
|
257 | - $string_bits = str_split ( $encrypted_text ); |
|
258 | - foreach ( $string_bits as $k => $v ) { |
|
259 | - $temp = ord ( $v ) - ord ( $key_bits[$k] ); |
|
260 | - $string_bits[$k] = chr ( $temp < 0 ? ( $temp + 256 ) : $temp ); |
|
255 | + $encrypted_text = base64_decode($encrypted_text); |
|
256 | + $key_bits = str_split(str_pad('', strlen($encrypted_text), $this->get_encryption_key(), STR_PAD_RIGHT)); |
|
257 | + $string_bits = str_split($encrypted_text); |
|
258 | + foreach ($string_bits as $k => $v) { |
|
259 | + $temp = ord($v) - ord($key_bits[$k]); |
|
260 | + $string_bits[$k] = chr($temp < 0 ? ($temp + 256) : $temp); |
|
261 | 261 | } |
262 | - $decrypted = join( '', $string_bits ); |
|
262 | + $decrypted = join('', $string_bits); |
|
263 | 263 | return $decrypted; |
264 | 264 | } |
265 | 265 | |
@@ -273,13 +273,13 @@ discard block |
||
273 | 273 | * @internal param $string - number of characters for random string |
274 | 274 | * @return string |
275 | 275 | */ |
276 | - public function generate_random_string ( $length = 40 ) { |
|
277 | - $iterations = ceil ( $length / 40 ); |
|
276 | + public function generate_random_string($length = 40) { |
|
277 | + $iterations = ceil($length / 40); |
|
278 | 278 | $random_string = ''; |
279 | - for ($i = 0; $i < $iterations; $i ++) { |
|
280 | - $random_string .= sha1( microtime(TRUE) . mt_rand( 10000, 90000 )); |
|
279 | + for ($i = 0; $i < $iterations; $i++) { |
|
280 | + $random_string .= sha1(microtime(TRUE).mt_rand(10000, 90000)); |
|
281 | 281 | } |
282 | - $random_string = substr( $random_string, 0, $length ); |
|
282 | + $random_string = substr($random_string, 0, $length); |
|
283 | 283 | return $random_string; |
284 | 284 | } |
285 | 285 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | /** |
89 | 89 | * error_handler |
90 | 90 | * @access public |
91 | - * @param $code |
|
91 | + * @param integer $code |
|
92 | 92 | * @param $message |
93 | 93 | * @param $file |
94 | 94 | * @param $line |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | /** |
190 | 190 | * _format_error |
191 | 191 | * @access private |
192 | - * @param $code |
|
192 | + * @param string $code |
|
193 | 193 | * @param $message |
194 | 194 | * @param $file |
195 | 195 | * @param $line |
@@ -942,7 +942,7 @@ discard block |
||
942 | 942 | * |
943 | 943 | * @access public |
944 | 944 | * @param string $return_url |
945 | - * @return array |
|
945 | + * @return string |
|
946 | 946 | */ |
947 | 947 | public static function get_persistent_admin_notices( $return_url = '' ) { |
948 | 948 | $notices = ''; |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | * |
968 | 968 | * @access public |
969 | 969 | * @param bool $force_print |
970 | - * @return void |
|
970 | + * @return null|string |
|
971 | 971 | */ |
972 | 972 | private static function _print_scripts( $force_print = FALSE ) { |
973 | 973 | if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) { |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | |
1106 | 1106 | /** |
1107 | 1107 | * Like get_notices, but returns an array of all the notices of the given type. |
1108 | - * @return array { |
|
1108 | + * @return boolean { |
|
1109 | 1109 | * @type array $success all the success messages |
1110 | 1110 | * @type array $errors all the error messages |
1111 | 1111 | * @type array $attention all the attention messages |
@@ -5,65 +5,65 @@ discard block |
||
5 | 5 | register_shutdown_function( array( 'EE_Error', 'fatal_error_handler' )); |
6 | 6 | } |
7 | 7 | /** |
8 | - * |
|
9 | - * Error Handling Class |
|
10 | - * |
|
11 | - * @package Event Espresso |
|
12 | - * @subpackage includes/classes/EE_Exceptions.class.php |
|
13 | - * @author Brent Christensen |
|
14 | - * |
|
15 | - * ------------------------------------------------------------------------ |
|
16 | - */ |
|
8 | + * |
|
9 | + * Error Handling Class |
|
10 | + * |
|
11 | + * @package Event Espresso |
|
12 | + * @subpackage includes/classes/EE_Exceptions.class.php |
|
13 | + * @author Brent Christensen |
|
14 | + * |
|
15 | + * ------------------------------------------------------------------------ |
|
16 | + */ |
|
17 | 17 | class EE_Error extends Exception { |
18 | 18 | |
19 | 19 | |
20 | 20 | /** |
21 | - * name of the file to log exceptions to |
|
22 | - * @access private |
|
23 | - * @var string |
|
24 | - */ |
|
21 | + * name of the file to log exceptions to |
|
22 | + * @access private |
|
23 | + * @var string |
|
24 | + */ |
|
25 | 25 | private static $_exception_log_file = 'espresso_error_log.txt'; |
26 | 26 | |
27 | 27 | /** |
28 | - * the exception |
|
29 | - * @access private |
|
30 | - * @var object |
|
31 | - */ |
|
28 | + * the exception |
|
29 | + * @access private |
|
30 | + * @var object |
|
31 | + */ |
|
32 | 32 | private $_exception; |
33 | 33 | |
34 | 34 | /** |
35 | - * stores details for all exception |
|
36 | - * @access private |
|
37 | - * @var array |
|
38 | - */ |
|
35 | + * stores details for all exception |
|
36 | + * @access private |
|
37 | + * @var array |
|
38 | + */ |
|
39 | 39 | private static $_all_exceptions = array(); |
40 | 40 | |
41 | 41 | /** |
42 | - * tracks number of errors |
|
43 | - * @access private |
|
44 | - * @var int |
|
45 | - */ |
|
42 | + * tracks number of errors |
|
43 | + * @access private |
|
44 | + * @var int |
|
45 | + */ |
|
46 | 46 | private static $_error_count = 0; |
47 | 47 | |
48 | 48 | /** |
49 | - * has JS been loaded ? |
|
50 | - * @access private |
|
51 | - * @var boolean |
|
52 | - */ |
|
49 | + * has JS been loaded ? |
|
50 | + * @access private |
|
51 | + * @var boolean |
|
52 | + */ |
|
53 | 53 | private static $_js_loaded = FALSE; |
54 | 54 | |
55 | 55 | /** |
56 | - * has shutdown action been added ? |
|
57 | - * @access private |
|
58 | - * @var boolean |
|
59 | - */ |
|
56 | + * has shutdown action been added ? |
|
57 | + * @access private |
|
58 | + * @var boolean |
|
59 | + */ |
|
60 | 60 | private static $_action_added = FALSE; |
61 | 61 | |
62 | 62 | /** |
63 | - * has shutdown action been added ? |
|
64 | - * @access private |
|
65 | - * @var boolean |
|
66 | - */ |
|
63 | + * has shutdown action been added ? |
|
64 | + * @access private |
|
65 | + * @var boolean |
|
66 | + */ |
|
67 | 67 | private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE ); |
68 | 68 | |
69 | 69 | |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | |
72 | 72 | |
73 | 73 | /** |
74 | - * @override default exception handling |
|
75 | - * @access public |
|
76 | - * @echo string |
|
77 | - */ |
|
74 | + * @override default exception handling |
|
75 | + * @access public |
|
76 | + * @echo string |
|
77 | + */ |
|
78 | 78 | function __construct( $message, $code = 0, Exception $previous = NULL ) { |
79 | 79 | if ( version_compare( phpversion(), '5.3.0', '<' )) { |
80 | 80 | parent::__construct( $message, $code ); |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | |
174 | 174 | |
175 | 175 | /** |
176 | - * fatal_error_handler |
|
177 | - * @access public |
|
178 | - * @return void |
|
179 | - */ |
|
176 | + * fatal_error_handler |
|
177 | + * @access public |
|
178 | + * @return void |
|
179 | + */ |
|
180 | 180 | public static function fatal_error_handler() { |
181 | 181 | $last_error = error_get_last(); |
182 | 182 | if ( $last_error['type'] === E_ERROR ) { |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | |
222 | 222 | |
223 | 223 | /** |
224 | - * _add_actions |
|
225 | - * @access public |
|
226 | - * @return void |
|
227 | - */ |
|
228 | - public function get_error() { |
|
224 | + * _add_actions |
|
225 | + * @access public |
|
226 | + * @return void |
|
227 | + */ |
|
228 | + public function get_error() { |
|
229 | 229 | |
230 | 230 | if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){ |
231 | 231 | throw $this; |
@@ -255,22 +255,22 @@ discard block |
||
255 | 255 | |
256 | 256 | |
257 | 257 | /** |
258 | - * has_error |
|
259 | - * @access public |
|
260 | - * @return boolean |
|
261 | - */ |
|
262 | - public static function has_error(){ |
|
258 | + * has_error |
|
259 | + * @access public |
|
260 | + * @return boolean |
|
261 | + */ |
|
262 | + public static function has_error(){ |
|
263 | 263 | return self::$_error_count ? TRUE : FALSE; |
264 | 264 | } |
265 | 265 | |
266 | 266 | |
267 | 267 | |
268 | 268 | /** |
269 | - * display_errors |
|
270 | - * @access public |
|
271 | - * @echo string |
|
272 | - */ |
|
273 | - public function display_errors(){ |
|
269 | + * display_errors |
|
270 | + * @access public |
|
271 | + * @echo string |
|
272 | + */ |
|
273 | + public function display_errors(){ |
|
274 | 274 | |
275 | 275 | $trace_details = ''; |
276 | 276 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | // process trace info |
343 | 343 | if ( empty( $ex['trace'] )) { |
344 | 344 | |
345 | - $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' ); |
|
345 | + $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' ); |
|
346 | 346 | |
347 | 347 | } else { |
348 | 348 | |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $function_dsply = ! empty( $function ) ? $function : ' '; |
395 | 395 | $args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : ''; |
396 | 396 | |
397 | - $trace_details .= ' |
|
397 | + $trace_details .= ' |
|
398 | 398 | <tr> |
399 | 399 | <td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td> |
400 | 400 | <td align="right" class="' . $zebra . '">' . $line_dsply . '</td> |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | |
407 | 407 | } |
408 | 408 | |
409 | - $trace_details .= ' |
|
409 | + $trace_details .= ' |
|
410 | 410 | </table> |
411 | 411 | </div>'; |
412 | 412 | |
@@ -486,12 +486,12 @@ discard block |
||
486 | 486 | |
487 | 487 | |
488 | 488 | /** |
489 | - * generate string from exception trace args |
|
490 | - * |
|
491 | - * @access private |
|
492 | - * @ param array $arguments |
|
493 | - * @ return string |
|
494 | - */ |
|
489 | + * generate string from exception trace args |
|
490 | + * |
|
491 | + * @access private |
|
492 | + * @ param array $arguments |
|
493 | + * @ return string |
|
494 | + */ |
|
495 | 495 | private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) { |
496 | 496 | |
497 | 497 | $arg_string = ''; |
@@ -535,15 +535,15 @@ discard block |
||
535 | 535 | |
536 | 536 | |
537 | 537 | /** |
538 | - * add error message |
|
539 | - * |
|
540 | - * @access public |
|
541 | - * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
542 | - * @param string $file the file that the error occurred in - just use __FILE__ |
|
543 | - * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
544 | - * @param string $line the line number where the error occurred - just use __LINE__ |
|
545 | - * @return void |
|
546 | - */ |
|
538 | + * add error message |
|
539 | + * |
|
540 | + * @access public |
|
541 | + * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
542 | + * @param string $file the file that the error occurred in - just use __FILE__ |
|
543 | + * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
544 | + * @param string $line the line number where the error occurred - just use __LINE__ |
|
545 | + * @return void |
|
546 | + */ |
|
547 | 547 | public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
548 | 548 | self::_add_notice ( 'errors', $msg, $file, $func, $line ); |
549 | 549 | self::$_error_count++; |
@@ -554,15 +554,15 @@ discard block |
||
554 | 554 | |
555 | 555 | |
556 | 556 | /** |
557 | - * add success message |
|
558 | - * |
|
559 | - * @access public |
|
560 | - * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
561 | - * @param string $file the file that the error occurred in - just use __FILE__ |
|
562 | - * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
563 | - * @param string $line the line number where the error occurred - just use __LINE__ |
|
564 | - * @return void |
|
565 | - */ |
|
557 | + * add success message |
|
558 | + * |
|
559 | + * @access public |
|
560 | + * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
561 | + * @param string $file the file that the error occurred in - just use __FILE__ |
|
562 | + * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
563 | + * @param string $line the line number where the error occurred - just use __LINE__ |
|
564 | + * @return void |
|
565 | + */ |
|
566 | 566 | public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
567 | 567 | self::_add_notice ( 'success', $msg, $file, $func, $line ); |
568 | 568 | } |
@@ -572,15 +572,15 @@ discard block |
||
572 | 572 | |
573 | 573 | |
574 | 574 | /** |
575 | - * add attention message |
|
576 | - * |
|
577 | - * @access public |
|
578 | - * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
579 | - * @param string $file the file that the error occurred in - just use __FILE__ |
|
580 | - * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
581 | - * @param string $line the line number where the error occurred - just use __LINE__ |
|
582 | - * @return void |
|
583 | - */ |
|
575 | + * add attention message |
|
576 | + * |
|
577 | + * @access public |
|
578 | + * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
579 | + * @param string $file the file that the error occurred in - just use __FILE__ |
|
580 | + * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
581 | + * @param string $line the line number where the error occurred - just use __LINE__ |
|
582 | + * @return void |
|
583 | + */ |
|
584 | 584 | public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
585 | 585 | self::_add_notice ( 'attention', $msg, $file, $func, $line ); |
586 | 586 | } |
@@ -590,16 +590,16 @@ discard block |
||
590 | 590 | |
591 | 591 | |
592 | 592 | /** |
593 | - * add success message |
|
594 | - * |
|
595 | - * @access public |
|
596 | - * @param string $type whether the message is for a success or error notification |
|
597 | - * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
598 | - * @param string $file the file that the error occurred in - just use __FILE__ |
|
599 | - * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
600 | - * @param string $line the line number where the error occurred - just use __LINE__ |
|
601 | - * @return void |
|
602 | - */ |
|
593 | + * add success message |
|
594 | + * |
|
595 | + * @access public |
|
596 | + * @param string $type whether the message is for a success or error notification |
|
597 | + * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
598 | + * @param string $file the file that the error occurred in - just use __FILE__ |
|
599 | + * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
600 | + * @param string $line the line number where the error occurred - just use __LINE__ |
|
601 | + * @return void |
|
602 | + */ |
|
603 | 603 | private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
604 | 604 | if ( empty( $msg )) { |
605 | 605 | EE_Error::doing_it_wrong( |
@@ -648,11 +648,11 @@ discard block |
||
648 | 648 | |
649 | 649 | |
650 | 650 | /** |
651 | - * in some case it may be necessary to overwrite the existing success messages |
|
652 | - * |
|
653 | - * @access public |
|
654 | - * @return void |
|
655 | - */ |
|
651 | + * in some case it may be necessary to overwrite the existing success messages |
|
652 | + * |
|
653 | + * @access public |
|
654 | + * @return void |
|
655 | + */ |
|
656 | 656 | public static function overwrite_success() { |
657 | 657 | self::$_espresso_notices['success'] = FALSE; |
658 | 658 | } |
@@ -662,11 +662,11 @@ discard block |
||
662 | 662 | |
663 | 663 | |
664 | 664 | /** |
665 | - * in some case it may be necessary to overwrite the existing attention messages |
|
666 | - * |
|
667 | - * @access public |
|
668 | - * @return void |
|
669 | - */ |
|
665 | + * in some case it may be necessary to overwrite the existing attention messages |
|
666 | + * |
|
667 | + * @access public |
|
668 | + * @return void |
|
669 | + */ |
|
670 | 670 | public static function overwrite_attention() { |
671 | 671 | self::$_espresso_notices['attention'] = FALSE; |
672 | 672 | } |
@@ -676,11 +676,11 @@ discard block |
||
676 | 676 | |
677 | 677 | |
678 | 678 | /** |
679 | - * in some case it may be necessary to overwrite the existing error messages |
|
680 | - * |
|
681 | - * @access public |
|
682 | - * @return void |
|
683 | - */ |
|
679 | + * in some case it may be necessary to overwrite the existing error messages |
|
680 | + * |
|
681 | + * @access public |
|
682 | + * @return void |
|
683 | + */ |
|
684 | 684 | public static function overwrite_errors() { |
685 | 685 | self::$_espresso_notices['errors'] = FALSE; |
686 | 686 | } |
@@ -688,24 +688,24 @@ discard block |
||
688 | 688 | |
689 | 689 | |
690 | 690 | /** |
691 | - * reset_notices |
|
692 | - * @access private |
|
693 | - * @return void |
|
694 | - */ |
|
691 | + * reset_notices |
|
692 | + * @access private |
|
693 | + * @return void |
|
694 | + */ |
|
695 | 695 | public static function reset_notices(){ |
696 | - self::$_espresso_notices['success'] = FALSE; |
|
697 | - self::$_espresso_notices['attention'] = FALSE; |
|
698 | - self::$_espresso_notices['errors'] = FALSE; |
|
699 | - } |
|
696 | + self::$_espresso_notices['success'] = FALSE; |
|
697 | + self::$_espresso_notices['attention'] = FALSE; |
|
698 | + self::$_espresso_notices['errors'] = FALSE; |
|
699 | + } |
|
700 | 700 | |
701 | 701 | |
702 | 702 | |
703 | 703 | /** |
704 | - * has_errors |
|
705 | - * @access public |
|
706 | - * @return int |
|
707 | - */ |
|
708 | - public static function has_notices(){ |
|
704 | + * has_errors |
|
705 | + * @access public |
|
706 | + * @return int |
|
707 | + */ |
|
708 | + public static function has_notices(){ |
|
709 | 709 | $has_notices = 0; |
710 | 710 | // check for success messages |
711 | 711 | $has_notices = self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] ) ? 3 : $has_notices; |
@@ -719,15 +719,15 @@ discard block |
||
719 | 719 | |
720 | 720 | |
721 | 721 | /** |
722 | - * compile all error or success messages into one string |
|
723 | - * @see EE_Error::get_raw_notices if you want the raw notices without any preparations made to them |
|
724 | - * |
|
725 | - * @access public |
|
726 | - * @param boolean $format_output whether or not to format the messages for display in the WP admin |
|
727 | - * @param boolean $save_to_transient whether or not to save notices to the db for retrieval on next request - ONLY do this just before redirecting |
|
728 | - * @param boolean $remove_empty whether or not to unset empty messages |
|
729 | - * @return array |
|
730 | - */ |
|
722 | + * compile all error or success messages into one string |
|
723 | + * @see EE_Error::get_raw_notices if you want the raw notices without any preparations made to them |
|
724 | + * |
|
725 | + * @access public |
|
726 | + * @param boolean $format_output whether or not to format the messages for display in the WP admin |
|
727 | + * @param boolean $save_to_transient whether or not to save notices to the db for retrieval on next request - ONLY do this just before redirecting |
|
728 | + * @param boolean $remove_empty whether or not to unset empty messages |
|
729 | + * @return array |
|
730 | + */ |
|
731 | 731 | public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) { |
732 | 732 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
733 | 733 | |
@@ -839,14 +839,14 @@ discard block |
||
839 | 839 | |
840 | 840 | |
841 | 841 | /** |
842 | - * add_persistent_admin_notice |
|
843 | - * |
|
844 | - * @access public |
|
845 | - * @param string $pan_name the name, or key of the Persistent Admin Notice to be stored |
|
846 | - * @param string $pan_message the message to be stored persistently until dismissed |
|
847 | - * @param bool $force_update allows one to enforce the reappearance of a persistent message. |
|
848 | - * @return void |
|
849 | - */ |
|
842 | + * add_persistent_admin_notice |
|
843 | + * |
|
844 | + * @access public |
|
845 | + * @param string $pan_name the name, or key of the Persistent Admin Notice to be stored |
|
846 | + * @param string $pan_message the message to be stored persistently until dismissed |
|
847 | + * @param bool $force_update allows one to enforce the reappearance of a persistent message. |
|
848 | + * @return void |
|
849 | + */ |
|
850 | 850 | public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) { |
851 | 851 | if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
852 | 852 | $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
@@ -910,9 +910,9 @@ discard block |
||
910 | 910 | * display_persistent_admin_notices |
911 | 911 | * |
912 | 912 | * @access public |
913 | - * @param string $pan_name the name, or key of the Persistent Admin Notice to be stored |
|
914 | - * @param string $pan_name the message to be stored persistently until dismissed |
|
915 | - * @param string $return_url URL to go back to aftger nag notice is dismissed |
|
913 | + * @param string $pan_name the name, or key of the Persistent Admin Notice to be stored |
|
914 | + * @param string $pan_name the message to be stored persistently until dismissed |
|
915 | + * @param string $return_url URL to go back to aftger nag notice is dismissed |
|
916 | 916 | * @return string |
917 | 917 | */ |
918 | 918 | public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) { |
@@ -1001,11 +1001,11 @@ discard block |
||
1001 | 1001 | |
1002 | 1002 | |
1003 | 1003 | /** |
1004 | - * enqueue_error_scripts |
|
1005 | - * |
|
1006 | - * @access public |
|
1007 | - * @return void |
|
1008 | - */ |
|
1004 | + * enqueue_error_scripts |
|
1005 | + * |
|
1006 | + * @access public |
|
1007 | + * @return void |
|
1008 | + */ |
|
1009 | 1009 | public static function enqueue_error_scripts() { |
1010 | 1010 | self::_print_scripts(); |
1011 | 1011 | } |
@@ -1013,15 +1013,15 @@ discard block |
||
1013 | 1013 | |
1014 | 1014 | |
1015 | 1015 | /** |
1016 | - * create error code from filepath, function name, |
|
1017 | - * and line number where exception or error was thrown |
|
1018 | - * |
|
1019 | - * @access public |
|
1020 | - * @ param string $file |
|
1021 | - * @ param string $func |
|
1022 | - * @ param string $line |
|
1023 | - * @ return string |
|
1024 | - */ |
|
1016 | + * create error code from filepath, function name, |
|
1017 | + * and line number where exception or error was thrown |
|
1018 | + * |
|
1019 | + * @access public |
|
1020 | + * @ param string $file |
|
1021 | + * @ param string $func |
|
1022 | + * @ param string $line |
|
1023 | + * @ return string |
|
1024 | + */ |
|
1025 | 1025 | public static function generate_error_code ( $file = '', $func = '', $line = '' ) { |
1026 | 1026 | $file = explode( '.', basename( $file )); |
1027 | 1027 | $error_code = ! empty( $file[0] ) ? $file[0] : ''; |
@@ -1035,13 +1035,13 @@ discard block |
||
1035 | 1035 | |
1036 | 1036 | |
1037 | 1037 | /** |
1038 | - * write exception details to log file |
|
1039 | - * |
|
1040 | - * @access public |
|
1041 | - * @ param timestamp $time |
|
1042 | - * @ param object $ex |
|
1043 | - * @ return void |
|
1044 | - */ |
|
1038 | + * write exception details to log file |
|
1039 | + * |
|
1040 | + * @access public |
|
1041 | + * @ param timestamp $time |
|
1042 | + * @ param object $ex |
|
1043 | + * @ return void |
|
1044 | + */ |
|
1045 | 1045 | public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) { |
1046 | 1046 | |
1047 | 1047 | if ( ! $ex ) { |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE ); |
3 | -if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) { |
|
4 | - set_error_handler( array( 'EE_Error', 'error_handler' )); |
|
5 | - register_shutdown_function( array( 'EE_Error', 'fatal_error_handler' )); |
|
3 | +if (defined('WP_DEBUG') && WP_DEBUG === TRUE && defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS === TRUE) { |
|
4 | + set_error_handler(array('EE_Error', 'error_handler')); |
|
5 | + register_shutdown_function(array('EE_Error', 'fatal_error_handler')); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @access private |
65 | 65 | * @var boolean |
66 | 66 | */ |
67 | - private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE ); |
|
67 | + private static $_espresso_notices = array('success' => FALSE, 'errors' => FALSE, 'attention' => FALSE); |
|
68 | 68 | |
69 | 69 | |
70 | 70 | |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | * @access public |
76 | 76 | * @echo string |
77 | 77 | */ |
78 | - function __construct( $message, $code = 0, Exception $previous = NULL ) { |
|
79 | - if ( version_compare( phpversion(), '5.3.0', '<' )) { |
|
80 | - parent::__construct( $message, $code ); |
|
78 | + function __construct($message, $code = 0, Exception $previous = NULL) { |
|
79 | + if (version_compare(phpversion(), '5.3.0', '<')) { |
|
80 | + parent::__construct($message, $code); |
|
81 | 81 | } else { |
82 | - parent::__construct( $message, $code, $previous ); |
|
82 | + parent::__construct($message, $code, $previous); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | * @param $line |
95 | 95 | * @return void |
96 | 96 | */ |
97 | - public static function error_handler( $code, $message, $file, $line ) { |
|
98 | - $type = EE_Error::error_type( $code ); |
|
97 | + public static function error_handler($code, $message, $file, $line) { |
|
98 | + $type = EE_Error::error_type($code); |
|
99 | 99 | $site = site_url(); |
100 | - switch ( $site ) { |
|
100 | + switch ($site) { |
|
101 | 101 | case 'http://ee4.eventespresso.com/' : |
102 | 102 | case 'http://ee4decaf.eventespresso.com/' : |
103 | 103 | case 'http://ee4hf.eventespresso.com/' : |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | $to = '[email protected]'; |
111 | 111 | break; |
112 | 112 | default : |
113 | - $to = get_option( 'admin_email' ); |
|
113 | + $to = get_option('admin_email'); |
|
114 | 114 | } |
115 | - $subject = $type . ' ' . $message . ' in ' . EVENT_ESPRESSO_VERSION . ' on ' . site_url(); |
|
116 | - $msg = EE_Error::_format_error( $type, $message, $file, $line ); |
|
117 | - if ( function_exists( 'wp_mail' )) { |
|
118 | - add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' )); |
|
119 | - wp_mail( $to, $subject, $msg ); |
|
115 | + $subject = $type.' '.$message.' in '.EVENT_ESPRESSO_VERSION.' on '.site_url(); |
|
116 | + $msg = EE_Error::_format_error($type, $message, $file, $line); |
|
117 | + if (function_exists('wp_mail')) { |
|
118 | + add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type')); |
|
119 | + wp_mail($to, $subject, $msg); |
|
120 | 120 | } |
121 | 121 | echo '<div id="message" class="espresso-notices error"><p>'; |
122 | - echo $type . ': ' . $message . '<br />' . $file . ' line ' . $line; |
|
122 | + echo $type.': '.$message.'<br />'.$file.' line '.$line; |
|
123 | 123 | echo '<br /></p></div>'; |
124 | 124 | } |
125 | 125 | |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * @param $code |
133 | 133 | * @return string |
134 | 134 | */ |
135 | - public static function error_type( $code ) { |
|
136 | - switch( $code ) { |
|
135 | + public static function error_type($code) { |
|
136 | + switch ($code) { |
|
137 | 137 | case E_ERROR: // 1 // |
138 | 138 | return 'E_ERROR'; |
139 | 139 | case E_WARNING: // 2 // |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public static function fatal_error_handler() { |
181 | 181 | $last_error = error_get_last(); |
182 | - if ( $last_error['type'] === E_ERROR ) { |
|
183 | - EE_Error::error_handler( E_ERROR, $last_error['message'], $last_error['file'], $last_error['line'] ); |
|
182 | + if ($last_error['type'] === E_ERROR) { |
|
183 | + EE_Error::error_handler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @param $line |
196 | 196 | * @return string |
197 | 197 | */ |
198 | - private static function _format_error( $code, $message, $file, $line ) { |
|
198 | + private static function _format_error($code, $message, $file, $line) { |
|
199 | 199 | $html = "<table cellpadding='5'><thead bgcolor='#f8f8f8'><th>Item</th><th align='left'>Details</th></thead><tbody>"; |
200 | 200 | $html .= "<tr valign='top'><td><b>Code</b></td><td>$code</td></tr>"; |
201 | 201 | $html .= "<tr valign='top'><td><b>Error</b></td><td>$message</td></tr>"; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param $content_type |
214 | 214 | * @return string |
215 | 215 | */ |
216 | - public static function set_content_type( $content_type ) { |
|
216 | + public static function set_content_type($content_type) { |
|
217 | 217 | return 'text/html'; |
218 | 218 | } |
219 | 219 | |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function get_error() { |
229 | 229 | |
230 | - if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){ |
|
230 | + if (apply_filters('FHEE__EE_Error__get_error__show_normal_exceptions', FALSE)) { |
|
231 | 231 | throw $this; |
232 | 232 | } |
233 | 233 | // get separate user and developer messages if they exist |
234 | - $msg = explode( '||', $this->getMessage() ); |
|
234 | + $msg = explode('||', $this->getMessage()); |
|
235 | 235 | $user_msg = $msg[0]; |
236 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
236 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
237 | 237 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
238 | 238 | |
239 | 239 | // add details to _all_exceptions array |
240 | 240 | $x_time = time(); |
241 | - self::$_all_exceptions[ $x_time ]['name'] = get_class( $this ); |
|
242 | - self::$_all_exceptions[ $x_time ]['file'] = $this->getFile(); |
|
243 | - self::$_all_exceptions[ $x_time ]['line'] = $this->getLine(); |
|
244 | - self::$_all_exceptions[ $x_time ]['msg'] = $msg; |
|
245 | - self::$_all_exceptions[ $x_time ]['code'] = $this->getCode(); |
|
246 | - self::$_all_exceptions[ $x_time ]['trace'] = $this->getTrace(); |
|
247 | - self::$_all_exceptions[ $x_time ]['string'] = $this->getTraceAsString(); |
|
241 | + self::$_all_exceptions[$x_time]['name'] = get_class($this); |
|
242 | + self::$_all_exceptions[$x_time]['file'] = $this->getFile(); |
|
243 | + self::$_all_exceptions[$x_time]['line'] = $this->getLine(); |
|
244 | + self::$_all_exceptions[$x_time]['msg'] = $msg; |
|
245 | + self::$_all_exceptions[$x_time]['code'] = $this->getCode(); |
|
246 | + self::$_all_exceptions[$x_time]['trace'] = $this->getTrace(); |
|
247 | + self::$_all_exceptions[$x_time]['string'] = $this->getTraceAsString(); |
|
248 | 248 | self::$_error_count++; |
249 | 249 | |
250 | 250 | //add_action( 'shutdown', array( $this, 'display_errors' )); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * @access public |
260 | 260 | * @return boolean |
261 | 261 | */ |
262 | - public static function has_error(){ |
|
262 | + public static function has_error() { |
|
263 | 263 | return self::$_error_count ? TRUE : FALSE; |
264 | 264 | } |
265 | 265 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @access public |
271 | 271 | * @echo string |
272 | 272 | */ |
273 | - public function display_errors(){ |
|
273 | + public function display_errors() { |
|
274 | 274 | |
275 | 275 | $trace_details = ''; |
276 | 276 | |
@@ -331,18 +331,18 @@ discard block |
||
331 | 331 | </style> |
332 | 332 | <div id="ee-error-message" class="error">'; |
333 | 333 | |
334 | - if ( ! WP_DEBUG ) { |
|
334 | + if ( ! WP_DEBUG) { |
|
335 | 335 | $output .= ' |
336 | 336 | <p>'; |
337 | 337 | } |
338 | 338 | |
339 | 339 | // cycle thru errors |
340 | - foreach ( self::$_all_exceptions as $time => $ex ) { |
|
340 | + foreach (self::$_all_exceptions as $time => $ex) { |
|
341 | 341 | |
342 | 342 | // process trace info |
343 | - if ( empty( $ex['trace'] )) { |
|
343 | + if (empty($ex['trace'])) { |
|
344 | 344 | |
345 | - $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' ); |
|
345 | + $trace_details .= __('Sorry, but no trace information was available for this exception.', 'event_espresso'); |
|
346 | 346 | |
347 | 347 | } else { |
348 | 348 | |
@@ -357,50 +357,50 @@ discard block |
||
357 | 357 | <th scope="col" align="left">Method( arguments )</th> |
358 | 358 | </tr>'; |
359 | 359 | |
360 | - $last_on_stack = count( $ex['trace'] ) - 1; |
|
360 | + $last_on_stack = count($ex['trace']) - 1; |
|
361 | 361 | // reverse array so that stack is in proper chronological order |
362 | - $sorted_trace = array_reverse( $ex['trace'] ); |
|
362 | + $sorted_trace = array_reverse($ex['trace']); |
|
363 | 363 | |
364 | - foreach ( $sorted_trace as $nmbr => $trace ) { |
|
364 | + foreach ($sorted_trace as $nmbr => $trace) { |
|
365 | 365 | |
366 | - $file = isset( $trace['file'] ) ? $trace['file'] : '' ; |
|
367 | - $class = isset( $trace['class'] ) ? $trace['class'] : ''; |
|
368 | - $type = isset( $trace['type'] ) ? $trace['type'] : ''; |
|
369 | - $function = isset( $trace['function'] ) ? $trace['function'] : ''; |
|
370 | - $args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : ''; |
|
371 | - $line = isset( $trace['line'] ) ? $trace['line'] : ''; |
|
366 | + $file = isset($trace['file']) ? $trace['file'] : ''; |
|
367 | + $class = isset($trace['class']) ? $trace['class'] : ''; |
|
368 | + $type = isset($trace['type']) ? $trace['type'] : ''; |
|
369 | + $function = isset($trace['function']) ? $trace['function'] : ''; |
|
370 | + $args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : ''; |
|
371 | + $line = isset($trace['line']) ? $trace['line'] : ''; |
|
372 | 372 | $zebra = $nmbr % 2 ? ' odd' : ''; |
373 | 373 | |
374 | - if ( empty( $file ) && ! empty( $class )) { |
|
375 | - $a = new ReflectionClass( $class ); |
|
374 | + if (empty($file) && ! empty($class)) { |
|
375 | + $a = new ReflectionClass($class); |
|
376 | 376 | $file = $a->getFileName(); |
377 | - if ( empty( $line ) && ! empty( $function )) { |
|
378 | - $b = new ReflectionMethod( $class, $function ); |
|
377 | + if (empty($line) && ! empty($function)) { |
|
378 | + $b = new ReflectionMethod($class, $function); |
|
379 | 379 | $line = $b->getStartLine(); |
380 | 380 | } |
381 | 381 | } |
382 | 382 | |
383 | - if ( $nmbr == $last_on_stack ) { |
|
383 | + if ($nmbr == $last_on_stack) { |
|
384 | 384 | $file = $ex['file'] != '' ? $ex['file'] : $file; |
385 | 385 | $line = $ex['line'] != '' ? $ex['line'] : $line; |
386 | - $error_code = self::generate_error_code ( $file, $trace['function'], $line ); |
|
386 | + $error_code = self::generate_error_code($file, $trace['function'], $line); |
|
387 | 387 | } |
388 | 388 | |
389 | - $nmbr_dsply = ! empty( $nmbr ) ? $nmbr : ' '; |
|
390 | - $line_dsply = ! empty( $line ) ? $line : ' '; |
|
391 | - $file_dsply = ! empty( $file ) ? $file : ' '; |
|
392 | - $class_dsply = ! empty( $class ) ? $class : ' '; |
|
393 | - $type_dsply = ! empty( $type ) ? $type : ' '; |
|
394 | - $function_dsply = ! empty( $function ) ? $function : ' '; |
|
395 | - $args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : ''; |
|
389 | + $nmbr_dsply = ! empty($nmbr) ? $nmbr : ' '; |
|
390 | + $line_dsply = ! empty($line) ? $line : ' '; |
|
391 | + $file_dsply = ! empty($file) ? $file : ' '; |
|
392 | + $class_dsply = ! empty($class) ? $class : ' '; |
|
393 | + $type_dsply = ! empty($type) ? $type : ' '; |
|
394 | + $function_dsply = ! empty($function) ? $function : ' '; |
|
395 | + $args_dsply = ! empty($args) ? '( '.$args.' )' : ''; |
|
396 | 396 | |
397 | 397 | $trace_details .= ' |
398 | 398 | <tr> |
399 | - <td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td> |
|
400 | - <td align="right" class="' . $zebra . '">' . $line_dsply . '</td> |
|
401 | - <td align="left" class="' . $zebra . '">' . $file_dsply . '</td> |
|
402 | - <td align="left" class="' . $zebra . '">' . $class_dsply . '</td> |
|
403 | - <td align="left" class="' . $zebra . '">' . $type_dsply . $function_dsply . $args_dsply . '</td> |
|
399 | + <td align="right" class="' . $zebra.'">'.$nmbr_dsply.'</td> |
|
400 | + <td align="right" class="' . $zebra.'">'.$line_dsply.'</td> |
|
401 | + <td align="left" class="' . $zebra.'">'.$file_dsply.'</td> |
|
402 | + <td align="left" class="' . $zebra.'">'.$class_dsply.'</td> |
|
403 | + <td align="left" class="' . $zebra.'">'.$type_dsply.$function_dsply.$args_dsply.'</td> |
|
404 | 404 | </tr>'; |
405 | 405 | |
406 | 406 | |
@@ -415,9 +415,9 @@ discard block |
||
415 | 415 | $ex['code'] = $ex['code'] ? $ex['code'] : $error_code; |
416 | 416 | |
417 | 417 | // add generic non-identifying messages for non-privileged uesrs |
418 | - if ( ! WP_DEBUG ) { |
|
418 | + if ( ! WP_DEBUG) { |
|
419 | 419 | |
420 | - $output .= '<span class="ee-error-user-msg-spn">' . trim( $ex['msg'] ) . '</span> <sup>' . $ex['code'] . '</sup><br />'; |
|
420 | + $output .= '<span class="ee-error-user-msg-spn">'.trim($ex['msg']).'</span> <sup>'.$ex['code'].'</sup><br />'; |
|
421 | 421 | |
422 | 422 | } else { |
423 | 423 | |
@@ -425,24 +425,24 @@ discard block |
||
425 | 425 | $output .= ' |
426 | 426 | <div class="ee-error-dev-msg-dv"> |
427 | 427 | <p class="ee-error-dev-msg-pg"> |
428 | - <strong class="ee-error-dev-msg-str">An ' . $ex['name'] . ' exception was thrown!</strong> <span>code: ' . $ex['code'] . '</span><br /> |
|
429 | - <span class="big-text">"' . trim( $ex['msg'] ) . '"</span><br/> |
|
430 | - <a id="display-ee-error-trace-' . self::$_error_count . $time . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-' . self::$_error_count . $time . '"> |
|
431 | - ' . __( 'click to view backtrace and class/method details', 'event_espresso' ) . ' |
|
428 | + <strong class="ee-error-dev-msg-str">An ' . $ex['name'].' exception was thrown!</strong> <span>code: '.$ex['code'].'</span><br /> |
|
429 | + <span class="big-text">"' . trim($ex['msg']).'"</span><br/> |
|
430 | + <a id="display-ee-error-trace-' . self::$_error_count.$time.'" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-'.self::$_error_count.$time.'"> |
|
431 | + ' . __('click to view backtrace and class/method details', 'event_espresso').' |
|
432 | 432 | </a><br /> |
433 | 433 | <span class="small-text lt-grey-text">'.$ex['file'].' ( line no: '.$ex['line'].' )</span> |
434 | 434 | </p> |
435 | - <div id="ee-error-trace-' . self::$_error_count . $time . '-dv" class="ee-error-trace-dv" style="display: none;"> |
|
435 | + <div id="ee-error-trace-' . self::$_error_count.$time.'-dv" class="ee-error-trace-dv" style="display: none;"> |
|
436 | 436 | ' . $trace_details; |
437 | 437 | |
438 | - if ( ! empty( $class )) { |
|
438 | + if ( ! empty($class)) { |
|
439 | 439 | $output .= ' |
440 | 440 | <div style="padding:3px; margin:0 0 1em; border:1px solid #666; background:#fff; border-radius:3px;"> |
441 | 441 | <div style="padding:1em 2em; border:1px solid #666; background:#f9f9f9;"> |
442 | 442 | <h3>Class Details</h3>'; |
443 | - $a = new ReflectionClass( $class ); |
|
443 | + $a = new ReflectionClass($class); |
|
444 | 444 | $output .= ' |
445 | - <pre>' . $a . '</pre> |
|
445 | + <pre>' . $a.'</pre> |
|
446 | 446 | </div> |
447 | 447 | </div>'; |
448 | 448 | } |
@@ -454,14 +454,14 @@ discard block |
||
454 | 454 | |
455 | 455 | } |
456 | 456 | |
457 | - $this->write_to_error_log( $time, $ex ); |
|
457 | + $this->write_to_error_log($time, $ex); |
|
458 | 458 | |
459 | 459 | } |
460 | 460 | |
461 | 461 | // remove last linebreak |
462 | - $output = substr( $output, 0, ( count( $output ) - 7 )); |
|
462 | + $output = substr($output, 0, (count($output) - 7)); |
|
463 | 463 | |
464 | - if ( ! WP_DEBUG ) { |
|
464 | + if ( ! WP_DEBUG) { |
|
465 | 465 | $output .= ' |
466 | 466 | </p>'; |
467 | 467 | } |
@@ -469,10 +469,10 @@ discard block |
||
469 | 469 | $output .= ' |
470 | 470 | </div>'; |
471 | 471 | |
472 | - $output .= self::_print_scripts( TRUE ); |
|
472 | + $output .= self::_print_scripts(TRUE); |
|
473 | 473 | |
474 | - if ( defined( 'DOING_AJAX' )) { |
|
475 | - echo json_encode( array( 'error' => $output )); |
|
474 | + if (defined('DOING_AJAX')) { |
|
475 | + echo json_encode(array('error' => $output)); |
|
476 | 476 | exit(); |
477 | 477 | } |
478 | 478 | |
@@ -492,29 +492,29 @@ discard block |
||
492 | 492 | * @ param array $arguments |
493 | 493 | * @ return string |
494 | 494 | */ |
495 | - private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) { |
|
495 | + private function _convert_args_to_string($arguments = array(), $array = FALSE) { |
|
496 | 496 | |
497 | 497 | $arg_string = ''; |
498 | - if ( ! empty( $arguments )) { |
|
498 | + if ( ! empty($arguments)) { |
|
499 | 499 | |
500 | 500 | $args = array(); |
501 | 501 | |
502 | - foreach ( $arguments as $arg ) { |
|
502 | + foreach ($arguments as $arg) { |
|
503 | 503 | |
504 | - if ( ! empty( $arg )) { |
|
504 | + if ( ! empty($arg)) { |
|
505 | 505 | |
506 | - if ( is_string( $arg )) { |
|
507 | - $args[] = " '" . $arg . "'"; |
|
508 | - } elseif ( is_array( $arg )) { |
|
509 | - $args[] = 'ARRAY(' . $this->_convert_args_to_string( $arg, TRUE ); |
|
510 | - } elseif ( is_null( $arg )) { |
|
506 | + if (is_string($arg)) { |
|
507 | + $args[] = " '".$arg."'"; |
|
508 | + } elseif (is_array($arg)) { |
|
509 | + $args[] = 'ARRAY('.$this->_convert_args_to_string($arg, TRUE); |
|
510 | + } elseif (is_null($arg)) { |
|
511 | 511 | $args[] = ' NULL'; |
512 | - } elseif ( is_bool( $arg )) { |
|
513 | - $args[] = ( $arg ) ? ' TRUE' : ' FALSE'; |
|
514 | - } elseif ( is_object( $arg )) { |
|
515 | - $args[] = ' OBJECT ' . get_class( $arg ); |
|
516 | - } elseif ( is_resource( $arg )) { |
|
517 | - $args[] = get_resource_type( $arg ); |
|
512 | + } elseif (is_bool($arg)) { |
|
513 | + $args[] = ($arg) ? ' TRUE' : ' FALSE'; |
|
514 | + } elseif (is_object($arg)) { |
|
515 | + $args[] = ' OBJECT '.get_class($arg); |
|
516 | + } elseif (is_resource($arg)) { |
|
517 | + $args[] = get_resource_type($arg); |
|
518 | 518 | } else { |
519 | 519 | $args[] = $arg; |
520 | 520 | } |
@@ -522,9 +522,9 @@ discard block |
||
522 | 522 | } |
523 | 523 | |
524 | 524 | } |
525 | - $arg_string = implode( ', ', $args ); |
|
525 | + $arg_string = implode(', ', $args); |
|
526 | 526 | } |
527 | - if ( $array ) { |
|
527 | + if ($array) { |
|
528 | 528 | $arg_string .= ' )'; |
529 | 529 | } |
530 | 530 | return $arg_string; |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | * @param string $line the line number where the error occurred - just use __LINE__ |
545 | 545 | * @return void |
546 | 546 | */ |
547 | - public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
548 | - self::_add_notice ( 'errors', $msg, $file, $func, $line ); |
|
547 | + public static function add_error($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
548 | + self::_add_notice('errors', $msg, $file, $func, $line); |
|
549 | 549 | self::$_error_count++; |
550 | 550 | } |
551 | 551 | |
@@ -563,8 +563,8 @@ discard block |
||
563 | 563 | * @param string $line the line number where the error occurred - just use __LINE__ |
564 | 564 | * @return void |
565 | 565 | */ |
566 | - public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
567 | - self::_add_notice ( 'success', $msg, $file, $func, $line ); |
|
566 | + public static function add_success($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
567 | + self::_add_notice('success', $msg, $file, $func, $line); |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | |
@@ -581,8 +581,8 @@ discard block |
||
581 | 581 | * @param string $line the line number where the error occurred - just use __LINE__ |
582 | 582 | * @return void |
583 | 583 | */ |
584 | - public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
585 | - self::_add_notice ( 'attention', $msg, $file, $func, $line ); |
|
584 | + public static function add_attention($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
585 | + self::_add_notice('attention', $msg, $file, $func, $line); |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | |
@@ -600,12 +600,12 @@ discard block |
||
600 | 600 | * @param string $line the line number where the error occurred - just use __LINE__ |
601 | 601 | * @return void |
602 | 602 | */ |
603 | - private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
604 | - if ( empty( $msg )) { |
|
603 | + private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
604 | + if (empty($msg)) { |
|
605 | 605 | EE_Error::doing_it_wrong( |
606 | - 'EE_Error::add_' . $type . '()', |
|
606 | + 'EE_Error::add_'.$type.'()', |
|
607 | 607 | sprintf( |
608 | - __( 'Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso' ), |
|
608 | + __('Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso'), |
|
609 | 609 | $type, |
610 | 610 | $file, |
611 | 611 | $line |
@@ -613,32 +613,32 @@ discard block |
||
613 | 613 | EVENT_ESPRESSO_VERSION |
614 | 614 | ); |
615 | 615 | } |
616 | - if ( $type == 'errors' && ( empty( $file ) || empty( $func ) || empty( $line ))) { |
|
616 | + if ($type == 'errors' && (empty($file) || empty($func) || empty($line))) { |
|
617 | 617 | EE_Error::doing_it_wrong( |
618 | 618 | 'EE_Error::add_error()', |
619 | - __('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso' ), |
|
619 | + __('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso'), |
|
620 | 620 | EVENT_ESPRESSO_VERSION |
621 | 621 | ); |
622 | 622 | } |
623 | 623 | // get separate user and developer messages if they exist |
624 | - $msg = explode( '||', $msg ); |
|
624 | + $msg = explode('||', $msg); |
|
625 | 625 | $user_msg = $msg[0]; |
626 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
626 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
627 | 627 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
628 | 628 | // add notice if message exists |
629 | - if ( ! empty( $msg )) { |
|
629 | + if ( ! empty($msg)) { |
|
630 | 630 | // get error code |
631 | - $notice_code = EE_Error::generate_error_code( $file, $func, $line ); |
|
632 | - if ( WP_DEBUG && $type == 'errors' ) { |
|
633 | - $msg .= '<br/><span class="tiny-text">' . $notice_code . '</span>'; |
|
631 | + $notice_code = EE_Error::generate_error_code($file, $func, $line); |
|
632 | + if (WP_DEBUG && $type == 'errors') { |
|
633 | + $msg .= '<br/><span class="tiny-text">'.$notice_code.'</span>'; |
|
634 | 634 | } |
635 | 635 | // add notice. Index by code if it's not blank |
636 | - if( $notice_code ) { |
|
637 | - self::$_espresso_notices[ $type ][ $notice_code ] = $msg; |
|
636 | + if ($notice_code) { |
|
637 | + self::$_espresso_notices[$type][$notice_code] = $msg; |
|
638 | 638 | } else { |
639 | - self::$_espresso_notices[ $type ][] = $msg; |
|
639 | + self::$_espresso_notices[$type][] = $msg; |
|
640 | 640 | } |
641 | - add_action( 'wp_footer', array( 'EE_Error', 'enqueue_error_scripts' ), 1 ); |
|
641 | + add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1); |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | } |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | * @access private |
693 | 693 | * @return void |
694 | 694 | */ |
695 | - public static function reset_notices(){ |
|
695 | + public static function reset_notices() { |
|
696 | 696 | self::$_espresso_notices['success'] = FALSE; |
697 | 697 | self::$_espresso_notices['attention'] = FALSE; |
698 | 698 | self::$_espresso_notices['errors'] = FALSE; |
@@ -705,14 +705,14 @@ discard block |
||
705 | 705 | * @access public |
706 | 706 | * @return int |
707 | 707 | */ |
708 | - public static function has_notices(){ |
|
708 | + public static function has_notices() { |
|
709 | 709 | $has_notices = 0; |
710 | 710 | // check for success messages |
711 | - $has_notices = self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] ) ? 3 : $has_notices; |
|
711 | + $has_notices = self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success']) ? 3 : $has_notices; |
|
712 | 712 | // check for attention messages |
713 | - $has_notices = self::$_espresso_notices['attention'] && ! empty( self::$_espresso_notices['attention'] ) ? 2 : $has_notices; |
|
713 | + $has_notices = self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention']) ? 2 : $has_notices; |
|
714 | 714 | // check for error messages |
715 | - $has_notices = self::$_espresso_notices['errors'] && ! empty( self::$_espresso_notices['errors'] ) ? 1 : $has_notices; |
|
715 | + $has_notices = self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors']) ? 1 : $has_notices; |
|
716 | 716 | return $has_notices; |
717 | 717 | } |
718 | 718 | |
@@ -728,8 +728,8 @@ discard block |
||
728 | 728 | * @param boolean $remove_empty whether or not to unset empty messages |
729 | 729 | * @return array |
730 | 730 | */ |
731 | - public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) { |
|
732 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
731 | + public static function get_notices($format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE) { |
|
732 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
733 | 733 | |
734 | 734 | $success_messages = ''; |
735 | 735 | $attention_messages = ''; |
@@ -739,44 +739,44 @@ discard block |
||
739 | 739 | // EEH_Debug_Tools::printr( self::$_espresso_notices, 'espresso_notices <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
740 | 740 | |
741 | 741 | // either save notices to the db |
742 | - if ( $save_to_transient ) { |
|
743 | - update_option( 'ee_notices', self::$_espresso_notices ); |
|
742 | + if ($save_to_transient) { |
|
743 | + update_option('ee_notices', self::$_espresso_notices); |
|
744 | 744 | return; |
745 | 745 | } |
746 | 746 | // grab any notices that have been previously saved |
747 | - if ( $notices = get_option( 'ee_notices', FALSE )) { |
|
748 | - foreach ( $notices as $type => $notice ) { |
|
749 | - if ( is_array( $notice ) && ! empty( $notice )) { |
|
747 | + if ($notices = get_option('ee_notices', FALSE)) { |
|
748 | + foreach ($notices as $type => $notice) { |
|
749 | + if (is_array($notice) && ! empty($notice)) { |
|
750 | 750 | // make sure that existsing notice type is an array |
751 | - self::$_espresso_notices[ $type ] = is_array( self::$_espresso_notices[ $type ] ) && ! empty( self::$_espresso_notices[ $type ] ) ? self::$_espresso_notices[ $type ] : array(); |
|
751 | + self::$_espresso_notices[$type] = is_array(self::$_espresso_notices[$type]) && ! empty(self::$_espresso_notices[$type]) ? self::$_espresso_notices[$type] : array(); |
|
752 | 752 | // merge stored notices with any newly created ones |
753 | - self::$_espresso_notices[ $type ] = array_merge( self::$_espresso_notices[ $type ], $notice ); |
|
753 | + self::$_espresso_notices[$type] = array_merge(self::$_espresso_notices[$type], $notice); |
|
754 | 754 | $print_scripts = TRUE; |
755 | 755 | } |
756 | 756 | } |
757 | 757 | // now clear any stored notices |
758 | - update_option( 'ee_notices', FALSE ); |
|
758 | + update_option('ee_notices', FALSE); |
|
759 | 759 | } |
760 | 760 | |
761 | 761 | // check for success messages |
762 | - if ( self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] )) { |
|
762 | + if (self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success'])) { |
|
763 | 763 | // combine messages |
764 | - $success_messages .= implode( self::$_espresso_notices['success'], '<br />' ); |
|
764 | + $success_messages .= implode(self::$_espresso_notices['success'], '<br />'); |
|
765 | 765 | $print_scripts = TRUE; |
766 | 766 | } |
767 | 767 | |
768 | 768 | // check for attention messages |
769 | - if ( self::$_espresso_notices['attention'] && ! empty( self::$_espresso_notices['attention'] ) ) { |
|
769 | + if (self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention'])) { |
|
770 | 770 | // combine messages |
771 | - $attention_messages .= implode( self::$_espresso_notices['attention'], '<br />' ); |
|
771 | + $attention_messages .= implode(self::$_espresso_notices['attention'], '<br />'); |
|
772 | 772 | $print_scripts = TRUE; |
773 | 773 | } |
774 | 774 | |
775 | 775 | // check for error messages |
776 | - if ( self::$_espresso_notices['errors'] && ! empty( self::$_espresso_notices['errors'] ) ) { |
|
777 | - $error_messages .= count( self::$_espresso_notices['errors'] ) > 1 ? __( 'The following errors have occurred:<br />', 'event_espresso' ) : __( 'An error has occurred:<br />', 'event_espresso' ); |
|
776 | + if (self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors'])) { |
|
777 | + $error_messages .= count(self::$_espresso_notices['errors']) > 1 ? __('The following errors have occurred:<br />', 'event_espresso') : __('An error has occurred:<br />', 'event_espresso'); |
|
778 | 778 | // combine messages |
779 | - $error_messages .= implode( self::$_espresso_notices['errors'], '<br />' ); |
|
779 | + $error_messages .= implode(self::$_espresso_notices['errors'], '<br />'); |
|
780 | 780 | $print_scripts = TRUE; |
781 | 781 | } |
782 | 782 | |
@@ -790,21 +790,21 @@ discard block |
||
790 | 790 | $css_id = is_admin() ? 'message' : 'espresso-notices-success'; |
791 | 791 | $css_class = is_admin() ? 'updated fade' : 'success fade-away'; |
792 | 792 | //showMessage( $success_messages ); |
793 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $success_messages . '</p>' . $close . '</div>'; |
|
793 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$success_messages.'</p>'.$close.'</div>'; |
|
794 | 794 | } |
795 | 795 | |
796 | 796 | if ($attention_messages != '') { |
797 | 797 | $css_id = is_admin() ? 'message' : 'espresso-notices-attention'; |
798 | 798 | $css_class = is_admin() ? 'updated ee-notices-attention' : 'attention fade-away'; |
799 | 799 | //showMessage( $error_messages, TRUE ); |
800 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $attention_messages . '</p>' . $close . '</div>'; |
|
800 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$attention_messages.'</p>'.$close.'</div>'; |
|
801 | 801 | } |
802 | 802 | |
803 | 803 | if ($error_messages != '') { |
804 | 804 | $css_id = is_admin() ? 'message' : 'espresso-notices-error'; |
805 | 805 | $css_class = is_admin() ? 'error' : 'error fade-away'; |
806 | 806 | //showMessage( $error_messages, TRUE ); |
807 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $error_messages . '</p>' . $close . '</div>'; |
|
807 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$error_messages.'</p>'.$close.'</div>'; |
|
808 | 808 | } |
809 | 809 | |
810 | 810 | $notices .= '</div>'; |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | 'errors' => $error_messages |
818 | 818 | ); |
819 | 819 | |
820 | - if ( $remove_empty ) { |
|
820 | + if ($remove_empty) { |
|
821 | 821 | // remove empty notices |
822 | 822 | foreach ($notices as $type => $notice) { |
823 | 823 | if (empty($notice)) { |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | } |
828 | 828 | } |
829 | 829 | |
830 | - if ( $print_scripts ) { |
|
830 | + if ($print_scripts) { |
|
831 | 831 | self::_print_scripts(); |
832 | 832 | } |
833 | 833 | |
@@ -847,17 +847,17 @@ discard block |
||
847 | 847 | * @param bool $force_update allows one to enforce the reappearance of a persistent message. |
848 | 848 | * @return void |
849 | 849 | */ |
850 | - public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) { |
|
851 | - if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
|
852 | - $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
|
850 | + public static function add_persistent_admin_notice($pan_name = '', $pan_message, $force_update = FALSE) { |
|
851 | + if ( ! empty($pan_name) && ! empty($pan_message)) { |
|
852 | + $persistent_admin_notices = get_option('ee_pers_admin_notices', array()); |
|
853 | 853 | //maybe initialize persistent_admin_notices |
854 | - if ( empty( $persistent_admin_notices )) { |
|
855 | - add_option( 'ee_pers_admin_notices', array(), '', 'no' ); |
|
854 | + if (empty($persistent_admin_notices)) { |
|
855 | + add_option('ee_pers_admin_notices', array(), '', 'no'); |
|
856 | 856 | } |
857 | - $pan_name = sanitize_key( $pan_name ); |
|
858 | - if ( ! array_key_exists( $pan_name, $persistent_admin_notices ) || $force_update ) { |
|
859 | - $persistent_admin_notices[ $pan_name ] = $pan_message; |
|
860 | - update_option( 'ee_pers_admin_notices', $persistent_admin_notices ); |
|
857 | + $pan_name = sanitize_key($pan_name); |
|
858 | + if ( ! array_key_exists($pan_name, $persistent_admin_notices) || $force_update) { |
|
859 | + $persistent_admin_notices[$pan_name] = $pan_message; |
|
860 | + update_option('ee_pers_admin_notices', $persistent_admin_notices); |
|
861 | 861 | } |
862 | 862 | } |
863 | 863 | } |
@@ -873,34 +873,34 @@ discard block |
||
873 | 873 | * @param bool $return_immediately |
874 | 874 | * @return void |
875 | 875 | */ |
876 | - public static function dismiss_persistent_admin_notice( $pan_name = '', $purge = FALSE, $return_immediately = FALSE ) { |
|
877 | - $pan_name = EE_Registry::instance()->REQ->is_set( 'ee_nag_notice' ) ? EE_Registry::instance()->REQ->get( 'ee_nag_notice' ) : $pan_name; |
|
878 | - if ( ! empty( $pan_name )) { |
|
879 | - $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
|
876 | + public static function dismiss_persistent_admin_notice($pan_name = '', $purge = FALSE, $return_immediately = FALSE) { |
|
877 | + $pan_name = EE_Registry::instance()->REQ->is_set('ee_nag_notice') ? EE_Registry::instance()->REQ->get('ee_nag_notice') : $pan_name; |
|
878 | + if ( ! empty($pan_name)) { |
|
879 | + $persistent_admin_notices = get_option('ee_pers_admin_notices', array()); |
|
880 | 880 | // check if notice we wish to dismiss is actually in the $persistent_admin_notices array |
881 | - if ( is_array( $persistent_admin_notices ) && isset( $persistent_admin_notices[ $pan_name ] )) { |
|
881 | + if (is_array($persistent_admin_notices) && isset($persistent_admin_notices[$pan_name])) { |
|
882 | 882 | // completely delete nag notice, or just NULL message so that it can NOT be added again ? |
883 | - if ( $purge ) { |
|
884 | - unset( $persistent_admin_notices[ $pan_name ] ); |
|
883 | + if ($purge) { |
|
884 | + unset($persistent_admin_notices[$pan_name]); |
|
885 | 885 | } else { |
886 | - $persistent_admin_notices[ $pan_name ] = NULL; |
|
886 | + $persistent_admin_notices[$pan_name] = NULL; |
|
887 | 887 | } |
888 | - if ( update_option( 'ee_pers_admin_notices', $persistent_admin_notices ) === FALSE ) { |
|
889 | - EE_Error::add_error( sprintf( __( 'The persistent admin notice for "%s" could not be deleted.', 'event_espresso' ), $pan_name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
888 | + if (update_option('ee_pers_admin_notices', $persistent_admin_notices) === FALSE) { |
|
889 | + EE_Error::add_error(sprintf(__('The persistent admin notice for "%s" could not be deleted.', 'event_espresso'), $pan_name), __FILE__, __FUNCTION__, __LINE__); |
|
890 | 890 | } |
891 | 891 | } |
892 | 892 | } |
893 | - if ( $return_immediately ) { |
|
893 | + if ($return_immediately) { |
|
894 | 894 | return; |
895 | - } else if ( EE_Registry::instance()->REQ->ajax ) { |
|
895 | + } else if (EE_Registry::instance()->REQ->ajax) { |
|
896 | 896 | // grab any notices and concatenate into string |
897 | - echo json_encode( array( 'errors' => implode( '<br />', EE_Error::get_notices( FALSE )))); |
|
897 | + echo json_encode(array('errors' => implode('<br />', EE_Error::get_notices(FALSE)))); |
|
898 | 898 | exit(); |
899 | 899 | } else { |
900 | 900 | // save errors to a transient to be displayed on next request (after redirect) |
901 | - EE_Error::get_notices( FALSE, TRUE ); |
|
902 | - $return_url = EE_Registry::instance()->REQ->is_set( 'return_url' ) ? EE_Registry::instance()->REQ->get( 'return_url' ) : ''; |
|
903 | - wp_safe_redirect( urldecode( $return_url )); |
|
901 | + EE_Error::get_notices(FALSE, TRUE); |
|
902 | + $return_url = EE_Registry::instance()->REQ->is_set('return_url') ? EE_Registry::instance()->REQ->get('return_url') : ''; |
|
903 | + wp_safe_redirect(urldecode($return_url)); |
|
904 | 904 | } |
905 | 905 | } |
906 | 906 | |
@@ -915,20 +915,20 @@ discard block |
||
915 | 915 | * @param string $return_url URL to go back to aftger nag notice is dismissed |
916 | 916 | * @return string |
917 | 917 | */ |
918 | - public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) { |
|
919 | - if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
|
918 | + public static function display_persistent_admin_notices($pan_name = '', $pan_message = '', $return_url = '') { |
|
919 | + if ( ! empty($pan_name) && ! empty($pan_message)) { |
|
920 | 920 | $args = array( |
921 | 921 | 'nag_notice' => $pan_name, |
922 | - 'return_url' => urlencode( $return_url ), |
|
922 | + 'return_url' => urlencode($return_url), |
|
923 | 923 | 'ajax_url' => WP_AJAX_URL, |
924 | - 'unknown_error' => __( 'An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso' ) |
|
924 | + 'unknown_error' => __('An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso') |
|
925 | 925 | ); |
926 | - wp_localize_script( 'espresso_core', 'ee_dismiss', $args ); |
|
926 | + wp_localize_script('espresso_core', 'ee_dismiss', $args); |
|
927 | 927 | return ' |
928 | - <div id="' . $pan_name . '" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;"> |
|
929 | - <p>' . $pan_message . '</p> |
|
930 | - <a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name . '"> |
|
931 | - <span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__( 'Dismiss', 'event_espresso' ) .' |
|
928 | + <div id="' . $pan_name.'" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;"> |
|
929 | + <p>' . $pan_message.'</p> |
|
930 | + <a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name.'"> |
|
931 | + <span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__('Dismiss', 'event_espresso').' |
|
932 | 932 | </a> |
933 | 933 | <div style="clear:both;"></div> |
934 | 934 | </div>'; |
@@ -944,24 +944,24 @@ discard block |
||
944 | 944 | * @param string $return_url |
945 | 945 | * @return array |
946 | 946 | */ |
947 | - public static function get_persistent_admin_notices( $return_url = '' ) { |
|
947 | + public static function get_persistent_admin_notices($return_url = '') { |
|
948 | 948 | $notices = ''; |
949 | 949 | // check for persistent admin notices |
950 | 950 | //filter the list though so plugins can notify the admin in a different way if they want |
951 | 951 | $persistent_admin_notices = apply_filters( |
952 | 952 | 'FHEE__EE_Error__get_persistent_admin_notices', |
953 | - get_option( 'ee_pers_admin_notices', FALSE ), |
|
953 | + get_option('ee_pers_admin_notices', FALSE), |
|
954 | 954 | 'ee_pers_admin_notices', |
955 | 955 | $return_url |
956 | 956 | ); |
957 | - if ( $persistent_admin_notices ) { |
|
957 | + if ($persistent_admin_notices) { |
|
958 | 958 | // load scripts |
959 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
960 | - wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
961 | - wp_enqueue_script( 'ee_error_js' ); |
|
959 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
960 | + wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
961 | + wp_enqueue_script('ee_error_js'); |
|
962 | 962 | // and display notices |
963 | - foreach( $persistent_admin_notices as $pan_name => $pan_message ) { |
|
964 | - $notices .= self::display_persistent_admin_notices( $pan_name, $pan_message, $return_url ); |
|
963 | + foreach ($persistent_admin_notices as $pan_name => $pan_message) { |
|
964 | + $notices .= self::display_persistent_admin_notices($pan_name, $pan_message, $return_url); |
|
965 | 965 | } |
966 | 966 | } |
967 | 967 | return $notices; |
@@ -976,26 +976,26 @@ discard block |
||
976 | 976 | * @param bool $force_print |
977 | 977 | * @return void |
978 | 978 | */ |
979 | - private static function _print_scripts( $force_print = FALSE ) { |
|
980 | - if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) { |
|
981 | - if ( wp_script_is( 'ee_error_js', 'enqueued' )) { |
|
979 | + private static function _print_scripts($force_print = FALSE) { |
|
980 | + if ((did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts')) && ! $force_print) { |
|
981 | + if (wp_script_is('ee_error_js', 'enqueued')) { |
|
982 | 982 | return; |
983 | - } else if ( wp_script_is( 'ee_error_js', 'registered' )) { |
|
984 | - add_filter( 'FHEE_load_css', '__return_true' ); |
|
985 | - add_filter( 'FHEE_load_js', '__return_true' ); |
|
986 | - wp_enqueue_script( 'ee_error_js' ); |
|
987 | - wp_localize_script( 'ee_error_js','ee_settings', array( 'wp_debug'=>WP_DEBUG )); |
|
983 | + } else if (wp_script_is('ee_error_js', 'registered')) { |
|
984 | + add_filter('FHEE_load_css', '__return_true'); |
|
985 | + add_filter('FHEE_load_js', '__return_true'); |
|
986 | + wp_enqueue_script('ee_error_js'); |
|
987 | + wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug'=>WP_DEBUG)); |
|
988 | 988 | } |
989 | 989 | } else { |
990 | 990 | return ' |
991 | 991 | <script> |
992 | 992 | /* <![CDATA[ */ |
993 | -var ee_settings = {"wp_debug":"' . WP_DEBUG . '"}; |
|
993 | +var ee_settings = {"wp_debug":"' . WP_DEBUG.'"}; |
|
994 | 994 | /* ]]> */ |
995 | 995 | </script> |
996 | -<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script> |
|
997 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
998 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
996 | +<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script> |
|
997 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
998 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
999 | 999 | '; |
1000 | 1000 | |
1001 | 1001 | } |
@@ -1029,11 +1029,11 @@ discard block |
||
1029 | 1029 | * @ param string $line |
1030 | 1030 | * @ return string |
1031 | 1031 | */ |
1032 | - public static function generate_error_code ( $file = '', $func = '', $line = '' ) { |
|
1033 | - $file = explode( '.', basename( $file )); |
|
1034 | - $error_code = ! empty( $file[0] ) ? $file[0] : ''; |
|
1035 | - $error_code .= ! empty( $func ) ? ' - ' . $func : ''; |
|
1036 | - $error_code .= ! empty( $line ) ? ' - ' . $line : ''; |
|
1032 | + public static function generate_error_code($file = '', $func = '', $line = '') { |
|
1033 | + $file = explode('.', basename($file)); |
|
1034 | + $error_code = ! empty($file[0]) ? $file[0] : ''; |
|
1035 | + $error_code .= ! empty($func) ? ' - '.$func : ''; |
|
1036 | + $error_code .= ! empty($line) ? ' - '.$line : ''; |
|
1037 | 1037 | return $error_code; |
1038 | 1038 | } |
1039 | 1039 | |
@@ -1049,37 +1049,37 @@ discard block |
||
1049 | 1049 | * @ param object $ex |
1050 | 1050 | * @ return void |
1051 | 1051 | */ |
1052 | - public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) { |
|
1052 | + public function write_to_error_log($time = FALSE, $ex = FALSE, $clear = FALSE) { |
|
1053 | 1053 | |
1054 | - if ( ! $ex ) { |
|
1054 | + if ( ! $ex) { |
|
1055 | 1055 | return; |
1056 | 1056 | } |
1057 | 1057 | |
1058 | - if ( ! $time ) { |
|
1058 | + if ( ! $time) { |
|
1059 | 1059 | $time = time(); |
1060 | 1060 | } |
1061 | 1061 | |
1062 | - $exception_log = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
1063 | - $exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . '] Exception Details' . PHP_EOL; |
|
1064 | - $exception_log .= 'Message: ' . $ex['msg'] . PHP_EOL; |
|
1065 | - $exception_log .= 'Code: '. $ex['code'] . PHP_EOL; |
|
1066 | - $exception_log .= 'File: '. $ex['file'] . PHP_EOL; |
|
1067 | - $exception_log .= 'Line No: ' . $ex['line'] . PHP_EOL; |
|
1068 | - $exception_log .= 'Stack trace: ' . PHP_EOL; |
|
1069 | - $exception_log .= $ex['string'] . PHP_EOL; |
|
1070 | - $exception_log .= '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
1071 | - |
|
1072 | - EE_Registry::instance()->load_helper( 'File' ); |
|
1062 | + $exception_log = '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
1063 | + $exception_log .= '['.date('Y-m-d H:i:s', $time).'] Exception Details'.PHP_EOL; |
|
1064 | + $exception_log .= 'Message: '.$ex['msg'].PHP_EOL; |
|
1065 | + $exception_log .= 'Code: '.$ex['code'].PHP_EOL; |
|
1066 | + $exception_log .= 'File: '.$ex['file'].PHP_EOL; |
|
1067 | + $exception_log .= 'Line No: '.$ex['line'].PHP_EOL; |
|
1068 | + $exception_log .= 'Stack trace: '.PHP_EOL; |
|
1069 | + $exception_log .= $ex['string'].PHP_EOL; |
|
1070 | + $exception_log .= '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
1071 | + |
|
1072 | + EE_Registry::instance()->load_helper('File'); |
|
1073 | 1073 | try { |
1074 | - EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ); |
|
1075 | - EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' ); |
|
1076 | - if ( ! $clear ) { |
|
1074 | + EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file); |
|
1075 | + EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs'); |
|
1076 | + if ( ! $clear) { |
|
1077 | 1077 | //get existing log file and append new log info |
1078 | - $exception_log = EEH_File::get_file_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ) . $exception_log; |
|
1078 | + $exception_log = EEH_File::get_file_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file).$exception_log; |
|
1079 | 1079 | } |
1080 | - EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file, $exception_log ); |
|
1081 | - } catch( EE_Error $e ){ |
|
1082 | - EE_Error::add_error( sprintf( __( 'Event Espresso error logging could not be setup because: %s', 'event_espresso' ), $e->getMessage() )); |
|
1080 | + EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file, $exception_log); |
|
1081 | + } catch (EE_Error $e) { |
|
1082 | + EE_Error::add_error(sprintf(__('Event Espresso error logging could not be setup because: %s', 'event_espresso'), $e->getMessage())); |
|
1083 | 1083 | return; |
1084 | 1084 | } |
1085 | 1085 | |
@@ -1103,10 +1103,10 @@ discard block |
||
1103 | 1103 | * @param int $error_type |
1104 | 1104 | * @return void |
1105 | 1105 | */ |
1106 | - public static function doing_it_wrong( $function, $message, $version, $error_type = E_USER_NOTICE ) { |
|
1107 | - if ( defined('WP_DEBUG') && WP_DEBUG ) { |
|
1106 | + public static function doing_it_wrong($function, $message, $version, $error_type = E_USER_NOTICE) { |
|
1107 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
1108 | 1108 | EE_Registry::instance()->load_helper('Debug_Tools'); |
1109 | - EEH_Debug_Tools::instance()->doing_it_wrong( $function, $message, $version, $error_type ); |
|
1109 | + EEH_Debug_Tools::instance()->doing_it_wrong($function, $message, $version, $error_type); |
|
1110 | 1110 | } |
1111 | 1111 | } |
1112 | 1112 | |
@@ -1138,13 +1138,13 @@ discard block |
||
1138 | 1138 | */ |
1139 | 1139 | function espresso_error_enqueue_scripts() { |
1140 | 1140 | // js for error handling |
1141 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE ); |
|
1142 | - wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE ); |
|
1141 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE); |
|
1142 | + wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE); |
|
1143 | 1143 | } |
1144 | -if ( is_admin() ) { |
|
1145 | - add_action( 'admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 ); |
|
1144 | +if (is_admin()) { |
|
1145 | + add_action('admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2); |
|
1146 | 1146 | } else { |
1147 | - add_action( 'wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 ); |
|
1147 | + add_action('wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2); |
|
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public static function instance() { |
63 | 63 | // check if class object is instantiated, and instantiated properly |
64 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Front_Controller )) { |
|
64 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Front_Controller)) { |
|
65 | 65 | self::$_instance = new self(); |
66 | 66 | } |
67 | 67 | return self::$_instance; |
@@ -79,37 +79,37 @@ discard block |
||
79 | 79 | */ |
80 | 80 | private function __construct() { |
81 | 81 | // make sure template tags are loaded immediately so that themes don't break |
82 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'load_espresso_template_tags' ), 10 ); |
|
82 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'load_espresso_template_tags'), 10); |
|
83 | 83 | // determine how to integrate WP_Query with the EE models |
84 | - add_action( 'AHEE__EE_System__initialize', array( $this, 'employ_CPT_Strategy' )); |
|
84 | + add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy')); |
|
85 | 85 | // load other resources and begin to actually run shortcodes and modules |
86 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 5 ); |
|
86 | + add_action('wp_loaded', array($this, 'wp_loaded'), 5); |
|
87 | 87 | // analyse the incoming WP request |
88 | - add_action( 'parse_request', array( $this, 'get_request' ), 1, 1 ); |
|
88 | + add_action('parse_request', array($this, 'get_request'), 1, 1); |
|
89 | 89 | // process any content shortcodes |
90 | - add_action( 'parse_request', array( $this, '_initialize_shortcodes' ), 5 ); |
|
90 | + add_action('parse_request', array($this, '_initialize_shortcodes'), 5); |
|
91 | 91 | // process request with module factory |
92 | - add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 10, 1 ); |
|
92 | + add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1); |
|
93 | 93 | // before headers sent |
94 | - add_action( 'wp', array( $this, 'wp' ), 5 ); |
|
94 | + add_action('wp', array($this, 'wp'), 5); |
|
95 | 95 | // load css and js |
96 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 1 ); |
|
96 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 1); |
|
97 | 97 | // header |
98 | - add_action('wp_head', array( $this, 'header_meta_tag' ), 5 ); |
|
99 | - add_filter( 'template_include', array( $this, 'template_include' ), 1 ); |
|
98 | + add_action('wp_head', array($this, 'header_meta_tag'), 5); |
|
99 | + add_filter('template_include', array($this, 'template_include'), 1); |
|
100 | 100 | // display errors |
101 | - add_action('loop_start', array( $this, 'display_errors' ), 2 ); |
|
101 | + add_action('loop_start', array($this, 'display_errors'), 2); |
|
102 | 102 | // the content |
103 | - add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 ); |
|
103 | + add_filter('the_content', array($this, 'the_content'), 5, 1); |
|
104 | 104 | //exclude our private cpt comments |
105 | - add_filter( 'comments_clauses', array( $this, 'filter_wp_comments'), 10, 1 ); |
|
105 | + add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1); |
|
106 | 106 | //make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://) |
107 | - add_filter( 'admin_url', array( $this, 'maybe_force_admin_ajax_ssl' ), 200, 1 ); |
|
107 | + add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1); |
|
108 | 108 | // action hook EE |
109 | - do_action( 'AHEE__EE_Front_Controller__construct__done',$this ); |
|
109 | + do_action('AHEE__EE_Front_Controller__construct__done', $this); |
|
110 | 110 | // for checking that browser cookies are enabled |
111 | - if ( apply_filters( 'FHEE__EE_Front_Controller____construct__set_test_cookie', true )) { |
|
112 | - setcookie( 'ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/' ); |
|
111 | + if (apply_filters('FHEE__EE_Front_Controller____construct__set_test_cookie', true)) { |
|
112 | + setcookie('ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/'); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | * @return void |
130 | 130 | */ |
131 | 131 | public function load_espresso_template_tags() { |
132 | - if ( is_readable( EE_PUBLIC . 'template_tags.php' )) { |
|
133 | - require_once( EE_PUBLIC . 'template_tags.php' ); |
|
132 | + if (is_readable(EE_PUBLIC.'template_tags.php')) { |
|
133 | + require_once(EE_PUBLIC.'template_tags.php'); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | * @param array $clauses array of comment clauses setup by WP_Comment_Query |
146 | 146 | * @return array array of comment clauses with modifications. |
147 | 147 | */ |
148 | - public function filter_wp_comments( $clauses ) { |
|
148 | + public function filter_wp_comments($clauses) { |
|
149 | 149 | global $wpdb; |
150 | - if ( strpos( $clauses['join'], $wpdb->posts ) !== FALSE ) { |
|
150 | + if (strpos($clauses['join'], $wpdb->posts) !== FALSE) { |
|
151 | 151 | $cpts = EE_Register_CPTs::get_private_CPTs(); |
152 | - foreach ( $cpts as $cpt => $details ) { |
|
153 | - $clauses['where'] .= $wpdb->prepare( " AND $wpdb->posts.post_type != %s", $cpt ); |
|
152 | + foreach ($cpts as $cpt => $details) { |
|
153 | + $clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | return $clauses; |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * @return void |
168 | 168 | */ |
169 | 169 | public function employ_CPT_Strategy() { |
170 | - if ( apply_filters( 'FHEE__EE_Front_Controller__employ_CPT_Strategy',true) ){ |
|
171 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
170 | + if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) { |
|
171 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | * @param string $url incoming url |
181 | 181 | * @return string final assembled url |
182 | 182 | */ |
183 | - public function maybe_force_admin_ajax_ssl( $url ) { |
|
184 | - if ( is_ssl() && preg_match( '/admin-ajax.php/', $url )) { |
|
185 | - $url = str_replace( 'http://', 'https://', $url ); |
|
183 | + public function maybe_force_admin_ajax_ssl($url) { |
|
184 | + if (is_ssl() && preg_match('/admin-ajax.php/', $url)) { |
|
185 | + $url = str_replace('http://', 'https://', $url); |
|
186 | 186 | } |
187 | 187 | return $url; |
188 | 188 | } |
@@ -219,12 +219,12 @@ discard block |
||
219 | 219 | * @param WP $WP |
220 | 220 | * @return void |
221 | 221 | */ |
222 | - public function get_request( WP $WP ) { |
|
223 | - do_action( 'AHEE__EE_Front_Controller__get_request__start' ); |
|
222 | + public function get_request(WP $WP) { |
|
223 | + do_action('AHEE__EE_Front_Controller__get_request__start'); |
|
224 | 224 | /** @var EE_Request_Handler $Request_Handler */ |
225 | - $Request_Handler = EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
226 | - $Request_Handler->parse_request( $WP ); |
|
227 | - do_action( 'AHEE__EE_Front_Controller__get_request__complete' ); |
|
225 | + $Request_Handler = EE_Registry::instance()->load_core('Request_Handler'); |
|
226 | + $Request_Handler->parse_request($WP); |
|
227 | + do_action('AHEE__EE_Front_Controller__get_request__complete'); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | |
@@ -236,22 +236,22 @@ discard block |
||
236 | 236 | * @param WP $WP |
237 | 237 | * @return void |
238 | 238 | */ |
239 | - public function _initialize_shortcodes( WP $WP ) { |
|
240 | - do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this ); |
|
239 | + public function _initialize_shortcodes(WP $WP) { |
|
240 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this); |
|
241 | 241 | // grab post_name from request |
242 | - $current_post = apply_filters( 'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', EE_Registry::instance()->REQ->get( 'post_name' )); |
|
242 | + $current_post = apply_filters('FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', EE_Registry::instance()->REQ->get('post_name')); |
|
243 | 243 | // if it's not set, then check if frontpage is blog |
244 | - if ( empty( $current_post ) && get_option( 'show_on_front' ) == 'posts' ) { |
|
244 | + if (empty($current_post) && get_option('show_on_front') == 'posts') { |
|
245 | 245 | // yup.. this is the posts page, prepare to load all shortcode modules |
246 | 246 | $current_post = 'posts'; |
247 | - } else if ( empty( $current_post ) && get_option( 'show_on_front' ) == 'page' ) { |
|
247 | + } else if (empty($current_post) && get_option('show_on_front') == 'page') { |
|
248 | 248 | // some other page is set as the homepage |
249 | - $page_on_front = get_option( 'page_on_front' ); |
|
250 | - if ( $page_on_front ) { |
|
249 | + $page_on_front = get_option('page_on_front'); |
|
250 | + if ($page_on_front) { |
|
251 | 251 | // k now we need to find the post_name for this page |
252 | 252 | global $wpdb; |
253 | 253 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='page' AND post_status='publish' AND ID=%d"; |
254 | - $page_on_front = $wpdb->get_var( $wpdb->prepare( $SQL, $page_on_front )); |
|
254 | + $page_on_front = $wpdb->get_var($wpdb->prepare($SQL, $page_on_front)); |
|
255 | 255 | // set the current post slug to what it actually is |
256 | 256 | $current_post = $page_on_front ? $page_on_front : $current_post; |
257 | 257 | } |
@@ -259,58 +259,58 @@ discard block |
||
259 | 259 | // where are posts being displayed ? |
260 | 260 | $page_for_posts = EE_Config::get_page_for_posts(); |
261 | 261 | // in case $current_post is hierarchical like: /parent-page/current-page |
262 | - $current_post = basename( $current_post ); |
|
262 | + $current_post = basename($current_post); |
|
263 | 263 | // are we on a category page? |
264 | - $term_exists = is_array( term_exists( $current_post, 'category' )) || array_key_exists( 'category_name', $WP->query_vars ); |
|
264 | + $term_exists = is_array(term_exists($current_post, 'category')) || array_key_exists('category_name', $WP->query_vars); |
|
265 | 265 | // make sure shortcodes are set |
266 | - if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes )) { |
|
266 | + if (isset(EE_Registry::instance()->CFG->core->post_shortcodes)) { |
|
267 | 267 | // d( EE_Registry::instance()->CFG->core->post_shortcodes ); |
268 | 268 | // cycle thru all posts with shortcodes set |
269 | - foreach ( EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $post_shortcodes ) { |
|
269 | + foreach (EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $post_shortcodes) { |
|
270 | 270 | // filter shortcodes so |
271 | - $post_shortcodes = apply_filters( 'FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes ); |
|
271 | + $post_shortcodes = apply_filters('FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes); |
|
272 | 272 | // now cycle thru shortcodes |
273 | - foreach ( $post_shortcodes as $shortcode_class => $post_id ) { |
|
273 | + foreach ($post_shortcodes as $shortcode_class => $post_id) { |
|
274 | 274 | // are we on this page, or on the blog page, or an EE CPT category page ? |
275 | - if ( $current_post == $post_name || $term_exists ) { |
|
275 | + if ($current_post == $post_name || $term_exists) { |
|
276 | 276 | // verify shortcode is in list of registered shortcodes |
277 | - if ( ! isset( EE_Registry::instance()->shortcodes->{$shortcode_class} )) { |
|
278 | - if ( $current_post != $page_for_posts && current_user_can( 'edit_post', $post_id )) { |
|
279 | - $msg = sprintf( __( 'The [%s] shortcode has not been properly registered or the corresponding addon/module is not active for some reason. Either fix/remove the shortcode from the post, or activate the addon/module the shortcode is associated with.', 'event_espresso' ), $shortcode_class ); |
|
280 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
281 | - add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
|
277 | + if ( ! isset(EE_Registry::instance()->shortcodes->{$shortcode_class} )) { |
|
278 | + if ($current_post != $page_for_posts && current_user_can('edit_post', $post_id)) { |
|
279 | + $msg = sprintf(__('The [%s] shortcode has not been properly registered or the corresponding addon/module is not active for some reason. Either fix/remove the shortcode from the post, or activate the addon/module the shortcode is associated with.', 'event_espresso'), $shortcode_class); |
|
280 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
281 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
282 | 282 | } |
283 | - add_shortcode( $shortcode_class, array( 'EES_Shortcode', 'invalid_shortcode_processor' )); |
|
283 | + add_shortcode($shortcode_class, array('EES_Shortcode', 'invalid_shortcode_processor')); |
|
284 | 284 | continue; |
285 | 285 | } |
286 | 286 | // is this : a shortcodes set exclusively for this post, or for the home page, or a category, or a taxonomy ? |
287 | - if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $current_post ] ) || $term_exists || $current_post == $page_for_posts ) { |
|
287 | + if (isset(EE_Registry::instance()->CFG->core->post_shortcodes[$current_post]) || $term_exists || $current_post == $page_for_posts) { |
|
288 | 288 | // let's pause to reflect on this... |
289 | - $sc_reflector = new ReflectionClass( 'EES_' . $shortcode_class ); |
|
289 | + $sc_reflector = new ReflectionClass('EES_'.$shortcode_class); |
|
290 | 290 | // ensure that class is actually a shortcode |
291 | - if ( ! $sc_reflector->isSubclassOf( 'EES_Shortcode' ) && defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE ) { |
|
292 | - $msg = sprintf( __( 'The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.', 'event_espresso' ), $shortcode_class ); |
|
293 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
294 | - add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
|
291 | + if ( ! $sc_reflector->isSubclassOf('EES_Shortcode') && defined('WP_DEBUG') && WP_DEBUG === TRUE) { |
|
292 | + $msg = sprintf(__('The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.', 'event_espresso'), $shortcode_class); |
|
293 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
294 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
295 | 295 | continue; |
296 | 296 | } |
297 | 297 | // and pass the request object to the run method |
298 | 298 | EE_Registry::instance()->shortcodes->{$shortcode_class} = $sc_reflector->newInstance(); |
299 | 299 | // fire the shortcode class's run method, so that it can activate resources |
300 | - EE_Registry::instance()->shortcodes->{$shortcode_class}->run( $WP ); |
|
300 | + EE_Registry::instance()->shortcodes->{$shortcode_class}->run($WP); |
|
301 | 301 | } |
302 | 302 | // if this is NOT the "Posts page" and we have a valid entry for the "Posts page" in our tracked post_shortcodes array |
303 | - } else if ( $post_name != $page_for_posts && isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] )) { |
|
303 | + } else if ($post_name != $page_for_posts && isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) { |
|
304 | 304 | // and the shortcode is not being tracked for this page |
305 | - if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] )) { |
|
305 | + if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$shortcode_class])) { |
|
306 | 306 | // then remove the "fallback" shortcode processor |
307 | - remove_shortcode( $shortcode_class ); |
|
307 | + remove_shortcode($shortcode_class); |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 | } |
311 | 311 | } |
312 | 312 | } |
313 | - do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__end', $this ); |
|
313 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $this); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | |
@@ -322,20 +322,20 @@ discard block |
||
322 | 322 | * @param WP_Query $WP_Query |
323 | 323 | * @return void |
324 | 324 | */ |
325 | - public function pre_get_posts( $WP_Query ) { |
|
325 | + public function pre_get_posts($WP_Query) { |
|
326 | 326 | // only load Module_Request_Router if this is the main query |
327 | - if ( $WP_Query->is_main_query() ) { |
|
327 | + if ($WP_Query->is_main_query()) { |
|
328 | 328 | // load module request router |
329 | - $Module_Request_Router = EE_Registry::instance()->load_core( 'Module_Request_Router' ); |
|
329 | + $Module_Request_Router = EE_Registry::instance()->load_core('Module_Request_Router'); |
|
330 | 330 | // verify object |
331 | - if ( $Module_Request_Router instanceof EE_Module_Request_Router ) { |
|
331 | + if ($Module_Request_Router instanceof EE_Module_Request_Router) { |
|
332 | 332 | // cycle thru module routes |
333 | - while ( $route = $Module_Request_Router->get_route( $WP_Query )) { |
|
333 | + while ($route = $Module_Request_Router->get_route($WP_Query)) { |
|
334 | 334 | // determine module and method for route |
335 | - $module = $Module_Request_Router->resolve_route( $route[0], $route[1] ); |
|
336 | - if( $module instanceof EED_Module ) { |
|
335 | + $module = $Module_Request_Router->resolve_route($route[0], $route[1]); |
|
336 | + if ($module instanceof EED_Module) { |
|
337 | 337 | // get registered view for route |
338 | - $this->_template_path = $Module_Request_Router->get_view( $route ); |
|
338 | + $this->_template_path = $Module_Request_Router->get_view($route); |
|
339 | 339 | // grab module name |
340 | 340 | $module_name = $module->module_name(); |
341 | 341 | // map the module to the module objects |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | * @return void |
363 | 363 | */ |
364 | 364 | public function wp() { |
365 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
365 | + EE_Registry::instance()->load_helper('Template'); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | |
@@ -380,30 +380,30 @@ discard block |
||
380 | 380 | public function wp_enqueue_scripts() { |
381 | 381 | |
382 | 382 | // css is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF via: add_filter( 'FHEE_load_css', '__return_false' ); |
383 | - if ( apply_filters( 'FHEE_load_css', TRUE ) ) { |
|
383 | + if (apply_filters('FHEE_load_css', TRUE)) { |
|
384 | 384 | |
385 | 385 | EE_Registry::instance()->CFG->template_settings->enable_default_style = TRUE; |
386 | 386 | //Load the ThemeRoller styles if enabled |
387 | - if ( isset( EE_Registry::instance()->CFG->template_settings->enable_default_style ) && EE_Registry::instance()->CFG->template_settings->enable_default_style ) { |
|
387 | + if (isset(EE_Registry::instance()->CFG->template_settings->enable_default_style) && EE_Registry::instance()->CFG->template_settings->enable_default_style) { |
|
388 | 388 | |
389 | 389 | //Load custom style sheet if available |
390 | - if ( isset( EE_Registry::instance()->CFG->template_settings->custom_style_sheet )) { |
|
391 | - wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL . 'css/' . EE_Registry::instance()->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION ); |
|
390 | + if (isset(EE_Registry::instance()->CFG->template_settings->custom_style_sheet)) { |
|
391 | + wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL.'css/'.EE_Registry::instance()->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION); |
|
392 | 392 | wp_enqueue_style('espresso_custom_css'); |
393 | 393 | } |
394 | 394 | |
395 | - EE_Registry::instance()->load_helper( 'File' ); |
|
396 | - if ( is_readable( EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css' )) { |
|
397 | - wp_register_style( 'espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
395 | + EE_Registry::instance()->load_helper('File'); |
|
396 | + if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')) { |
|
397 | + wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
398 | 398 | } else { |
399 | - wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
399 | + wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
400 | 400 | } |
401 | 401 | wp_enqueue_style('espresso_default'); |
402 | 402 | |
403 | - if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css' )) { |
|
404 | - wp_register_style( 'espresso_style', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
403 | + if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'style.css')) { |
|
404 | + wp_register_style('espresso_style', get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default')); |
|
405 | 405 | } else { |
406 | - wp_register_style( 'espresso_style', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
406 | + wp_register_style('espresso_style', EE_TEMPLATES_URL.EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default')); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | } |
@@ -411,29 +411,29 @@ discard block |
||
411 | 411 | } |
412 | 412 | |
413 | 413 | // js is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF via: add_filter( 'FHEE_load_js', '__return_false' ); |
414 | - if ( apply_filters( 'FHEE_load_js', TRUE ) ) { |
|
414 | + if (apply_filters('FHEE_load_js', TRUE)) { |
|
415 | 415 | |
416 | - wp_enqueue_script( 'jquery' ); |
|
416 | + wp_enqueue_script('jquery'); |
|
417 | 417 | //let's make sure that all required scripts have been setup |
418 | - if ( function_exists( 'wp_script_is' )) { |
|
419 | - if ( ! wp_script_is( 'jquery' )) { |
|
418 | + if (function_exists('wp_script_is')) { |
|
419 | + if ( ! wp_script_is('jquery')) { |
|
420 | 420 | $msg = sprintf( |
421 | - __( '%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso' ), |
|
421 | + __('%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso'), |
|
422 | 422 | '<em><br />', |
423 | 423 | '</em>' |
424 | 424 | ); |
425 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
425 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
426 | 426 | } |
427 | 427 | } |
428 | 428 | // load core js |
429 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
430 | - wp_enqueue_script( 'espresso_core' ); |
|
431 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
429 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
430 | + wp_enqueue_script('espresso_core'); |
|
431 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
432 | 432 | |
433 | 433 | } |
434 | 434 | |
435 | 435 | //qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' ); |
436 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
436 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
437 | 437 | EE_Registry::instance()->load_helper('Qtip_Loader'); |
438 | 438 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
439 | 439 | } |
@@ -441,11 +441,11 @@ discard block |
||
441 | 441 | |
442 | 442 | //accounting.js library |
443 | 443 | // @link http://josscrowcroft.github.io/accounting.js/ |
444 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
445 | - $acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js'; |
|
446 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
447 | - wp_register_script( 'ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE ); |
|
448 | - wp_enqueue_script( 'ee-accounting' ); |
|
444 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
445 | + $acct_js = EE_THIRD_PARTY_URL.'accounting/accounting.js'; |
|
446 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
447 | + wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE); |
|
448 | + wp_enqueue_script('ee-accounting'); |
|
449 | 449 | |
450 | 450 | $currency_config = array( |
451 | 451 | 'currency' => array( |
@@ -468,21 +468,21 @@ discard block |
||
468 | 468 | wp_localize_script('ee-accounting', 'EE_ACCOUNTING_CFG', $currency_config); |
469 | 469 | } |
470 | 470 | |
471 | - if ( ! function_exists( 'wp_head' )) { |
|
471 | + if ( ! function_exists('wp_head')) { |
|
472 | 472 | $msg = sprintf( |
473 | - __( '%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ), |
|
473 | + __('%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'), |
|
474 | 474 | '<em><br />', |
475 | 475 | '</em>' |
476 | 476 | ); |
477 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
477 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
478 | 478 | } |
479 | - if ( ! function_exists( 'wp_footer' )) { |
|
479 | + if ( ! function_exists('wp_footer')) { |
|
480 | 480 | $msg = sprintf( |
481 | - __( '%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ), |
|
481 | + __('%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'), |
|
482 | 482 | '<em><br />', |
483 | 483 | '</em>' |
484 | 484 | ); |
485 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
485 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | } |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | * @return void |
497 | 497 | */ |
498 | 498 | public function header_meta_tag() { |
499 | - print( apply_filters("FHEE__EE_Front_Controller__header_meta_tag","<meta name='generator' content='Event Espresso Version " . EVENT_ESPRESSO_VERSION . "' />")); |
|
499 | + print(apply_filters("FHEE__EE_Front_Controller__header_meta_tag", "<meta name='generator' content='Event Espresso Version ".EVENT_ESPRESSO_VERSION."' />")); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | |
@@ -510,9 +510,9 @@ discard block |
||
510 | 510 | * @param $the_content |
511 | 511 | * @return string |
512 | 512 | */ |
513 | - public function the_content( $the_content ) { |
|
513 | + public function the_content($the_content) { |
|
514 | 514 | // nothing gets loaded at this point unless other systems turn this hookpoint on by using: add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
515 | - if ( apply_filters( 'FHEE_run_EE_the_content', FALSE ) ) { |
|
515 | + if (apply_filters('FHEE_run_EE_the_content', FALSE)) { |
|
516 | 516 | } |
517 | 517 | return $the_content; |
518 | 518 | } |
@@ -537,9 +537,9 @@ discard block |
||
537 | 537 | */ |
538 | 538 | public function display_errors() { |
539 | 539 | static $shown_already = FALSE; |
540 | - do_action( 'AHEE__EE_Front_Controller__display_errors__begin' ); |
|
540 | + do_action('AHEE__EE_Front_Controller__display_errors__begin'); |
|
541 | 541 | if ( |
542 | - apply_filters( 'FHEE__EE_Front_Controller__display_errors', TRUE ) |
|
542 | + apply_filters('FHEE__EE_Front_Controller__display_errors', TRUE) |
|
543 | 543 | && ! $shown_already |
544 | 544 | && is_main_query() |
545 | 545 | && ! is_feed() |
@@ -548,10 +548,10 @@ discard block |
||
548 | 548 | ) { |
549 | 549 | echo EE_Error::get_notices(); |
550 | 550 | $shown_already = TRUE; |
551 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
552 | - EEH_Template::display_template( EE_TEMPLATES . 'espresso-ajax-notices.template.php' ); |
|
551 | + EE_Registry::instance()->load_helper('Template'); |
|
552 | + EEH_Template::display_template(EE_TEMPLATES.'espresso-ajax-notices.template.php'); |
|
553 | 553 | } |
554 | - do_action( 'AHEE__EE_Front_Controller__display_errors__end' ); |
|
554 | + do_action('AHEE__EE_Front_Controller__display_errors__end'); |
|
555 | 555 | } |
556 | 556 | |
557 | 557 | |
@@ -566,12 +566,12 @@ discard block |
||
566 | 566 | * @param string $template_include_path |
567 | 567 | * @return string |
568 | 568 | */ |
569 | - public function template_include( $template_include_path = NULL ) { |
|
570 | - if ( EE_Registry::instance()->REQ->is_espresso_page() ) { |
|
571 | - $this->_template_path = ! empty( $this->_template_path ) ? basename( $this->_template_path ) : basename( $template_include_path ); |
|
572 | - $template_path = EEH_Template::locate_template( $this->_template_path, array(), false ); |
|
573 | - $this->_template_path = ! empty( $template_path ) ? $template_path : $template_include_path; |
|
574 | - $this->_template = basename( $this->_template_path ); |
|
569 | + public function template_include($template_include_path = NULL) { |
|
570 | + if (EE_Registry::instance()->REQ->is_espresso_page()) { |
|
571 | + $this->_template_path = ! empty($this->_template_path) ? basename($this->_template_path) : basename($template_include_path); |
|
572 | + $template_path = EEH_Template::locate_template($this->_template_path, array(), false); |
|
573 | + $this->_template_path = ! empty($template_path) ? $template_path : $template_include_path; |
|
574 | + $this->_template = basename($this->_template_path); |
|
575 | 575 | return $this->_template_path; |
576 | 576 | } |
577 | 577 | return $template_include_path; |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | * @param bool $with_path |
587 | 587 | * @return string |
588 | 588 | */ |
589 | - public function get_selected_template( $with_path = FALSE ) { |
|
589 | + public function get_selected_template($with_path = FALSE) { |
|
590 | 590 | return $with_path ? $this->_template_path : $this->_template; |
591 | 591 | } |
592 | 592 |