@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -32,20 +32,20 @@ discard block |
||
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | - public function __construct( $routing = TRUE ) { |
|
36 | - parent::__construct( $routing ); |
|
37 | - define( 'GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/' ); |
|
35 | + public function __construct($routing = TRUE) { |
|
36 | + parent::__construct($routing); |
|
37 | + define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'general_settings/templates/'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
41 | 41 | |
42 | 42 | protected function _extend_page_config() { |
43 | 43 | |
44 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings'; |
|
44 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'general_settings'; |
|
45 | 45 | |
46 | 46 | //filters and action hooks here |
47 | - add_action( 'AHEE__admin_option_settings__template__before', array( $this, 'debug_logging_options' ), 9 ); |
|
48 | - add_filter( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', array( $this, 'update_debug_logging_options' ), 10, 1 ); |
|
47 | + add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9); |
|
48 | + add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', array($this, 'update_debug_logging_options'), 10, 1); |
|
49 | 49 | |
50 | 50 | } |
51 | 51 | |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | * @param array $template_args |
60 | 60 | * @return void |
61 | 61 | */ |
62 | - public function debug_logging_options( $template_args = array() ) { |
|
62 | + public function debug_logging_options($template_args = array()) { |
|
63 | 63 | $template_args['use_full_logging'] = EE_Registry::instance()->CFG->admin->use_full_logging; |
64 | - $template_args['use_remote_logging'] = isset( EE_Registry::instance()->CFG->admin->use_remote_logging ) ? absint( EE_Registry::instance()->CFG->admin->use_remote_logging ) : FALSE; |
|
65 | - $template_args['remote_logging_url'] = isset( EE_Registry::instance()->CFG->admin->remote_logging_url ) && ! empty( EE_Registry::instance()->CFG->admin->remote_logging_url ) ? stripslashes( EE_Registry::instance()->CFG->admin->remote_logging_url ) : ''; |
|
66 | - $template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php'; |
|
67 | - EEH_Template::display_template( $template, $template_args ); |
|
64 | + $template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : FALSE; |
|
65 | + $template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : ''; |
|
66 | + $template = GEN_SET_CAF_TEMPLATE_PATH.'debug_log_settings.template.php'; |
|
67 | + EEH_Template::display_template($template, $template_args); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -75,17 +75,17 @@ discard block |
||
75 | 75 | * @param array $admin_options |
76 | 76 | * @return array |
77 | 77 | */ |
78 | - public function update_debug_logging_options( $admin_options = array() ) { |
|
79 | - $use_full_logging = isset( $this->_req_data['use_full_logging'] ) ? (bool)absint( $this->_req_data['use_full_logging'] ) : $admin_options->use_full_logging; |
|
78 | + public function update_debug_logging_options($admin_options = array()) { |
|
79 | + $use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool) absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging; |
|
80 | 80 | $admin_options->use_full_logging = $use_full_logging; |
81 | 81 | |
82 | - if ( $use_full_logging === FALSE ) { |
|
83 | - EE_Error::get_notices( FALSE ); |
|
82 | + if ($use_full_logging === FALSE) { |
|
83 | + EE_Error::get_notices(FALSE); |
|
84 | 84 | EE_Error::reset_notices(); |
85 | 85 | } |
86 | 86 | |
87 | - $admin_options->use_remote_logging = isset( $this->_req_data['use_remote_logging'] ) ? absint( $this->_req_data['use_remote_logging'] ) : $admin_options->use_remote_logging; |
|
88 | - $admin_options->remote_logging_url = isset( $this->_req_data['remote_logging_url'] ) ? esc_url_raw( $this->_req_data['remote_logging_url'] ) : $admin_options->remote_logging_url; |
|
87 | + $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging; |
|
88 | + $admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url; |
|
89 | 89 | return $admin_options; |
90 | 90 | } |
91 | 91 |
@@ -30,224 +30,224 @@ |
||
30 | 30 | class AdminOptionsSettings extends FormHandler |
31 | 31 | { |
32 | 32 | |
33 | - protected $template_args = array(); |
|
34 | - |
|
35 | - /** |
|
36 | - * Form constructor. |
|
37 | - * |
|
38 | - * @param \EE_Registry $registry |
|
39 | - */ |
|
40 | - public function __construct(\EE_Registry $registry) { |
|
41 | - parent::__construct( |
|
42 | - esc_html__('Admin Options', 'event_espresso'), |
|
43 | - esc_html__('Admin Options', 'event_espresso'), |
|
44 | - 'admin_option_settings', |
|
45 | - '', |
|
46 | - FormHandler::DO_NOT_SETUP_FORM, |
|
47 | - $registry |
|
48 | - ); |
|
49 | - } |
|
50 | - |
|
51 | - |
|
52 | - |
|
53 | - /** |
|
54 | - * @param array $template_args |
|
55 | - */ |
|
56 | - public function setTemplateArgs(array $template_args) |
|
57 | - { |
|
58 | - $this->template_args = $template_args; |
|
59 | - } |
|
60 | - |
|
61 | - |
|
62 | - |
|
63 | - /** |
|
64 | - * creates and returns the actual form |
|
65 | - * |
|
66 | - * @return EE_Form_Section_Proper |
|
67 | - * @throws \EE_Error |
|
68 | - */ |
|
69 | - public function generate() |
|
70 | - { |
|
71 | - $form = new \EE_Form_Section_Proper( |
|
72 | - array( |
|
73 | - 'name' => 'admin_option_settings', |
|
74 | - 'html_id' => 'admin_option_settings', |
|
75 | - 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
76 | - 'subsections' => array( |
|
77 | - 'help_tour_activation_hdr' => new EE_Form_Section_HTML( |
|
78 | - EEH_HTML::h2( |
|
79 | - esc_html__('Help Tour Global Activation', 'event_espresso') |
|
80 | - . ' ' |
|
81 | - . EEH_HTML::span( |
|
82 | - EEH_Template::get_help_tab_link('help_tour_activation_info'), |
|
83 | - 'help_tour_activation' |
|
84 | - ), |
|
85 | - '', 'ee-admin-settings-hdr' |
|
86 | - ) |
|
87 | - ), |
|
88 | - 'help_tour_activation' => new EE_Yes_No_Input( |
|
89 | - array( |
|
90 | - 'html_label_text' => esc_html__('Activate Global Help Tours?', 'event_espresso'), |
|
91 | - 'html_help_text' => esc_html__( |
|
92 | - 'This toggles whether the Event Espresso help tours are active globally or not.', |
|
93 | - 'event_espresso' |
|
94 | - ), |
|
95 | - 'default' => isset($this->registry->CFG->admin->help_tour_activation) |
|
96 | - ? filter_var($this->registry->CFG->admin->help_tour_activation, FILTER_VALIDATE_BOOLEAN) |
|
97 | - : true, |
|
98 | - 'required' => false |
|
99 | - ) |
|
100 | - ), |
|
101 | - 'compatibility_hdr' => new EE_Form_Section_HTML( |
|
102 | - EEH_HTML::h2( |
|
103 | - esc_html__('Compatibility Settings', 'event_espresso'), |
|
104 | - '', 'ee-admin-settings-hdr' |
|
105 | - ) |
|
106 | - ), |
|
107 | - 'encode_session_data' => new EE_Yes_No_Input( |
|
108 | - array( |
|
109 | - 'html_label_text' => esc_html__('Encode Session Data?', 'event_espresso'), |
|
110 | - 'html_help_text' => sprintf( |
|
111 | - esc_html__( |
|
112 | - 'Some servers and database configurations can cause problems when saving the Event Espresso session data. Setting this option to "Yes" adds an extra layer of encoding to session data to prevent serialization errors, but can be incompatible with some server configurations.%1$sIf you receive "500 internal server" type errors during registration, try turning this option on.%1$sIf you get fatal PHP errors regarding missing base64 functions, then turn this option off.', |
|
113 | - 'event_espresso' |
|
114 | - ), |
|
115 | - '<br>' |
|
116 | - ), |
|
117 | - 'default' => $this->registry->CFG->admin->encode_session_data(), |
|
118 | - 'required' => false |
|
119 | - ) |
|
120 | - ), |
|
121 | - ) |
|
122 | - ) |
|
123 | - ); |
|
124 | - if ( |
|
125 | - $this->registry->CAP->current_user_can( |
|
126 | - 'manage_options', |
|
127 | - 'display_admin_settings_options_promote_and_affiliate' |
|
128 | - ) |
|
129 | - ) { |
|
130 | - $form->add_subsections( |
|
131 | - array( |
|
132 | - 'promote_ee_hdr' => new EE_Form_Section_HTML( |
|
133 | - EEH_HTML::h2( |
|
134 | - esc_html__('Promote Event Espresso', 'event_espresso') |
|
135 | - . ' ' |
|
136 | - . EEH_HTML::span( |
|
137 | - EEH_Template::get_help_tab_link('affiliate_info'), |
|
138 | - 'affiliate_info' |
|
139 | - ), |
|
140 | - '', 'ee-admin-settings-hdr' |
|
141 | - ) |
|
142 | - ), |
|
143 | - 'show_reg_footer' => new EE_Yes_No_Input( |
|
144 | - array( |
|
145 | - 'html_label_text' => esc_html__( |
|
146 | - 'Link to Event Espresso in your Registration Page?', |
|
147 | - 'event_espresso' |
|
148 | - ) |
|
149 | - . EEH_Template::get_help_tab_link('email_validation_info'), |
|
150 | - 'html_help_text' => esc_html__( |
|
151 | - 'adds an unobtrusive link to Event Espresso\'s website in the footer of your registration form. Get an affiliate link (see below) and make money if people click the link and purchase Event Espresso.', |
|
152 | - 'event_espresso' |
|
153 | - ), |
|
154 | - 'default' => isset($this->registry->CFG->admin->show_reg_footer) |
|
155 | - ? filter_var($this->registry->CFG->admin->show_reg_footer, FILTER_VALIDATE_BOOLEAN) |
|
156 | - : true, |
|
157 | - 'required' => false |
|
158 | - ) |
|
159 | - ), |
|
160 | - 'affiliate_id' => new EE_Text_Input( |
|
161 | - array( |
|
162 | - 'html_label_text' => sprintf( |
|
163 | - esc_html__('Event Espresso %sAffiliate%s ID', 'event_espresso'), |
|
164 | - '<a href="http://eventespresso.com/affiliates/" target="_blank">', |
|
165 | - '</a>' |
|
166 | - ), |
|
167 | - 'html_help_text' => esc_html__( |
|
168 | - 'Earn cash for promoting Event Espresso.', |
|
169 | - 'event_espresso' |
|
170 | - ), |
|
171 | - 'html_class' => 'regular-text', |
|
172 | - 'default' => isset($this->registry->CFG->admin->affiliate_id) |
|
173 | - ? $this->registry->CFG->admin->get_pretty('affiliate_id') |
|
174 | - : '', |
|
175 | - 'required' => false |
|
176 | - ) |
|
177 | - ), |
|
178 | - ), |
|
179 | - 'help_tour_activation_hdr' |
|
180 | - ); |
|
181 | - } |
|
182 | - return $form; |
|
183 | - } |
|
184 | - |
|
185 | - |
|
186 | - |
|
187 | - /** |
|
188 | - * takes the generated form and displays it along with ony other non-form HTML that may be required |
|
189 | - * returns a string of HTML that can be directly echoed in a template |
|
190 | - * |
|
191 | - * @return string |
|
192 | - * @throws LogicException |
|
193 | - * @throws \EE_Error |
|
194 | - */ |
|
195 | - public function display() |
|
196 | - { |
|
197 | - add_filter( |
|
198 | - 'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__before_form', |
|
199 | - array($this, 'handleOldAdminOptionsSettingsAction') |
|
200 | - ); |
|
201 | - return parent::display(); |
|
202 | - } |
|
203 | - |
|
204 | - |
|
205 | - |
|
206 | - /** |
|
207 | - * @return string |
|
208 | - */ |
|
209 | - public function handleOldAdminOptionsSettingsAction() |
|
210 | - { |
|
211 | - ob_start(); |
|
212 | - do_action('AHEE__admin_option_settings__template__before', $this->template_args); |
|
213 | - return ob_get_clean(); |
|
214 | - } |
|
215 | - |
|
216 | - |
|
217 | - |
|
218 | - /** |
|
219 | - * handles processing the form submission |
|
220 | - * returns true or false depending on whether the form was processed successfully or not |
|
221 | - * |
|
222 | - * @param array $form_data |
|
223 | - * @return bool |
|
224 | - * @throws InvalidFormSubmissionException |
|
225 | - * @throws EE_Error |
|
226 | - * @throws LogicException |
|
227 | - * @throws InvalidArgumentException |
|
228 | - * @throws InvalidDataTypeException |
|
229 | - */ |
|
230 | - public function process($form_data = array()) |
|
231 | - { |
|
232 | - // process form |
|
233 | - $valid_data = (array)parent::process($form_data); |
|
234 | - if (empty($valid_data)) { |
|
235 | - return false; |
|
236 | - } |
|
237 | - $this->registry->CFG->admin->show_reg_footer = isset( $form_data['show_reg_footer'] ) |
|
238 | - ? absint( $form_data['show_reg_footer'] ) |
|
239 | - : $this->registry->CFG->admin->show_reg_footer; |
|
240 | - $this->registry->CFG->admin->affiliate_id = isset( $form_data['affiliate_id'] ) |
|
241 | - ? sanitize_text_field( $form_data['affiliate_id'] ) |
|
242 | - : $this->registry->CFG->admin->affiliate_id; |
|
243 | - $this->registry->CFG->admin->help_tour_activation = isset( $form_data['help_tour_activation'] ) |
|
244 | - ? absint( $form_data['help_tour_activation']) |
|
245 | - : $this->registry->CFG->admin->help_tour_activation; |
|
246 | - if (isset($form_data['encode_session_data'])) { |
|
247 | - $this->registry->CFG->admin->set_encode_session_data($form_data['encode_session_data']); |
|
248 | - } |
|
249 | - return false; |
|
250 | - } |
|
33 | + protected $template_args = array(); |
|
34 | + |
|
35 | + /** |
|
36 | + * Form constructor. |
|
37 | + * |
|
38 | + * @param \EE_Registry $registry |
|
39 | + */ |
|
40 | + public function __construct(\EE_Registry $registry) { |
|
41 | + parent::__construct( |
|
42 | + esc_html__('Admin Options', 'event_espresso'), |
|
43 | + esc_html__('Admin Options', 'event_espresso'), |
|
44 | + 'admin_option_settings', |
|
45 | + '', |
|
46 | + FormHandler::DO_NOT_SETUP_FORM, |
|
47 | + $registry |
|
48 | + ); |
|
49 | + } |
|
50 | + |
|
51 | + |
|
52 | + |
|
53 | + /** |
|
54 | + * @param array $template_args |
|
55 | + */ |
|
56 | + public function setTemplateArgs(array $template_args) |
|
57 | + { |
|
58 | + $this->template_args = $template_args; |
|
59 | + } |
|
60 | + |
|
61 | + |
|
62 | + |
|
63 | + /** |
|
64 | + * creates and returns the actual form |
|
65 | + * |
|
66 | + * @return EE_Form_Section_Proper |
|
67 | + * @throws \EE_Error |
|
68 | + */ |
|
69 | + public function generate() |
|
70 | + { |
|
71 | + $form = new \EE_Form_Section_Proper( |
|
72 | + array( |
|
73 | + 'name' => 'admin_option_settings', |
|
74 | + 'html_id' => 'admin_option_settings', |
|
75 | + 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
76 | + 'subsections' => array( |
|
77 | + 'help_tour_activation_hdr' => new EE_Form_Section_HTML( |
|
78 | + EEH_HTML::h2( |
|
79 | + esc_html__('Help Tour Global Activation', 'event_espresso') |
|
80 | + . ' ' |
|
81 | + . EEH_HTML::span( |
|
82 | + EEH_Template::get_help_tab_link('help_tour_activation_info'), |
|
83 | + 'help_tour_activation' |
|
84 | + ), |
|
85 | + '', 'ee-admin-settings-hdr' |
|
86 | + ) |
|
87 | + ), |
|
88 | + 'help_tour_activation' => new EE_Yes_No_Input( |
|
89 | + array( |
|
90 | + 'html_label_text' => esc_html__('Activate Global Help Tours?', 'event_espresso'), |
|
91 | + 'html_help_text' => esc_html__( |
|
92 | + 'This toggles whether the Event Espresso help tours are active globally or not.', |
|
93 | + 'event_espresso' |
|
94 | + ), |
|
95 | + 'default' => isset($this->registry->CFG->admin->help_tour_activation) |
|
96 | + ? filter_var($this->registry->CFG->admin->help_tour_activation, FILTER_VALIDATE_BOOLEAN) |
|
97 | + : true, |
|
98 | + 'required' => false |
|
99 | + ) |
|
100 | + ), |
|
101 | + 'compatibility_hdr' => new EE_Form_Section_HTML( |
|
102 | + EEH_HTML::h2( |
|
103 | + esc_html__('Compatibility Settings', 'event_espresso'), |
|
104 | + '', 'ee-admin-settings-hdr' |
|
105 | + ) |
|
106 | + ), |
|
107 | + 'encode_session_data' => new EE_Yes_No_Input( |
|
108 | + array( |
|
109 | + 'html_label_text' => esc_html__('Encode Session Data?', 'event_espresso'), |
|
110 | + 'html_help_text' => sprintf( |
|
111 | + esc_html__( |
|
112 | + 'Some servers and database configurations can cause problems when saving the Event Espresso session data. Setting this option to "Yes" adds an extra layer of encoding to session data to prevent serialization errors, but can be incompatible with some server configurations.%1$sIf you receive "500 internal server" type errors during registration, try turning this option on.%1$sIf you get fatal PHP errors regarding missing base64 functions, then turn this option off.', |
|
113 | + 'event_espresso' |
|
114 | + ), |
|
115 | + '<br>' |
|
116 | + ), |
|
117 | + 'default' => $this->registry->CFG->admin->encode_session_data(), |
|
118 | + 'required' => false |
|
119 | + ) |
|
120 | + ), |
|
121 | + ) |
|
122 | + ) |
|
123 | + ); |
|
124 | + if ( |
|
125 | + $this->registry->CAP->current_user_can( |
|
126 | + 'manage_options', |
|
127 | + 'display_admin_settings_options_promote_and_affiliate' |
|
128 | + ) |
|
129 | + ) { |
|
130 | + $form->add_subsections( |
|
131 | + array( |
|
132 | + 'promote_ee_hdr' => new EE_Form_Section_HTML( |
|
133 | + EEH_HTML::h2( |
|
134 | + esc_html__('Promote Event Espresso', 'event_espresso') |
|
135 | + . ' ' |
|
136 | + . EEH_HTML::span( |
|
137 | + EEH_Template::get_help_tab_link('affiliate_info'), |
|
138 | + 'affiliate_info' |
|
139 | + ), |
|
140 | + '', 'ee-admin-settings-hdr' |
|
141 | + ) |
|
142 | + ), |
|
143 | + 'show_reg_footer' => new EE_Yes_No_Input( |
|
144 | + array( |
|
145 | + 'html_label_text' => esc_html__( |
|
146 | + 'Link to Event Espresso in your Registration Page?', |
|
147 | + 'event_espresso' |
|
148 | + ) |
|
149 | + . EEH_Template::get_help_tab_link('email_validation_info'), |
|
150 | + 'html_help_text' => esc_html__( |
|
151 | + 'adds an unobtrusive link to Event Espresso\'s website in the footer of your registration form. Get an affiliate link (see below) and make money if people click the link and purchase Event Espresso.', |
|
152 | + 'event_espresso' |
|
153 | + ), |
|
154 | + 'default' => isset($this->registry->CFG->admin->show_reg_footer) |
|
155 | + ? filter_var($this->registry->CFG->admin->show_reg_footer, FILTER_VALIDATE_BOOLEAN) |
|
156 | + : true, |
|
157 | + 'required' => false |
|
158 | + ) |
|
159 | + ), |
|
160 | + 'affiliate_id' => new EE_Text_Input( |
|
161 | + array( |
|
162 | + 'html_label_text' => sprintf( |
|
163 | + esc_html__('Event Espresso %sAffiliate%s ID', 'event_espresso'), |
|
164 | + '<a href="http://eventespresso.com/affiliates/" target="_blank">', |
|
165 | + '</a>' |
|
166 | + ), |
|
167 | + 'html_help_text' => esc_html__( |
|
168 | + 'Earn cash for promoting Event Espresso.', |
|
169 | + 'event_espresso' |
|
170 | + ), |
|
171 | + 'html_class' => 'regular-text', |
|
172 | + 'default' => isset($this->registry->CFG->admin->affiliate_id) |
|
173 | + ? $this->registry->CFG->admin->get_pretty('affiliate_id') |
|
174 | + : '', |
|
175 | + 'required' => false |
|
176 | + ) |
|
177 | + ), |
|
178 | + ), |
|
179 | + 'help_tour_activation_hdr' |
|
180 | + ); |
|
181 | + } |
|
182 | + return $form; |
|
183 | + } |
|
184 | + |
|
185 | + |
|
186 | + |
|
187 | + /** |
|
188 | + * takes the generated form and displays it along with ony other non-form HTML that may be required |
|
189 | + * returns a string of HTML that can be directly echoed in a template |
|
190 | + * |
|
191 | + * @return string |
|
192 | + * @throws LogicException |
|
193 | + * @throws \EE_Error |
|
194 | + */ |
|
195 | + public function display() |
|
196 | + { |
|
197 | + add_filter( |
|
198 | + 'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__before_form', |
|
199 | + array($this, 'handleOldAdminOptionsSettingsAction') |
|
200 | + ); |
|
201 | + return parent::display(); |
|
202 | + } |
|
203 | + |
|
204 | + |
|
205 | + |
|
206 | + /** |
|
207 | + * @return string |
|
208 | + */ |
|
209 | + public function handleOldAdminOptionsSettingsAction() |
|
210 | + { |
|
211 | + ob_start(); |
|
212 | + do_action('AHEE__admin_option_settings__template__before', $this->template_args); |
|
213 | + return ob_get_clean(); |
|
214 | + } |
|
215 | + |
|
216 | + |
|
217 | + |
|
218 | + /** |
|
219 | + * handles processing the form submission |
|
220 | + * returns true or false depending on whether the form was processed successfully or not |
|
221 | + * |
|
222 | + * @param array $form_data |
|
223 | + * @return bool |
|
224 | + * @throws InvalidFormSubmissionException |
|
225 | + * @throws EE_Error |
|
226 | + * @throws LogicException |
|
227 | + * @throws InvalidArgumentException |
|
228 | + * @throws InvalidDataTypeException |
|
229 | + */ |
|
230 | + public function process($form_data = array()) |
|
231 | + { |
|
232 | + // process form |
|
233 | + $valid_data = (array)parent::process($form_data); |
|
234 | + if (empty($valid_data)) { |
|
235 | + return false; |
|
236 | + } |
|
237 | + $this->registry->CFG->admin->show_reg_footer = isset( $form_data['show_reg_footer'] ) |
|
238 | + ? absint( $form_data['show_reg_footer'] ) |
|
239 | + : $this->registry->CFG->admin->show_reg_footer; |
|
240 | + $this->registry->CFG->admin->affiliate_id = isset( $form_data['affiliate_id'] ) |
|
241 | + ? sanitize_text_field( $form_data['affiliate_id'] ) |
|
242 | + : $this->registry->CFG->admin->affiliate_id; |
|
243 | + $this->registry->CFG->admin->help_tour_activation = isset( $form_data['help_tour_activation'] ) |
|
244 | + ? absint( $form_data['help_tour_activation']) |
|
245 | + : $this->registry->CFG->admin->help_tour_activation; |
|
246 | + if (isset($form_data['encode_session_data'])) { |
|
247 | + $this->registry->CFG->admin->set_encode_session_data($form_data['encode_session_data']); |
|
248 | + } |
|
249 | + return false; |
|
250 | + } |
|
251 | 251 | |
252 | 252 | } |
253 | 253 | // End of file AdminOptionsSettings.php |
@@ -230,18 +230,18 @@ |
||
230 | 230 | public function process($form_data = array()) |
231 | 231 | { |
232 | 232 | // process form |
233 | - $valid_data = (array)parent::process($form_data); |
|
233 | + $valid_data = (array) parent::process($form_data); |
|
234 | 234 | if (empty($valid_data)) { |
235 | 235 | return false; |
236 | 236 | } |
237 | - $this->registry->CFG->admin->show_reg_footer = isset( $form_data['show_reg_footer'] ) |
|
238 | - ? absint( $form_data['show_reg_footer'] ) |
|
237 | + $this->registry->CFG->admin->show_reg_footer = isset($form_data['show_reg_footer']) |
|
238 | + ? absint($form_data['show_reg_footer']) |
|
239 | 239 | : $this->registry->CFG->admin->show_reg_footer; |
240 | - $this->registry->CFG->admin->affiliate_id = isset( $form_data['affiliate_id'] ) |
|
241 | - ? sanitize_text_field( $form_data['affiliate_id'] ) |
|
240 | + $this->registry->CFG->admin->affiliate_id = isset($form_data['affiliate_id']) |
|
241 | + ? sanitize_text_field($form_data['affiliate_id']) |
|
242 | 242 | : $this->registry->CFG->admin->affiliate_id; |
243 | - $this->registry->CFG->admin->help_tour_activation = isset( $form_data['help_tour_activation'] ) |
|
244 | - ? absint( $form_data['help_tour_activation']) |
|
243 | + $this->registry->CFG->admin->help_tour_activation = isset($form_data['help_tour_activation']) |
|
244 | + ? absint($form_data['help_tour_activation']) |
|
245 | 245 | : $this->registry->CFG->admin->help_tour_activation; |
246 | 246 | if (isset($form_data['encode_session_data'])) { |
247 | 247 | $this->registry->CFG->admin->set_encode_session_data($form_data['encode_session_data']); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | 'order' => 50 |
157 | 157 | ), |
158 | 158 | 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
159 | - 'help_tabs' => array( |
|
159 | + 'help_tabs' => array( |
|
160 | 160 | 'general_settings_critical_pages_help_tab' => array( |
161 | 161 | 'title' => __('Critical Pages', 'event_espresso'), |
162 | 162 | 'filename' => 'general_settings_critical_pages' |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | 'label' => __('Your Organization', 'event_espresso'), |
171 | 171 | 'order' => 20 |
172 | 172 | ), |
173 | - 'help_tabs' => array( |
|
173 | + 'help_tabs' => array( |
|
174 | 174 | 'general_settings_your_organization_help_tab' => array( |
175 | 175 | 'title' => __('Your Organization', 'event_espresso'), |
176 | 176 | 'filename' => 'general_settings_your_organization' |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | 'order' => 60 |
187 | 187 | ), |
188 | 188 | 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
189 | - 'help_tabs' => array( |
|
189 | + 'help_tabs' => array( |
|
190 | 190 | 'general_settings_admin_options_help_tab' => array( |
191 | 191 | 'title' => __('Admin Options', 'event_espresso'), |
192 | 192 | 'filename' => 'general_settings_admin_options' |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | 'label' => __('Countries', 'event_espresso'), |
201 | 201 | 'order' => 70 |
202 | 202 | ), |
203 | - 'help_tabs' => array( |
|
203 | + 'help_tabs' => array( |
|
204 | 204 | 'general_settings_countries_help_tab' => array( |
205 | 205 | 'title' => __('Countries', 'event_espresso'), |
206 | 206 | 'filename' => 'general_settings_countries' |
@@ -453,68 +453,68 @@ discard block |
||
453 | 453 | |
454 | 454 | |
455 | 455 | |
456 | - /************* Admin Options *************/ |
|
457 | - |
|
458 | - |
|
459 | - |
|
460 | - /** |
|
461 | - * _admin_option_settings |
|
462 | - * |
|
463 | - * @throws \EE_Error |
|
464 | - * @throws \LogicException |
|
465 | - */ |
|
466 | - protected function _admin_option_settings() { |
|
467 | - $this->_template_args['admin_page_content'] = ''; |
|
468 | - try { |
|
469 | - $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance()); |
|
470 | - // still need this for the old school form in Extend_General_Settings_Admin_Page |
|
471 | - $this->_template_args['values'] = $this->_yes_no_values; |
|
472 | - // also need to account for the do_action that was in the old template |
|
473 | - $admin_options_settings_form->setTemplateArgs($this->_template_args); |
|
474 | - $this->_template_args['admin_page_content'] = $admin_options_settings_form->display(); |
|
475 | - } catch (Exception $e) { |
|
476 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
477 | - } |
|
478 | - $this->_set_add_edit_form_tags('update_admin_option_settings'); |
|
479 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
480 | - $this->display_admin_page_with_sidebar(); |
|
481 | - } |
|
482 | - |
|
483 | - |
|
484 | - |
|
485 | - /** |
|
486 | - * _update_admin_option_settings |
|
487 | - * |
|
488 | - * @throws \EE_Error |
|
489 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
490 | - * @throws \EventEspresso\core\exceptions\InvalidFormSubmissionException |
|
491 | - * @throws \InvalidArgumentException |
|
492 | - * @throws \LogicException |
|
493 | - */ |
|
494 | - protected function _update_admin_option_settings() { |
|
495 | - try { |
|
496 | - $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance()); |
|
497 | - $admin_options_settings_form->process($this->_req_data[$admin_options_settings_form->slug()]); |
|
498 | - EE_Registry::instance()->CFG->admin = apply_filters( |
|
499 | - 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', |
|
500 | - EE_Registry::instance()->CFG->admin |
|
501 | - ); |
|
502 | - } catch (Exception $e) { |
|
503 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
504 | - } |
|
456 | + /************* Admin Options *************/ |
|
457 | + |
|
458 | + |
|
459 | + |
|
460 | + /** |
|
461 | + * _admin_option_settings |
|
462 | + * |
|
463 | + * @throws \EE_Error |
|
464 | + * @throws \LogicException |
|
465 | + */ |
|
466 | + protected function _admin_option_settings() { |
|
467 | + $this->_template_args['admin_page_content'] = ''; |
|
468 | + try { |
|
469 | + $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance()); |
|
470 | + // still need this for the old school form in Extend_General_Settings_Admin_Page |
|
471 | + $this->_template_args['values'] = $this->_yes_no_values; |
|
472 | + // also need to account for the do_action that was in the old template |
|
473 | + $admin_options_settings_form->setTemplateArgs($this->_template_args); |
|
474 | + $this->_template_args['admin_page_content'] = $admin_options_settings_form->display(); |
|
475 | + } catch (Exception $e) { |
|
476 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
477 | + } |
|
478 | + $this->_set_add_edit_form_tags('update_admin_option_settings'); |
|
479 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
480 | + $this->display_admin_page_with_sidebar(); |
|
481 | + } |
|
482 | + |
|
483 | + |
|
484 | + |
|
485 | + /** |
|
486 | + * _update_admin_option_settings |
|
487 | + * |
|
488 | + * @throws \EE_Error |
|
489 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
490 | + * @throws \EventEspresso\core\exceptions\InvalidFormSubmissionException |
|
491 | + * @throws \InvalidArgumentException |
|
492 | + * @throws \LogicException |
|
493 | + */ |
|
494 | + protected function _update_admin_option_settings() { |
|
495 | + try { |
|
496 | + $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance()); |
|
497 | + $admin_options_settings_form->process($this->_req_data[$admin_options_settings_form->slug()]); |
|
498 | + EE_Registry::instance()->CFG->admin = apply_filters( |
|
499 | + 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', |
|
500 | + EE_Registry::instance()->CFG->admin |
|
501 | + ); |
|
502 | + } catch (Exception $e) { |
|
503 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
504 | + } |
|
505 | 505 | $this->_redirect_after_action( |
506 | - apply_filters( |
|
507 | - 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', |
|
508 | - $this->_update_espresso_configuration( |
|
509 | - 'Admin Options', |
|
510 | - EE_Registry::instance()->CFG->admin, |
|
511 | - __FILE__, __FUNCTION__, __LINE__ |
|
512 | - ) |
|
513 | - ), |
|
514 | - 'Admin Options', |
|
515 | - 'updated', |
|
516 | - array( 'action' => 'admin_option_settings' ) |
|
517 | - ); |
|
506 | + apply_filters( |
|
507 | + 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', |
|
508 | + $this->_update_espresso_configuration( |
|
509 | + 'Admin Options', |
|
510 | + EE_Registry::instance()->CFG->admin, |
|
511 | + __FILE__, __FUNCTION__, __LINE__ |
|
512 | + ) |
|
513 | + ), |
|
514 | + 'Admin Options', |
|
515 | + 'updated', |
|
516 | + array( 'action' => 'admin_option_settings' ) |
|
517 | + ); |
|
518 | 518 | |
519 | 519 | } |
520 | 520 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | use EventEspresso\admin_pages\general_settings\AdminOptionsSettings; |
3 | 3 | |
4 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
5 | 5 | exit('NO direct script access allowed'); |
6 | 6 | |
7 | 7 | /** |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | |
43 | 43 | |
44 | 44 | |
45 | - public function __construct( $routing = TRUE ) { |
|
46 | - parent::__construct( $routing ); |
|
45 | + public function __construct($routing = TRUE) { |
|
46 | + parent::__construct($routing); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | |
60 | 60 | |
61 | 61 | protected function _ajax_hooks() { |
62 | - add_action('wp_ajax_espresso_display_country_settings', array( $this, 'display_country_settings')); |
|
63 | - add_action('wp_ajax_espresso_display_country_states', array( $this, 'display_country_states')); |
|
64 | - add_action('wp_ajax_espresso_delete_state', array( $this, 'delete_state'), 10, 3 ); |
|
65 | - add_action('wp_ajax_espresso_add_new_state', array( $this, 'add_new_state')); |
|
62 | + add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings')); |
|
63 | + add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states')); |
|
64 | + add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3); |
|
65 | + add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state')); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -155,14 +155,14 @@ discard block |
||
155 | 155 | 'label' => __('Critical Pages', 'event_espresso'), |
156 | 156 | 'order' => 50 |
157 | 157 | ), |
158 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
158 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
159 | 159 | 'help_tabs' => array( |
160 | 160 | 'general_settings_critical_pages_help_tab' => array( |
161 | 161 | 'title' => __('Critical Pages', 'event_espresso'), |
162 | 162 | 'filename' => 'general_settings_critical_pages' |
163 | 163 | ) |
164 | 164 | ), |
165 | - 'help_tour' => array( 'Critical_Pages_Help_Tour' ), |
|
165 | + 'help_tour' => array('Critical_Pages_Help_Tour'), |
|
166 | 166 | 'require_nonce' => FALSE |
167 | 167 | ), |
168 | 168 | 'default' => array( |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | 'filename' => 'general_settings_your_organization' |
177 | 177 | ) |
178 | 178 | ), |
179 | - 'help_tour' => array( 'Your_Organization_Help_Tour' ), |
|
180 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
179 | + 'help_tour' => array('Your_Organization_Help_Tour'), |
|
180 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
181 | 181 | 'require_nonce' => FALSE |
182 | 182 | ), |
183 | 183 | 'admin_option_settings' => array( |
@@ -185,14 +185,14 @@ discard block |
||
185 | 185 | 'label' => __('Admin Options', 'event_espresso'), |
186 | 186 | 'order' => 60 |
187 | 187 | ), |
188 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
188 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
189 | 189 | 'help_tabs' => array( |
190 | 190 | 'general_settings_admin_options_help_tab' => array( |
191 | 191 | 'title' => __('Admin Options', 'event_espresso'), |
192 | 192 | 'filename' => 'general_settings_admin_options' |
193 | 193 | ) |
194 | 194 | ), |
195 | - 'help_tour' => array( 'Admin_Options_Help_Tour' ), |
|
195 | + 'help_tour' => array('Admin_Options_Help_Tour'), |
|
196 | 196 | 'require_nonce' => FALSE |
197 | 197 | ), |
198 | 198 | 'country_settings' => array( |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | 'filename' => 'general_settings_countries' |
207 | 207 | ) |
208 | 208 | ), |
209 | - 'help_tour' => array( 'Countries_Help_Tour' ), |
|
209 | + 'help_tour' => array('Countries_Help_Tour'), |
|
210 | 210 | 'require_nonce' => FALSE |
211 | 211 | ) |
212 | 212 | ); |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | } |
225 | 225 | |
226 | 226 | public function admin_init() { |
227 | - EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = __( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' ); |
|
228 | - EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' ); |
|
229 | - EE_Registry::$i18n_js_strings[ 'confirm_delete_state' ] = __( 'Are you sure you want to delete this State / Province?', 'event_espresso' ); |
|
230 | - $protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://'; |
|
231 | - EE_Registry::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php?page=espresso_general_settings', $protocol ); |
|
227 | + EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso'); |
|
228 | + EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso'); |
|
229 | + EE_Registry::$i18n_js_strings['confirm_delete_state'] = __('Are you sure you want to delete this State / Province?', 'event_espresso'); |
|
230 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
231 | + EE_Registry::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php?page=espresso_general_settings', $protocol); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | public function admin_notices() {} |
@@ -241,21 +241,21 @@ discard block |
||
241 | 241 | //scripts |
242 | 242 | wp_enqueue_script('media-upload'); |
243 | 243 | wp_enqueue_script('thickbox'); |
244 | - wp_register_script( 'organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js', array( 'jquery','media-upload','thickbox' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
245 | - wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION ); |
|
246 | - wp_enqueue_script( 'organization_settings' ); |
|
247 | - wp_enqueue_style( 'organization-css' ); |
|
248 | - $confirm_image_delete = array( 'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso')); |
|
249 | - wp_localize_script( 'organization_settings', 'confirm_image_delete', $confirm_image_delete ); |
|
244 | + wp_register_script('organization_settings', GEN_SET_ASSETS_URL.'your_organization_settings.js', array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, TRUE); |
|
245 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
246 | + wp_enqueue_script('organization_settings'); |
|
247 | + wp_enqueue_style('organization-css'); |
|
248 | + $confirm_image_delete = array('text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso')); |
|
249 | + wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete); |
|
250 | 250 | |
251 | 251 | } |
252 | 252 | |
253 | 253 | public function load_scripts_styles_country_settings() { |
254 | 254 | //scripts |
255 | - wp_register_script( 'gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js', array( 'ee_admin_js' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
256 | - wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION ); |
|
257 | - wp_enqueue_script( 'gen_settings_countries' ); |
|
258 | - wp_enqueue_style( 'organization-css' ); |
|
255 | + wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL.'gen_settings_countries.js', array('ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
256 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
257 | + wp_enqueue_script('gen_settings_countries'); |
|
258 | + wp_enqueue_style('organization-css'); |
|
259 | 259 | |
260 | 260 | } |
261 | 261 | |
@@ -272,31 +272,31 @@ discard block |
||
272 | 272 | $this->_transient_garbage_collection(); |
273 | 273 | $this->_template_args['values'] = $this->_yes_no_values; |
274 | 274 | |
275 | - $this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ?EE_Registry::instance()->CFG->core->reg_page_id : NULL; |
|
276 | - $this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id ) : FALSE; |
|
275 | + $this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? EE_Registry::instance()->CFG->core->reg_page_id : NULL; |
|
276 | + $this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id) : FALSE; |
|
277 | 277 | |
278 | - $this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ?EE_Registry::instance()->CFG->core->txn_page_id : NULL; |
|
279 | - $this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id ) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id ) : FALSE; |
|
278 | + $this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? EE_Registry::instance()->CFG->core->txn_page_id : NULL; |
|
279 | + $this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id) : FALSE; |
|
280 | 280 | |
281 | - $this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ?EE_Registry::instance()->CFG->core->thank_you_page_id : NULL; |
|
282 | - $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id ) : FALSE; |
|
281 | + $this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? EE_Registry::instance()->CFG->core->thank_you_page_id : NULL; |
|
282 | + $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id) : FALSE; |
|
283 | 283 | |
284 | - $this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ?EE_Registry::instance()->CFG->core->cancel_page_id : NULL; |
|
285 | - $this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id ) : FALSE; |
|
284 | + $this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? EE_Registry::instance()->CFG->core->cancel_page_id : NULL; |
|
285 | + $this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id) : FALSE; |
|
286 | 286 | |
287 | - $this->_set_add_edit_form_tags( 'update_espresso_page_settings' ); |
|
288 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
289 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', $this->_template_args, TRUE ); |
|
287 | + $this->_set_add_edit_form_tags('update_espresso_page_settings'); |
|
288 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
289 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php', $this->_template_args, TRUE); |
|
290 | 290 | $this->display_admin_page_with_sidebar(); |
291 | 291 | |
292 | 292 | } |
293 | 293 | |
294 | 294 | protected function _update_espresso_page_settings() { |
295 | 295 | // capture incoming request data |
296 | - $reg_page_id = isset( $this->_req_data['reg_page_id'] ) ? absint( $this->_req_data['reg_page_id'] ) : EE_Registry::instance()->CFG->core->reg_page_id; |
|
297 | - $txn_page_id = isset( $this->_req_data['txn_page_id'] ) ? absint( $this->_req_data['txn_page_id'] ) : EE_Registry::instance()->CFG->core->txn_page_id; |
|
298 | - $thank_you_page_id = isset( $this->_req_data['thank_you_page_id'] ) ? absint( $this->_req_data['thank_you_page_id'] ) : EE_Registry::instance()->CFG->core->thank_you_page_id; |
|
299 | - $cancel_page_id = isset( $this->_req_data['cancel_page_id'] ) ? absint( $this->_req_data['cancel_page_id'] ) : EE_Registry::instance()->CFG->core->cancel_page_id; |
|
296 | + $reg_page_id = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id; |
|
297 | + $txn_page_id = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id; |
|
298 | + $thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id; |
|
299 | + $cancel_page_id = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id; |
|
300 | 300 | // pack critical_pages into an array |
301 | 301 | $critical_pages = array( |
302 | 302 | 'reg_page_id' => $reg_page_id, |
@@ -304,17 +304,17 @@ discard block |
||
304 | 304 | 'thank_you_page_id' => $thank_you_page_id, |
305 | 305 | 'cancel_page_id' => $cancel_page_id |
306 | 306 | ); |
307 | - foreach ( $critical_pages as $critical_page_name => $critical_page_id ) { |
|
307 | + foreach ($critical_pages as $critical_page_name => $critical_page_id) { |
|
308 | 308 | // has the page changed ? |
309 | - if ( EE_Registry::instance()->CFG->core->{$critical_page_name} !== $critical_page_id ) { |
|
309 | + if (EE_Registry::instance()->CFG->core->{$critical_page_name} !== $critical_page_id) { |
|
310 | 310 | // grab post object for old page |
311 | - $post = get_post( EE_Registry::instance()->CFG->core->{$critical_page_name} ); |
|
311 | + $post = get_post(EE_Registry::instance()->CFG->core->{$critical_page_name} ); |
|
312 | 312 | // update post shortcodes for old page |
313 | - EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $critical_page_id, $post ); |
|
313 | + EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post); |
|
314 | 314 | // grab post object for new page |
315 | - $post = get_post( $critical_page_id ); |
|
315 | + $post = get_post($critical_page_id); |
|
316 | 316 | // update post shortcodes for new page |
317 | - EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $critical_page_id, $post ); |
|
317 | + EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post); |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | // set page IDs |
@@ -323,14 +323,14 @@ discard block |
||
323 | 323 | EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id; |
324 | 324 | EE_Registry::instance()->CFG->core->cancel_page_id = $cancel_page_id; |
325 | 325 | |
326 | - EE_Registry::instance()->CFG->core = apply_filters( 'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data ); |
|
326 | + EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data); |
|
327 | 327 | |
328 | 328 | $what = __('Critical Pages & Shortcodes', 'event_espresso'); |
329 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__ ); |
|
329 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__); |
|
330 | 330 | $query_args = array( |
331 | 331 | 'action' => 'critical_pages' |
332 | 332 | ); |
333 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
333 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
334 | 334 | |
335 | 335 | } |
336 | 336 | |
@@ -345,34 +345,34 @@ discard block |
||
345 | 345 | |
346 | 346 | protected function _your_organization_settings() { |
347 | 347 | |
348 | - $this->_template_args['site_license_key'] = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->get_pretty( 'site_license_key' ) : ''; |
|
349 | - $this->_template_args['organization_name'] = isset( EE_Registry::instance()->CFG->organization->name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : ''; |
|
350 | - $this->_template_args['organization_address_1'] = isset( EE_Registry::instance()->CFG->organization->address_1 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ) : ''; |
|
351 | - $this->_template_args['organization_address_2'] = isset( EE_Registry::instance()->CFG->organization->address_2 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ) : ''; |
|
352 | - $this->_template_args['organization_city'] = isset( EE_Registry::instance()->CFG->organization->city ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'city' ) : ''; |
|
353 | - $this->_template_args['organization_zip'] = isset( EE_Registry::instance()->CFG->organization->zip ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ) : ''; |
|
354 | - $this->_template_args['organization_email'] = isset( EE_Registry::instance()->CFG->organization->email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : ''; |
|
355 | - $this->_template_args['organization_phone'] = isset( EE_Registry::instance()->CFG->organization->phone ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ) : ''; |
|
356 | - $this->_template_args['organization_vat'] = isset( EE_Registry::instance()->CFG->organization->vat ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'vat' ) : ''; |
|
357 | - $this->_template_args['currency_sign'] = isset( EE_Registry::instance()->CFG->currency->sign ) ? EE_Registry::instance()->CFG->currency->get_pretty( 'sign' ) : '$'; |
|
358 | - $this->_template_args['organization_logo_url'] = isset( EE_Registry::instance()->CFG->organization->logo_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) : FALSE; |
|
359 | - $this->_template_args['organization_facebook'] = isset( EE_Registry::instance()->CFG->organization->facebook ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : ''; |
|
360 | - $this->_template_args['organization_twitter'] = isset( EE_Registry::instance()->CFG->organization->twitter ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : ''; |
|
361 | - $this->_template_args['organization_linkedin'] = isset( EE_Registry::instance()->CFG->organization->linkedin ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ) : ''; |
|
362 | - $this->_template_args['organization_pinterest'] = isset( EE_Registry::instance()->CFG->organization->pinterest ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ) : ''; |
|
363 | - $this->_template_args['organization_google'] = isset( EE_Registry::instance()->CFG->organization->google ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'google' ) : ''; |
|
364 | - $this->_template_args['organization_instagram'] = isset( EE_Registry::instance()->CFG->organization->instagram ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ) : ''; |
|
348 | + $this->_template_args['site_license_key'] = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : ''; |
|
349 | + $this->_template_args['organization_name'] = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : ''; |
|
350 | + $this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : ''; |
|
351 | + $this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : ''; |
|
352 | + $this->_template_args['organization_city'] = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : ''; |
|
353 | + $this->_template_args['organization_zip'] = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : ''; |
|
354 | + $this->_template_args['organization_email'] = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : ''; |
|
355 | + $this->_template_args['organization_phone'] = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : ''; |
|
356 | + $this->_template_args['organization_vat'] = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : ''; |
|
357 | + $this->_template_args['currency_sign'] = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$'; |
|
358 | + $this->_template_args['organization_logo_url'] = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : FALSE; |
|
359 | + $this->_template_args['organization_facebook'] = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : ''; |
|
360 | + $this->_template_args['organization_twitter'] = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : ''; |
|
361 | + $this->_template_args['organization_linkedin'] = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : ''; |
|
362 | + $this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : ''; |
|
363 | + $this->_template_args['organization_google'] = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : ''; |
|
364 | + $this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : ''; |
|
365 | 365 | //UXIP settings |
366 | - $this->_template_args['ee_ueip_optin'] = isset( EE_Registry::instance()->CFG->core->ee_ueip_optin ) ? EE_Registry::instance()->CFG->core->get_pretty( 'ee_ueip_optin' ) : TRUE; |
|
366 | + $this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : TRUE; |
|
367 | 367 | |
368 | - $STA_ID = isset( EE_Registry::instance()->CFG->organization->STA_ID ) ? EE_Registry::instance()->CFG->organization->STA_ID : 4; |
|
368 | + $STA_ID = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4; |
|
369 | 369 | $this->_template_args['states'] = new EE_Question_Form_Input( |
370 | - EE_Question::new_instance ( array( |
|
370 | + EE_Question::new_instance(array( |
|
371 | 371 | 'QST_ID'=> 0, |
372 | 372 | 'QST_display_text'=> __('State/Province', 'event_espresso'), |
373 | 373 | 'QST_system'=>'admin-state' |
374 | 374 | )), |
375 | - EE_Answer::new_instance ( array( |
|
375 | + EE_Answer::new_instance(array( |
|
376 | 376 | 'ANS_ID' => 0, |
377 | 377 | 'ANS_value' => $STA_ID |
378 | 378 | )), |
@@ -384,14 +384,14 @@ discard block |
||
384 | 384 | ) |
385 | 385 | ); |
386 | 386 | |
387 | - $CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
387 | + $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
388 | 388 | $this->_template_args['countries'] = new EE_Question_Form_Input( |
389 | - EE_Question::new_instance ( array( |
|
389 | + EE_Question::new_instance(array( |
|
390 | 390 | 'QST_ID'=> 0, |
391 | 391 | 'QST_display_text'=> __('Country', 'event_espresso'), |
392 | 392 | 'QST_system'=>'admin-country' |
393 | 393 | )), |
394 | - EE_Answer::new_instance ( array( |
|
394 | + EE_Answer::new_instance(array( |
|
395 | 395 | 'ANS_ID' => 0, |
396 | 396 | 'ANS_value' => $CNT_ISO |
397 | 397 | )), |
@@ -403,51 +403,51 @@ discard block |
||
403 | 403 | ) |
404 | 404 | ); |
405 | 405 | |
406 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 ); |
|
407 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 ); |
|
406 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
407 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
408 | 408 | |
409 | 409 | //PUE verification stuff |
410 | - $ver_option_key = 'puvererr_' . basename( EE_PLUGIN_BASENAME ); |
|
411 | - $verify_fail = get_option( $ver_option_key ); |
|
412 | - $this->_template_args['site_license_key_verified'] = $verify_fail || !empty( $verify_fail ) || ( empty( $this->_template_args['site_license_key'] ) && empty( $verify_fail ) )? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>'; |
|
410 | + $ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME); |
|
411 | + $verify_fail = get_option($ver_option_key); |
|
412 | + $this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>'; |
|
413 | 413 | |
414 | - $this->_set_add_edit_form_tags( 'update_your_organization_settings' ); |
|
415 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
416 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php', $this->_template_args, TRUE ); |
|
414 | + $this->_set_add_edit_form_tags('update_your_organization_settings'); |
|
415 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
416 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'your_organization_settings.template.php', $this->_template_args, TRUE); |
|
417 | 417 | |
418 | 418 | $this->display_admin_page_with_sidebar(); |
419 | 419 | } |
420 | 420 | |
421 | 421 | protected function _update_your_organization_settings() { |
422 | - if ( is_main_site() ) |
|
423 | - EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key; |
|
424 | - EE_Registry::instance()->CFG->organization->name = isset( $this->_req_data['organization_name'] ) ? sanitize_text_field( $this->_req_data['organization_name'] ) : EE_Registry::instance()->CFG->organization->name; |
|
425 | - EE_Registry::instance()->CFG->organization->address_1 = isset( $this->_req_data['organization_address_1'] ) ? sanitize_text_field( $this->_req_data['organization_address_1'] ) : EE_Registry::instance()->CFG->organization->address_1; |
|
426 | - EE_Registry::instance()->CFG->organization->address_2 = isset( $this->_req_data['organization_address_2'] ) ? sanitize_text_field( $this->_req_data['organization_address_2'] ) : EE_Registry::instance()->CFG->organization->address_2; |
|
427 | - EE_Registry::instance()->CFG->organization->city = isset( $this->_req_data['organization_city'] ) ? sanitize_text_field( $this->_req_data['organization_city'] ) : EE_Registry::instance()->CFG->organization->city; |
|
428 | - EE_Registry::instance()->CFG->organization->STA_ID = isset( $this->_req_data['organization_state'] ) ? absint( $this->_req_data['organization_state'] ) : EE_Registry::instance()->CFG->organization->STA_ID; |
|
429 | - EE_Registry::instance()->CFG->organization->CNT_ISO = isset( $this->_req_data['organization_country'] ) ? sanitize_text_field( $this->_req_data['organization_country'] ) : EE_Registry::instance()->CFG->organization->CNT_ISO; |
|
430 | - EE_Registry::instance()->CFG->organization->zip = isset( $this->_req_data['organization_zip'] ) ? sanitize_text_field( $this->_req_data['organization_zip'] ) : EE_Registry::instance()->CFG->organization->zip; |
|
431 | - EE_Registry::instance()->CFG->organization->email = isset( $this->_req_data['organization_email'] ) ? sanitize_email( $this->_req_data['organization_email'] ) : EE_Registry::instance()->CFG->organization->email; |
|
432 | - EE_Registry::instance()->CFG->organization->vat = isset( $this->_req_data['organization_vat'] ) ? sanitize_text_field( $this->_req_data['organization_vat'] ) : EE_Registry::instance()->CFG->organization->vat; |
|
433 | - EE_Registry::instance()->CFG->organization->phone = isset( $this->_req_data['organization_phone'] ) ? sanitize_text_field( $this->_req_data['organization_phone'] ) : EE_Registry::instance()->CFG->organization->phone; |
|
434 | - EE_Registry::instance()->CFG->organization->logo_url = isset( $this->_req_data['organization_logo_url'] ) ? esc_url_raw( $this->_req_data['organization_logo_url'] ) : EE_Registry::instance()->CFG->organization->logo_url; |
|
435 | - EE_Registry::instance()->CFG->organization->facebook = isset( $this->_req_data['organization_facebook'] ) ? esc_url_raw( $this->_req_data['organization_facebook'] ) : EE_Registry::instance()->CFG->organization->facebook; |
|
436 | - EE_Registry::instance()->CFG->organization->twitter = isset( $this->_req_data['organization_twitter'] ) ? esc_url_raw( $this->_req_data['organization_twitter'] ) : EE_Registry::instance()->CFG->organization->twitter; |
|
437 | - EE_Registry::instance()->CFG->organization->linkedin = isset( $this->_req_data['organization_linkedin'] ) ? esc_url_raw( $this->_req_data['organization_linkedin'] ) : EE_Registry::instance()->CFG->organization->linkedin; |
|
438 | - EE_Registry::instance()->CFG->organization->pinterest = isset( $this->_req_data['organization_pinterest'] ) ? esc_url_raw( $this->_req_data['organization_pinterest'] ) : EE_Registry::instance()->CFG->organization->pinterest; |
|
439 | - EE_Registry::instance()->CFG->organization->google = isset( $this->_req_data['organization_google'] ) ? esc_url_raw( $this->_req_data['organization_google'] ) : EE_Registry::instance()->CFG->organization->google; |
|
440 | - EE_Registry::instance()->CFG->organization->instagram = isset( $this->_req_data['organization_instagram'] ) ? esc_url_raw( $this->_req_data['organization_instagram'] ) : EE_Registry::instance()->CFG->organization->instagram; |
|
441 | - EE_Registry::instance()->CFG->core->ee_ueip_optin = isset( $this->_req_data['ueip_optin'] ) && !empty( $this->_req_data['ueip_optin'] ) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin; |
|
442 | - |
|
443 | - EE_Registry::instance()->CFG->currency = new EE_Currency_Config( EE_Registry::instance()->CFG->organization->CNT_ISO ); |
|
444 | - |
|
445 | - EE_Registry::instance()->CFG = apply_filters( 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG ); |
|
422 | + if (is_main_site()) |
|
423 | + EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key; |
|
424 | + EE_Registry::instance()->CFG->organization->name = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name; |
|
425 | + EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1; |
|
426 | + EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2; |
|
427 | + EE_Registry::instance()->CFG->organization->city = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city; |
|
428 | + EE_Registry::instance()->CFG->organization->STA_ID = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID; |
|
429 | + EE_Registry::instance()->CFG->organization->CNT_ISO = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO; |
|
430 | + EE_Registry::instance()->CFG->organization->zip = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip; |
|
431 | + EE_Registry::instance()->CFG->organization->email = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email; |
|
432 | + EE_Registry::instance()->CFG->organization->vat = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat; |
|
433 | + EE_Registry::instance()->CFG->organization->phone = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone; |
|
434 | + EE_Registry::instance()->CFG->organization->logo_url = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url; |
|
435 | + EE_Registry::instance()->CFG->organization->facebook = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook; |
|
436 | + EE_Registry::instance()->CFG->organization->twitter = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter; |
|
437 | + EE_Registry::instance()->CFG->organization->linkedin = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin; |
|
438 | + EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest; |
|
439 | + EE_Registry::instance()->CFG->organization->google = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google; |
|
440 | + EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram; |
|
441 | + EE_Registry::instance()->CFG->core->ee_ueip_optin = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin; |
|
442 | + |
|
443 | + EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO); |
|
444 | + |
|
445 | + EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG); |
|
446 | 446 | |
447 | 447 | $what = 'Your Organization Settings'; |
448 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ ); |
|
448 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__); |
|
449 | 449 | |
450 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default' ) ); |
|
450 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'default')); |
|
451 | 451 | |
452 | 452 | } |
453 | 453 | |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | ), |
514 | 514 | 'Admin Options', |
515 | 515 | 'updated', |
516 | - array( 'action' => 'admin_option_settings' ) |
|
516 | + array('action' => 'admin_option_settings') |
|
517 | 517 | ); |
518 | 518 | |
519 | 519 | } |
@@ -527,20 +527,20 @@ discard block |
||
527 | 527 | |
528 | 528 | protected function _country_settings() { |
529 | 529 | |
530 | - $CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
531 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO; |
|
530 | + $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
531 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO; |
|
532 | 532 | |
533 | 533 | //load field generator helper |
534 | 534 | |
535 | 535 | $this->_template_args['values'] = $this->_yes_no_values; |
536 | 536 | |
537 | 537 | $this->_template_args['countries'] = new EE_Question_Form_Input( |
538 | - EE_Question::new_instance ( array( |
|
538 | + EE_Question::new_instance(array( |
|
539 | 539 | 'QST_ID'=> 0, |
540 | 540 | 'QST_display_text'=> __('Select Country', 'event_espresso'), |
541 | 541 | 'QST_system'=>'admin-country' |
542 | 542 | )), |
543 | - EE_Answer::new_instance ( array( |
|
543 | + EE_Answer::new_instance(array( |
|
544 | 544 | 'ANS_ID' => 0, |
545 | 545 | 'ANS_value' => $CNT_ISO |
546 | 546 | )), |
@@ -553,14 +553,14 @@ discard block |
||
553 | 553 | ); |
554 | 554 | // EEH_Debug_Tools::printr( $this->_template_args['countries'], 'countries <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
555 | 555 | |
556 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 ); |
|
557 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 ); |
|
556 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
557 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
558 | 558 | $this->_template_args['country_details_settings'] = $this->display_country_settings(); |
559 | 559 | $this->_template_args['country_states_settings'] = $this->display_country_states(); |
560 | 560 | |
561 | - $this->_set_add_edit_form_tags( 'update_country_settings' ); |
|
562 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
563 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', $this->_template_args, TRUE ); |
|
561 | + $this->_set_add_edit_form_tags('update_country_settings'); |
|
562 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
563 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'countries_settings.template.php', $this->_template_args, TRUE); |
|
564 | 564 | $this->display_admin_page_with_no_sidebar(); |
565 | 565 | } |
566 | 566 | |
@@ -573,43 +573,43 @@ discard block |
||
573 | 573 | * @param string $CNT_ISO |
574 | 574 | * @return mixed string | array |
575 | 575 | */ |
576 | - public function display_country_settings( $CNT_ISO = '' ) { |
|
576 | + public function display_country_settings($CNT_ISO = '') { |
|
577 | 577 | |
578 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO; |
|
579 | - if ( ! $CNT_ISO ) { |
|
578 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO; |
|
579 | + if ( ! $CNT_ISO) { |
|
580 | 580 | return ''; |
581 | 581 | } |
582 | 582 | |
583 | 583 | // for ajax |
584 | - remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' ); |
|
585 | - remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' ); |
|
586 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 ); |
|
587 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 ); |
|
588 | - $country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO ); |
|
584 | + remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
585 | + remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
586 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
587 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
588 | + $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
589 | 589 | //EEH_Debug_Tools::printr( $country, '$country <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
590 | 590 | $country_input_types = array( |
591 | - 'CNT_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ), |
|
592 | - 'CNT_ISO' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
593 | - 'CNT_ISO3' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
594 | - 'RGN_ID' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
595 | - 'CNT_name' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'regular-text' ), |
|
596 | - 'CNT_cur_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
597 | - 'CNT_cur_single' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ), |
|
598 | - 'CNT_cur_plural' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ), |
|
599 | - 'CNT_cur_sign' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text', 'htmlentities' => FALSE ), |
|
600 | - 'CNT_cur_sign_b4' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ), |
|
601 | - 'CNT_cur_dec_plc' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => 0, 'text' => '' ), array( 'id' => 1, 'text' => '' ), array( 'id' => 2, 'text' => '' ), array( 'id' => 3, 'text' => '' ))), |
|
602 | - 'CNT_cur_dec_mrk' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ), |
|
603 | - 'CNT_cur_thsnds' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ), |
|
604 | - 'CNT_tel_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
605 | - 'CNT_is_EU' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ) |
|
591 | + 'CNT_active' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE), |
|
592 | + 'CNT_ISO' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
593 | + 'CNT_ISO3' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
594 | + 'RGN_ID' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
595 | + 'CNT_name' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'regular-text'), |
|
596 | + 'CNT_cur_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
597 | + 'CNT_cur_single' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'), |
|
598 | + 'CNT_cur_plural' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'), |
|
599 | + 'CNT_cur_sign' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text', 'htmlentities' => FALSE), |
|
600 | + 'CNT_cur_sign_b4' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE), |
|
601 | + 'CNT_cur_dec_plc' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => 0, 'text' => ''), array('id' => 1, 'text' => ''), array('id' => 2, 'text' => ''), array('id' => 3, 'text' => ''))), |
|
602 | + 'CNT_cur_dec_mrk' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE), |
|
603 | + 'CNT_cur_thsnds' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE), |
|
604 | + 'CNT_tel_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
605 | + 'CNT_is_EU' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE) |
|
606 | 606 | ); |
607 | - $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $country, $country_input_types ); |
|
608 | - $country_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', $this->_template_args, TRUE ); |
|
607 | + $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country, $country_input_types); |
|
608 | + $country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php', $this->_template_args, TRUE); |
|
609 | 609 | |
610 | - if ( defined( 'DOING_AJAX' )) { |
|
611 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE ); |
|
612 | - echo json_encode( array( 'return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] )); |
|
610 | + if (defined('DOING_AJAX')) { |
|
611 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE); |
|
612 | + echo json_encode(array('return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'])); |
|
613 | 613 | die(); |
614 | 614 | } else { |
615 | 615 | return $country_details_settings; |
@@ -627,49 +627,49 @@ discard block |
||
627 | 627 | * @param string $CNT_ISO |
628 | 628 | * @return string |
629 | 629 | */ |
630 | - public function display_country_states( $CNT_ISO = '' ) { |
|
630 | + public function display_country_states($CNT_ISO = '') { |
|
631 | 631 | |
632 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? sanitize_text_field( $this->_req_data['country'] ) : $CNT_ISO; |
|
632 | + $CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO; |
|
633 | 633 | |
634 | - if ( ! $CNT_ISO ) { |
|
634 | + if ( ! $CNT_ISO) { |
|
635 | 635 | return ''; |
636 | 636 | } |
637 | 637 | // for ajax |
638 | - remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' ); |
|
639 | - remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' ); |
|
640 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'state_form_field_label_wrap' ), 10, 2 ); |
|
641 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'state_form_field_input__wrap' ), 10, 2 ); |
|
642 | - $states = EEM_State::instance()->get_all_states_for_these_countries( array( $CNT_ISO => $CNT_ISO )); |
|
638 | + remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
639 | + remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
640 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2); |
|
641 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2); |
|
642 | + $states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO)); |
|
643 | 643 | |
644 | 644 | // echo '<h4>$CNT_ISO : ' . $CNT_ISO . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
645 | 645 | // global $wpdb; |
646 | 646 | // echo '<h4>' . $wpdb->last_query . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
647 | 647 | // EEH_Debug_Tools::printr( $states, '$states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
648 | - if ( $states ) { |
|
649 | - foreach ( $states as $STA_ID => $state ) { |
|
650 | - if ( $state instanceof EE_State ) { |
|
648 | + if ($states) { |
|
649 | + foreach ($states as $STA_ID => $state) { |
|
650 | + if ($state instanceof EE_State) { |
|
651 | 651 | //STA_abbrev STA_name STA_active |
652 | 652 | $state_input_types = array( |
653 | - 'STA_abbrev' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'mid-text' ), |
|
654 | - 'STA_name' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'regular-text' ), |
|
655 | - 'STA_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'states[' . $STA_ID . ']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true ) |
|
653 | + 'STA_abbrev' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'mid-text'), |
|
654 | + 'STA_name' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'regular-text'), |
|
655 | + 'STA_active' => array('type' => 'RADIO_BTN', 'input_name' => 'states['.$STA_ID.']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true) |
|
656 | 656 | ); |
657 | - $this->_template_args[ 'states' ][ $STA_ID ][ 'inputs' ] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $state, $state_input_types ); |
|
658 | - $query_args = array( 'action' => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev() ); |
|
659 | - $this->_template_args[ 'states' ][ $STA_ID ][ 'delete_state_url' ] = EE_Admin_Page::add_query_args_and_nonce( $query_args, GEN_SET_ADMIN_URL ); |
|
657 | + $this->_template_args['states'][$STA_ID]['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($state, $state_input_types); |
|
658 | + $query_args = array('action' => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev()); |
|
659 | + $this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, GEN_SET_ADMIN_URL); |
|
660 | 660 | } |
661 | 661 | } |
662 | 662 | } else { |
663 | 663 | $this->_template_args['states'] = FALSE; |
664 | 664 | } |
665 | 665 | // EEH_Debug_Tools::printr( $this->_template_args['states'], 'states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
666 | - $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'add_new_state' ), GEN_SET_ADMIN_URL ); |
|
666 | + $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'), GEN_SET_ADMIN_URL); |
|
667 | 667 | |
668 | - $state_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', $this->_template_args, TRUE ); |
|
668 | + $state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php', $this->_template_args, TRUE); |
|
669 | 669 | |
670 | - if ( defined( 'DOING_AJAX' )) { |
|
671 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE ); |
|
672 | - echo json_encode( array( 'return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] )); |
|
670 | + if (defined('DOING_AJAX')) { |
|
671 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE); |
|
672 | + echo json_encode(array('return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'])); |
|
673 | 673 | die(); |
674 | 674 | } else { |
675 | 675 | return $state_details_settings; |
@@ -690,40 +690,39 @@ discard block |
||
690 | 690 | |
691 | 691 | $success = TRUE; |
692 | 692 | |
693 | - $CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE; |
|
694 | - if ( ! $CNT_ISO ) { |
|
695 | - EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
693 | + $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE; |
|
694 | + if ( ! $CNT_ISO) { |
|
695 | + EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
696 | 696 | $success = FALSE; |
697 | 697 | } |
698 | - $STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE; |
|
699 | - if ( ! $STA_abbrev ) { |
|
700 | - EE_Error::add_error( __( 'No State ISO code or an invalid State ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
698 | + $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE; |
|
699 | + if ( ! $STA_abbrev) { |
|
700 | + EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
701 | 701 | $success = FALSE; |
702 | 702 | } |
703 | - $STA_name = isset( $this->_req_data['STA_name'] ) ? sanitize_text_field( $this->_req_data['STA_name'] ) : |
|
704 | - FALSE; |
|
705 | - if ( ! $STA_name ) { |
|
706 | - EE_Error::add_error( __( 'No State name or an invalid State name was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
703 | + $STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) : FALSE; |
|
704 | + if ( ! $STA_name) { |
|
705 | + EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
707 | 706 | $success = FALSE; |
708 | 707 | } |
709 | 708 | |
710 | - if ( $success ) { |
|
709 | + if ($success) { |
|
711 | 710 | $cols_n_values = array( |
712 | 711 | 'CNT_ISO' => $CNT_ISO, |
713 | 712 | 'STA_abbrev' => $STA_abbrev, |
714 | 713 | 'STA_name' => $STA_name, |
715 | 714 | 'STA_active' => TRUE |
716 | 715 | ); |
717 | - $success = EEM_State::instance()->insert ( $cols_n_values ); |
|
718 | - EE_Error::add_success( __( 'The State was added successfully.', 'event_espresso' ) ); |
|
716 | + $success = EEM_State::instance()->insert($cols_n_values); |
|
717 | + EE_Error::add_success(__('The State was added successfully.', 'event_espresso')); |
|
719 | 718 | } |
720 | 719 | |
721 | - if ( defined( 'DOING_AJAX' )) { |
|
722 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE ); |
|
723 | - echo json_encode( array_merge( $notices, array( 'return_data' => $CNT_ISO ) ) ); |
|
720 | + if (defined('DOING_AJAX')) { |
|
721 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE); |
|
722 | + echo json_encode(array_merge($notices, array('return_data' => $CNT_ISO))); |
|
724 | 723 | die(); |
725 | 724 | } else { |
726 | - $this->_redirect_after_action( $success, 'State', 'added', array( 'action' => 'country_settings' ) ); |
|
725 | + $this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings')); |
|
727 | 726 | } |
728 | 727 | } |
729 | 728 | |
@@ -736,25 +735,25 @@ discard block |
||
736 | 735 | * @return boolean | void |
737 | 736 | */ |
738 | 737 | public function delete_state() { |
739 | - $CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE; |
|
740 | - $STA_ID = isset( $this->_req_data['STA_ID'] ) ? sanitize_text_field( $this->_req_data['STA_ID'] ) : FALSE; |
|
741 | - $STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE; |
|
742 | - if ( ! $STA_ID ) { |
|
743 | - EE_Error::add_error( __( 'No State ID or an invalid State ID was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
738 | + $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE; |
|
739 | + $STA_ID = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : FALSE; |
|
740 | + $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE; |
|
741 | + if ( ! $STA_ID) { |
|
742 | + EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
744 | 743 | return FALSE; |
745 | 744 | } |
746 | - $success = EEM_State::instance()->delete_by_ID( $STA_ID ); |
|
747 | - if ( $success !== FALSE ) { |
|
748 | - do_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array( 'STA_abbrev' => $STA_abbrev )); |
|
749 | - EE_Error::add_success( __( 'The State was deleted successfully.', 'event_espresso' )); |
|
745 | + $success = EEM_State::instance()->delete_by_ID($STA_ID); |
|
746 | + if ($success !== FALSE) { |
|
747 | + do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array('STA_abbrev' => $STA_abbrev)); |
|
748 | + EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso')); |
|
750 | 749 | } |
751 | - if ( defined( 'DOING_AJAX' )) { |
|
752 | - $notices = EE_Error::get_notices( FALSE, FALSE ); |
|
750 | + if (defined('DOING_AJAX')) { |
|
751 | + $notices = EE_Error::get_notices(FALSE, FALSE); |
|
753 | 752 | $notices['return_data'] = TRUE; |
754 | - echo json_encode( $notices ); |
|
753 | + echo json_encode($notices); |
|
755 | 754 | die(); |
756 | 755 | } else { |
757 | - $this->_redirect_after_action( $success, 'State', 'deleted', array( 'action' => 'country_settings' ) ); |
|
756 | + $this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings')); |
|
758 | 757 | } |
759 | 758 | } |
760 | 759 | |
@@ -770,63 +769,63 @@ discard block |
||
770 | 769 | protected function _update_country_settings() { |
771 | 770 | // EEH_Debug_Tools::printr( $this->_req_data, '$this->_req_data <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
772 | 771 | // grab the country ISO code |
773 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : FALSE; |
|
774 | - if ( ! $CNT_ISO ) { |
|
775 | - EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
772 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : FALSE; |
|
773 | + if ( ! $CNT_ISO) { |
|
774 | + EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
776 | 775 | return; |
777 | 776 | } |
778 | 777 | $cols_n_values = array(); |
779 | - $cols_n_values['CNT_ISO3'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] )) : FALSE; |
|
780 | - $cols_n_values['RGN_ID'] = isset( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) : NULL; |
|
781 | - $cols_n_values['CNT_name'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) : NULL; |
|
782 | - $cols_n_values['CNT_cur_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] )) : 'USD'; |
|
783 | - $cols_n_values['CNT_cur_single'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) : 'dollar'; |
|
784 | - $cols_n_values['CNT_cur_plural'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) : 'dollars'; |
|
785 | - $cols_n_values['CNT_cur_sign'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) : '$'; |
|
786 | - $cols_n_values['CNT_cur_sign_b4'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) : TRUE; |
|
787 | - $cols_n_values['CNT_cur_dec_plc'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) : 2; |
|
788 | - $cols_n_values['CNT_cur_dec_mrk'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) : '.'; |
|
789 | - $cols_n_values['CNT_cur_thsnds'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) : ','; |
|
790 | - $cols_n_values['CNT_tel_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) : NULL; |
|
791 | - $cols_n_values['CNT_is_EU'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) : FALSE; |
|
792 | - $cols_n_values['CNT_active'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) : FALSE; |
|
778 | + $cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : FALSE; |
|
779 | + $cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : NULL; |
|
780 | + $cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : NULL; |
|
781 | + $cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD'; |
|
782 | + $cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar'; |
|
783 | + $cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars'; |
|
784 | + $cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$'; |
|
785 | + $cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : TRUE; |
|
786 | + $cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2; |
|
787 | + $cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.'; |
|
788 | + $cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ','; |
|
789 | + $cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : NULL; |
|
790 | + $cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : FALSE; |
|
791 | + $cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : FALSE; |
|
793 | 792 | // allow filtering of country data |
794 | - $cols_n_values = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values ); |
|
793 | + $cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values); |
|
795 | 794 | //EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
796 | 795 | // where values |
797 | - $where_cols_n_values = array( array( 'CNT_ISO' => $CNT_ISO )); |
|
796 | + $where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO)); |
|
798 | 797 | // run the update |
799 | - $success = EEM_Country::instance()->update( $cols_n_values, $where_cols_n_values ); |
|
798 | + $success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values); |
|
800 | 799 | // global $wpdb; |
801 | 800 | // echo '<h4>' . $wpdb->last_query . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
802 | 801 | // echo '<h4>$success : ' . $success . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
803 | - if ( isset( $this->_req_data['states'] ) && is_array( $this->_req_data['states'] ) && $success !== FALSE ) { |
|
802 | + if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== FALSE) { |
|
804 | 803 | // allow filtering of states data |
805 | - $states = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states'] ); |
|
804 | + $states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states']); |
|
806 | 805 | // EEH_Debug_Tools::printr( $states, '$states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
807 | 806 | // loop thru state data ( looks like : states[75][STA_name] ) |
808 | - foreach( $states as $STA_ID => $state ) { |
|
807 | + foreach ($states as $STA_ID => $state) { |
|
809 | 808 | $cols_n_values = array( |
810 | 809 | 'CNT_ISO' => $CNT_ISO, |
811 | - 'STA_abbrev' => sanitize_text_field( $state['STA_abbrev'] ), |
|
812 | - 'STA_name' => sanitize_text_field( $state['STA_name'] ), |
|
813 | - 'STA_active' => (bool)absint( $state['STA_active'] ) |
|
810 | + 'STA_abbrev' => sanitize_text_field($state['STA_abbrev']), |
|
811 | + 'STA_name' => sanitize_text_field($state['STA_name']), |
|
812 | + 'STA_active' => (bool) absint($state['STA_active']) |
|
814 | 813 | ); |
815 | 814 | // where values |
816 | - $where_cols_n_values = array( array( 'STA_ID' => $STA_ID )); |
|
815 | + $where_cols_n_values = array(array('STA_ID' => $STA_ID)); |
|
817 | 816 | // run the update |
818 | - $success = EEM_State::instance()->update( $cols_n_values, $where_cols_n_values ); |
|
819 | - if ( $success !== FALSE ) { |
|
820 | - do_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values ); |
|
817 | + $success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values); |
|
818 | + if ($success !== FALSE) { |
|
819 | + do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values); |
|
821 | 820 | } |
822 | 821 | } |
823 | 822 | } |
824 | 823 | // check if country being edited matches org option country, and if so, then update EE_Config with new settings |
825 | - if ( isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO ) { |
|
826 | - EE_Registry::instance()->CFG->currency = new EE_Currency_Config( $CNT_ISO ); |
|
824 | + if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) { |
|
825 | + EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO); |
|
827 | 826 | EE_Registry::instance()->CFG->update_espresso_config(); |
828 | 827 | } |
829 | - $this->_redirect_after_action( $success, 'Countries', 'updated', array( 'action' => 'country_settings', 'country' => $CNT_ISO )); |
|
828 | + $this->_redirect_after_action($success, 'Countries', 'updated', array('action' => 'country_settings', 'country' => $CNT_ISO)); |
|
830 | 829 | } |
831 | 830 | |
832 | 831 | |
@@ -840,11 +839,11 @@ discard block |
||
840 | 839 | * @param string $label |
841 | 840 | * @return string |
842 | 841 | */ |
843 | - public function country_form_field_label_wrap( $label, $required_text ) { |
|
842 | + public function country_form_field_label_wrap($label, $required_text) { |
|
844 | 843 | return ' |
845 | 844 | <tr> |
846 | 845 | <th> |
847 | - ' . $label . ' |
|
846 | + ' . $label.' |
|
848 | 847 | </th>'; |
849 | 848 | } |
850 | 849 | |
@@ -858,10 +857,10 @@ discard block |
||
858 | 857 | * @param string $label |
859 | 858 | * @return string |
860 | 859 | */ |
861 | - public function country_form_field_input__wrap( $input, $label ) { |
|
860 | + public function country_form_field_input__wrap($input, $label) { |
|
862 | 861 | return ' |
863 | 862 | <td class="general-settings-country-input-td"> |
864 | - ' . $input . ' |
|
863 | + ' . $input.' |
|
865 | 864 | </td> |
866 | 865 | </tr>'; |
867 | 866 | } |
@@ -877,7 +876,7 @@ discard block |
||
877 | 876 | * @param string $required_text |
878 | 877 | * @return string |
879 | 878 | */ |
880 | - public function state_form_field_label_wrap( $label, $required_text ) { |
|
879 | + public function state_form_field_label_wrap($label, $required_text) { |
|
881 | 880 | return $required_text; |
882 | 881 | } |
883 | 882 | |
@@ -891,10 +890,10 @@ discard block |
||
891 | 890 | * @param string $label |
892 | 891 | * @return string |
893 | 892 | */ |
894 | - public function state_form_field_input__wrap( $input, $label ) { |
|
893 | + public function state_form_field_input__wrap($input, $label) { |
|
895 | 894 | return ' |
896 | 895 | <td class="general-settings-country-state-input-td"> |
897 | - ' . $input . ' |
|
896 | + ' . $input.' |
|
898 | 897 | </td>'; |
899 | 898 | |
900 | 899 | } |
@@ -917,10 +916,10 @@ discard block |
||
917 | 916 | * @param int $ee_page_id |
918 | 917 | * @return string |
919 | 918 | */ |
920 | - public static function edit_view_links( $ee_page_id ) { |
|
921 | - $links = '<a href="' . add_query_arg( array( 'post' => $ee_page_id, 'action' => 'edit' ), admin_url( 'post.php' )) . '" >' . __('Edit', 'event_espresso') . '</a>'; |
|
919 | + public static function edit_view_links($ee_page_id) { |
|
920 | + $links = '<a href="'.add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), admin_url('post.php')).'" >'.__('Edit', 'event_espresso').'</a>'; |
|
922 | 921 | $links .= ' | '; |
923 | - $links .= '<a href="' . get_permalink( $ee_page_id ) . '" >' . __('View', 'event_espresso') . '</a>'; |
|
922 | + $links .= '<a href="'.get_permalink($ee_page_id).'" >'.__('View', 'event_espresso').'</a>'; |
|
924 | 923 | return $links; |
925 | 924 | } |
926 | 925 | |
@@ -933,27 +932,27 @@ discard block |
||
933 | 932 | * @param WP page object $ee_page |
934 | 933 | * @return string |
935 | 934 | */ |
936 | - public static function page_and_shortcode_status( $ee_page, $shortcode ) { |
|
935 | + public static function page_and_shortcode_status($ee_page, $shortcode) { |
|
937 | 936 | |
938 | 937 | // page status |
939 | - if ( isset( $ee_page->post_status ) && $ee_page->post_status == 'publish') { |
|
938 | + if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') { |
|
940 | 939 | $pg_colour = 'green'; |
941 | - $pg_status = sprintf( __('Page%sStatus%sOK', 'event_espresso'), ' ' , ' ' ); |
|
940 | + $pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), ' ', ' '); |
|
942 | 941 | } else { |
943 | 942 | $pg_colour = 'red'; |
944 | - $pg_status = sprintf( __('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' ' ); |
|
943 | + $pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' '); |
|
945 | 944 | } |
946 | 945 | |
947 | 946 | // shortcode status |
948 | - if ( isset( $ee_page->post_content ) && strpos( $ee_page->post_content, $shortcode ) !== FALSE ) { |
|
947 | + if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== FALSE) { |
|
949 | 948 | $sc_colour = 'green'; |
950 | - $sc_status = sprintf( __('Shortcode%sOK', 'event_espresso'), ' ' ); |
|
949 | + $sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), ' '); |
|
951 | 950 | } else { |
952 | 951 | $sc_colour = 'red'; |
953 | - $sc_status = sprintf( __('Shortcode%sProblem', 'event_espresso'), ' ' ); |
|
952 | + $sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), ' '); |
|
954 | 953 | } |
955 | 954 | |
956 | - return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>'; |
|
955 | + return '<span style="color:'.$pg_colour.'; margin-right:2em;"><strong>'.$pg_status.'</strong></span><span style="color:'.$sc_colour.'"><strong>'.$sc_status.'</strong></span>'; |
|
957 | 956 | |
958 | 957 | } |
959 | 958 | |
@@ -968,20 +967,20 @@ discard block |
||
968 | 967 | * @param unknown_type $level |
969 | 968 | * @return unknown |
970 | 969 | */ |
971 | - public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) { |
|
970 | + public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0) { |
|
972 | 971 | global $wpdb; |
973 | - $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent) ); |
|
972 | + $items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent)); |
|
974 | 973 | |
975 | - if ( $items ) { |
|
976 | - foreach ( $items as $item ) { |
|
977 | - $pad = str_repeat( ' ', $level * 3 ); |
|
978 | - if ( $item->ID == $default) |
|
974 | + if ($items) { |
|
975 | + foreach ($items as $item) { |
|
976 | + $pad = str_repeat(' ', $level * 3); |
|
977 | + if ($item->ID == $default) |
|
979 | 978 | $current = ' selected="selected"'; |
980 | 979 | else |
981 | 980 | $current = ''; |
982 | 981 | |
983 | - echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>"; |
|
984 | - parent_dropdown( $default, $item->ID, $level +1 ); |
|
982 | + echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad ".esc_html($item->post_title)."</option>"; |
|
983 | + parent_dropdown($default, $item->ID, $level + 1); |
|
985 | 984 | } |
986 | 985 | } else { |
987 | 986 | return false; |
@@ -414,9 +414,9 @@ discard block |
||
414 | 414 | } |
415 | 415 | } |
416 | 416 | // decode the data ? |
417 | - if (EE_Registry::instance()->CFG->admin->encode_session_data()) { |
|
418 | - $session_data = $this->valid_base_64($session_data) ? base64_decode($session_data) : $session_data; |
|
419 | - } |
|
417 | + if (EE_Registry::instance()->CFG->admin->encode_session_data()) { |
|
418 | + $session_data = $this->valid_base_64($session_data) ? base64_decode($session_data) : $session_data; |
|
419 | + } |
|
420 | 420 | // un-encrypt the data ? |
421 | 421 | $session_data = $this->_use_encryption ? $this->encryption->decrypt( $session_data ) : $session_data; |
422 | 422 | if ( ! is_array( $session_data ) ) { |
@@ -686,12 +686,12 @@ discard block |
||
686 | 686 | ) { |
687 | 687 | return false; |
688 | 688 | } |
689 | - // then serialize all of our session data |
|
690 | - $session_data = serialize($this->_session_data); |
|
691 | - // do we need to also encode it to avoid corrupted data when saved to the db? |
|
692 | - if (EE_Registry::instance()->CFG->admin->encode_session_data()) { |
|
693 | - $session_data = base64_encode($this->_session_data); |
|
694 | - } |
|
689 | + // then serialize all of our session data |
|
690 | + $session_data = serialize($this->_session_data); |
|
691 | + // do we need to also encode it to avoid corrupted data when saved to the db? |
|
692 | + if (EE_Registry::instance()->CFG->admin->encode_session_data()) { |
|
693 | + $session_data = base64_encode($this->_session_data); |
|
694 | + } |
|
695 | 695 | // encrypt it if we are using encryption |
696 | 696 | $session_data = $this->_use_encryption ? $this->encryption->encrypt( $session_data ) : $session_data; |
697 | 697 | // maybe save hash check |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\exceptions\InvalidSessionDataException; |
2 | 2 | |
3 | -if (!defined( 'EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
4 | 4 | /** |
5 | 5 | * |
6 | 6 | * EE_Session class |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * array for defining default session vars |
92 | 92 | * @var array |
93 | 93 | */ |
94 | - private $_default_session_vars = array ( |
|
94 | + private $_default_session_vars = array( |
|
95 | 95 | 'id' => NULL, |
96 | 96 | 'user_id' => NULL, |
97 | 97 | 'ip_address' => NULL, |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | * @throws InvalidSessionDataException |
112 | 112 | * @throws \EE_Error |
113 | 113 | */ |
114 | - public static function instance( EE_Encryption $encryption = null ) { |
|
114 | + public static function instance(EE_Encryption $encryption = null) { |
|
115 | 115 | // check if class object is instantiated |
116 | 116 | // session loading is turned ON by default, but prior to the init hook, can be turned back OFF via: |
117 | 117 | // add_filter( 'FHEE_load_EE_Session', '__return_false' ); |
118 | - if ( ! self::$_instance instanceof EE_Session && apply_filters( 'FHEE_load_EE_Session', true ) ) { |
|
119 | - self::$_instance = new self( $encryption ); |
|
118 | + if ( ! self::$_instance instanceof EE_Session && apply_filters('FHEE_load_EE_Session', true)) { |
|
119 | + self::$_instance = new self($encryption); |
|
120 | 120 | } |
121 | 121 | return self::$_instance; |
122 | 122 | } |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | * @throws \EE_Error |
133 | 133 | * @throws \EventEspresso\core\exceptions\InvalidSessionDataException |
134 | 134 | */ |
135 | - protected function __construct( EE_Encryption $encryption = null ) { |
|
135 | + protected function __construct(EE_Encryption $encryption = null) { |
|
136 | 136 | |
137 | 137 | // session loading is turned ON by default, but prior to the init hook, can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' ); |
138 | - if ( ! apply_filters( 'FHEE_load_EE_Session', TRUE ) ) { |
|
138 | + if ( ! apply_filters('FHEE_load_EE_Session', TRUE)) { |
|
139 | 139 | return; |
140 | 140 | } |
141 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
142 | - if ( ! defined( 'ESPRESSO_SESSION' ) ) { |
|
143 | - define( 'ESPRESSO_SESSION', true ); |
|
141 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
142 | + if ( ! defined('ESPRESSO_SESSION')) { |
|
143 | + define('ESPRESSO_SESSION', true); |
|
144 | 144 | } |
145 | 145 | // default session lifespan in seconds |
146 | 146 | $this->_lifespan = apply_filters( |
@@ -154,36 +154,36 @@ discard block |
||
154 | 154 | * } |
155 | 155 | */ |
156 | 156 | // retrieve session options from db |
157 | - $session_settings = get_option( 'ee_session_settings' ); |
|
158 | - if ( $session_settings !== FALSE ) { |
|
157 | + $session_settings = get_option('ee_session_settings'); |
|
158 | + if ($session_settings !== FALSE) { |
|
159 | 159 | // cycle though existing session options |
160 | - foreach ( $session_settings as $var_name => $session_setting ) { |
|
160 | + foreach ($session_settings as $var_name => $session_setting) { |
|
161 | 161 | // set values for class properties |
162 | - $var_name = '_' . $var_name; |
|
162 | + $var_name = '_'.$var_name; |
|
163 | 163 | $this->{$var_name} = $session_setting; |
164 | 164 | } |
165 | 165 | } |
166 | 166 | // are we using encryption? |
167 | - if ( $this->_use_encryption && $encryption instanceof EE_Encryption ) { |
|
167 | + if ($this->_use_encryption && $encryption instanceof EE_Encryption) { |
|
168 | 168 | // encrypt data via: $this->encryption->encrypt(); |
169 | 169 | $this->encryption = $encryption; |
170 | 170 | } |
171 | 171 | // filter hook allows outside functions/classes/plugins to change default empty cart |
172 | - $extra_default_session_vars = apply_filters( 'FHEE__EE_Session__construct__extra_default_session_vars', array() ); |
|
173 | - array_merge( $this->_default_session_vars, $extra_default_session_vars ); |
|
172 | + $extra_default_session_vars = apply_filters('FHEE__EE_Session__construct__extra_default_session_vars', array()); |
|
173 | + array_merge($this->_default_session_vars, $extra_default_session_vars); |
|
174 | 174 | // apply default session vars |
175 | 175 | $this->_set_defaults(); |
176 | 176 | // check for existing session and retrieve it from db |
177 | - if ( ! $this->_espresso_session() ) { |
|
177 | + if ( ! $this->_espresso_session()) { |
|
178 | 178 | // or just start a new one |
179 | 179 | $this->_create_espresso_session(); |
180 | 180 | } |
181 | 181 | // check request for 'clear_session' param |
182 | - add_action( 'AHEE__EE_Request_Handler__construct__complete', array( $this, 'wp_loaded' )); |
|
182 | + add_action('AHEE__EE_Request_Handler__construct__complete', array($this, 'wp_loaded')); |
|
183 | 183 | // once everything is all said and done, |
184 | - add_action( 'shutdown', array( $this, 'update' ), 100 ); |
|
185 | - add_action( 'shutdown', array( $this, 'garbage_collection' ), 999 ); |
|
186 | - add_filter( 'wp_redirect', array( $this, 'update_on_redirect' ), 100, 1 ); |
|
184 | + add_action('shutdown', array($this, 'update'), 100); |
|
185 | + add_action('shutdown', array($this, 'garbage_collection'), 999); |
|
186 | + add_filter('wp_redirect', array($this, 'update_on_redirect'), 100, 1); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -214,11 +214,11 @@ discard block |
||
214 | 214 | */ |
215 | 215 | private function _set_defaults() { |
216 | 216 | // set some defaults |
217 | - foreach ( $this->_default_session_vars as $key => $default_var ) { |
|
218 | - if ( is_array( $default_var )) { |
|
219 | - $this->_session_data[ $key ] = array(); |
|
217 | + foreach ($this->_default_session_vars as $key => $default_var) { |
|
218 | + if (is_array($default_var)) { |
|
219 | + $this->_session_data[$key] = array(); |
|
220 | 220 | } else { |
221 | - $this->_session_data[ $key ] = ''; |
|
221 | + $this->_session_data[$key] = ''; |
|
222 | 222 | } |
223 | 223 | } |
224 | 224 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * @param \EE_Cart $cart |
241 | 241 | * @return bool |
242 | 242 | */ |
243 | - public function set_cart( EE_Cart $cart ) { |
|
243 | + public function set_cart(EE_Cart $cart) { |
|
244 | 244 | $this->_session_data['cart'] = $cart; |
245 | 245 | return TRUE; |
246 | 246 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @return \EE_Cart |
261 | 261 | */ |
262 | 262 | public function cart() { |
263 | - return isset( $this->_session_data['cart'] ) ? $this->_session_data['cart'] : NULL; |
|
263 | + return isset($this->_session_data['cart']) ? $this->_session_data['cart'] : NULL; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * @param \EE_Checkout $checkout |
270 | 270 | * @return bool |
271 | 271 | */ |
272 | - public function set_checkout( EE_Checkout $checkout ) { |
|
272 | + public function set_checkout(EE_Checkout $checkout) { |
|
273 | 273 | $this->_session_data['checkout'] = $checkout; |
274 | 274 | return TRUE; |
275 | 275 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @return \EE_Checkout |
290 | 290 | */ |
291 | 291 | public function checkout() { |
292 | - return isset( $this->_session_data['checkout'] ) ? $this->_session_data['checkout'] : NULL; |
|
292 | + return isset($this->_session_data['checkout']) ? $this->_session_data['checkout'] : NULL; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | |
@@ -299,9 +299,9 @@ discard block |
||
299 | 299 | * @return bool |
300 | 300 | * @throws \EE_Error |
301 | 301 | */ |
302 | - public function set_transaction( EE_Transaction $transaction ) { |
|
302 | + public function set_transaction(EE_Transaction $transaction) { |
|
303 | 303 | // first remove the session from the transaction before we save the transaction in the session |
304 | - $transaction->set_txn_session_data( NULL ); |
|
304 | + $transaction->set_txn_session_data(NULL); |
|
305 | 305 | $this->_session_data['transaction'] = $transaction; |
306 | 306 | return TRUE; |
307 | 307 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * @return \EE_Transaction |
322 | 322 | */ |
323 | 323 | public function transaction() { |
324 | - return isset( $this->_session_data['transaction'] ) ? $this->_session_data['transaction'] : NULL; |
|
324 | + return isset($this->_session_data['transaction']) ? $this->_session_data['transaction'] : NULL; |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | |
@@ -333,15 +333,15 @@ discard block |
||
333 | 333 | * @param bool $reset_cache |
334 | 334 | * @return array |
335 | 335 | */ |
336 | - public function get_session_data( $key = NULL, $reset_cache = FALSE ) { |
|
337 | - if ( $reset_cache ) { |
|
336 | + public function get_session_data($key = NULL, $reset_cache = FALSE) { |
|
337 | + if ($reset_cache) { |
|
338 | 338 | $this->reset_cart(); |
339 | 339 | $this->reset_checkout(); |
340 | 340 | $this->reset_transaction(); |
341 | 341 | } |
342 | - if ( ! empty( $key )) { |
|
343 | - return isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL; |
|
344 | - } else { |
|
342 | + if ( ! empty($key)) { |
|
343 | + return isset($this->_session_data[$key]) ? $this->_session_data[$key] : NULL; |
|
344 | + } else { |
|
345 | 345 | return $this->_session_data; |
346 | 346 | } |
347 | 347 | } |
@@ -354,20 +354,20 @@ discard block |
||
354 | 354 | * @param array $data |
355 | 355 | * @return TRUE on success, FALSE on fail |
356 | 356 | */ |
357 | - public function set_session_data( $data ) { |
|
357 | + public function set_session_data($data) { |
|
358 | 358 | |
359 | 359 | // nothing ??? bad data ??? go home! |
360 | - if ( empty( $data ) || ! is_array( $data )) { |
|
361 | - EE_Error::add_error( __( 'No session data or invalid session data was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
360 | + if (empty($data) || ! is_array($data)) { |
|
361 | + EE_Error::add_error(__('No session data or invalid session data was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
362 | 362 | return FALSE; |
363 | 363 | } |
364 | 364 | |
365 | - foreach ( $data as $key =>$value ) { |
|
366 | - if ( isset( $this->_default_session_vars[ $key ] )) { |
|
367 | - EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $key ), __FILE__, __FUNCTION__, __LINE__ ); |
|
365 | + foreach ($data as $key =>$value) { |
|
366 | + if (isset($this->_default_session_vars[$key])) { |
|
367 | + EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $key), __FILE__, __FUNCTION__, __LINE__); |
|
368 | 368 | return FALSE; |
369 | 369 | } else { |
370 | - $this->_session_data[ $key ] = $value; |
|
370 | + $this->_session_data[$key] = $value; |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
@@ -385,9 +385,9 @@ discard block |
||
385 | 385 | * @throws \EE_Error |
386 | 386 | */ |
387 | 387 | private function _espresso_session() { |
388 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
388 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
389 | 389 | // check that session has started |
390 | - if ( session_id() === '' ) { |
|
390 | + if (session_id() === '') { |
|
391 | 391 | //starts a new session if one doesn't already exist, or re-initiates an existing one |
392 | 392 | session_start(); |
393 | 393 | } |
@@ -396,18 +396,18 @@ discard block |
||
396 | 396 | // and the visitors IP |
397 | 397 | $this->_ip_address = $this->_visitor_ip(); |
398 | 398 | // set the "user agent" |
399 | - $this->_user_agent = ( isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr( $_SERVER['HTTP_USER_AGENT'] ) : FALSE; |
|
399 | + $this->_user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr($_SERVER['HTTP_USER_AGENT']) : FALSE; |
|
400 | 400 | // now let's retrieve what's in the db |
401 | 401 | // we're using WP's Transient API to store session data using the PHP session ID as the option name |
402 | - $session_data = get_transient( EE_Session::session_id_prefix . $this->_sid ); |
|
403 | - if ( $session_data ) { |
|
404 | - if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) { |
|
405 | - $hash_check = get_transient( EE_Session::hash_check_prefix . $this->_sid ); |
|
406 | - if ( $hash_check && $hash_check !== md5( $session_data ) ) { |
|
402 | + $session_data = get_transient(EE_Session::session_id_prefix.$this->_sid); |
|
403 | + if ($session_data) { |
|
404 | + if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) { |
|
405 | + $hash_check = get_transient(EE_Session::hash_check_prefix.$this->_sid); |
|
406 | + if ($hash_check && $hash_check !== md5($session_data)) { |
|
407 | 407 | EE_Error::add_error( |
408 | 408 | sprintf( |
409 | - __( 'The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso' ), |
|
410 | - EE_Session::session_id_prefix . $this->_sid |
|
409 | + __('The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso'), |
|
410 | + EE_Session::session_id_prefix.$this->_sid |
|
411 | 411 | ), |
412 | 412 | __FILE__, __FUNCTION__, __LINE__ |
413 | 413 | ); |
@@ -418,33 +418,33 @@ discard block |
||
418 | 418 | $session_data = $this->valid_base_64($session_data) ? base64_decode($session_data) : $session_data; |
419 | 419 | } |
420 | 420 | // un-encrypt the data ? |
421 | - $session_data = $this->_use_encryption ? $this->encryption->decrypt( $session_data ) : $session_data; |
|
422 | - if ( ! is_array( $session_data ) ) { |
|
421 | + $session_data = $this->_use_encryption ? $this->encryption->decrypt($session_data) : $session_data; |
|
422 | + if ( ! is_array($session_data)) { |
|
423 | 423 | try { |
424 | - $session_data = maybe_unserialize( $session_data ); |
|
425 | - } catch ( Exception $e ) { |
|
424 | + $session_data = maybe_unserialize($session_data); |
|
425 | + } catch (Exception $e) { |
|
426 | 426 | $msg = esc_html__( |
427 | 427 | 'An error occurred while attempting to unserialize the session data.', |
428 | 428 | 'event_espresso' |
429 | 429 | ); |
430 | - $msg .= WP_DEBUG ? '<br>' . $this->find_serialize_error( $session_data ) : ''; |
|
431 | - throw new InvalidSessionDataException( $msg, 0, $e ); |
|
430 | + $msg .= WP_DEBUG ? '<br>'.$this->find_serialize_error($session_data) : ''; |
|
431 | + throw new InvalidSessionDataException($msg, 0, $e); |
|
432 | 432 | } |
433 | 433 | } |
434 | 434 | // just a check to make sure the session array is indeed an array |
435 | - if ( ! is_array( $session_data ) ) { |
|
435 | + if ( ! is_array($session_data)) { |
|
436 | 436 | // no?!?! then something is wrong |
437 | 437 | $msg = esc_html__( |
438 | 438 | 'The session data is missing, invalid, or corrupted.', |
439 | 439 | 'event_espresso' |
440 | 440 | ); |
441 | - $msg .= WP_DEBUG ? '<br>' . $this->find_serialize_error( $session_data ) : ''; |
|
442 | - throw new InvalidSessionDataException( $msg ); |
|
441 | + $msg .= WP_DEBUG ? '<br>'.$this->find_serialize_error($session_data) : ''; |
|
442 | + throw new InvalidSessionDataException($msg); |
|
443 | 443 | } |
444 | 444 | // get the current time in UTC |
445 | - $this->_time = isset( $this->_time ) ? $this->_time : time(); |
|
445 | + $this->_time = isset($this->_time) ? $this->_time : time(); |
|
446 | 446 | // and reset the session expiration |
447 | - $this->_expiration = isset( $session_data['expiration'] ) |
|
447 | + $this->_expiration = isset($session_data['expiration']) |
|
448 | 448 | ? $session_data['expiration'] |
449 | 449 | : $this->_time + $this->_lifespan; |
450 | 450 | |
@@ -452,24 +452,24 @@ discard block |
||
452 | 452 | // set initial site access time and the session expiration |
453 | 453 | $this->_set_init_access_and_expiration(); |
454 | 454 | // set referer |
455 | - $this->_session_data[ 'pages_visited' ][ $this->_session_data['init_access'] ] = isset( $_SERVER['HTTP_REFERER'] ) |
|
456 | - ? esc_attr( $_SERVER['HTTP_REFERER'] ) |
|
455 | + $this->_session_data['pages_visited'][$this->_session_data['init_access']] = isset($_SERVER['HTTP_REFERER']) |
|
456 | + ? esc_attr($_SERVER['HTTP_REFERER']) |
|
457 | 457 | : ''; |
458 | 458 | // no previous session = go back and create one (on top of the data above) |
459 | 459 | return FALSE; |
460 | 460 | } |
461 | 461 | // now the user agent |
462 | - if ( $session_data['user_agent'] !== $this->_user_agent ) { |
|
462 | + if ($session_data['user_agent'] !== $this->_user_agent) { |
|
463 | 463 | return FALSE; |
464 | 464 | } |
465 | 465 | // wait a minute... how old are you? |
466 | - if ( $this->_time > $this->_expiration ) { |
|
466 | + if ($this->_time > $this->_expiration) { |
|
467 | 467 | // yer too old fer me! |
468 | 468 | // wipe out everything that isn't a default session datum |
469 | - $this->clear_session( __CLASS__, __FUNCTION__ ); |
|
469 | + $this->clear_session(__CLASS__, __FUNCTION__); |
|
470 | 470 | } |
471 | 471 | // make event espresso session data available to plugin |
472 | - $this->_session_data = array_merge( $this->_session_data, $session_data ); |
|
472 | + $this->_session_data = array_merge($this->_session_data, $session_data); |
|
473 | 473 | return TRUE; |
474 | 474 | |
475 | 475 | } |
@@ -487,12 +487,12 @@ discard block |
||
487 | 487 | */ |
488 | 488 | protected function _generate_session_id() { |
489 | 489 | // check if the SID was passed explicitly, otherwise get from session, then add salt and hash it to reduce length |
490 | - if ( isset( $_REQUEST[ 'EESID' ] ) ) { |
|
491 | - $session_id = sanitize_text_field( $_REQUEST[ 'EESID' ] ); |
|
490 | + if (isset($_REQUEST['EESID'])) { |
|
491 | + $session_id = sanitize_text_field($_REQUEST['EESID']); |
|
492 | 492 | } else { |
493 | - $session_id = md5( session_id() . get_current_blog_id() . $this->_get_sid_salt() ); |
|
493 | + $session_id = md5(session_id().get_current_blog_id().$this->_get_sid_salt()); |
|
494 | 494 | } |
495 | - return apply_filters( 'FHEE__EE_Session___generate_session_id__session_id', $session_id ); |
|
495 | + return apply_filters('FHEE__EE_Session___generate_session_id__session_id', $session_id); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | |
@@ -504,20 +504,20 @@ discard block |
||
504 | 504 | */ |
505 | 505 | protected function _get_sid_salt() { |
506 | 506 | // was session id salt already saved to db ? |
507 | - if ( empty( $this->_sid_salt ) ) { |
|
507 | + if (empty($this->_sid_salt)) { |
|
508 | 508 | // no? then maybe use WP defined constant |
509 | - if ( defined( 'AUTH_SALT' ) ) { |
|
509 | + if (defined('AUTH_SALT')) { |
|
510 | 510 | $this->_sid_salt = AUTH_SALT; |
511 | 511 | } |
512 | 512 | // if salt doesn't exist or is too short |
513 | - if ( empty( $this->_sid_salt ) || strlen( $this->_sid_salt ) < 32 ) { |
|
513 | + if (empty($this->_sid_salt) || strlen($this->_sid_salt) < 32) { |
|
514 | 514 | // create a new one |
515 | - $this->_sid_salt = wp_generate_password( 64 ); |
|
515 | + $this->_sid_salt = wp_generate_password(64); |
|
516 | 516 | } |
517 | 517 | // and save it as a permanent session setting |
518 | - $session_settings = get_option( 'ee_session_settings' ); |
|
519 | - $session_settings[ 'sid_salt' ] = $this->_sid_salt; |
|
520 | - update_option( 'ee_session_settings', $session_settings ); |
|
518 | + $session_settings = get_option('ee_session_settings'); |
|
519 | + $session_settings['sid_salt'] = $this->_sid_salt; |
|
520 | + update_option('ee_session_settings', $session_settings); |
|
521 | 521 | } |
522 | 522 | return $this->_sid_salt; |
523 | 523 | } |
@@ -545,19 +545,19 @@ discard block |
||
545 | 545 | * @param bool $new_session |
546 | 546 | * @return TRUE on success, FALSE on fail |
547 | 547 | */ |
548 | - public function update( $new_session = FALSE ) { |
|
549 | - $this->_session_data = isset( $this->_session_data ) |
|
550 | - && is_array( $this->_session_data ) |
|
551 | - && isset( $this->_session_data['id']) |
|
548 | + public function update($new_session = FALSE) { |
|
549 | + $this->_session_data = isset($this->_session_data) |
|
550 | + && is_array($this->_session_data) |
|
551 | + && isset($this->_session_data['id']) |
|
552 | 552 | ? $this->_session_data |
553 | 553 | : NULL; |
554 | - if ( empty( $this->_session_data )) { |
|
554 | + if (empty($this->_session_data)) { |
|
555 | 555 | $this->_set_defaults(); |
556 | 556 | } |
557 | 557 | $session_data = array(); |
558 | - foreach ( $this->_session_data as $key => $value ) { |
|
558 | + foreach ($this->_session_data as $key => $value) { |
|
559 | 559 | |
560 | - switch( $key ) { |
|
560 | + switch ($key) { |
|
561 | 561 | |
562 | 562 | case 'id' : |
563 | 563 | // session ID |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | break; |
576 | 576 | |
577 | 577 | case 'init_access' : |
578 | - $session_data['init_access'] = absint( $value ); |
|
578 | + $session_data['init_access'] = absint($value); |
|
579 | 579 | break; |
580 | 580 | |
581 | 581 | case 'last_access' : |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | |
586 | 586 | case 'expiration' : |
587 | 587 | // when the session expires |
588 | - $session_data['expiration'] = ! empty( $this->_expiration ) |
|
588 | + $session_data['expiration'] = ! empty($this->_expiration) |
|
589 | 589 | ? $this->_expiration |
590 | 590 | : $session_data['init_access'] + $this->_lifespan; |
591 | 591 | break; |
@@ -597,11 +597,11 @@ discard block |
||
597 | 597 | |
598 | 598 | case 'pages_visited' : |
599 | 599 | $page_visit = $this->_get_page_visit(); |
600 | - if ( $page_visit ) { |
|
600 | + if ($page_visit) { |
|
601 | 601 | // set pages visited where the first will be the http referrer |
602 | - $this->_session_data[ 'pages_visited' ][ $this->_time ] = $page_visit; |
|
602 | + $this->_session_data['pages_visited'][$this->_time] = $page_visit; |
|
603 | 603 | // we'll only save the last 10 page visits. |
604 | - $session_data[ 'pages_visited' ] = array_slice( $this->_session_data['pages_visited'], -10 ); |
|
604 | + $session_data['pages_visited'] = array_slice($this->_session_data['pages_visited'], -10); |
|
605 | 605 | } |
606 | 606 | break; |
607 | 607 | |
@@ -615,9 +615,9 @@ discard block |
||
615 | 615 | |
616 | 616 | $this->_session_data = $session_data; |
617 | 617 | // creating a new session does not require saving to the db just yet |
618 | - if ( ! $new_session ) { |
|
618 | + if ( ! $new_session) { |
|
619 | 619 | // ready? let's save |
620 | - if ( $this->_save_session_to_db() ) { |
|
620 | + if ($this->_save_session_to_db()) { |
|
621 | 621 | return TRUE; |
622 | 622 | } else { |
623 | 623 | return FALSE; |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | * @param string $location |
640 | 640 | * @return mixed |
641 | 641 | */ |
642 | - public function update_on_redirect( $location ) { |
|
642 | + public function update_on_redirect($location) { |
|
643 | 643 | $this->update(); |
644 | 644 | return $location; |
645 | 645 | } |
@@ -651,9 +651,9 @@ discard block |
||
651 | 651 | * @return bool |
652 | 652 | */ |
653 | 653 | private function _create_espresso_session( ) { |
654 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, '' ); |
|
654 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, ''); |
|
655 | 655 | // use the update function for now with $new_session arg set to TRUE |
656 | - return $this->update( TRUE ) ? TRUE : FALSE; |
|
656 | + return $this->update(TRUE) ? TRUE : FALSE; |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | // OR an admin request that is NOT AJAX |
681 | 681 | || ( |
682 | 682 | is_admin() |
683 | - && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) |
|
683 | + && ! (defined('DOING_AJAX') && DOING_AJAX) |
|
684 | 684 | ) |
685 | 685 | ) |
686 | 686 | ) { |
@@ -693,13 +693,13 @@ discard block |
||
693 | 693 | $session_data = base64_encode($this->_session_data); |
694 | 694 | } |
695 | 695 | // encrypt it if we are using encryption |
696 | - $session_data = $this->_use_encryption ? $this->encryption->encrypt( $session_data ) : $session_data; |
|
696 | + $session_data = $this->_use_encryption ? $this->encryption->encrypt($session_data) : $session_data; |
|
697 | 697 | // maybe save hash check |
698 | - if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) { |
|
699 | - set_transient( EE_Session::hash_check_prefix . $this->_sid, md5( $session_data ), $this->_lifespan ); |
|
698 | + if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) { |
|
699 | + set_transient(EE_Session::hash_check_prefix.$this->_sid, md5($session_data), $this->_lifespan); |
|
700 | 700 | } |
701 | 701 | // we're using the Transient API for storing session data, cuz it's so damn simple -> set_transient( transient ID, data, expiry ) |
702 | - return set_transient( EE_Session::session_id_prefix . $this->_sid, $session_data, $this->_lifespan ); |
|
702 | + return set_transient(EE_Session::session_id_prefix.$this->_sid, $session_data, $this->_lifespan); |
|
703 | 703 | } |
704 | 704 | |
705 | 705 | |
@@ -725,10 +725,10 @@ discard block |
||
725 | 725 | 'HTTP_FORWARDED', |
726 | 726 | 'REMOTE_ADDR' |
727 | 727 | ); |
728 | - foreach ( $server_keys as $key ){ |
|
729 | - if ( isset( $_SERVER[ $key ] )) { |
|
730 | - foreach ( array_map( 'trim', explode( ',', $_SERVER[ $key ] )) as $ip ) { |
|
731 | - if ( $ip === '127.0.0.1' || filter_var( $ip, FILTER_VALIDATE_IP ) !== FALSE ) { |
|
728 | + foreach ($server_keys as $key) { |
|
729 | + if (isset($_SERVER[$key])) { |
|
730 | + foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) { |
|
731 | + if ($ip === '127.0.0.1' || filter_var($ip, FILTER_VALIDATE_IP) !== FALSE) { |
|
732 | 732 | $visitor_ip = $ip; |
733 | 733 | } |
734 | 734 | } |
@@ -747,32 +747,32 @@ discard block |
||
747 | 747 | * @return string |
748 | 748 | */ |
749 | 749 | public function _get_page_visit() { |
750 | - $page_visit = home_url('/') . 'wp-admin/admin-ajax.php'; |
|
750 | + $page_visit = home_url('/').'wp-admin/admin-ajax.php'; |
|
751 | 751 | // check for request url |
752 | - if ( isset( $_SERVER['REQUEST_URI'] )) { |
|
752 | + if (isset($_SERVER['REQUEST_URI'])) { |
|
753 | 753 | $http_host = ''; |
754 | 754 | $page_id = '?'; |
755 | 755 | $e_reg = ''; |
756 | - $request_uri = esc_url( $_SERVER['REQUEST_URI'] ); |
|
757 | - $ru_bits = explode( '?', $request_uri ); |
|
756 | + $request_uri = esc_url($_SERVER['REQUEST_URI']); |
|
757 | + $ru_bits = explode('?', $request_uri); |
|
758 | 758 | $request_uri = $ru_bits[0]; |
759 | 759 | // check for and grab host as well |
760 | - if ( isset( $_SERVER['HTTP_HOST'] )) { |
|
761 | - $http_host = esc_url( $_SERVER['HTTP_HOST'] ); |
|
760 | + if (isset($_SERVER['HTTP_HOST'])) { |
|
761 | + $http_host = esc_url($_SERVER['HTTP_HOST']); |
|
762 | 762 | } |
763 | 763 | // check for page_id in SERVER REQUEST |
764 | - if ( isset( $_REQUEST['page_id'] )) { |
|
764 | + if (isset($_REQUEST['page_id'])) { |
|
765 | 765 | // rebuild $e_reg without any of the extra parameters |
766 | - $page_id = '?page_id=' . esc_attr( $_REQUEST['page_id'] ) . '&'; |
|
766 | + $page_id = '?page_id='.esc_attr($_REQUEST['page_id']).'&'; |
|
767 | 767 | } |
768 | 768 | // check for $e_reg in SERVER REQUEST |
769 | - if ( isset( $_REQUEST['ee'] )) { |
|
769 | + if (isset($_REQUEST['ee'])) { |
|
770 | 770 | // rebuild $e_reg without any of the extra parameters |
771 | - $e_reg = 'ee=' . esc_attr( $_REQUEST['ee'] ); |
|
771 | + $e_reg = 'ee='.esc_attr($_REQUEST['ee']); |
|
772 | 772 | } |
773 | - $page_visit = rtrim( $http_host . $request_uri . $page_id . $e_reg, '?' ); |
|
773 | + $page_visit = rtrim($http_host.$request_uri.$page_id.$e_reg, '?'); |
|
774 | 774 | } |
775 | - return $page_visit !== home_url( '/wp-admin/admin-ajax.php' ) ? $page_visit : ''; |
|
775 | + return $page_visit !== home_url('/wp-admin/admin-ajax.php') ? $page_visit : ''; |
|
776 | 776 | |
777 | 777 | } |
778 | 778 | |
@@ -801,14 +801,14 @@ discard block |
||
801 | 801 | * @param string $function |
802 | 802 | * @return void |
803 | 803 | */ |
804 | - public function clear_session( $class = '', $function = '' ) { |
|
804 | + public function clear_session($class = '', $function = '') { |
|
805 | 805 | //echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '( ' . $class . '::' . $function . '() )</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span> <b style="font-size:10px;"> ' . __LINE__ . ' </b></h3>'; |
806 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : ' . $class . '::' . $function . '()' ); |
|
806 | + do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : '.$class.'::'.$function.'()'); |
|
807 | 807 | $this->reset_cart(); |
808 | 808 | $this->reset_checkout(); |
809 | 809 | $this->reset_transaction(); |
810 | 810 | // wipe out everything that isn't a default session datum |
811 | - $this->reset_data( array_keys( $this->_session_data )); |
|
811 | + $this->reset_data(array_keys($this->_session_data)); |
|
812 | 812 | // reset initial site access time and the session expiration |
813 | 813 | $this->_set_init_access_and_expiration(); |
814 | 814 | $this->_save_session_to_db(); |
@@ -823,42 +823,42 @@ discard block |
||
823 | 823 | * @param bool $show_all_notices |
824 | 824 | * @return TRUE on success, FALSE on fail |
825 | 825 | */ |
826 | - public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) { |
|
826 | + public function reset_data($data_to_reset = array(), $show_all_notices = FALSE) { |
|
827 | 827 | // if $data_to_reset is not in an array, then put it in one |
828 | - if ( ! is_array( $data_to_reset ) ) { |
|
829 | - $data_to_reset = array ( $data_to_reset ); |
|
828 | + if ( ! is_array($data_to_reset)) { |
|
829 | + $data_to_reset = array($data_to_reset); |
|
830 | 830 | } |
831 | 831 | // nothing ??? go home! |
832 | - if ( empty( $data_to_reset )) { |
|
833 | - EE_Error::add_error( __( 'No session data could be reset, because no session var name was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
832 | + if (empty($data_to_reset)) { |
|
833 | + EE_Error::add_error(__('No session data could be reset, because no session var name was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
834 | 834 | return FALSE; |
835 | 835 | } |
836 | 836 | $return_value = TRUE; |
837 | 837 | // since $data_to_reset is an array, cycle through the values |
838 | - foreach ( $data_to_reset as $reset ) { |
|
838 | + foreach ($data_to_reset as $reset) { |
|
839 | 839 | |
840 | 840 | // first check to make sure it is a valid session var |
841 | - if ( isset( $this->_session_data[ $reset ] )) { |
|
841 | + if (isset($this->_session_data[$reset])) { |
|
842 | 842 | // then check to make sure it is not a default var |
843 | - if ( ! array_key_exists( $reset, $this->_default_session_vars )) { |
|
843 | + if ( ! array_key_exists($reset, $this->_default_session_vars)) { |
|
844 | 844 | // remove session var |
845 | - unset( $this->_session_data[ $reset ] ); |
|
846 | - if ( $show_all_notices ) { |
|
847 | - EE_Error::add_success( sprintf( __( 'The session variable %s was removed.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ ); |
|
845 | + unset($this->_session_data[$reset]); |
|
846 | + if ($show_all_notices) { |
|
847 | + EE_Error::add_success(sprintf(__('The session variable %s was removed.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__); |
|
848 | 848 | } |
849 | - $return_value = !isset($return_value) ? TRUE : $return_value; |
|
849 | + $return_value = ! isset($return_value) ? TRUE : $return_value; |
|
850 | 850 | |
851 | 851 | } else { |
852 | 852 | // yeeeeeeeeerrrrrrrrrrr OUT !!!! |
853 | - if ( $show_all_notices ) { |
|
854 | - EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ ); |
|
853 | + if ($show_all_notices) { |
|
854 | + EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__); |
|
855 | 855 | } |
856 | 856 | $return_value = FALSE; |
857 | 857 | } |
858 | 858 | |
859 | - } else if ( $show_all_notices ) { |
|
859 | + } else if ($show_all_notices) { |
|
860 | 860 | // oops! that session var does not exist! |
861 | - EE_Error::add_error( sprintf( __( 'The session item provided, %s, is invalid or does not exist.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ ); |
|
861 | + EE_Error::add_error(sprintf(__('The session item provided, %s, is invalid or does not exist.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__); |
|
862 | 862 | $return_value = FALSE; |
863 | 863 | } |
864 | 864 | |
@@ -878,8 +878,8 @@ discard block |
||
878 | 878 | * @access public |
879 | 879 | */ |
880 | 880 | public function wp_loaded() { |
881 | - if ( isset( EE_Registry::instance()->REQ ) && EE_Registry::instance()->REQ->is_set( 'clear_session' )) { |
|
882 | - $this->clear_session( __CLASS__, __FUNCTION__ ); |
|
881 | + if (isset(EE_Registry::instance()->REQ) && EE_Registry::instance()->REQ->is_set('clear_session')) { |
|
882 | + $this->clear_session(__CLASS__, __FUNCTION__); |
|
883 | 883 | } |
884 | 884 | } |
885 | 885 | |
@@ -904,24 +904,24 @@ discard block |
||
904 | 904 | */ |
905 | 905 | public function garbage_collection() { |
906 | 906 | // only perform during regular requests |
907 | - if ( ! defined( 'DOING_AJAX') || ! DOING_AJAX ) { |
|
907 | + if ( ! defined('DOING_AJAX') || ! DOING_AJAX) { |
|
908 | 908 | /** @type WPDB $wpdb */ |
909 | 909 | global $wpdb; |
910 | 910 | // since transient expiration timestamps are set in the future, we can compare against NOW |
911 | 911 | $expiration = time(); |
912 | - $too_far_in_the_the_future = $expiration + ( $this->_lifespan * 2 ); |
|
912 | + $too_far_in_the_the_future = $expiration + ($this->_lifespan * 2); |
|
913 | 913 | // filter the query limit. Set to 0 to turn off garbage collection |
914 | - $expired_session_transient_delete_query_limit = absint( apply_filters( 'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50 )); |
|
914 | + $expired_session_transient_delete_query_limit = absint(apply_filters('FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50)); |
|
915 | 915 | // non-zero LIMIT means take out the trash |
916 | - if ( $expired_session_transient_delete_query_limit ) { |
|
916 | + if ($expired_session_transient_delete_query_limit) { |
|
917 | 917 | //array of transient keys that require garbage collection |
918 | 918 | $session_keys = array( |
919 | 919 | EE_Session::session_id_prefix, |
920 | 920 | EE_Session::hash_check_prefix, |
921 | 921 | ); |
922 | - foreach ( $session_keys as $session_key ) { |
|
923 | - $session_key = str_replace( '_', '\_', $session_key ); |
|
924 | - $session_key = '\_transient\_timeout\_' . $session_key . '%'; |
|
922 | + foreach ($session_keys as $session_key) { |
|
923 | + $session_key = str_replace('_', '\_', $session_key); |
|
924 | + $session_key = '\_transient\_timeout\_'.$session_key.'%'; |
|
925 | 925 | $SQL = " |
926 | 926 | SELECT option_name |
927 | 927 | FROM {$wpdb->options} |
@@ -931,25 +931,25 @@ discard block |
||
931 | 931 | OR option_value > {$too_far_in_the_the_future} ) |
932 | 932 | LIMIT {$expired_session_transient_delete_query_limit} |
933 | 933 | "; |
934 | - $expired_sessions = $wpdb->get_col( $SQL ); |
|
934 | + $expired_sessions = $wpdb->get_col($SQL); |
|
935 | 935 | // valid results? |
936 | - if ( ! $expired_sessions instanceof WP_Error && ! empty( $expired_sessions ) ) { |
|
936 | + if ( ! $expired_sessions instanceof WP_Error && ! empty($expired_sessions)) { |
|
937 | 937 | // format array of results into something usable within the actual DELETE query's IN clause |
938 | 938 | $expired = array(); |
939 | - foreach ( $expired_sessions as $expired_session ) { |
|
940 | - $expired[ ] = "'" . $expired_session . "'"; |
|
941 | - $expired[ ] = "'" . str_replace( 'timeout_', '', $expired_session ) . "'"; |
|
939 | + foreach ($expired_sessions as $expired_session) { |
|
940 | + $expired[] = "'".$expired_session."'"; |
|
941 | + $expired[] = "'".str_replace('timeout_', '', $expired_session)."'"; |
|
942 | 942 | } |
943 | - $expired = implode( ', ', $expired ); |
|
943 | + $expired = implode(', ', $expired); |
|
944 | 944 | $SQL = " |
945 | 945 | DELETE FROM {$wpdb->options} |
946 | 946 | WHERE option_name |
947 | 947 | IN ( $expired ); |
948 | 948 | "; |
949 | - $results = $wpdb->query( $SQL ); |
|
949 | + $results = $wpdb->query($SQL); |
|
950 | 950 | // if something went wrong, then notify the admin |
951 | - if ( $results instanceof WP_Error && is_admin() ) { |
|
952 | - EE_Error::add_error( $results->get_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
951 | + if ($results instanceof WP_Error && is_admin()) { |
|
952 | + EE_Error::add_error($results->get_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
953 | 953 | } |
954 | 954 | } |
955 | 955 | } |
@@ -970,18 +970,18 @@ discard block |
||
970 | 970 | * @param $string |
971 | 971 | * @return bool |
972 | 972 | */ |
973 | - private function valid_base_64( $string ) { |
|
974 | - $decoded = base64_decode( $string, true ); |
|
973 | + private function valid_base_64($string) { |
|
974 | + $decoded = base64_decode($string, true); |
|
975 | 975 | // Check if there is no invalid character in string |
976 | - if ( ! preg_match( '/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $string ) ) { |
|
976 | + if ( ! preg_match('/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $string)) { |
|
977 | 977 | return false; |
978 | 978 | } |
979 | 979 | // Decode the string in strict mode and send the response |
980 | - if ( ! base64_decode( $string, true ) ) { |
|
980 | + if ( ! base64_decode($string, true)) { |
|
981 | 981 | return false; |
982 | 982 | } |
983 | 983 | // Encode and compare it to original one |
984 | - return base64_encode( $decoded ) === $string; |
|
984 | + return base64_encode($decoded) === $string; |
|
985 | 985 | } |
986 | 986 | |
987 | 987 | |
@@ -991,34 +991,34 @@ discard block |
||
991 | 991 | * @param $data1 |
992 | 992 | * @return string |
993 | 993 | */ |
994 | - private function find_serialize_error( $data1 ) { |
|
994 | + private function find_serialize_error($data1) { |
|
995 | 995 | $error = "<pre>"; |
996 | 996 | $data2 = preg_replace_callback( |
997 | 997 | '!s:(\d+):"(.*?)";!', |
998 | - function ( $match ) { |
|
999 | - return ( $match[1] === strlen( $match[2] ) ) |
|
998 | + function($match) { |
|
999 | + return ($match[1] === strlen($match[2])) |
|
1000 | 1000 | ? $match[0] |
1001 | 1001 | : 's:' |
1002 | - . strlen( $match[2] ) |
|
1002 | + . strlen($match[2]) |
|
1003 | 1003 | . ':"' |
1004 | 1004 | . $match[2] |
1005 | 1005 | . '";'; |
1006 | 1006 | }, |
1007 | 1007 | $data1 |
1008 | 1008 | ); |
1009 | - $max = ( strlen( $data1 ) > strlen( $data2 ) ) ? strlen( $data1 ) : strlen( $data2 ); |
|
1010 | - $error .= $data1 . PHP_EOL; |
|
1011 | - $error .= $data2 . PHP_EOL; |
|
1012 | - for ( $i = 0; $i < $max; $i++ ) { |
|
1013 | - if ( @$data1[ $i ] !== @$data2[ $i ] ) { |
|
1014 | - $error .= "Difference " . @$data1[ $i ] . " != " . @$data2[ $i ] . PHP_EOL; |
|
1015 | - $error .= "\t-> ORD number " . ord( @$data1[ $i ] ) . " != " . ord( @$data2[ $i ] ) . PHP_EOL; |
|
1016 | - $error .= "\t-> Line Number = $i" . PHP_EOL; |
|
1017 | - $start = ( $i - 20 ); |
|
1018 | - $start = ( $start < 0 ) ? 0 : $start; |
|
1009 | + $max = (strlen($data1) > strlen($data2)) ? strlen($data1) : strlen($data2); |
|
1010 | + $error .= $data1.PHP_EOL; |
|
1011 | + $error .= $data2.PHP_EOL; |
|
1012 | + for ($i = 0; $i < $max; $i++) { |
|
1013 | + if (@$data1[$i] !== @$data2[$i]) { |
|
1014 | + $error .= "Difference ".@$data1[$i]." != ".@$data2[$i].PHP_EOL; |
|
1015 | + $error .= "\t-> ORD number ".ord(@$data1[$i])." != ".ord(@$data2[$i]).PHP_EOL; |
|
1016 | + $error .= "\t-> Line Number = $i".PHP_EOL; |
|
1017 | + $start = ($i - 20); |
|
1018 | + $start = ($start < 0) ? 0 : $start; |
|
1019 | 1019 | $length = 40; |
1020 | 1020 | $point = $max - $i; |
1021 | - if ( $point < 20 ) { |
|
1021 | + if ($point < 20) { |
|
1022 | 1022 | $rlength = 1; |
1023 | 1023 | $rpoint = -$point; |
1024 | 1024 | } else { |
@@ -1027,16 +1027,16 @@ discard block |
||
1027 | 1027 | } |
1028 | 1028 | $error .= "\t-> Section Data1 = "; |
1029 | 1029 | $error .= substr_replace( |
1030 | - substr( $data1, $start, $length ), |
|
1031 | - "<b style=\"color:green\">{$data1[ $i ]}</b>", |
|
1030 | + substr($data1, $start, $length), |
|
1031 | + "<b style=\"color:green\">{$data1[$i]}</b>", |
|
1032 | 1032 | $rpoint, |
1033 | 1033 | $rlength |
1034 | 1034 | ); |
1035 | 1035 | $error .= PHP_EOL; |
1036 | 1036 | $error .= "\t-> Section Data2 = "; |
1037 | 1037 | $error .= substr_replace( |
1038 | - substr( $data2, $start, $length ), |
|
1039 | - "<b style=\"color:red\">{$data2[ $i ]}</b>", |
|
1038 | + substr($data2, $start, $length), |
|
1039 | + "<b style=\"color:red\">{$data2[$i]}</b>", |
|
1040 | 1040 | $rpoint, |
1041 | 1041 | $rlength |
1042 | 1042 | ); |
@@ -8,19 +8,19 @@ discard block |
||
8 | 8 | * |
9 | 9 | * This input has a default validation strategy of plaintext (which can be removed after construction) |
10 | 10 | */ |
11 | -class EE_Text_Input extends EE_Form_Input_Base{ |
|
11 | +class EE_Text_Input extends EE_Form_Input_Base { |
|
12 | 12 | |
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @param array $options |
16 | 16 | */ |
17 | - public function __construct($options = array()){ |
|
17 | + public function __construct($options = array()) { |
|
18 | 18 | $this->_set_display_strategy(new EE_Text_Input_Display_Strategy()); |
19 | 19 | $this->_set_normalization_strategy(new EE_Text_Normalization()); |
20 | 20 | parent::__construct($options); |
21 | 21 | //if the input hasn't specifically mentioned a more lenient validation strategy, |
22 | 22 | //apply plaintext validation strategy |
23 | - if( ! $this->has_validation_strategy( |
|
23 | + if ( ! $this->has_validation_strategy( |
|
24 | 24 | array( |
25 | 25 | 'EE_Full_HTML_Validation_Strategy', |
26 | 26 | 'EE_Simple_HTML_Validation_Strategy' |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | ) { |
30 | 30 | //by default we use the plaintext validation. If you want something else, |
31 | 31 | //just remove it after the input is constructed :P using EE_Form_Input_Base::remove_validation_strategy() |
32 | - $this->_add_validation_strategy( new EE_Plaintext_Validation_Strategy() ); |
|
32 | + $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 |
@@ -22,7 +22,6 @@ discard block |
||
22 | 22 | * for displaying and processing a typical form. |
23 | 23 | * allow your form to integrate with other systems that utilize the |
24 | 24 | * \EventEspresso\core\libraries\form_sections\form_handlers\FormInterface interface |
25 | - |
|
26 | 25 | * |
27 | 26 | *@package Event Espresso |
28 | 27 | * @author Brent Christensen |
@@ -122,7 +121,6 @@ discard block |
||
122 | 121 | |
123 | 122 | /** |
124 | 123 | * Form constructor. |
125 | - |
|
126 | 124 | * |
127 | 125 | *@param string $form_name |
128 | 126 | * @param string $admin_name |
@@ -171,7 +169,7 @@ discard block |
||
171 | 169 | * @throws \LogicException |
172 | 170 | */ |
173 | 171 | public function form( $for_display = false ) { |
174 | - if ( ! $this->formIsValid() ) { |
|
172 | + if ( ! $this->formIsValid() ) { |
|
175 | 173 | return null; |
176 | 174 | } |
177 | 175 | if ( $for_display ) { |
@@ -194,14 +192,14 @@ discard block |
||
194 | 192 | * @throws LogicException |
195 | 193 | */ |
196 | 194 | public function formIsValid() { |
197 | - if ( ! $this->form instanceof \EE_Form_Section_Proper ) { |
|
195 | + if ( ! $this->form instanceof \EE_Form_Section_Proper ) { |
|
198 | 196 | static $generated = false; |
199 | 197 | if ( ! $generated ) { |
200 | 198 | $generated = true; |
201 | 199 | $form = $this->generate(); |
202 | - if ( $form instanceof \EE_Form_Section_Proper) { |
|
203 | - $this->setForm($form); |
|
204 | - } |
|
200 | + if ( $form instanceof \EE_Form_Section_Proper) { |
|
201 | + $this->setForm($form); |
|
202 | + } |
|
205 | 203 | } |
206 | 204 | return $this->verifyForm(); |
207 | 205 | } |
@@ -571,7 +569,7 @@ discard block |
||
571 | 569 | * @throws \EE_Error |
572 | 570 | */ |
573 | 571 | public function display() { |
574 | - $form_html = apply_filters( |
|
572 | + $form_html = apply_filters( |
|
575 | 573 | 'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__before_form', |
576 | 574 | '' |
577 | 575 | ); |
@@ -610,11 +608,11 @@ discard block |
||
610 | 608 | */ |
611 | 609 | public function process( $submitted_form_data = array() ) { |
612 | 610 | if ( ! $this->form()->was_submitted( $submitted_form_data ) ) { |
613 | - throw new InvalidFormSubmissionException( $this->form_name ); |
|
611 | + throw new InvalidFormSubmissionException( $this->form_name ); |
|
614 | 612 | } |
615 | - $this->form( true )->receive_form_submission( $submitted_form_data ); |
|
613 | + $this->form( true )->receive_form_submission( $submitted_form_data ); |
|
616 | 614 | if ( ! $this->form()->is_valid() ) { |
617 | - throw new InvalidFormSubmissionException( |
|
615 | + throw new InvalidFormSubmissionException( |
|
618 | 616 | $this->form_name, |
619 | 617 | sprintf( |
620 | 618 | __( |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | use EventEspresso\core\exceptions\InvalidDataTypeException; |
11 | 11 | use EventEspresso\core\exceptions\InvalidFormSubmissionException; |
12 | 12 | |
13 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
14 | - exit( 'No direct script access allowed' ); |
|
13 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
14 | + exit('No direct script access allowed'); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @author Brent Christensen |
29 | 29 | * @since 4.9.0 |
30 | 30 | */ |
31 | -abstract class FormHandler implements FormHandlerInterface{ |
|
31 | +abstract class FormHandler implements FormHandlerInterface { |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * will add opening and closing HTML form tags as well as a submit button |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | $form_config = FormHandler::ADD_FORM_TAGS_AND_SUBMIT, |
140 | 140 | \EE_Registry $registry |
141 | 141 | ) { |
142 | - $this->setFormName( $form_name ); |
|
143 | - $this->setAdminName( $admin_name ); |
|
144 | - $this->setSlug( $slug ); |
|
145 | - $this->setFormAction( $form_action ); |
|
146 | - $this->setFormConfig( $form_config ); |
|
147 | - $this->setSubmitBtnText( __( 'Submit', 'event_espresso' ) ); |
|
142 | + $this->setFormName($form_name); |
|
143 | + $this->setAdminName($admin_name); |
|
144 | + $this->setSlug($slug); |
|
145 | + $this->setFormAction($form_action); |
|
146 | + $this->setFormConfig($form_config); |
|
147 | + $this->setSubmitBtnText(__('Submit', 'event_espresso')); |
|
148 | 148 | $this->registry = $registry; |
149 | 149 | } |
150 | 150 | |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | * @throws \EE_Error |
171 | 171 | * @throws \LogicException |
172 | 172 | */ |
173 | - public function form( $for_display = false ) { |
|
174 | - if ( ! $this->formIsValid() ) { |
|
173 | + public function form($for_display = false) { |
|
174 | + if ( ! $this->formIsValid()) { |
|
175 | 175 | return null; |
176 | 176 | } |
177 | - if ( $for_display ) { |
|
177 | + if ($for_display) { |
|
178 | 178 | $form_config = $this->formConfig(); |
179 | 179 | if ( |
180 | 180 | $form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT |
@@ -194,12 +194,12 @@ discard block |
||
194 | 194 | * @throws LogicException |
195 | 195 | */ |
196 | 196 | public function formIsValid() { |
197 | - if ( ! $this->form instanceof \EE_Form_Section_Proper ) { |
|
197 | + if ( ! $this->form instanceof \EE_Form_Section_Proper) { |
|
198 | 198 | static $generated = false; |
199 | - if ( ! $generated ) { |
|
199 | + if ( ! $generated) { |
|
200 | 200 | $generated = true; |
201 | 201 | $form = $this->generate(); |
202 | - if ( $form instanceof \EE_Form_Section_Proper) { |
|
202 | + if ($form instanceof \EE_Form_Section_Proper) { |
|
203 | 203 | $this->setForm($form); |
204 | 204 | } |
205 | 205 | } |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | * @throws LogicException |
216 | 216 | */ |
217 | 217 | public function verifyForm() { |
218 | - if ( $this->form instanceof \EE_Form_Section_Proper ) { |
|
218 | + if ($this->form instanceof \EE_Form_Section_Proper) { |
|
219 | 219 | return true; |
220 | 220 | } |
221 | 221 | throw new LogicException( |
222 | 222 | sprintf( |
223 | - __( 'The "%1$s" form is invalid or missing', 'event_espresso' ), |
|
223 | + __('The "%1$s" form is invalid or missing', 'event_espresso'), |
|
224 | 224 | $this->form_name |
225 | 225 | ) |
226 | 226 | ); |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | /** |
232 | 232 | * @param \EE_Form_Section_Proper $form |
233 | 233 | */ |
234 | - public function setForm( \EE_Form_Section_Proper $form ) { |
|
234 | + public function setForm(\EE_Form_Section_Proper $form) { |
|
235 | 235 | $this->form = $form; |
236 | 236 | } |
237 | 237 | |
@@ -249,8 +249,8 @@ discard block |
||
249 | 249 | /** |
250 | 250 | * @param boolean $displayable |
251 | 251 | */ |
252 | - public function setDisplayable( $displayable = false ) { |
|
253 | - $this->displayable = filter_var( $displayable, FILTER_VALIDATE_BOOLEAN ); |
|
252 | + public function setDisplayable($displayable = false) { |
|
253 | + $this->displayable = filter_var($displayable, FILTER_VALIDATE_BOOLEAN); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | * @param string $form_name |
271 | 271 | * @throws InvalidDataTypeException |
272 | 272 | */ |
273 | - public function setFormName( $form_name ) { |
|
274 | - if ( ! is_string( $form_name ) ) { |
|
275 | - throw new InvalidDataTypeException( '$form_name', $form_name, 'string' ); |
|
273 | + public function setFormName($form_name) { |
|
274 | + if ( ! is_string($form_name)) { |
|
275 | + throw new InvalidDataTypeException('$form_name', $form_name, 'string'); |
|
276 | 276 | } |
277 | 277 | $this->form_name = $form_name; |
278 | 278 | } |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | * @param string $admin_name |
295 | 295 | * @throws InvalidDataTypeException |
296 | 296 | */ |
297 | - public function setAdminName( $admin_name ) { |
|
298 | - if ( ! is_string( $admin_name ) ) { |
|
299 | - throw new InvalidDataTypeException( '$admin_name', $admin_name, 'string' ); |
|
297 | + public function setAdminName($admin_name) { |
|
298 | + if ( ! is_string($admin_name)) { |
|
299 | + throw new InvalidDataTypeException('$admin_name', $admin_name, 'string'); |
|
300 | 300 | } |
301 | 301 | $this->admin_name = $admin_name; |
302 | 302 | } |
@@ -318,9 +318,9 @@ discard block |
||
318 | 318 | * @param string $slug |
319 | 319 | * @throws InvalidDataTypeException |
320 | 320 | */ |
321 | - public function setSlug( $slug ) { |
|
322 | - if ( ! is_string( $slug ) ) { |
|
323 | - throw new InvalidDataTypeException( '$slug', $slug, 'string' ); |
|
321 | + public function setSlug($slug) { |
|
322 | + if ( ! is_string($slug)) { |
|
323 | + throw new InvalidDataTypeException('$slug', $slug, 'string'); |
|
324 | 324 | } |
325 | 325 | $this->slug = $slug; |
326 | 326 | } |
@@ -339,13 +339,13 @@ discard block |
||
339 | 339 | /** |
340 | 340 | * @param string $submit_btn_text |
341 | 341 | */ |
342 | - public function setSubmitBtnText( $submit_btn_text ) { |
|
343 | - if ( ! is_string( $submit_btn_text ) ) { |
|
344 | - throw new InvalidDataTypeException( '$submit_btn_text', $submit_btn_text, 'string' ); |
|
342 | + public function setSubmitBtnText($submit_btn_text) { |
|
343 | + if ( ! is_string($submit_btn_text)) { |
|
344 | + throw new InvalidDataTypeException('$submit_btn_text', $submit_btn_text, 'string'); |
|
345 | 345 | } |
346 | - if ( empty( $submit_btn_text ) ) { |
|
346 | + if (empty($submit_btn_text)) { |
|
347 | 347 | throw new InvalidArgumentException( |
348 | - __( 'Can not set Submit button text because an empty string was provided.', 'event_espresso' ) |
|
348 | + __('Can not set Submit button text because an empty string was provided.', 'event_espresso') |
|
349 | 349 | ); |
350 | 350 | } |
351 | 351 | $this->submit_btn_text = $submit_btn_text; |
@@ -357,8 +357,8 @@ discard block |
||
357 | 357 | * @return string |
358 | 358 | */ |
359 | 359 | public function formAction() { |
360 | - return ! empty( $this->form_args ) |
|
361 | - ? add_query_arg( $this->form_args, $this->form_action ) |
|
360 | + return ! empty($this->form_args) |
|
361 | + ? add_query_arg($this->form_args, $this->form_action) |
|
362 | 362 | : $this->form_action; |
363 | 363 | } |
364 | 364 | |
@@ -368,9 +368,9 @@ discard block |
||
368 | 368 | * @param string $form_action |
369 | 369 | * @throws InvalidDataTypeException |
370 | 370 | */ |
371 | - public function setFormAction( $form_action ) { |
|
372 | - if ( ! is_string( $form_action ) ) { |
|
373 | - throw new InvalidDataTypeException( '$form_action', $form_action, 'string' ); |
|
371 | + public function setFormAction($form_action) { |
|
372 | + if ( ! is_string($form_action)) { |
|
373 | + throw new InvalidDataTypeException('$form_action', $form_action, 'string'); |
|
374 | 374 | } |
375 | 375 | $this->form_action = $form_action; |
376 | 376 | } |
@@ -382,20 +382,20 @@ discard block |
||
382 | 382 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
383 | 383 | * @throws \InvalidArgumentException |
384 | 384 | */ |
385 | - public function addFormActionArgs( $form_args = array() ) { |
|
386 | - if ( is_object( $form_args ) ) { |
|
385 | + public function addFormActionArgs($form_args = array()) { |
|
386 | + if (is_object($form_args)) { |
|
387 | 387 | throw new InvalidDataTypeException( |
388 | 388 | '$form_args', |
389 | 389 | $form_args, |
390 | 390 | 'anything other than an object was expected.' |
391 | 391 | ); |
392 | 392 | } |
393 | - if ( empty( $form_args ) ) { |
|
393 | + if (empty($form_args)) { |
|
394 | 394 | throw new InvalidArgumentException( |
395 | - __( 'The redirect arguments can not be an empty array.', 'event_espresso' ) |
|
395 | + __('The redirect arguments can not be an empty array.', 'event_espresso') |
|
396 | 396 | ); |
397 | 397 | } |
398 | - $this->form_args = array_merge( $this->form_args, $form_args ); |
|
398 | + $this->form_args = array_merge($this->form_args, $form_args); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * @param string $form_config |
414 | 414 | * @throws DomainException |
415 | 415 | */ |
416 | - public function setFormConfig( $form_config ) { |
|
416 | + public function setFormConfig($form_config) { |
|
417 | 417 | if ( |
418 | 418 | ! in_array( |
419 | 419 | $form_config, |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | ) { |
428 | 428 | throw new DomainException( |
429 | 429 | sprintf( |
430 | - __( '"%1$s" is not a valid value for the form config. Please use one of the class constants on \EventEspresso\core\libraries\form_sections\form_handlers\Form', 'event_espresso' ), |
|
430 | + __('"%1$s" is not a valid value for the form config. Please use one of the class constants on \EventEspresso\core\libraries\form_sections\form_handlers\Form', 'event_espresso'), |
|
431 | 431 | $form_config |
432 | 432 | ) |
433 | 433 | ); |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * @return boolean |
448 | 448 | */ |
449 | 449 | public function initialize() { |
450 | - $this->form_has_errors = \EE_Error::has_error( true ); |
|
450 | + $this->form_has_errors = \EE_Error::has_error(true); |
|
451 | 451 | return true; |
452 | 452 | } |
453 | 453 | |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | * @throws \EE_Error |
462 | 462 | */ |
463 | 463 | public function enqueueStylesAndScripts() { |
464 | - $this->form( false )->enqueue_js(); |
|
464 | + $this->form(false)->enqueue_js(); |
|
465 | 465 | |
466 | 466 | } |
467 | 467 | |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * |
473 | 473 | * @return EE_Form_Section_Proper |
474 | 474 | */ |
475 | - abstract public function generate() ; |
|
475 | + abstract public function generate(); |
|
476 | 476 | |
477 | 477 | |
478 | 478 | |
@@ -482,15 +482,15 @@ discard block |
||
482 | 482 | * @param string $text |
483 | 483 | * @return \EE_Submit_Input |
484 | 484 | */ |
485 | - public function generateSubmitButton( $text = '' ) { |
|
486 | - $text = ! empty( $text ) ? $text : $this->submitBtnText(); |
|
485 | + public function generateSubmitButton($text = '') { |
|
486 | + $text = ! empty($text) ? $text : $this->submitBtnText(); |
|
487 | 487 | return new EE_Submit_Input( |
488 | 488 | array( |
489 | - 'html_name' => 'ee-form-submit-' . $this->slug(), |
|
490 | - 'html_id' => 'ee-form-submit-' . $this->slug(), |
|
489 | + 'html_name' => 'ee-form-submit-'.$this->slug(), |
|
490 | + 'html_id' => 'ee-form-submit-'.$this->slug(), |
|
491 | 491 | 'html_class' => 'ee-form-submit', |
492 | 492 | 'html_label' => ' ', |
493 | - 'other_html_attributes' => ' rel="' . $this->slug() . '"', |
|
493 | + 'other_html_attributes' => ' rel="'.$this->slug().'"', |
|
494 | 494 | 'default' => $text |
495 | 495 | ) |
496 | 496 | ); |
@@ -506,12 +506,12 @@ discard block |
||
506 | 506 | * @throws \LogicException |
507 | 507 | * @throws \EE_Error |
508 | 508 | */ |
509 | - public function appendSubmitButton( $text = '' ) { |
|
510 | - if ( $this->form->subsection_exists( $this->slug() . '-submit-btn' ) ) { |
|
509 | + public function appendSubmitButton($text = '') { |
|
510 | + if ($this->form->subsection_exists($this->slug().'-submit-btn')) { |
|
511 | 511 | return; |
512 | 512 | } |
513 | 513 | $this->form->add_subsections( |
514 | - array( $this->slug() . '-submit-btn' => $this->generateSubmitButton( $text ) ), |
|
514 | + array($this->slug().'-submit-btn' => $this->generateSubmitButton($text)), |
|
515 | 515 | null, |
516 | 516 | false |
517 | 517 | ); |
@@ -525,18 +525,18 @@ discard block |
||
525 | 525 | * @param string $text |
526 | 526 | * @return \EE_Submit_Input |
527 | 527 | */ |
528 | - public function generateCancelButton( $text = '' ) { |
|
528 | + public function generateCancelButton($text = '') { |
|
529 | 529 | $cancel_button = new EE_Submit_Input( |
530 | 530 | array( |
531 | - 'html_name' => 'ee-form-submit-' . $this->slug(), // YES! Same name as submit !!! |
|
532 | - 'html_id' => 'ee-cancel-form-' . $this->slug(), |
|
531 | + 'html_name' => 'ee-form-submit-'.$this->slug(), // YES! Same name as submit !!! |
|
532 | + 'html_id' => 'ee-cancel-form-'.$this->slug(), |
|
533 | 533 | 'html_class' => 'ee-cancel-form', |
534 | 534 | 'html_label' => ' ', |
535 | - 'other_html_attributes' => ' rel="' . $this->slug() . '"', |
|
536 | - 'default' => ! empty( $text ) ? $text : __( 'Cancel', 'event_espresso' ) |
|
535 | + 'other_html_attributes' => ' rel="'.$this->slug().'"', |
|
536 | + 'default' => ! empty($text) ? $text : __('Cancel', 'event_espresso') |
|
537 | 537 | ) |
538 | 538 | ); |
539 | - $cancel_button->set_button_css_attributes( false ); |
|
539 | + $cancel_button->set_button_css_attributes(false); |
|
540 | 540 | return $cancel_button; |
541 | 541 | } |
542 | 542 | |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | $this->form->add_subsections( |
553 | 553 | array( |
554 | 554 | 'clear-submit-btn-float' => new \EE_Form_Section_HTML( |
555 | - EEH_HTML::div( '', '', 'clear-float' ) . EEH_HTML::divx() |
|
555 | + EEH_HTML::div('', '', 'clear-float').EEH_HTML::divx() |
|
556 | 556 | ) |
557 | 557 | ), |
558 | 558 | null, |
@@ -580,9 +580,9 @@ discard block |
||
580 | 580 | $form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT |
581 | 581 | || $form_config === FormHandler::ADD_FORM_TAGS_ONLY |
582 | 582 | ) { |
583 | - $form_html .= $this->form()->form_open( $this->formAction() ); |
|
583 | + $form_html .= $this->form()->form_open($this->formAction()); |
|
584 | 584 | } |
585 | - $form_html .= $this->form( true )->get_html( $this->form_has_errors ); |
|
585 | + $form_html .= $this->form(true)->get_html($this->form_has_errors); |
|
586 | 586 | if ( |
587 | 587 | $form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT |
588 | 588 | || $form_config === FormHandler::ADD_FORM_TAGS_ONLY |
@@ -608,12 +608,12 @@ discard block |
||
608 | 608 | * @throws \LogicException |
609 | 609 | * @throws InvalidFormSubmissionException |
610 | 610 | */ |
611 | - public function process( $submitted_form_data = array() ) { |
|
612 | - if ( ! $this->form()->was_submitted( $submitted_form_data ) ) { |
|
613 | - throw new InvalidFormSubmissionException( $this->form_name ); |
|
611 | + public function process($submitted_form_data = array()) { |
|
612 | + if ( ! $this->form()->was_submitted($submitted_form_data)) { |
|
613 | + throw new InvalidFormSubmissionException($this->form_name); |
|
614 | 614 | } |
615 | - $this->form( true )->receive_form_submission( $submitted_form_data ); |
|
616 | - if ( ! $this->form()->is_valid() ) { |
|
615 | + $this->form(true)->receive_form_submission($submitted_form_data); |
|
616 | + if ( ! $this->form()->is_valid()) { |
|
617 | 617 | throw new InvalidFormSubmissionException( |
618 | 618 | $this->form_name, |
619 | 619 | sprintf( |
@@ -2193,7 +2193,7 @@ discard block |
||
2193 | 2193 | $table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
2194 | 2194 | // get country code from organization settings or use default |
2195 | 2195 | $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
2196 | - && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2196 | + && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2197 | 2197 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2198 | 2198 | : ''; |
2199 | 2199 | // but override if requested |
@@ -2503,12 +2503,12 @@ discard block |
||
2503 | 2503 | public $help_tour_activation; |
2504 | 2504 | |
2505 | 2505 | /** |
2506 | - * adds extra layer of encoding to session data to prevent serialization errors |
|
2507 | - * but is incompatible with some server configuration errors |
|
2508 | - * if you get "500 internal server errors" during registration, try turning this on |
|
2509 | - * if you get PHP fatal errors regarding base 64 methods not defined, then turn this off |
|
2510 | - * |
|
2511 | - * @var boolean $encode_session_data |
|
2506 | + * adds extra layer of encoding to session data to prevent serialization errors |
|
2507 | + * but is incompatible with some server configuration errors |
|
2508 | + * if you get "500 internal server errors" during registration, try turning this on |
|
2509 | + * if you get PHP fatal errors regarding base 64 methods not defined, then turn this off |
|
2510 | + * |
|
2511 | + * @var boolean $encode_session_data |
|
2512 | 2512 | */ |
2513 | 2513 | private $encode_session_data = false; |
2514 | 2514 | |
@@ -2573,21 +2573,21 @@ discard block |
||
2573 | 2573 | |
2574 | 2574 | |
2575 | 2575 | |
2576 | - /** |
|
2577 | - * @return boolean |
|
2578 | - */ |
|
2579 | - public function encode_session_data() { |
|
2580 | - return filter_var( $this->encode_session_data, FILTER_VALIDATE_BOOLEAN ); |
|
2581 | - } |
|
2576 | + /** |
|
2577 | + * @return boolean |
|
2578 | + */ |
|
2579 | + public function encode_session_data() { |
|
2580 | + return filter_var( $this->encode_session_data, FILTER_VALIDATE_BOOLEAN ); |
|
2581 | + } |
|
2582 | 2582 | |
2583 | 2583 | |
2584 | 2584 | |
2585 | - /** |
|
2586 | - * @param boolean $encode_session_data |
|
2587 | - */ |
|
2588 | - public function set_encode_session_data( $encode_session_data ) { |
|
2589 | - $this->encode_session_data = filter_var( $encode_session_data, FILTER_VALIDATE_BOOLEAN ); |
|
2590 | - } |
|
2585 | + /** |
|
2586 | + * @param boolean $encode_session_data |
|
2587 | + */ |
|
2588 | + public function set_encode_session_data( $encode_session_data ) { |
|
2589 | + $this->encode_session_data = filter_var( $encode_session_data, FILTER_VALIDATE_BOOLEAN ); |
|
2590 | + } |
|
2591 | 2591 | |
2592 | 2592 | |
2593 | 2593 | |
@@ -2963,8 +2963,8 @@ discard block |
||
2963 | 2963 | */ |
2964 | 2964 | public function max_input_vars_limit_check( $input_count = 0 ) { |
2965 | 2965 | if ( ! empty( $this->php->max_input_vars ) |
2966 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2967 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2966 | + && ( $input_count >= $this->php->max_input_vars ) |
|
2967 | + && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2968 | 2968 | ) { |
2969 | 2969 | return sprintf( |
2970 | 2970 | __( |
@@ -3008,22 +3008,22 @@ discard block |
||
3008 | 3008 | class EE_Tax_Config extends EE_Config_Base |
3009 | 3009 | { |
3010 | 3010 | |
3011 | - /* |
|
3011 | + /* |
|
3012 | 3012 | * flag to indicate whether or not to display ticket prices with the taxes included |
3013 | 3013 | * |
3014 | 3014 | * @var boolean $prices_displayed_including_taxes |
3015 | 3015 | */ |
3016 | - public $prices_displayed_including_taxes; |
|
3016 | + public $prices_displayed_including_taxes; |
|
3017 | 3017 | |
3018 | 3018 | |
3019 | 3019 | |
3020 | - /** |
|
3021 | - * class constructor |
|
3022 | - */ |
|
3023 | - public function __construct() |
|
3024 | - { |
|
3025 | - $this->prices_displayed_including_taxes = true; |
|
3026 | - } |
|
3020 | + /** |
|
3021 | + * class constructor |
|
3022 | + */ |
|
3023 | + public function __construct() |
|
3024 | + { |
|
3025 | + $this->prices_displayed_including_taxes = true; |
|
3026 | + } |
|
3027 | 3027 | } |
3028 | 3028 | |
3029 | 3029 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -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; |
@@ -148,20 +148,20 @@ discard block |
||
148 | 148 | * site was put into maintenance mode) |
149 | 149 | * @return EE_Config |
150 | 150 | */ |
151 | - public static function reset( $hard_reset = false, $reinstantiate = true ) { |
|
152 | - if ( $hard_reset ) { |
|
151 | + public static function reset($hard_reset = false, $reinstantiate = true) { |
|
152 | + if ($hard_reset) { |
|
153 | 153 | self::$_instance->_addon_option_names = array(); |
154 | 154 | self::$_instance->_initialize_config(); |
155 | 155 | self::$_instance->update_espresso_config(); |
156 | 156 | } |
157 | - if ( self::$_instance instanceof EE_Config ) { |
|
157 | + if (self::$_instance instanceof EE_Config) { |
|
158 | 158 | self::$_instance->update_addon_option_names(); |
159 | 159 | } |
160 | 160 | self::$_instance = null; |
161 | 161 | //we don't need to reset the static properties imo because those should |
162 | 162 | //only change when a module is added or removed. Currently we don't |
163 | 163 | //support removing a module during a request when it previously existed |
164 | - if ( $reinstantiate ) { |
|
164 | + if ($reinstantiate) { |
|
165 | 165 | return self::instance(); |
166 | 166 | } else { |
167 | 167 | return null; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @access private |
177 | 177 | */ |
178 | 178 | private function __construct() { |
179 | - do_action( 'AHEE__EE_Config__construct__begin', $this ); |
|
179 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
180 | 180 | // setup empty config classes |
181 | 181 | $this->_initialize_config(); |
182 | 182 | // load existing EE site settings |
@@ -186,17 +186,17 @@ discard block |
||
186 | 186 | // register shortcodes and modules |
187 | 187 | add_action( |
188 | 188 | 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
189 | - array( $this, 'register_shortcodes_and_modules' ), |
|
189 | + array($this, 'register_shortcodes_and_modules'), |
|
190 | 190 | 999 |
191 | 191 | ); |
192 | 192 | // initialize shortcodes and modules |
193 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) ); |
|
193 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
194 | 194 | // register widgets |
195 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
195 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
196 | 196 | // shutdown |
197 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
197 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
198 | 198 | // construct__end hook |
199 | - do_action( 'AHEE__EE_Config__construct__end', $this ); |
|
199 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
200 | 200 | // hardcoded hack |
201 | 201 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
202 | 202 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @return string current theme set. |
210 | 210 | */ |
211 | 211 | public static function get_current_theme() { |
212 | - return isset( self::$_instance->template_settings->current_espresso_theme ) |
|
212 | + return isset(self::$_instance->template_settings->current_espresso_theme) |
|
213 | 213 | ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
214 | 214 | } |
215 | 215 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | private function _initialize_config() { |
225 | 225 | EE_Config::trim_log(); |
226 | 226 | //set defaults |
227 | - $this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() ); |
|
227 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
228 | 228 | $this->addons = new stdClass(); |
229 | 229 | // set _module_route_map |
230 | 230 | EE_Config::$_module_route_map = array(); |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | */ |
245 | 245 | private function _load_core_config() { |
246 | 246 | // load_core_config__start hook |
247 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
247 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
248 | 248 | $espresso_config = $this->get_espresso_config(); |
249 | - foreach ( $espresso_config as $config => $settings ) { |
|
249 | + foreach ($espresso_config as $config => $settings) { |
|
250 | 250 | // load_core_config__start hook |
251 | 251 | $settings = apply_filters( |
252 | 252 | 'FHEE__EE_Config___load_core_config__config_settings', |
@@ -254,22 +254,22 @@ discard block |
||
254 | 254 | $config, |
255 | 255 | $this |
256 | 256 | ); |
257 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
258 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
257 | + if (is_object($settings) && property_exists($this, $config)) { |
|
258 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
259 | 259 | //call configs populate method to ensure any defaults are set for empty values. |
260 | - if ( method_exists( $settings, 'populate' ) ) { |
|
260 | + if (method_exists($settings, 'populate')) { |
|
261 | 261 | $this->{$config}->populate(); |
262 | 262 | } |
263 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
263 | + if (method_exists($settings, 'do_hooks')) { |
|
264 | 264 | $this->{$config}->do_hooks(); |
265 | 265 | } |
266 | 266 | } |
267 | 267 | } |
268 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) { |
|
268 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
269 | 269 | $this->update_espresso_config(); |
270 | 270 | } |
271 | 271 | // load_core_config__end hook |
272 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
272 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | |
@@ -284,23 +284,23 @@ discard block |
||
284 | 284 | $this->core = $this->core instanceof EE_Core_Config |
285 | 285 | ? $this->core |
286 | 286 | : new EE_Core_Config(); |
287 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
287 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
288 | 288 | $this->organization = $this->organization instanceof EE_Organization_Config |
289 | 289 | ? $this->organization |
290 | 290 | : new EE_Organization_Config(); |
291 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
291 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
292 | 292 | $this->currency = $this->currency instanceof EE_Currency_Config |
293 | 293 | ? $this->currency |
294 | 294 | : new EE_Currency_Config(); |
295 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
295 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
296 | 296 | $this->registration = $this->registration instanceof EE_Registration_Config |
297 | 297 | ? $this->registration |
298 | 298 | : new EE_Registration_Config(); |
299 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
299 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
300 | 300 | $this->admin = $this->admin instanceof EE_Admin_Config |
301 | 301 | ? $this->admin |
302 | 302 | : new EE_Admin_Config(); |
303 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
303 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
304 | 304 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
305 | 305 | ? $this->template_settings |
306 | 306 | : new EE_Template_Config(); |
@@ -311,19 +311,19 @@ discard block |
||
311 | 311 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
312 | 312 | ? $this->map_settings |
313 | 313 | : new EE_Map_Config(); |
314 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
314 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
315 | 315 | $this->environment = $this->environment instanceof EE_Environment_Config |
316 | 316 | ? $this->environment |
317 | 317 | : new EE_Environment_Config(); |
318 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
318 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
319 | 319 | $this->tax_settings = $this->tax_settings instanceof EE_Tax_Config |
320 | 320 | ? $this->tax_settings |
321 | 321 | : new EE_Tax_Config(); |
322 | - $this->tax_settings = apply_filters( 'FHEE__EE_Config___initialize_config__tax_settings', $this->tax_settings ); |
|
322 | + $this->tax_settings = apply_filters('FHEE__EE_Config___initialize_config__tax_settings', $this->tax_settings); |
|
323 | 323 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
324 | 324 | ? $this->gateway |
325 | 325 | : new EE_Gateway_Config(); |
326 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
326 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | // grab espresso configuration |
339 | 339 | return apply_filters( |
340 | 340 | 'FHEE__EE_Config__get_espresso_config__CFG', |
341 | - get_option( EE_Config::OPTION_NAME, array() ) |
|
341 | + get_option(EE_Config::OPTION_NAME, array()) |
|
342 | 342 | ); |
343 | 343 | } |
344 | 344 | |
@@ -352,12 +352,12 @@ discard block |
||
352 | 352 | * @param $old_value |
353 | 353 | * @param $value |
354 | 354 | */ |
355 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
355 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
356 | 356 | // make sure we're checking the ee config |
357 | - if ( $option === EE_Config::OPTION_NAME ) { |
|
357 | + if ($option === EE_Config::OPTION_NAME) { |
|
358 | 358 | // run a loose comparison of the old value against the new value for type and properties, |
359 | 359 | // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
360 | - if ( $value != $old_value ) { |
|
360 | + if ($value != $old_value) { |
|
361 | 361 | // if they are NOT the same, then remove the hook, |
362 | 362 | // which means the subsequent update results will be based solely on the update query results |
363 | 363 | // the reason we do this is because, as stated above, |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | // the string it sees in the db looks the same as the new one it has been passed!!! |
373 | 373 | // This results in the query returning an "affected rows" value of ZERO, |
374 | 374 | // which gets returned immediately by WP update_option and looks like an error. |
375 | - remove_action( 'update_option', array( $this, 'check_config_updated' ) ); |
|
375 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
376 | 376 | } |
377 | 377 | } |
378 | 378 | } |
@@ -386,11 +386,11 @@ discard block |
||
386 | 386 | */ |
387 | 387 | protected function _reset_espresso_addon_config() { |
388 | 388 | $this->_addon_option_names = array(); |
389 | - foreach ( $this->addons as $addon_name => $addon_config_obj ) { |
|
390 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
391 | - $config_class = get_class( $addon_config_obj ); |
|
392 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
393 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, false ); |
|
389 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
390 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
391 | + $config_class = get_class($addon_config_obj); |
|
392 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
393 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
394 | 394 | } |
395 | 395 | $this->addons->{$addon_name} = null; |
396 | 396 | } |
@@ -406,22 +406,22 @@ discard block |
||
406 | 406 | * @param bool $add_error |
407 | 407 | * @return bool |
408 | 408 | */ |
409 | - public function update_espresso_config( $add_success = false, $add_error = true ) { |
|
409 | + public function update_espresso_config($add_success = false, $add_error = true) { |
|
410 | 410 | // don't allow config updates during WP heartbeats |
411 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
411 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
412 | 412 | return false; |
413 | 413 | } |
414 | 414 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
415 | 415 | //$clone = clone( self::$_instance ); |
416 | 416 | //self::$_instance = NULL; |
417 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this ); |
|
417 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
418 | 418 | $this->_reset_espresso_addon_config(); |
419 | 419 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
420 | 420 | // but BEFORE the actual update occurs |
421 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
421 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
422 | 422 | // now update "ee_config" |
423 | - $saved = update_option( EE_Config::OPTION_NAME, $this ); |
|
424 | - EE_Config::log( EE_Config::OPTION_NAME ); |
|
423 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
424 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
425 | 425 | // if not saved... check if the hook we just added still exists; |
426 | 426 | // if it does, it means one of two things: |
427 | 427 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -432,17 +432,17 @@ discard block |
||
432 | 432 | // but just means no update occurred, so don't display an error to the user. |
433 | 433 | // BUT... if update_option returns FALSE, AND the hook is missing, |
434 | 434 | // then it means that something truly went wrong |
435 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved; |
|
435 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
436 | 436 | // remove our action since we don't want it in the system anymore |
437 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
438 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
437 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
438 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
439 | 439 | //self::$_instance = $clone; |
440 | 440 | //unset( $clone ); |
441 | 441 | // if config remains the same or was updated successfully |
442 | - if ( $saved ) { |
|
443 | - if ( $add_success ) { |
|
442 | + if ($saved) { |
|
443 | + if ($add_success) { |
|
444 | 444 | EE_Error::add_success( |
445 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
445 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
446 | 446 | __FILE__, |
447 | 447 | __FUNCTION__, |
448 | 448 | __LINE__ |
@@ -450,9 +450,9 @@ discard block |
||
450 | 450 | } |
451 | 451 | return true; |
452 | 452 | } else { |
453 | - if ( $add_error ) { |
|
453 | + if ($add_error) { |
|
454 | 454 | EE_Error::add_error( |
455 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
455 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
456 | 456 | __FILE__, |
457 | 457 | __FUNCTION__, |
458 | 458 | __LINE__ |
@@ -481,16 +481,16 @@ discard block |
||
481 | 481 | $name = '', |
482 | 482 | $config_class = '', |
483 | 483 | $config_obj = null, |
484 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
484 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
485 | 485 | $display_errors = true |
486 | 486 | ) { |
487 | 487 | try { |
488 | - foreach ( $tests_to_run as $test ) { |
|
489 | - switch ( $test ) { |
|
488 | + foreach ($tests_to_run as $test) { |
|
489 | + switch ($test) { |
|
490 | 490 | // TEST #1 : check that section was set |
491 | 491 | case 1 : |
492 | - if ( empty( $section ) ) { |
|
493 | - if ( $display_errors ) { |
|
492 | + if (empty($section)) { |
|
493 | + if ($display_errors) { |
|
494 | 494 | throw new EE_Error( |
495 | 495 | sprintf( |
496 | 496 | __( |
@@ -506,11 +506,11 @@ discard block |
||
506 | 506 | break; |
507 | 507 | // TEST #2 : check that settings section exists |
508 | 508 | case 2 : |
509 | - if ( ! isset( $this->{$section} ) ) { |
|
510 | - if ( $display_errors ) { |
|
509 | + if ( ! isset($this->{$section} )) { |
|
510 | + if ($display_errors) { |
|
511 | 511 | throw new EE_Error( |
512 | 512 | sprintf( |
513 | - __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
513 | + __('The "%s" configuration section does not exist.', 'event_espresso'), |
|
514 | 514 | $section |
515 | 515 | ) |
516 | 516 | ); |
@@ -521,9 +521,9 @@ discard block |
||
521 | 521 | // TEST #3 : check that section is the proper format |
522 | 522 | case 3 : |
523 | 523 | if ( |
524 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
524 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
525 | 525 | ) { |
526 | - if ( $display_errors ) { |
|
526 | + if ($display_errors) { |
|
527 | 527 | throw new EE_Error( |
528 | 528 | sprintf( |
529 | 529 | __( |
@@ -539,8 +539,8 @@ discard block |
||
539 | 539 | break; |
540 | 540 | // TEST #4 : check that config section name has been set |
541 | 541 | case 4 : |
542 | - if ( empty( $name ) ) { |
|
543 | - if ( $display_errors ) { |
|
542 | + if (empty($name)) { |
|
543 | + if ($display_errors) { |
|
544 | 544 | throw new EE_Error( |
545 | 545 | __( |
546 | 546 | 'No name has been provided for the specific configuration section.', |
@@ -553,8 +553,8 @@ discard block |
||
553 | 553 | break; |
554 | 554 | // TEST #5 : check that a config class name has been set |
555 | 555 | case 5 : |
556 | - if ( empty( $config_class ) ) { |
|
557 | - if ( $display_errors ) { |
|
556 | + if (empty($config_class)) { |
|
557 | + if ($display_errors) { |
|
558 | 558 | throw new EE_Error( |
559 | 559 | __( |
560 | 560 | 'No class name has been provided for the specific configuration section.', |
@@ -567,8 +567,8 @@ discard block |
||
567 | 567 | break; |
568 | 568 | // TEST #6 : verify config class is accessible |
569 | 569 | case 6 : |
570 | - if ( ! class_exists( $config_class ) ) { |
|
571 | - if ( $display_errors ) { |
|
570 | + if ( ! class_exists($config_class)) { |
|
571 | + if ($display_errors) { |
|
572 | 572 | throw new EE_Error( |
573 | 573 | sprintf( |
574 | 574 | __( |
@@ -584,11 +584,11 @@ discard block |
||
584 | 584 | break; |
585 | 585 | // TEST #7 : check that config has even been set |
586 | 586 | case 7 : |
587 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
588 | - if ( $display_errors ) { |
|
587 | + if ( ! isset($this->{$section}->{$name} )) { |
|
588 | + if ($display_errors) { |
|
589 | 589 | throw new EE_Error( |
590 | 590 | sprintf( |
591 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
591 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
592 | 592 | $section, |
593 | 593 | $name |
594 | 594 | ) |
@@ -597,13 +597,13 @@ discard block |
||
597 | 597 | return false; |
598 | 598 | } else { |
599 | 599 | // and make sure it's not serialized |
600 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
600 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
601 | 601 | } |
602 | 602 | break; |
603 | 603 | // TEST #8 : check that config is the requested type |
604 | 604 | case 8 : |
605 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
606 | - if ( $display_errors ) { |
|
605 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
606 | + if ($display_errors) { |
|
607 | 607 | throw new EE_Error( |
608 | 608 | sprintf( |
609 | 609 | __( |
@@ -621,12 +621,12 @@ discard block |
||
621 | 621 | break; |
622 | 622 | // TEST #9 : verify config object |
623 | 623 | case 9 : |
624 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
625 | - if ( $display_errors ) { |
|
624 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
625 | + if ($display_errors) { |
|
626 | 626 | throw new EE_Error( |
627 | 627 | sprintf( |
628 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
629 | - print_r( $config_obj, true ) |
|
628 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
629 | + print_r($config_obj, true) |
|
630 | 630 | ) |
631 | 631 | ); |
632 | 632 | } |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | break; |
636 | 636 | } |
637 | 637 | } |
638 | - } catch ( EE_Error $e ) { |
|
638 | + } catch (EE_Error $e) { |
|
639 | 639 | $e->get_error(); |
640 | 640 | } |
641 | 641 | // you have successfully run the gauntlet |
@@ -652,8 +652,8 @@ discard block |
||
652 | 652 | * @param string $name |
653 | 653 | * @return string |
654 | 654 | */ |
655 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
656 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
655 | + private function _generate_config_option_name($section = '', $name = '') { |
|
656 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | |
@@ -667,10 +667,10 @@ discard block |
||
667 | 667 | * @param string $name |
668 | 668 | * @return string |
669 | 669 | */ |
670 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
671 | - return ! empty( $config_class ) |
|
670 | + private function _set_config_class($config_class = '', $name = '') { |
|
671 | + return ! empty($config_class) |
|
672 | 672 | ? $config_class |
673 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
673 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | |
@@ -685,36 +685,36 @@ discard block |
||
685 | 685 | * @param EE_Config_Base $config_obj |
686 | 686 | * @return EE_Config_Base |
687 | 687 | */ |
688 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
688 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
689 | 689 | // ensure config class is set to something |
690 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
690 | + $config_class = $this->_set_config_class($config_class, $name); |
|
691 | 691 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
692 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
692 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
693 | 693 | return null; |
694 | 694 | } |
695 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
695 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
696 | 696 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
697 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
698 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
697 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
698 | + $this->_addon_option_names[$config_option_name] = $config_class; |
|
699 | 699 | $this->update_addon_option_names(); |
700 | 700 | } |
701 | 701 | // verify the incoming config object but suppress errors |
702 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
702 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
703 | 703 | $config_obj = new $config_class(); |
704 | 704 | } |
705 | - if ( get_option( $config_option_name ) ) { |
|
706 | - EE_Config::log( $config_option_name ); |
|
707 | - update_option( $config_option_name, $config_obj ); |
|
705 | + if (get_option($config_option_name)) { |
|
706 | + EE_Config::log($config_option_name); |
|
707 | + update_option($config_option_name, $config_obj); |
|
708 | 708 | $this->{$section}->{$name} = $config_obj; |
709 | 709 | return $this->{$section}->{$name}; |
710 | 710 | } else { |
711 | 711 | // create a wp-option for this config |
712 | - if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) { |
|
713 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
712 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
713 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
714 | 714 | return $this->{$section}->{$name}; |
715 | 715 | } else { |
716 | 716 | EE_Error::add_error( |
717 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
717 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
718 | 718 | __FILE__, |
719 | 719 | __FUNCTION__, |
720 | 720 | __LINE__ |
@@ -737,46 +737,46 @@ discard block |
||
737 | 737 | * @param bool $throw_errors |
738 | 738 | * @return bool |
739 | 739 | */ |
740 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
740 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
741 | 741 | // don't allow config updates during WP heartbeats |
742 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
742 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
743 | 743 | return false; |
744 | 744 | } |
745 | - $config_obj = maybe_unserialize( $config_obj ); |
|
745 | + $config_obj = maybe_unserialize($config_obj); |
|
746 | 746 | // get class name of the incoming object |
747 | - $config_class = get_class( $config_obj ); |
|
747 | + $config_class = get_class($config_obj); |
|
748 | 748 | // run tests 1-5 and 9 to verify config |
749 | 749 | if ( ! $this->_verify_config_params( |
750 | 750 | $section, |
751 | 751 | $name, |
752 | 752 | $config_class, |
753 | 753 | $config_obj, |
754 | - array( 1, 2, 3, 4, 7, 9 ) |
|
754 | + array(1, 2, 3, 4, 7, 9) |
|
755 | 755 | ) |
756 | 756 | ) { |
757 | 757 | return false; |
758 | 758 | } |
759 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
759 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
760 | 760 | // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
761 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
761 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
762 | 762 | // save new config to db |
763 | - if( $this->set_config( $section, $name, $config_class, $config_obj ) ) { |
|
763 | + if ($this->set_config($section, $name, $config_class, $config_obj)) { |
|
764 | 764 | return true; |
765 | 765 | } |
766 | 766 | } else { |
767 | 767 | // first check if the record already exists |
768 | - $existing_config = get_option( $config_option_name ); |
|
769 | - $config_obj = serialize( $config_obj ); |
|
768 | + $existing_config = get_option($config_option_name); |
|
769 | + $config_obj = serialize($config_obj); |
|
770 | 770 | // just return if db record is already up to date (NOT type safe comparison) |
771 | - if ( $existing_config == $config_obj ) { |
|
771 | + if ($existing_config == $config_obj) { |
|
772 | 772 | $this->{$section}->{$name} = $config_obj; |
773 | 773 | return true; |
774 | - } else if ( update_option( $config_option_name, $config_obj ) ) { |
|
775 | - EE_Config::log( $config_option_name ); |
|
774 | + } else if (update_option($config_option_name, $config_obj)) { |
|
775 | + EE_Config::log($config_option_name); |
|
776 | 776 | // update wp-option for this config class |
777 | 777 | $this->{$section}->{$name} = $config_obj; |
778 | 778 | return true; |
779 | - } elseif ( $throw_errors ) { |
|
779 | + } elseif ($throw_errors) { |
|
780 | 780 | EE_Error::add_error( |
781 | 781 | sprintf( |
782 | 782 | __( |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | 'event_espresso' |
785 | 785 | ), |
786 | 786 | $config_class, |
787 | - 'EE_Config->' . $section . '->' . $name |
|
787 | + 'EE_Config->'.$section.'->'.$name |
|
788 | 788 | ), |
789 | 789 | __FILE__, |
790 | 790 | __FUNCTION__, |
@@ -806,34 +806,34 @@ discard block |
||
806 | 806 | * @param string $config_class |
807 | 807 | * @return mixed EE_Config_Base | NULL |
808 | 808 | */ |
809 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
809 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
810 | 810 | // ensure config class is set to something |
811 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
811 | + $config_class = $this->_set_config_class($config_class, $name); |
|
812 | 812 | // run tests 1-4, 6 and 7 to verify that all params have been set |
813 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
813 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
814 | 814 | return null; |
815 | 815 | } |
816 | 816 | // now test if the requested config object exists, but suppress errors |
817 | - if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) { |
|
817 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
818 | 818 | // config already exists, so pass it back |
819 | 819 | return $this->{$section}->{$name}; |
820 | 820 | } |
821 | 821 | // load config option from db if it exists |
822 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) ); |
|
822 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
823 | 823 | // verify the newly retrieved config object, but suppress errors |
824 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
824 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
825 | 825 | // config is good, so set it and pass it back |
826 | 826 | $this->{$section}->{$name} = $config_obj; |
827 | 827 | return $this->{$section}->{$name}; |
828 | 828 | } |
829 | 829 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
830 | - $config_obj = $this->set_config( $section, $name, $config_class ); |
|
830 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
831 | 831 | // verify the newly created config object |
832 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) { |
|
832 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
833 | 833 | return $this->{$section}->{$name}; |
834 | 834 | } else { |
835 | 835 | EE_Error::add_error( |
836 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
836 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
837 | 837 | __FILE__, |
838 | 838 | __FUNCTION__, |
839 | 839 | __LINE__ |
@@ -851,11 +851,11 @@ discard block |
||
851 | 851 | * @param string $config_option_name |
852 | 852 | * @return mixed EE_Config_Base | FALSE |
853 | 853 | */ |
854 | - public function get_config_option( $config_option_name = '' ) { |
|
854 | + public function get_config_option($config_option_name = '') { |
|
855 | 855 | // retrieve the wp-option for this config class. |
856 | - $config_option = maybe_unserialize( get_option( $config_option_name, array() ) ); |
|
857 | - if ( empty( $config_option ) ) { |
|
858 | - EE_Config::log( $config_option_name . '-NOT-FOUND' ); |
|
856 | + $config_option = maybe_unserialize(get_option($config_option_name, array())); |
|
857 | + if (empty($config_option)) { |
|
858 | + EE_Config::log($config_option_name.'-NOT-FOUND'); |
|
859 | 859 | } |
860 | 860 | return $config_option; |
861 | 861 | } |
@@ -867,17 +867,17 @@ discard block |
||
867 | 867 | * |
868 | 868 | * @param string $config_option_name |
869 | 869 | */ |
870 | - public static function log( $config_option_name = '' ) { |
|
871 | - if ( ! empty( $config_option_name ) ) { |
|
872 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
870 | + public static function log($config_option_name = '') { |
|
871 | + if ( ! empty($config_option_name)) { |
|
872 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
873 | 873 | //copy incoming $_REQUEST and sanitize it so we can save it |
874 | 874 | $_request = $_REQUEST; |
875 | - array_walk_recursive( $_request, 'sanitize_text_field' ); |
|
876 | - $config_log[ (string) microtime( true ) ] = array( |
|
875 | + array_walk_recursive($_request, 'sanitize_text_field'); |
|
876 | + $config_log[(string) microtime(true)] = array( |
|
877 | 877 | 'config_name' => $config_option_name, |
878 | 878 | 'request' => $_request, |
879 | 879 | ); |
880 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
880 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
881 | 881 | } |
882 | 882 | } |
883 | 883 | |
@@ -888,12 +888,12 @@ discard block |
||
888 | 888 | * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
889 | 889 | */ |
890 | 890 | public static function trim_log() { |
891 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
892 | - $log_length = count( $config_log ); |
|
893 | - if ( $log_length > EE_Config::LOG_LENGTH ) { |
|
894 | - ksort( $config_log ); |
|
895 | - $config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true ); |
|
896 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
891 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
892 | + $log_length = count($config_log); |
|
893 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
894 | + ksort($config_log); |
|
895 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
896 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
897 | 897 | } |
898 | 898 | } |
899 | 899 | |
@@ -908,14 +908,14 @@ discard block |
||
908 | 908 | * @return string |
909 | 909 | */ |
910 | 910 | public static function get_page_for_posts() { |
911 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
912 | - if ( ! $page_for_posts ) { |
|
911 | + $page_for_posts = get_option('page_for_posts'); |
|
912 | + if ( ! $page_for_posts) { |
|
913 | 913 | return 'posts'; |
914 | 914 | } |
915 | 915 | /** @type WPDB $wpdb */ |
916 | 916 | global $wpdb; |
917 | 917 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
918 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) ); |
|
918 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | |
@@ -971,17 +971,17 @@ discard block |
||
971 | 971 | ) |
972 | 972 | ) { |
973 | 973 | // grab list of installed widgets |
974 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
974 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
975 | 975 | // filter list of modules to register |
976 | 976 | $widgets_to_register = apply_filters( |
977 | 977 | 'FHEE__EE_Config__register_widgets__widgets_to_register', |
978 | 978 | $widgets_to_register |
979 | 979 | ); |
980 | - if ( ! empty( $widgets_to_register ) ) { |
|
980 | + if ( ! empty($widgets_to_register)) { |
|
981 | 981 | // cycle thru widget folders |
982 | - foreach ( $widgets_to_register as $widget_path ) { |
|
982 | + foreach ($widgets_to_register as $widget_path) { |
|
983 | 983 | // add to list of installed widget modules |
984 | - EE_Config::register_ee_widget( $widget_path ); |
|
984 | + EE_Config::register_ee_widget($widget_path); |
|
985 | 985 | } |
986 | 986 | } |
987 | 987 | // filter list of installed modules |
@@ -1001,57 +1001,57 @@ discard block |
||
1001 | 1001 | * @param string $widget_path - full path up to and including widget folder |
1002 | 1002 | * @return void |
1003 | 1003 | */ |
1004 | - public static function register_ee_widget( $widget_path = null ) { |
|
1005 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
1004 | + public static function register_ee_widget($widget_path = null) { |
|
1005 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
1006 | 1006 | $widget_ext = '.widget.php'; |
1007 | 1007 | // make all separators match |
1008 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
1008 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
1009 | 1009 | // does the file path INCLUDE the actual file name as part of the path ? |
1010 | - if ( strpos( $widget_path, $widget_ext ) !== false ) { |
|
1010 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
1011 | 1011 | // grab and shortcode file name from directory name and break apart at dots |
1012 | - $file_name = explode( '.', basename( $widget_path ) ); |
|
1012 | + $file_name = explode('.', basename($widget_path)); |
|
1013 | 1013 | // take first segment from file name pieces and remove class prefix if it exists |
1014 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
1014 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
1015 | 1015 | // sanitize shortcode directory name |
1016 | - $widget = sanitize_key( $widget ); |
|
1016 | + $widget = sanitize_key($widget); |
|
1017 | 1017 | // now we need to rebuild the shortcode path |
1018 | - $widget_path = explode( DS, $widget_path ); |
|
1018 | + $widget_path = explode(DS, $widget_path); |
|
1019 | 1019 | // remove last segment |
1020 | - array_pop( $widget_path ); |
|
1020 | + array_pop($widget_path); |
|
1021 | 1021 | // glue it back together |
1022 | - $widget_path = implode( DS, $widget_path ); |
|
1022 | + $widget_path = implode(DS, $widget_path); |
|
1023 | 1023 | } else { |
1024 | 1024 | // grab and sanitize widget directory name |
1025 | - $widget = sanitize_key( basename( $widget_path ) ); |
|
1025 | + $widget = sanitize_key(basename($widget_path)); |
|
1026 | 1026 | } |
1027 | 1027 | // create classname from widget directory name |
1028 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) ); |
|
1028 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1029 | 1029 | // add class prefix |
1030 | - $widget_class = 'EEW_' . $widget; |
|
1030 | + $widget_class = 'EEW_'.$widget; |
|
1031 | 1031 | // does the widget exist ? |
1032 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) { |
|
1032 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
1033 | 1033 | $msg = sprintf( |
1034 | 1034 | __( |
1035 | 1035 | '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', |
1036 | 1036 | 'event_espresso' |
1037 | 1037 | ), |
1038 | 1038 | $widget_class, |
1039 | - $widget_path . DS . $widget_class . $widget_ext |
|
1039 | + $widget_path.DS.$widget_class.$widget_ext |
|
1040 | 1040 | ); |
1041 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1041 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1042 | 1042 | return; |
1043 | 1043 | } |
1044 | 1044 | // load the widget class file |
1045 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
1045 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
1046 | 1046 | // verify that class exists |
1047 | - if ( ! class_exists( $widget_class ) ) { |
|
1048 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
1049 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1047 | + if ( ! class_exists($widget_class)) { |
|
1048 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1049 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1050 | 1050 | return; |
1051 | 1051 | } |
1052 | - register_widget( $widget_class ); |
|
1052 | + register_widget($widget_class); |
|
1053 | 1053 | // add to array of registered widgets |
1054 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
1054 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | |
@@ -1064,17 +1064,17 @@ discard block |
||
1064 | 1064 | */ |
1065 | 1065 | private function _register_shortcodes() { |
1066 | 1066 | // grab list of installed shortcodes |
1067 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1067 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1068 | 1068 | // filter list of modules to register |
1069 | 1069 | $shortcodes_to_register = apply_filters( |
1070 | 1070 | 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
1071 | 1071 | $shortcodes_to_register |
1072 | 1072 | ); |
1073 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1073 | + if ( ! empty($shortcodes_to_register)) { |
|
1074 | 1074 | // cycle thru shortcode folders |
1075 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1075 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1076 | 1076 | // add to list of installed shortcode modules |
1077 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1077 | + EE_Config::register_shortcode($shortcode_path); |
|
1078 | 1078 | } |
1079 | 1079 | } |
1080 | 1080 | // filter list of installed modules |
@@ -1093,64 +1093,64 @@ discard block |
||
1093 | 1093 | * @param string $shortcode_path - full path up to and including shortcode folder |
1094 | 1094 | * @return bool |
1095 | 1095 | */ |
1096 | - public static function register_shortcode( $shortcode_path = null ) { |
|
1097 | - do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path ); |
|
1096 | + public static function register_shortcode($shortcode_path = null) { |
|
1097 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1098 | 1098 | $shortcode_ext = '.shortcode.php'; |
1099 | 1099 | // make all separators match |
1100 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1100 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1101 | 1101 | // does the file path INCLUDE the actual file name as part of the path ? |
1102 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) { |
|
1102 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
1103 | 1103 | // grab shortcode file name from directory name and break apart at dots |
1104 | - $shortcode_file = explode( '.', basename( $shortcode_path ) ); |
|
1104 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1105 | 1105 | // take first segment from file name pieces and remove class prefix if it exists |
1106 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 |
|
1107 | - ? substr( $shortcode_file[0], 4 ) |
|
1106 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
1107 | + ? substr($shortcode_file[0], 4) |
|
1108 | 1108 | : $shortcode_file[0]; |
1109 | 1109 | // sanitize shortcode directory name |
1110 | - $shortcode = sanitize_key( $shortcode ); |
|
1110 | + $shortcode = sanitize_key($shortcode); |
|
1111 | 1111 | // now we need to rebuild the shortcode path |
1112 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1112 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1113 | 1113 | // remove last segment |
1114 | - array_pop( $shortcode_path ); |
|
1114 | + array_pop($shortcode_path); |
|
1115 | 1115 | // glue it back together |
1116 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1116 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1117 | 1117 | } else { |
1118 | 1118 | // we need to generate the filename based off of the folder name |
1119 | 1119 | // grab and sanitize shortcode directory name |
1120 | - $shortcode = sanitize_key( basename( $shortcode_path ) ); |
|
1121 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1120 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1121 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1122 | 1122 | } |
1123 | 1123 | // create classname from shortcode directory or file name |
1124 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) ); |
|
1124 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1125 | 1125 | // add class prefix |
1126 | - $shortcode_class = 'EES_' . $shortcode; |
|
1126 | + $shortcode_class = 'EES_'.$shortcode; |
|
1127 | 1127 | // does the shortcode exist ? |
1128 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) { |
|
1128 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1129 | 1129 | $msg = sprintf( |
1130 | 1130 | __( |
1131 | 1131 | 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', |
1132 | 1132 | 'event_espresso' |
1133 | 1133 | ), |
1134 | 1134 | $shortcode_class, |
1135 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1135 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1136 | 1136 | ); |
1137 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1137 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1138 | 1138 | return false; |
1139 | 1139 | } |
1140 | 1140 | // load the shortcode class file |
1141 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1141 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1142 | 1142 | // verify that class exists |
1143 | - if ( ! class_exists( $shortcode_class ) ) { |
|
1143 | + if ( ! class_exists($shortcode_class)) { |
|
1144 | 1144 | $msg = sprintf( |
1145 | - __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), |
|
1145 | + __('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
1146 | 1146 | $shortcode_class |
1147 | 1147 | ); |
1148 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1148 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1149 | 1149 | return false; |
1150 | 1150 | } |
1151 | - $shortcode = strtoupper( $shortcode ); |
|
1151 | + $shortcode = strtoupper($shortcode); |
|
1152 | 1152 | // add to array of registered shortcodes |
1153 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1153 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1154 | 1154 | return true; |
1155 | 1155 | } |
1156 | 1156 | |
@@ -1164,22 +1164,22 @@ discard block |
||
1164 | 1164 | */ |
1165 | 1165 | private function _register_modules() { |
1166 | 1166 | // grab list of installed modules |
1167 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1167 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1168 | 1168 | // filter list of modules to register |
1169 | 1169 | $modules_to_register = apply_filters( |
1170 | 1170 | 'FHEE__EE_Config__register_modules__modules_to_register', |
1171 | 1171 | $modules_to_register |
1172 | 1172 | ); |
1173 | - if ( ! empty( $modules_to_register ) ) { |
|
1173 | + if ( ! empty($modules_to_register)) { |
|
1174 | 1174 | // loop through folders |
1175 | - foreach ( $modules_to_register as $module_path ) { |
|
1175 | + foreach ($modules_to_register as $module_path) { |
|
1176 | 1176 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1177 | 1177 | if ( |
1178 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1179 | - && $module_path !== EE_MODULES . 'gateways' |
|
1178 | + $module_path !== EE_MODULES.'zzz-copy-this-module-template' |
|
1179 | + && $module_path !== EE_MODULES.'gateways' |
|
1180 | 1180 | ) { |
1181 | 1181 | // add to list of installed modules |
1182 | - EE_Config::register_module( $module_path ); |
|
1182 | + EE_Config::register_module($module_path); |
|
1183 | 1183 | } |
1184 | 1184 | } |
1185 | 1185 | } |
@@ -1199,39 +1199,39 @@ discard block |
||
1199 | 1199 | * @param string $module_path - full path up to and including module folder |
1200 | 1200 | * @return bool |
1201 | 1201 | */ |
1202 | - public static function register_module( $module_path = null ) { |
|
1203 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1202 | + public static function register_module($module_path = null) { |
|
1203 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1204 | 1204 | $module_ext = '.module.php'; |
1205 | 1205 | // make all separators match |
1206 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1206 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1207 | 1207 | // does the file path INCLUDE the actual file name as part of the path ? |
1208 | - if ( strpos( $module_path, $module_ext ) !== false ) { |
|
1208 | + if (strpos($module_path, $module_ext) !== false) { |
|
1209 | 1209 | // grab and shortcode file name from directory name and break apart at dots |
1210 | - $module_file = explode( '.', basename( $module_path ) ); |
|
1210 | + $module_file = explode('.', basename($module_path)); |
|
1211 | 1211 | // now we need to rebuild the shortcode path |
1212 | - $module_path = explode( DS, $module_path ); |
|
1212 | + $module_path = explode(DS, $module_path); |
|
1213 | 1213 | // remove last segment |
1214 | - array_pop( $module_path ); |
|
1214 | + array_pop($module_path); |
|
1215 | 1215 | // glue it back together |
1216 | - $module_path = implode( DS, $module_path ) . DS; |
|
1216 | + $module_path = implode(DS, $module_path).DS; |
|
1217 | 1217 | // take first segment from file name pieces and sanitize it |
1218 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1218 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1219 | 1219 | // ensure class prefix is added |
1220 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1220 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1221 | 1221 | } else { |
1222 | 1222 | // we need to generate the filename based off of the folder name |
1223 | 1223 | // grab and sanitize module name |
1224 | - $module = strtolower( basename( $module_path ) ); |
|
1225 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module ); |
|
1224 | + $module = strtolower(basename($module_path)); |
|
1225 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1226 | 1226 | // like trailingslashit() |
1227 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1227 | + $module_path = rtrim($module_path, DS).DS; |
|
1228 | 1228 | // create classname from module directory name |
1229 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) ); |
|
1229 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1230 | 1230 | // add class prefix |
1231 | - $module_class = 'EED_' . $module; |
|
1231 | + $module_class = 'EED_'.$module; |
|
1232 | 1232 | } |
1233 | 1233 | // does the module exist ? |
1234 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) { |
|
1234 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1235 | 1235 | $msg = sprintf( |
1236 | 1236 | __( |
1237 | 1237 | 'The requested %s module file could not be found or is not readable due to file permissions.', |
@@ -1239,19 +1239,19 @@ discard block |
||
1239 | 1239 | ), |
1240 | 1240 | $module |
1241 | 1241 | ); |
1242 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1242 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1243 | 1243 | return false; |
1244 | 1244 | } |
1245 | 1245 | // load the module class file |
1246 | - require_once( $module_path . $module_class . $module_ext ); |
|
1246 | + require_once($module_path.$module_class.$module_ext); |
|
1247 | 1247 | // verify that class exists |
1248 | - if ( ! class_exists( $module_class ) ) { |
|
1249 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1250 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1248 | + if ( ! class_exists($module_class)) { |
|
1249 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1250 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1251 | 1251 | return false; |
1252 | 1252 | } |
1253 | 1253 | // add to array of registered modules |
1254 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1254 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1255 | 1255 | do_action( |
1256 | 1256 | 'AHEE__EE_Config__register_module__complete', |
1257 | 1257 | $module_class, |
@@ -1271,26 +1271,26 @@ discard block |
||
1271 | 1271 | */ |
1272 | 1272 | private function _initialize_shortcodes() { |
1273 | 1273 | // cycle thru shortcode folders |
1274 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1274 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1275 | 1275 | // add class prefix |
1276 | - $shortcode_class = 'EES_' . $shortcode; |
|
1276 | + $shortcode_class = 'EES_'.$shortcode; |
|
1277 | 1277 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1278 | 1278 | // which set hooks ? |
1279 | - if ( is_admin() ) { |
|
1279 | + if (is_admin()) { |
|
1280 | 1280 | // fire immediately |
1281 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' ) ); |
|
1281 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1282 | 1282 | } else { |
1283 | 1283 | // delay until other systems are online |
1284 | 1284 | add_action( |
1285 | 1285 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1286 | - array( $shortcode_class, 'set_hooks' ) |
|
1286 | + array($shortcode_class, 'set_hooks') |
|
1287 | 1287 | ); |
1288 | 1288 | // convert classname to UPPERCASE and create WP shortcode. |
1289 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1289 | + $shortcode_tag = strtoupper($shortcode); |
|
1290 | 1290 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1291 | - if ( ! shortcode_exists( $shortcode_tag ) ) { |
|
1291 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1292 | 1292 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1293 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) ); |
|
1293 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1294 | 1294 | } |
1295 | 1295 | } |
1296 | 1296 | } |
@@ -1307,17 +1307,17 @@ discard block |
||
1307 | 1307 | */ |
1308 | 1308 | private function _initialize_modules() { |
1309 | 1309 | // cycle thru shortcode folders |
1310 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1310 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1311 | 1311 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1312 | 1312 | // which set hooks ? |
1313 | - if ( is_admin() ) { |
|
1313 | + if (is_admin()) { |
|
1314 | 1314 | // fire immediately |
1315 | - call_user_func( array( $module_class, 'set_hooks_admin' ) ); |
|
1315 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1316 | 1316 | } else { |
1317 | 1317 | // delay until other systems are online |
1318 | 1318 | add_action( |
1319 | 1319 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1320 | - array( $module_class, 'set_hooks' ) |
|
1320 | + array($module_class, 'set_hooks') |
|
1321 | 1321 | ); |
1322 | 1322 | } |
1323 | 1323 | } |
@@ -1335,29 +1335,29 @@ discard block |
||
1335 | 1335 | * @param string $key - url param key indicating a route is being called |
1336 | 1336 | * @return bool |
1337 | 1337 | */ |
1338 | - public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) { |
|
1339 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1340 | - $module = str_replace( 'EED_', '', $module ); |
|
1341 | - $module_class = 'EED_' . $module; |
|
1342 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) { |
|
1343 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1344 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1338 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') { |
|
1339 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1340 | + $module = str_replace('EED_', '', $module); |
|
1341 | + $module_class = 'EED_'.$module; |
|
1342 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1343 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1344 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1345 | 1345 | return false; |
1346 | 1346 | } |
1347 | - if ( empty( $route ) ) { |
|
1348 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1349 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1347 | + if (empty($route)) { |
|
1348 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1349 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1350 | 1350 | return false; |
1351 | 1351 | } |
1352 | - if ( ! method_exists( 'EED_' . $module, $method_name ) ) { |
|
1352 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1353 | 1353 | $msg = sprintf( |
1354 | - __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), |
|
1354 | + __('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1355 | 1355 | $route |
1356 | 1356 | ); |
1357 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1357 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1358 | 1358 | return false; |
1359 | 1359 | } |
1360 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1360 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1361 | 1361 | return true; |
1362 | 1362 | } |
1363 | 1363 | |
@@ -1371,11 +1371,11 @@ discard block |
||
1371 | 1371 | * @param string $key - url param key indicating a route is being called |
1372 | 1372 | * @return string |
1373 | 1373 | */ |
1374 | - public static function get_route( $route = null, $key = 'ee' ) { |
|
1375 | - do_action( 'AHEE__EE_Config__get_route__begin', $route ); |
|
1376 | - $route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route ); |
|
1377 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) { |
|
1378 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1374 | + public static function get_route($route = null, $key = 'ee') { |
|
1375 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1376 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1377 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1378 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1379 | 1379 | } |
1380 | 1380 | return null; |
1381 | 1381 | } |
@@ -1405,49 +1405,49 @@ discard block |
||
1405 | 1405 | * @param string $key - url param key indicating a route is being called |
1406 | 1406 | * @return bool |
1407 | 1407 | */ |
1408 | - public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) { |
|
1409 | - do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward ); |
|
1410 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1408 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') { |
|
1409 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1410 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1411 | 1411 | $msg = sprintf( |
1412 | - __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), |
|
1412 | + __('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1413 | 1413 | $route |
1414 | 1414 | ); |
1415 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1415 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1416 | 1416 | return false; |
1417 | 1417 | } |
1418 | - if ( empty( $forward ) ) { |
|
1419 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1420 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1418 | + if (empty($forward)) { |
|
1419 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1420 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1421 | 1421 | return false; |
1422 | 1422 | } |
1423 | - if ( is_array( $forward ) ) { |
|
1424 | - if ( ! isset( $forward[1] ) ) { |
|
1423 | + if (is_array($forward)) { |
|
1424 | + if ( ! isset($forward[1])) { |
|
1425 | 1425 | $msg = sprintf( |
1426 | - __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), |
|
1426 | + __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1427 | 1427 | $route |
1428 | 1428 | ); |
1429 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1429 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1430 | 1430 | return false; |
1431 | 1431 | } |
1432 | - if ( ! method_exists( $forward[0], $forward[1] ) ) { |
|
1432 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1433 | 1433 | $msg = sprintf( |
1434 | - __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1434 | + __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1435 | 1435 | $forward[1], |
1436 | 1436 | $route |
1437 | 1437 | ); |
1438 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1438 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1439 | 1439 | return false; |
1440 | 1440 | } |
1441 | - } else if ( ! function_exists( $forward ) ) { |
|
1441 | + } else if ( ! function_exists($forward)) { |
|
1442 | 1442 | $msg = sprintf( |
1443 | - __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1443 | + __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1444 | 1444 | $forward, |
1445 | 1445 | $route |
1446 | 1446 | ); |
1447 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1447 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1448 | 1448 | return false; |
1449 | 1449 | } |
1450 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1450 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1451 | 1451 | return true; |
1452 | 1452 | } |
1453 | 1453 | |
@@ -1463,12 +1463,12 @@ discard block |
||
1463 | 1463 | * @param string $key - url param key indicating a route is being called |
1464 | 1464 | * @return string |
1465 | 1465 | */ |
1466 | - public static function get_forward( $route = null, $status = 0, $key = 'ee' ) { |
|
1467 | - do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status ); |
|
1468 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) { |
|
1466 | + public static function get_forward($route = null, $status = 0, $key = 'ee') { |
|
1467 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1468 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1469 | 1469 | return apply_filters( |
1470 | 1470 | 'FHEE__EE_Config__get_forward', |
1471 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1471 | + EE_Config::$_module_forward_map[$key][$route][$status], |
|
1472 | 1472 | $route, |
1473 | 1473 | $status |
1474 | 1474 | ); |
@@ -1490,17 +1490,17 @@ discard block |
||
1490 | 1490 | * @param string $key - url param key indicating a route is being called |
1491 | 1491 | * @return bool |
1492 | 1492 | */ |
1493 | - public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) { |
|
1494 | - do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view ); |
|
1495 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1493 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') { |
|
1494 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1495 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1496 | 1496 | $msg = sprintf( |
1497 | - __( 'The module route %s for this view has not been registered.', 'event_espresso' ), |
|
1497 | + __('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1498 | 1498 | $route |
1499 | 1499 | ); |
1500 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1500 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1501 | 1501 | return false; |
1502 | 1502 | } |
1503 | - if ( ! is_readable( $view ) ) { |
|
1503 | + if ( ! is_readable($view)) { |
|
1504 | 1504 | $msg = sprintf( |
1505 | 1505 | __( |
1506 | 1506 | 'The %s view file could not be found or is not readable due to file permissions.', |
@@ -1508,10 +1508,10 @@ discard block |
||
1508 | 1508 | ), |
1509 | 1509 | $view |
1510 | 1510 | ); |
1511 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1511 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1512 | 1512 | return false; |
1513 | 1513 | } |
1514 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1514 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1515 | 1515 | return true; |
1516 | 1516 | } |
1517 | 1517 | |
@@ -1527,12 +1527,12 @@ discard block |
||
1527 | 1527 | * @param string $key - url param key indicating a route is being called |
1528 | 1528 | * @return string |
1529 | 1529 | */ |
1530 | - public static function get_view( $route = null, $status = 0, $key = 'ee' ) { |
|
1531 | - do_action( 'AHEE__EE_Config__get_view__begin', $route, $status ); |
|
1532 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) { |
|
1530 | + public static function get_view($route = null, $status = 0, $key = 'ee') { |
|
1531 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1532 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1533 | 1533 | return apply_filters( |
1534 | 1534 | 'FHEE__EE_Config__get_view', |
1535 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1535 | + EE_Config::$_module_view_map[$key][$route][$status], |
|
1536 | 1536 | $route, |
1537 | 1537 | $status |
1538 | 1538 | ); |
@@ -1543,7 +1543,7 @@ discard block |
||
1543 | 1543 | |
1544 | 1544 | |
1545 | 1545 | public function update_addon_option_names() { |
1546 | - update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names ); |
|
1546 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1547 | 1547 | } |
1548 | 1548 | |
1549 | 1549 | |
@@ -1571,22 +1571,22 @@ discard block |
||
1571 | 1571 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1572 | 1572 | * @throws \EE_Error |
1573 | 1573 | */ |
1574 | - public function get_pretty( $property ) { |
|
1575 | - if ( ! property_exists( $this, $property ) ) { |
|
1574 | + public function get_pretty($property) { |
|
1575 | + if ( ! property_exists($this, $property)) { |
|
1576 | 1576 | throw new EE_Error( |
1577 | 1577 | sprintf( |
1578 | 1578 | __( |
1579 | 1579 | '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
1580 | 1580 | 'event_espresso' |
1581 | 1581 | ), |
1582 | - get_class( $this ), |
|
1582 | + get_class($this), |
|
1583 | 1583 | $property |
1584 | 1584 | ) |
1585 | 1585 | ); |
1586 | 1586 | } |
1587 | 1587 | //just handling escaping of strings for now. |
1588 | - if ( is_string( $this->{$property} ) ) { |
|
1589 | - return stripslashes( $this->{$property} ); |
|
1588 | + if (is_string($this->{$property} )) { |
|
1589 | + return stripslashes($this->{$property} ); |
|
1590 | 1590 | } |
1591 | 1591 | return $this->{$property}; |
1592 | 1592 | } |
@@ -1595,17 +1595,17 @@ discard block |
||
1595 | 1595 | |
1596 | 1596 | public function populate() { |
1597 | 1597 | //grab defaults via a new instance of this class. |
1598 | - $class_name = get_class( $this ); |
|
1598 | + $class_name = get_class($this); |
|
1599 | 1599 | $defaults = new $class_name; |
1600 | 1600 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1601 | 1601 | //default from our $defaults object. |
1602 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1603 | - if ( $this->{$property} === null ) { |
|
1602 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1603 | + if ($this->{$property} === null) { |
|
1604 | 1604 | $this->{$property} = $value; |
1605 | 1605 | } |
1606 | 1606 | } |
1607 | 1607 | //cleanup |
1608 | - unset( $defaults ); |
|
1608 | + unset($defaults); |
|
1609 | 1609 | } |
1610 | 1610 | |
1611 | 1611 | |
@@ -1621,7 +1621,7 @@ discard block |
||
1621 | 1621 | * @param $a |
1622 | 1622 | * @return bool |
1623 | 1623 | */ |
1624 | - public function __isset( $a ) { |
|
1624 | + public function __isset($a) { |
|
1625 | 1625 | return false; |
1626 | 1626 | } |
1627 | 1627 | |
@@ -1633,7 +1633,7 @@ discard block |
||
1633 | 1633 | * @param $a |
1634 | 1634 | * @return bool |
1635 | 1635 | */ |
1636 | - public function __unset( $a ) { |
|
1636 | + public function __unset($a) { |
|
1637 | 1637 | return false; |
1638 | 1638 | } |
1639 | 1639 | |
@@ -1743,7 +1743,7 @@ discard block |
||
1743 | 1743 | $this->current_blog_id = get_current_blog_id(); |
1744 | 1744 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1745 | 1745 | $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin(); |
1746 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true; |
|
1746 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1747 | 1747 | $this->post_shortcodes = array(); |
1748 | 1748 | $this->module_route_map = array(); |
1749 | 1749 | $this->module_forward_map = array(); |
@@ -1759,9 +1759,9 @@ discard block |
||
1759 | 1759 | $this->thank_you_page_url = ''; |
1760 | 1760 | $this->cancel_page_url = ''; |
1761 | 1761 | //cpt slugs |
1762 | - $this->event_cpt_slug = __( 'events', 'event_espresso' ); |
|
1762 | + $this->event_cpt_slug = __('events', 'event_espresso'); |
|
1763 | 1763 | //ueip constant check |
1764 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1764 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1765 | 1765 | $this->ee_ueip_optin = false; |
1766 | 1766 | $this->ee_ueip_has_notified = true; |
1767 | 1767 | } |
@@ -1804,11 +1804,11 @@ discard block |
||
1804 | 1804 | * @return string |
1805 | 1805 | */ |
1806 | 1806 | public function reg_page_url() { |
1807 | - if ( ! $this->reg_page_url ) { |
|
1807 | + if ( ! $this->reg_page_url) { |
|
1808 | 1808 | $this->reg_page_url = add_query_arg( |
1809 | - array( 'uts' => time() ), |
|
1810 | - get_permalink( $this->reg_page_id ) |
|
1811 | - ) . '#checkout'; |
|
1809 | + array('uts' => time()), |
|
1810 | + get_permalink($this->reg_page_id) |
|
1811 | + ).'#checkout'; |
|
1812 | 1812 | } |
1813 | 1813 | return $this->reg_page_url; |
1814 | 1814 | } |
@@ -1823,12 +1823,12 @@ discard block |
||
1823 | 1823 | * @access public |
1824 | 1824 | * @return string |
1825 | 1825 | */ |
1826 | - public function txn_page_url( $query_args = array() ) { |
|
1827 | - if ( ! $this->txn_page_url ) { |
|
1828 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1826 | + public function txn_page_url($query_args = array()) { |
|
1827 | + if ( ! $this->txn_page_url) { |
|
1828 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1829 | 1829 | } |
1830 | - if ( $query_args ) { |
|
1831 | - return add_query_arg( $query_args, $this->txn_page_url ); |
|
1830 | + if ($query_args) { |
|
1831 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1832 | 1832 | } else { |
1833 | 1833 | return $this->txn_page_url; |
1834 | 1834 | } |
@@ -1844,12 +1844,12 @@ discard block |
||
1844 | 1844 | * @access public |
1845 | 1845 | * @return string |
1846 | 1846 | */ |
1847 | - public function thank_you_page_url( $query_args = array() ) { |
|
1848 | - if ( ! $this->thank_you_page_url ) { |
|
1849 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1847 | + public function thank_you_page_url($query_args = array()) { |
|
1848 | + if ( ! $this->thank_you_page_url) { |
|
1849 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1850 | 1850 | } |
1851 | - if ( $query_args ) { |
|
1852 | - return add_query_arg( $query_args, $this->thank_you_page_url ); |
|
1851 | + if ($query_args) { |
|
1852 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1853 | 1853 | } else { |
1854 | 1854 | return $this->thank_you_page_url; |
1855 | 1855 | } |
@@ -1864,8 +1864,8 @@ discard block |
||
1864 | 1864 | * @return string |
1865 | 1865 | */ |
1866 | 1866 | public function cancel_page_url() { |
1867 | - if ( ! $this->cancel_page_url ) { |
|
1868 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1867 | + if ( ! $this->cancel_page_url) { |
|
1868 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1869 | 1869 | } |
1870 | 1870 | return $this->cancel_page_url; |
1871 | 1871 | } |
@@ -1894,22 +1894,22 @@ discard block |
||
1894 | 1894 | */ |
1895 | 1895 | protected function _get_main_ee_ueip_optin() { |
1896 | 1896 | //if this is the main site then we can just bypass our direct query. |
1897 | - if ( is_main_site() ) { |
|
1898 | - return get_option( 'ee_ueip_optin', false ); |
|
1897 | + if (is_main_site()) { |
|
1898 | + return get_option('ee_ueip_optin', false); |
|
1899 | 1899 | } |
1900 | 1900 | |
1901 | 1901 | //is this already cached for this request? If so use it. |
1902 | - if ( ! empty( EE_Core_Config::$ee_ueip_option ) ) { |
|
1902 | + if ( ! empty(EE_Core_Config::$ee_ueip_option)) { |
|
1903 | 1903 | return EE_Core_Config::$ee_ueip_option; |
1904 | 1904 | } |
1905 | 1905 | |
1906 | 1906 | global $wpdb; |
1907 | 1907 | $current_network_main_site = is_multisite() ? get_current_site() : null; |
1908 | - $current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1908 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1909 | 1909 | $option = 'ee_ueip_optin'; |
1910 | 1910 | |
1911 | 1911 | //set correct table for query |
1912 | - $table_name = $wpdb->get_blog_prefix( $current_main_site_id ) . 'options'; |
|
1912 | + $table_name = $wpdb->get_blog_prefix($current_main_site_id).'options'; |
|
1913 | 1913 | |
1914 | 1914 | |
1915 | 1915 | //rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because |
@@ -1917,20 +1917,20 @@ discard block |
||
1917 | 1917 | //re-constructed on the blog switch. Note, we are still executing any core wp filters on this option retrieval. |
1918 | 1918 | //this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog |
1919 | 1919 | //for the purpose of caching. |
1920 | - $pre = apply_filters( 'pre_option_' . $option, false, $option ); |
|
1921 | - if ( false !== $pre ) { |
|
1920 | + $pre = apply_filters('pre_option_'.$option, false, $option); |
|
1921 | + if (false !== $pre) { |
|
1922 | 1922 | EE_Core_Config::$ee_ueip_option = $pre; |
1923 | 1923 | return EE_Core_Config::$ee_ueip_option; |
1924 | 1924 | } |
1925 | 1925 | |
1926 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option ) ); |
|
1927 | - if ( is_object( $row ) ) { |
|
1926 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option)); |
|
1927 | + if (is_object($row)) { |
|
1928 | 1928 | $value = $row->option_value; |
1929 | 1929 | } else { //option does not exist so use default. |
1930 | - return apply_filters( 'default_option_' . $option, false, $option ); |
|
1930 | + return apply_filters('default_option_'.$option, false, $option); |
|
1931 | 1931 | } |
1932 | 1932 | |
1933 | - EE_Core_Config::$ee_ueip_option = apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option ); |
|
1933 | + EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option); |
|
1934 | 1934 | return EE_Core_Config::$ee_ueip_option; |
1935 | 1935 | } |
1936 | 1936 | |
@@ -1946,7 +1946,7 @@ discard block |
||
1946 | 1946 | //reset all url properties |
1947 | 1947 | $this->_reset_urls(); |
1948 | 1948 | //return what to save to db |
1949 | - return array_keys( get_object_vars( $this ) ); |
|
1949 | + return array_keys(get_object_vars($this)); |
|
1950 | 1950 | } |
1951 | 1951 | |
1952 | 1952 | } |
@@ -2093,14 +2093,14 @@ discard block |
||
2093 | 2093 | */ |
2094 | 2094 | public function __construct() { |
2095 | 2095 | // set default organization settings |
2096 | - $this->name = get_bloginfo( 'name' ); |
|
2096 | + $this->name = get_bloginfo('name'); |
|
2097 | 2097 | $this->address_1 = '123 Onna Road'; |
2098 | 2098 | $this->address_2 = 'PO Box 123'; |
2099 | 2099 | $this->city = 'Inna City'; |
2100 | 2100 | $this->STA_ID = 4; |
2101 | 2101 | $this->CNT_ISO = 'US'; |
2102 | 2102 | $this->zip = '12345'; |
2103 | - $this->email = get_bloginfo( 'admin_email' ); |
|
2103 | + $this->email = get_bloginfo('admin_email'); |
|
2104 | 2104 | $this->phone = ''; |
2105 | 2105 | $this->vat = '123456789'; |
2106 | 2106 | $this->logo_url = ''; |
@@ -2188,46 +2188,46 @@ discard block |
||
2188 | 2188 | * @param string $CNT_ISO |
2189 | 2189 | * @throws \EE_Error |
2190 | 2190 | */ |
2191 | - public function __construct( $CNT_ISO = '' ) { |
|
2191 | + public function __construct($CNT_ISO = '') { |
|
2192 | 2192 | /** @var \EventEspresso\core\services\database\TableAnalysis $table_analysis */ |
2193 | - $table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
|
2193 | + $table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true); |
|
2194 | 2194 | // get country code from organization settings or use default |
2195 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
|
2195 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2196 | 2196 | && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
2197 | 2197 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2198 | 2198 | : ''; |
2199 | 2199 | // but override if requested |
2200 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
2200 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2201 | 2201 | // 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 |
2202 | 2202 | if ( |
2203 | - ! empty( $CNT_ISO ) |
|
2203 | + ! empty($CNT_ISO) |
|
2204 | 2204 | && EE_Maintenance_Mode::instance()->models_can_query() |
2205 | - && $table_analysis->tableExists( EE_Registry::instance()->load_model( 'Country' )->table() ) |
|
2205 | + && $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table()) |
|
2206 | 2206 | ) { |
2207 | 2207 | // retrieve the country settings from the db, just in case they have been customized |
2208 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
2209 | - if ( $country instanceof EE_Country ) { |
|
2210 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2211 | - $this->name = $country->currency_name_single(); // Dollar |
|
2212 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
2213 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
2214 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2215 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2216 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2217 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2208 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2209 | + if ($country instanceof EE_Country) { |
|
2210 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2211 | + $this->name = $country->currency_name_single(); // Dollar |
|
2212 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
2213 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
2214 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2215 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2216 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2217 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2218 | 2218 | } |
2219 | 2219 | } |
2220 | 2220 | // fallback to hardcoded defaults, in case the above failed |
2221 | - if ( empty( $this->code ) ) { |
|
2221 | + if (empty($this->code)) { |
|
2222 | 2222 | // set default currency settings |
2223 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2224 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
2225 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
2226 | - $this->sign = '$'; // currency sign: $ |
|
2227 | - $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2228 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2229 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2230 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2223 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2224 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
2225 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
2226 | + $this->sign = '$'; // currency sign: $ |
|
2227 | + $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2228 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2229 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2230 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2231 | 2231 | } |
2232 | 2232 | } |
2233 | 2233 | } |
@@ -2396,7 +2396,7 @@ discard block |
||
2396 | 2396 | * @since 4.8.8.rc.019 |
2397 | 2397 | */ |
2398 | 2398 | public function do_hooks() { |
2399 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) ); |
|
2399 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2400 | 2400 | } |
2401 | 2401 | |
2402 | 2402 | |
@@ -2405,7 +2405,7 @@ discard block |
||
2405 | 2405 | * @return void |
2406 | 2406 | */ |
2407 | 2407 | public function set_default_reg_status_on_EEM_Event() { |
2408 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2408 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2409 | 2409 | } |
2410 | 2410 | |
2411 | 2411 | |
@@ -2422,7 +2422,7 @@ discard block |
||
2422 | 2422 | /** |
2423 | 2423 | * @param boolean $track_invalid_checkout_access |
2424 | 2424 | */ |
2425 | - public function set_track_invalid_checkout_access( $track_invalid_checkout_access ) { |
|
2425 | + public function set_track_invalid_checkout_access($track_invalid_checkout_access) { |
|
2426 | 2426 | $this->track_invalid_checkout_access = filter_var( |
2427 | 2427 | $track_invalid_checkout_access, |
2428 | 2428 | FILTER_VALIDATE_BOOLEAN |
@@ -2540,10 +2540,10 @@ discard block |
||
2540 | 2540 | * @param bool $reset |
2541 | 2541 | * @return string |
2542 | 2542 | */ |
2543 | - public function log_file_name( $reset = false ) { |
|
2544 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2545 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2546 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2543 | + public function log_file_name($reset = false) { |
|
2544 | + if (empty($this->log_file_name) || $reset) { |
|
2545 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt'; |
|
2546 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2547 | 2547 | } |
2548 | 2548 | return $this->log_file_name; |
2549 | 2549 | } |
@@ -2554,10 +2554,10 @@ discard block |
||
2554 | 2554 | * @param bool $reset |
2555 | 2555 | * @return string |
2556 | 2556 | */ |
2557 | - public function debug_file_name( $reset = false ) { |
|
2558 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2559 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2560 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2557 | + public function debug_file_name($reset = false) { |
|
2558 | + if (empty($this->debug_file_name) || $reset) { |
|
2559 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt'; |
|
2560 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2561 | 2561 | } |
2562 | 2562 | return $this->debug_file_name; |
2563 | 2563 | } |
@@ -2568,7 +2568,7 @@ discard block |
||
2568 | 2568 | * @return string |
2569 | 2569 | */ |
2570 | 2570 | public function affiliate_id() { |
2571 | - return ! empty( $this->affiliate_id ) ? $this->affiliate_id : 'default'; |
|
2571 | + return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default'; |
|
2572 | 2572 | } |
2573 | 2573 | |
2574 | 2574 | |
@@ -2577,7 +2577,7 @@ discard block |
||
2577 | 2577 | * @return boolean |
2578 | 2578 | */ |
2579 | 2579 | public function encode_session_data() { |
2580 | - return filter_var( $this->encode_session_data, FILTER_VALIDATE_BOOLEAN ); |
|
2580 | + return filter_var($this->encode_session_data, FILTER_VALIDATE_BOOLEAN); |
|
2581 | 2581 | } |
2582 | 2582 | |
2583 | 2583 | |
@@ -2585,8 +2585,8 @@ discard block |
||
2585 | 2585 | /** |
2586 | 2586 | * @param boolean $encode_session_data |
2587 | 2587 | */ |
2588 | - public function set_encode_session_data( $encode_session_data ) { |
|
2589 | - $this->encode_session_data = filter_var( $encode_session_data, FILTER_VALIDATE_BOOLEAN ); |
|
2588 | + public function set_encode_session_data($encode_session_data) { |
|
2589 | + $this->encode_session_data = filter_var($encode_session_data, FILTER_VALIDATE_BOOLEAN); |
|
2590 | 2590 | } |
2591 | 2591 | |
2592 | 2592 | |
@@ -2766,21 +2766,21 @@ discard block |
||
2766 | 2766 | $this->use_google_maps = true; |
2767 | 2767 | $this->google_map_api_key = ''; |
2768 | 2768 | // for event details pages (reg page) |
2769 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2770 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2771 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2772 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2773 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2774 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2775 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2769 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2770 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2771 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2772 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2773 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2774 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2775 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2776 | 2776 | // for event list pages |
2777 | - $this->event_list_map_width = 300; // ee_map_width |
|
2778 | - $this->event_list_map_height = 185; // ee_map_height |
|
2779 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2780 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2781 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2782 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2783 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2777 | + $this->event_list_map_width = 300; // ee_map_width |
|
2778 | + $this->event_list_map_height = 185; // ee_map_height |
|
2779 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2780 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2781 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2782 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2783 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2784 | 2784 | } |
2785 | 2785 | |
2786 | 2786 | } |
@@ -2942,7 +2942,7 @@ discard block |
||
2942 | 2942 | * @return void |
2943 | 2943 | */ |
2944 | 2944 | protected function _set_php_values() { |
2945 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2945 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2946 | 2946 | $this->php->version = phpversion(); |
2947 | 2947 | } |
2948 | 2948 | |
@@ -2961,10 +2961,10 @@ discard block |
||
2961 | 2961 | * @type string $msg Any message to be displayed. |
2962 | 2962 | * } |
2963 | 2963 | */ |
2964 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2965 | - if ( ! empty( $this->php->max_input_vars ) |
|
2966 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2967 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2964 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2965 | + if ( ! empty($this->php->max_input_vars) |
|
2966 | + && ($input_count >= $this->php->max_input_vars) |
|
2967 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
2968 | 2968 | ) { |
2969 | 2969 | return sprintf( |
2970 | 2970 | __( |
@@ -3060,7 +3060,7 @@ discard block |
||
3060 | 3060 | */ |
3061 | 3061 | public function __construct() { |
3062 | 3062 | $this->payment_settings = array(); |
3063 | - $this->active_gateways = array( 'Invoice' => false ); |
|
3063 | + $this->active_gateways = array('Invoice' => false); |
|
3064 | 3064 | } |
3065 | 3065 | } |
3066 | 3066 |