@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @return EED_Ticket_Selector_Caff |
17 | 17 | */ |
18 | 18 | public static function instance() { |
19 | - return parent::get_instance( __CLASS__ ); |
|
19 | + return parent::get_instance(__CLASS__); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
@@ -37,24 +37,24 @@ discard block |
||
37 | 37 | * @return void |
38 | 38 | */ |
39 | 39 | public static function set_hooks_admin() { |
40 | - define( 'TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
41 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Ticket_Selector_Caff', 'template_settings_form' ), 10 ); |
|
42 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Ticket_Selector_Caff', 'update_template_settings' ), 10, 2 ); |
|
40 | + define('TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
41 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Ticket_Selector_Caff', 'template_settings_form'), 10); |
|
42 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Ticket_Selector_Caff', 'update_template_settings'), 10, 2); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
46 | 46 | //just required because of abstract declaration |
47 | - public function run( $WP ) { |
|
47 | + public function run($WP) { |
|
48 | 48 | $this->set_config(); |
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | - protected function set_config(){ |
|
55 | - $this->set_config_section( 'template_settings' ); |
|
56 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
57 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
54 | + protected function set_config() { |
|
55 | + $this->set_config_section('template_settings'); |
|
56 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
57 | + $this->set_config_name('EED_Ticket_Selector'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | 'FHEE__EED_Ticket_Selector_Caff___ticket_selector_settings_form__form_subsections', |
90 | 90 | array( |
91 | 91 | 'appearance_settings_hdr' => new EE_Form_Section_HTML( |
92 | - EEH_HTML::br(2) . |
|
93 | - EEH_HTML::h2( __( 'Ticket Selector Template Settings', 'event_espresso' )) |
|
92 | + EEH_HTML::br(2). |
|
93 | + EEH_HTML::h2(__('Ticket Selector Template Settings', 'event_espresso')) |
|
94 | 94 | ), |
95 | 95 | 'appearance_settings' => EED_Ticket_Selector_Caff::_ticket_selector_appearance_settings() |
96 | 96 | ) |
@@ -114,25 +114,25 @@ discard block |
||
114 | 114 | 'FHEE__EED_Ticket_Selector_Caff___ticket_selector_appearance_settings__form_subsections', array( |
115 | 115 | 'show_ticket_details' => new EE_Yes_No_Input( |
116 | 116 | array( |
117 | - 'html_label_text' => __('Show Ticket Details?', 'event_espresso' ), |
|
118 | - 'html_help_text' => __( 'This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'), |
|
119 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true, |
|
117 | + 'html_label_text' => __('Show Ticket Details?', 'event_espresso'), |
|
118 | + 'html_help_text' => __('This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'), |
|
119 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true, |
|
120 | 120 | 'display_html_label_text' => false |
121 | 121 | ) |
122 | 122 | ), |
123 | 123 | 'show_ticket_sale_columns' => new EE_Yes_No_Input( |
124 | 124 | array( |
125 | - 'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso' ), |
|
126 | - 'html_help_text' => __( 'This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'), |
|
127 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true, |
|
125 | + 'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso'), |
|
126 | + 'html_help_text' => __('This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'), |
|
127 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true, |
|
128 | 128 | 'display_html_label_text' => false |
129 | 129 | ) |
130 | 130 | ), |
131 | 131 | 'show_expired_tickets' => new EE_Yes_No_Input( |
132 | 132 | array( |
133 | - 'html_label_text' => __( 'Show Expired Tickets?', 'event_espresso' ), |
|
134 | - 'html_help_text' => __( 'Indicate whether to show expired tickets in the ticket selector', 'event_espresso' ), |
|
135 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets : true, |
|
133 | + 'html_label_text' => __('Show Expired Tickets?', 'event_espresso'), |
|
134 | + 'html_help_text' => __('Indicate whether to show expired tickets in the ticket selector', 'event_espresso'), |
|
135 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets : true, |
|
136 | 136 | 'display_html_label_text' => false |
137 | 137 | ) |
138 | 138 | ) |
@@ -155,21 +155,21 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @return void |
157 | 157 | */ |
158 | - public static function update_template_settings( EE_Template_Config $CFG, $REQ ) { |
|
159 | - if ( ! isset( $CFG->EED_Ticket_Selector ) ) { |
|
158 | + public static function update_template_settings(EE_Template_Config $CFG, $REQ) { |
|
159 | + if ( ! isset($CFG->EED_Ticket_Selector)) { |
|
160 | 160 | $CFG->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
161 | 161 | } |
162 | 162 | try { |
163 | 163 | $ticket_selector_form = EED_Ticket_Selector_Caff::_ticket_selector_settings_form(); |
164 | 164 | |
165 | 165 | //check for form submission |
166 | - if ( $ticket_selector_form->was_submitted() ) { |
|
166 | + if ($ticket_selector_form->was_submitted()) { |
|
167 | 167 | |
168 | 168 | //capture form data |
169 | 169 | $ticket_selector_form->receive_form_submission(); |
170 | 170 | |
171 | 171 | //validate form data |
172 | - if ( $ticket_selector_form->is_valid() ) { |
|
172 | + if ($ticket_selector_form->is_valid()) { |
|
173 | 173 | |
174 | 174 | //grab validated data from form |
175 | 175 | $valid_data = $ticket_selector_form->valid_data(); |
@@ -179,13 +179,13 @@ discard block |
||
179 | 179 | $CFG->EED_Ticket_Selector->show_ticket_details = $valid_data['appearance_settings']['show_ticket_details']; |
180 | 180 | $CFG->EED_Ticket_Selector->show_expired_tickets = $valid_data['appearance_settings']['show_expired_tickets']; |
181 | 181 | } else { |
182 | - if ( $ticket_selector_form->submission_error_message() != '' ) { |
|
183 | - EE_Error::add_error( $ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
182 | + if ($ticket_selector_form->submission_error_message() != '') { |
|
183 | + EE_Error::add_error($ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | 187 | } |
188 | - } catch( EE_Error $e ) { |
|
188 | + } catch (EE_Error $e) { |
|
189 | 189 | $e->get_error(); |
190 | 190 | } |
191 | 191 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | <?php _e('Adjust the settings for the Authorize.net AIM payment gateway.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | 5 | <p> |
6 | -<?php printf( __( 'See %1$shere%2$s for list of currencies supported by Authorize.net AIM.', 'event_espresso' ), "<a href='http://www.authorize.net/international/' target='_blank'>","</a>" ); ?> |
|
6 | +<?php printf(__('See %1$shere%2$s for list of currencies supported by Authorize.net AIM.', 'event_espresso'), "<a href='http://www.authorize.net/international/' target='_blank'>", "</a>"); ?> |
|
7 | 7 | </p> |
8 | 8 | <h3><?php _e('Authorize.net AIM Settings', 'event_espresso'); ?></h3> |
9 | 9 | <ul> |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | <?php _e('By logging into Authorize.net, you can change which payment fields are required by Authorize.net when processing payments. These settings affect both the Advanced Integration Method (AIM, this) and the Simple Integration Method (SIM, different). The payment method settings "Excluded Payment Form Fields" and "Required Payment Form Fields" allow you to change the billing form in Event Espresso to reflect your payment form settings in Authorize.net.', 'event_espresso'); ?> |
29 | 29 | <br> |
30 | 30 | <?php printf( |
31 | - __( 'To change your payment form settings in Authorize.net, %1$slog in to authorize.net%2$s, go to %3$sAccount then Payment Form%2$s, then %4$sForm Fields%2$s. It will look similar to %5$sthis%2$s. If you make a field required in Authorize.net, you should also make it required in Event Espresso. If it isn\'t required in Authorize.net, and you want to simplify the billing form in Event Espresso, you can exclude it from the Event Espresso Form too.'), |
|
31 | + __('To change your payment form settings in Authorize.net, %1$slog in to authorize.net%2$s, go to %3$sAccount then Payment Form%2$s, then %4$sForm Fields%2$s. It will look similar to %5$sthis%2$s. If you make a field required in Authorize.net, you should also make it required in Event Espresso. If it isn\'t required in Authorize.net, and you want to simplify the billing form in Event Espresso, you can exclude it from the Event Espresso Form too.'), |
|
32 | 32 | '<a href="http://authorize.net" target="_blank">', |
33 | 33 | '</a>', |
34 | 34 | '<a href="https://monosnap.com/file/nebVteOkEXcdDIos88SojStWOifP23" target="_blank">', |
35 | 35 | '<a href="https://monosnap.com/file/WyxGJtev87TcDmdGBEZ2oi1xaBIQAm" target="_blank">', |
36 | - '<a href="https://monosnap.com/image/DbCJNfEesWXeSNUs1wLIpGYODFw52m" target="_blank">');?> |
|
36 | + '<a href="https://monosnap.com/image/DbCJNfEesWXeSNUs1wLIpGYODFw52m" target="_blank">'); ?> |
|
37 | 37 | </li> |
38 | 38 | <li> |
39 | 39 | <strong><?php _e('Button Image URL', 'event_espresso'); ?></strong><br /> |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public static function instance() { |
80 | 80 | // check if class object is instantiated |
81 | - if ( ! self::$_instance instanceof EE_CPT_Strategy ) { |
|
81 | + if ( ! self::$_instance instanceof EE_CPT_Strategy) { |
|
82 | 82 | self::$_instance = new self(); |
83 | 83 | } |
84 | 84 | return self::$_instance; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | // d( $this->_CPT_endpoints ); |
102 | 102 | // d( $this->_CPT_taxonomies ); |
103 | 103 | |
104 | - add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 5 ); |
|
104 | + add_action('pre_get_posts', array($this, 'pre_get_posts'), 5); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | */ |
115 | 115 | private function _set_CPT_endpoints() { |
116 | 116 | $_CPT_endpoints = array(); |
117 | - if ( is_array( $this->_CPTs )) { |
|
118 | - foreach ( $this->_CPTs as $CPT_type => $CPT ) { |
|
119 | - $_CPT_endpoints [ $CPT['plural_slug'] ] = $CPT_type; |
|
117 | + if (is_array($this->_CPTs)) { |
|
118 | + foreach ($this->_CPTs as $CPT_type => $CPT) { |
|
119 | + $_CPT_endpoints [$CPT['plural_slug']] = $CPT_type; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | return $_CPT_endpoints; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param WP_Query $WP_Query |
132 | 132 | * @return void |
133 | 133 | */ |
134 | - private function _set_EE_tags_on_WP_Query( WP_Query $WP_Query) { |
|
134 | + private function _set_EE_tags_on_WP_Query(WP_Query $WP_Query) { |
|
135 | 135 | $WP_Query->is_espresso_event_single = FALSE; |
136 | 136 | $WP_Query->is_espresso_event_archive = FALSE; |
137 | 137 | $WP_Query->is_espresso_event_taxonomy = FALSE; |
@@ -158,16 +158,16 @@ discard block |
||
158 | 158 | */ |
159 | 159 | private function _set_CPT_taxonomies() { |
160 | 160 | // check if taxonomies have already been set |
161 | - if ( empty( $this->_CPT_taxonomies )) { |
|
161 | + if (empty($this->_CPT_taxonomies)) { |
|
162 | 162 | // and that this CPT has taxonomies registered for it |
163 | - if ( isset( $this->CPT['args'] ) && isset( $this->CPT['args']['taxonomies'] )) { |
|
163 | + if (isset($this->CPT['args']) && isset($this->CPT['args']['taxonomies'])) { |
|
164 | 164 | // if so then grab them, but we want the taxonomy name as the key |
165 | - $taxonomies = array_flip( $this->CPT['args']['taxonomies'] ); |
|
165 | + $taxonomies = array_flip($this->CPT['args']['taxonomies']); |
|
166 | 166 | // then grab the list of ALL taxonomies |
167 | 167 | $all_taxonomies = EE_Register_CPTs::get_taxonomies(); |
168 | - foreach ( $taxonomies as $taxonomy => $details ) { |
|
168 | + foreach ($taxonomies as $taxonomy => $details) { |
|
169 | 169 | // add details to our taxonomies if they exist |
170 | - $taxonomies[ $taxonomy ] = isset( $all_taxonomies[ $taxonomy ] ) ? $all_taxonomies[ $taxonomy ] : NULL; |
|
170 | + $taxonomies[$taxonomy] = isset($all_taxonomies[$taxonomy]) ? $all_taxonomies[$taxonomy] : NULL; |
|
171 | 171 | } |
172 | 172 | $this->_CPT_taxonomies = $taxonomies; |
173 | 173 | } |
@@ -192,10 +192,10 @@ discard block |
||
192 | 192 | * @return void |
193 | 193 | */ |
194 | 194 | private function _set_CPT_terms() { |
195 | - if ( empty( $this->_CPT_terms )) { |
|
195 | + if (empty($this->_CPT_terms)) { |
|
196 | 196 | $terms = EEM_Term::instance()->get_all_CPT_post_tags(); |
197 | - foreach ( $terms as $term ) { |
|
198 | - $this->_CPT_terms[ $term->slug() ] = $term; |
|
197 | + foreach ($terms as $term) { |
|
198 | + $this->_CPT_terms[$term->slug()] = $term; |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | } |
@@ -209,24 +209,24 @@ discard block |
||
209 | 209 | * @param $WP_Query |
210 | 210 | * @return void |
211 | 211 | */ |
212 | - private function _set_post_type_for_terms( WP_Query $WP_Query ) { |
|
212 | + private function _set_post_type_for_terms(WP_Query $WP_Query) { |
|
213 | 213 | // is a tag set ? |
214 | - if ( isset( $WP_Query->query['tag'] )) { |
|
214 | + if (isset($WP_Query->query['tag'])) { |
|
215 | 215 | // set post_tags |
216 | 216 | $this->_set_CPT_terms(); |
217 | 217 | // is this tag archive term in the list of terms used by our CPTs ? |
218 | - $term = isset ( $this->_CPT_terms[ $WP_Query->query['tag'] ] ) ? $this->_CPT_terms[ $WP_Query->query['tag'] ] : NULL; |
|
218 | + $term = isset ($this->_CPT_terms[$WP_Query->query['tag']]) ? $this->_CPT_terms[$WP_Query->query['tag']] : NULL; |
|
219 | 219 | // verify the term |
220 | - if ( $term instanceof EE_Term ) { |
|
221 | - $term->post_type = array_merge( array( 'post', 'page' ), (array)$term->post_type ); |
|
222 | - $term->post_type = apply_filters( 'FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term ); |
|
220 | + if ($term instanceof EE_Term) { |
|
221 | + $term->post_type = array_merge(array('post', 'page'), (array) $term->post_type); |
|
222 | + $term->post_type = apply_filters('FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term); |
|
223 | 223 | // if a post type is already set |
224 | - if ( isset( $WP_Query->query_vars['post_type'] )) { |
|
224 | + if (isset($WP_Query->query_vars['post_type'])) { |
|
225 | 225 | // add to existing array |
226 | - $term->post_type = array_merge ( (array)$WP_Query->query_vars['post_type'], $term->post_type ); |
|
226 | + $term->post_type = array_merge((array) $WP_Query->query_vars['post_type'], $term->post_type); |
|
227 | 227 | } |
228 | 228 | // just set post_type to our CPT |
229 | - $WP_Query->set( 'post_type', $term->post_type ); |
|
229 | + $WP_Query->set('post_type', $term->post_type); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | } |
@@ -241,17 +241,17 @@ discard block |
||
241 | 241 | * in order for is_archive() and is_single() methods to work properly. |
242 | 242 | * @return void |
243 | 243 | */ |
244 | - public function _possibly_set_ee_request_var(){ |
|
244 | + public function _possibly_set_ee_request_var() { |
|
245 | 245 | // check if ee action var has been set |
246 | - if ( ! EE_Registry::instance()->REQ->is_set( 'ee' )) { |
|
246 | + if ( ! EE_Registry::instance()->REQ->is_set('ee')) { |
|
247 | 247 | // check that route exists for CPT archive slug |
248 | - if ( is_archive() && EE_Config::get_route( $this->CPT['plural_slug'] )) { |
|
248 | + if (is_archive() && EE_Config::get_route($this->CPT['plural_slug'])) { |
|
249 | 249 | // ie: set "ee" to "events" |
250 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['plural_slug'] ); |
|
250 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['plural_slug']); |
|
251 | 251 | // or does it match a single page CPT like /event/ |
252 | - } else if ( is_single() && EE_Config::get_route( $this->CPT['singular_slug'] )) { |
|
252 | + } else if (is_single() && EE_Config::get_route($this->CPT['singular_slug'])) { |
|
253 | 253 | // ie: set "ee" to "event" |
254 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] ); |
|
254 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']); |
|
255 | 255 | } |
256 | 256 | } |
257 | 257 | } |
@@ -265,11 +265,11 @@ discard block |
||
265 | 265 | * @param WP_Query $WP_Query |
266 | 266 | * @return void |
267 | 267 | */ |
268 | - public function _set_paging( $WP_Query ) { |
|
269 | - if ( $WP_Query->is_main_query() && apply_filters( 'FHEE__EE_CPT_Strategy___set_paging', TRUE )) { |
|
270 | - $page = ( get_query_var('page') ) ? get_query_var('page') : NULL; |
|
271 | - $paged = ( get_query_var('paged') ) ? get_query_var('paged') : $page; |
|
272 | - $WP_Query->set( 'paged', $paged ); |
|
268 | + public function _set_paging($WP_Query) { |
|
269 | + if ($WP_Query->is_main_query() && apply_filters('FHEE__EE_CPT_Strategy___set_paging', TRUE)) { |
|
270 | + $page = (get_query_var('page')) ? get_query_var('page') : NULL; |
|
271 | + $paged = (get_query_var('paged')) ? get_query_var('paged') : $page; |
|
272 | + $WP_Query->set('paged', $paged); |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
@@ -286,35 +286,35 @@ discard block |
||
286 | 286 | * @param WP_Query $WP_Query |
287 | 287 | * @return void |
288 | 288 | */ |
289 | - public function pre_get_posts( $WP_Query ) { |
|
289 | + public function pre_get_posts($WP_Query) { |
|
290 | 290 | // check that post-type is set |
291 | - if ( ! $WP_Query instanceof WP_Query ) { |
|
291 | + if ( ! $WP_Query instanceof WP_Query) { |
|
292 | 292 | return; |
293 | 293 | } |
294 | 294 | |
295 | 295 | // add our conditionals |
296 | - $this->_set_EE_tags_on_WP_Query( $WP_Query ); |
|
296 | + $this->_set_EE_tags_on_WP_Query($WP_Query); |
|
297 | 297 | // check for terms |
298 | - $this->_set_post_type_for_terms( $WP_Query ); |
|
298 | + $this->_set_post_type_for_terms($WP_Query); |
|
299 | 299 | // make sure paging is always set |
300 | - $this->_set_paging( $WP_Query ); |
|
300 | + $this->_set_paging($WP_Query); |
|
301 | 301 | |
302 | 302 | // is a taxonomy set ? |
303 | - if ( $WP_Query->is_tax ) { |
|
303 | + if ($WP_Query->is_tax) { |
|
304 | 304 | // loop thru our taxonomies |
305 | - foreach ( $this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details ) { |
|
305 | + foreach ($this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details) { |
|
306 | 306 | // check if one of our taxonomies is set as a query var |
307 | - if ( isset( $WP_Query->query[ $CPT_taxonomy ] )) { |
|
307 | + if (isset($WP_Query->query[$CPT_taxonomy])) { |
|
308 | 308 | // but which CPT does that correspond to??? hmmm... guess we gotta go looping |
309 | - foreach ( $this->_CPTs as $post_type => $CPT ) { |
|
309 | + foreach ($this->_CPTs as $post_type => $CPT) { |
|
310 | 310 | // verify our CPT has args, is public and has taxonomies set |
311 | - if ( isset( $CPT['args'] ) && $CPT['args']['public'] && ! empty( $CPT['args']['taxonomies'] )) { |
|
311 | + if (isset($CPT['args']) && $CPT['args']['public'] && ! empty($CPT['args']['taxonomies'])) { |
|
312 | 312 | // does the captured taxonomy belong to this CPT ? |
313 | - if ( in_array( $CPT_taxonomy, $CPT['args']['taxonomies'] )) { |
|
313 | + if (in_array($CPT_taxonomy, $CPT['args']['taxonomies'])) { |
|
314 | 314 | // if so, then add this CPT post_type to the current query's array of post_types' |
315 | - $WP_Query->query_vars['post_type'] = isset( $WP_Query->query_vars['post_type'] ) ? (array)$WP_Query->query_vars['post_type'] : array(); |
|
315 | + $WP_Query->query_vars['post_type'] = isset($WP_Query->query_vars['post_type']) ? (array) $WP_Query->query_vars['post_type'] : array(); |
|
316 | 316 | $WP_Query->query_vars['post_type'][] = $post_type; |
317 | - switch( $post_type ) { |
|
317 | + switch ($post_type) { |
|
318 | 318 | case 'espresso_events' : |
319 | 319 | $WP_Query->is_espresso_event_taxonomy = TRUE; |
320 | 320 | break; |
@@ -335,24 +335,24 @@ discard block |
||
335 | 335 | // d( $CPT_taxonomy ); |
336 | 336 | // d( $WP_Query ); |
337 | 337 | |
338 | - if ( isset( $WP_Query->query_vars['post_type'] )) { |
|
338 | + if (isset($WP_Query->query_vars['post_type'])) { |
|
339 | 339 | // loop thru post_types as array |
340 | - foreach ( (array)$WP_Query->query_vars['post_type'] as $post_type ) { |
|
340 | + foreach ((array) $WP_Query->query_vars['post_type'] as $post_type) { |
|
341 | 341 | |
342 | 342 | // is current query for an EE CPT ? |
343 | - if ( isset( $this->_CPTs[ $post_type ] )) { |
|
343 | + if (isset($this->_CPTs[$post_type])) { |
|
344 | 344 | // is EE on or off ? |
345 | - if ( EE_Maintenance_Mode::instance()->level() ) { |
|
345 | + if (EE_Maintenance_Mode::instance()->level()) { |
|
346 | 346 | // reroute CPT template view to maintenance_mode.template.php |
347 | - if( ! has_filter( 'template_include',array( 'EE_Maintenance_Mode', 'template_include' ))){ |
|
348 | - add_filter( 'template_include', array( 'EE_Maintenance_Mode', 'template_include' ), 99999 ); |
|
347 | + if ( ! has_filter('template_include', array('EE_Maintenance_Mode', 'template_include'))) { |
|
348 | + add_filter('template_include', array('EE_Maintenance_Mode', 'template_include'), 99999); |
|
349 | 349 | } |
350 | 350 | return; |
351 | 351 | } |
352 | 352 | // load EE_Request_Handler (this was added as a result of https://events.codebasehq.com/projects/event-espresso/tickets/9037 |
353 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
353 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
354 | 354 | // grab details for the CPT the current query is for |
355 | - $this->CPT = $this->_CPTs[ $post_type ]; |
|
355 | + $this->CPT = $this->_CPTs[$post_type]; |
|
356 | 356 | // set post type |
357 | 357 | $this->CPT['post_type'] = $post_type; |
358 | 358 | // set taxonomies |
@@ -360,27 +360,27 @@ discard block |
||
360 | 360 | // the post or category or term that is triggering EE |
361 | 361 | $this->CPT['espresso_page'] = EE_Registry::instance()->REQ->is_espresso_page(); |
362 | 362 | // requested post name |
363 | - $this->CPT['post_name'] = EE_Registry::instance()->REQ->get( 'post_name' ); |
|
363 | + $this->CPT['post_name'] = EE_Registry::instance()->REQ->get('post_name'); |
|
364 | 364 | //d( $this->CPT ); |
365 | 365 | // add support for viewing 'private', 'draft', or 'pending' posts |
366 | - if ( is_user_logged_in() && isset( $WP_Query->query_vars['p'] ) && $WP_Query->query_vars['p'] != 0 && current_user_can( 'edit_post', $WP_Query->query_vars['p'] )) { |
|
366 | + if (is_user_logged_in() && isset($WP_Query->query_vars['p']) && $WP_Query->query_vars['p'] != 0 && current_user_can('edit_post', $WP_Query->query_vars['p'])) { |
|
367 | 367 | // we can just inject directly into the WP_Query object |
368 | - $WP_Query->query['post_status'] = array( 'publish', 'private', 'draft', 'pending' ); |
|
368 | + $WP_Query->query['post_status'] = array('publish', 'private', 'draft', 'pending'); |
|
369 | 369 | // now set the main 'ee' request var so that the appropriate module can load the appropriate template(s) |
370 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] ); |
|
370 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']); |
|
371 | 371 | } |
372 | - $this->_possibly_set_ee_request_var( $post_type ); |
|
372 | + $this->_possibly_set_ee_request_var($post_type); |
|
373 | 373 | // convert post_type to model name |
374 | - $model_name = str_replace( 'EE_', '', $this->CPT['class_name'] ); |
|
374 | + $model_name = str_replace('EE_', '', $this->CPT['class_name']); |
|
375 | 375 | // get CPT table data via CPT Model |
376 | - $this->CPT_model = EE_Registry::instance()->load_model( $model_name ); |
|
376 | + $this->CPT_model = EE_Registry::instance()->load_model($model_name); |
|
377 | 377 | $this->CPT['tables'] = $this->CPT_model->get_tables(); |
378 | 378 | // is there a Meta Table for this CPT? |
379 | - $this->CPT['meta_table'] = isset( $this->CPT['tables'][ $model_name . '_Meta' ] ) ? $this->CPT['tables'][ $model_name . '_Meta' ] : FALSE; |
|
379 | + $this->CPT['meta_table'] = isset($this->CPT['tables'][$model_name.'_Meta']) ? $this->CPT['tables'][$model_name.'_Meta'] : FALSE; |
|
380 | 380 | // creates classname like: CPT_Event_Strategy |
381 | - $CPT_Strategy_class_name = 'CPT_' . $model_name . '_Strategy'; |
|
381 | + $CPT_Strategy_class_name = 'CPT_'.$model_name.'_Strategy'; |
|
382 | 382 | // load and instantiate |
383 | - $CPT_Strategy = EE_Registry::instance()->load_core ( $CPT_Strategy_class_name, array( 'WP_Query' => $WP_Query, 'CPT' => $this->CPT )); |
|
383 | + $CPT_Strategy = EE_Registry::instance()->load_core($CPT_Strategy_class_name, array('WP_Query' => $WP_Query, 'CPT' => $this->CPT)); |
|
384 | 384 | |
385 | 385 | // !!!!!!!!!! IMPORTANT !!!!!!!!!!!! |
386 | 386 | // here's the list of available filters in the WP_Query object |
@@ -392,13 +392,13 @@ discard block |
||
392 | 392 | // 'post_limits' |
393 | 393 | // 'posts_fields' |
394 | 394 | // 'posts_join' |
395 | - add_filter( 'posts_fields', array( $this, 'posts_fields' )); |
|
396 | - add_filter( 'posts_join', array( $this, 'posts_join' )); |
|
397 | - add_filter( 'get_' . $this->CPT['post_type'] . '_metadata', array( $CPT_Strategy, 'get_EE_post_type_metadata' ), 1, 4 ); |
|
398 | - add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 1 ); |
|
399 | - add_filter( 'get_edit_post_link', array( $this, 'get_edit_post_link' ), 10, 2 ); |
|
395 | + add_filter('posts_fields', array($this, 'posts_fields')); |
|
396 | + add_filter('posts_join', array($this, 'posts_join')); |
|
397 | + add_filter('get_'.$this->CPT['post_type'].'_metadata', array($CPT_Strategy, 'get_EE_post_type_metadata'), 1, 4); |
|
398 | + add_filter('the_posts', array($this, 'the_posts'), 1, 1); |
|
399 | + add_filter('get_edit_post_link', array($this, 'get_edit_post_link'), 10, 2); |
|
400 | 400 | |
401 | - $this->_do_template_filters( $WP_Query ); |
|
401 | + $this->_do_template_filters($WP_Query); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | } |
@@ -413,13 +413,13 @@ discard block |
||
413 | 413 | * @param $SQL |
414 | 414 | * @return string |
415 | 415 | */ |
416 | - public function posts_fields( $SQL ) { |
|
416 | + public function posts_fields($SQL) { |
|
417 | 417 | // does this CPT have a meta table ? |
418 | - if ( ! empty( $this->CPT['meta_table'] )) { |
|
418 | + if ( ! empty($this->CPT['meta_table'])) { |
|
419 | 419 | // adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement |
420 | - $SQL .= ', ' . $this->CPT['meta_table']->get_table_name() . '.* ' ; |
|
420 | + $SQL .= ', '.$this->CPT['meta_table']->get_table_name().'.* '; |
|
421 | 421 | } |
422 | - remove_filter( 'posts_fields', array( $this, 'posts_fields' )); |
|
422 | + remove_filter('posts_fields', array($this, 'posts_fields')); |
|
423 | 423 | return $SQL; |
424 | 424 | } |
425 | 425 | |
@@ -432,14 +432,14 @@ discard block |
||
432 | 432 | * @param $SQL |
433 | 433 | * @return string |
434 | 434 | */ |
435 | - public function posts_join( $SQL ) { |
|
435 | + public function posts_join($SQL) { |
|
436 | 436 | // does this CPT have a meta table ? |
437 | - if ( ! empty( $this->CPT['meta_table'] )) { |
|
437 | + if ( ! empty($this->CPT['meta_table'])) { |
|
438 | 438 | global $wpdb; |
439 | 439 | // adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement |
440 | - $SQL .= ' LEFT JOIN ' . $this->CPT['meta_table']->get_table_name() . ' ON ( ' . $this->CPT['meta_table']->get_table_name() . '.' . $this->CPT['meta_table']->get_fk_on_table() . ' = ' . $wpdb->posts . '.ID ) '; |
|
440 | + $SQL .= ' LEFT JOIN '.$this->CPT['meta_table']->get_table_name().' ON ( '.$this->CPT['meta_table']->get_table_name().'.'.$this->CPT['meta_table']->get_fk_on_table().' = '.$wpdb->posts.'.ID ) '; |
|
441 | 441 | } |
442 | - remove_filter( 'posts_join', array( $this, 'posts_join' )); |
|
442 | + remove_filter('posts_join', array($this, 'posts_join')); |
|
443 | 443 | return $SQL; |
444 | 444 | } |
445 | 445 | |
@@ -452,18 +452,18 @@ discard block |
||
452 | 452 | * @param \WP_Post[] $posts |
453 | 453 | * @return \WP_Post[] |
454 | 454 | */ |
455 | - public function the_posts( $posts ) { |
|
455 | + public function the_posts($posts) { |
|
456 | 456 | // d( $posts ); |
457 | 457 | $CPT_class = $this->CPT['class_name']; |
458 | 458 | // loop thru posts |
459 | - if ( is_array( $posts )) { |
|
460 | - foreach( $posts as $key => $post ) { |
|
461 | - if ( isset( $this->_CPTs[ $post->post_type ] )) { |
|
462 | - $post->$CPT_class = $this->CPT_model->instantiate_class_from_post_object( $post ); |
|
459 | + if (is_array($posts)) { |
|
460 | + foreach ($posts as $key => $post) { |
|
461 | + if (isset($this->_CPTs[$post->post_type])) { |
|
462 | + $post->$CPT_class = $this->CPT_model->instantiate_class_from_post_object($post); |
|
463 | 463 | } |
464 | 464 | } |
465 | 465 | } |
466 | - remove_filter( 'the_posts', array( $this, 'the_posts' ), 1, 1 ); |
|
466 | + remove_filter('the_posts', array($this, 'the_posts'), 1, 1); |
|
467 | 467 | return $posts; |
468 | 468 | } |
469 | 469 | |
@@ -474,17 +474,17 @@ discard block |
||
474 | 474 | * @param $ID |
475 | 475 | * @return string |
476 | 476 | */ |
477 | - function get_edit_post_link( $url, $ID ) { |
|
477 | + function get_edit_post_link($url, $ID) { |
|
478 | 478 | //need to make sure we only edit links if our cpt |
479 | 479 | global $post; |
480 | - if ( ! isset( $this->_CPTs[ $post->post_type ] )) { |
|
480 | + if ( ! isset($this->_CPTs[$post->post_type])) { |
|
481 | 481 | return $url; |
482 | 482 | } |
483 | 483 | //k made it here so all is good. |
484 | 484 | $scheme = is_ssl() ? 'https' : 'http'; |
485 | - $url = get_admin_url( EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme ); |
|
485 | + $url = get_admin_url(EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme); |
|
486 | 486 | // http://example.com/wp-admin/admin.php?page=espresso_events&action=edit&post=205&edit_nonce=0d403530d6 |
487 | - return wp_nonce_url( add_query_arg( array( 'page' => $this->CPT['post_type'], 'post' =>$ID, 'action' =>'edit' ), $url ), 'edit', 'edit_nonce' ); |
|
487 | + return wp_nonce_url(add_query_arg(array('page' => $this->CPT['post_type'], 'post' =>$ID, 'action' =>'edit'), $url), 'edit', 'edit_nonce'); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | |
@@ -498,11 +498,11 @@ discard block |
||
498 | 498 | * @param WP_Query $WP_Query |
499 | 499 | * @return void |
500 | 500 | */ |
501 | - protected function _do_template_filters( WP_Query $WP_Query ) { |
|
501 | + protected function _do_template_filters(WP_Query $WP_Query) { |
|
502 | 502 | // if it's the main query and requested cpt supports page_templates, |
503 | - if ( $WP_Query->is_main_query() && ! empty( $this->CPT['args']['page_templates'] ) ) { |
|
503 | + if ($WP_Query->is_main_query() && ! empty($this->CPT['args']['page_templates'])) { |
|
504 | 504 | // then let's hook into the appropriate query_template hook |
505 | - add_filter( 'single_template', array( $this, 'single_cpt_template' ) ); |
|
505 | + add_filter('single_template', array($this, 'single_cpt_template')); |
|
506 | 506 | } |
507 | 507 | } |
508 | 508 | |
@@ -516,17 +516,17 @@ discard block |
||
516 | 516 | * @param string $current_template Existing default template path derived for this page call. |
517 | 517 | * @return string the path to the full template file. |
518 | 518 | */ |
519 | - public function single_cpt_template( $current_template ) { |
|
519 | + public function single_cpt_template($current_template) { |
|
520 | 520 | $object = get_queried_object(); |
521 | 521 | //does this called object HAVE a page template set that is something other than the default. |
522 | - $template = get_post_meta( $object->ID, '_wp_page_template', true ); |
|
522 | + $template = get_post_meta($object->ID, '_wp_page_template', true); |
|
523 | 523 | |
524 | 524 | //exit early if default or not set or invalid path (accounts for theme changes) |
525 | - if ( $template == 'default' || empty( $template ) || ! is_readable( get_stylesheet_directory() . '/' . $template ) ) { |
|
525 | + if ($template == 'default' || empty($template) || ! is_readable(get_stylesheet_directory().'/'.$template)) { |
|
526 | 526 | return $current_template; |
527 | 527 | } |
528 | 528 | //made it here so we SHOULD be able to just locate the template and then return it. |
529 | - $template = locate_template( array($template) ); |
|
529 | + $template = locate_template(array($template)); |
|
530 | 530 | |
531 | 531 | return $template; |
532 | 532 | } |
@@ -574,9 +574,9 @@ discard block |
||
574 | 574 | * @param array $arguments |
575 | 575 | * @return \EE_CPT_Default_Strategy |
576 | 576 | */ |
577 | - public function __construct( $arguments = array() ) { |
|
578 | - $this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL; |
|
579 | - $WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL; |
|
577 | + public function __construct($arguments = array()) { |
|
578 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL; |
|
579 | + $WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL; |
|
580 | 580 | //EEH_Debug_Tools::printr( $this->CPT, '$this->CPT <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
581 | 581 | // add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ), 999 ); |
582 | 582 | // add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 ); |
@@ -591,9 +591,9 @@ discard block |
||
591 | 591 | * @param \WP_Query $WP_Query |
592 | 592 | * @return \WP_Query |
593 | 593 | */ |
594 | - public function pre_get_posts( WP_Query $WP_Query ) { |
|
594 | + public function pre_get_posts(WP_Query $WP_Query) { |
|
595 | 595 | //EEH_Debug_Tools::printr( $WP_Query, '$WP_Query <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
596 | - if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive() ) { |
|
596 | + if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) { |
|
597 | 597 | return $WP_Query; |
598 | 598 | } |
599 | 599 | // $WP_Query->set( 'post_type', array( $this->CPT['post_type'] )); |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | * @param \WP_Query $WP_Query |
612 | 612 | * @return \WP_Post[] |
613 | 613 | */ |
614 | - public function the_posts( $posts, WP_Query $WP_Query ) { |
|
614 | + public function the_posts($posts, WP_Query $WP_Query) { |
|
615 | 615 | return $posts; |
616 | 616 | } |
617 | 617 | |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | * @param string $single |
628 | 628 | * @return mixed |
629 | 629 | */ |
630 | - public function get_EE_post_type_metadata( $meta_value = NULL, $post_id, $meta_key, $single ) { |
|
630 | + public function get_EE_post_type_metadata($meta_value = NULL, $post_id, $meta_key, $single) { |
|
631 | 631 | return $meta_value; |
632 | 632 | } |
633 | 633 |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | |
43 | 43 | public function __construct() { |
44 | 44 | // construct request stack and run middleware apps as soon as all WP plugins are loaded |
45 | - add_action( 'plugins_loaded', array( $this, 'run_request_stack' ), 0 ); |
|
45 | + add_action('plugins_loaded', array($this, 'run_request_stack'), 0); |
|
46 | 46 | // set framework for the rest of EE to hook into when loading |
47 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'load_espresso_addons' ), 1 ); |
|
48 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'detect_activations_or_upgrades' ), 3 ); |
|
49 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'load_core_configuration' ), 5 ); |
|
50 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
51 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'brew_espresso' ), 9 ); |
|
47 | + add_action('plugins_loaded', array('EE_Bootstrap', 'load_espresso_addons'), 1); |
|
48 | + add_action('plugins_loaded', array('EE_Bootstrap', 'detect_activations_or_upgrades'), 3); |
|
49 | + add_action('plugins_loaded', array('EE_Bootstrap', 'load_core_configuration'), 5); |
|
50 | + add_action('plugins_loaded', array('EE_Bootstrap', 'register_shortcodes_modules_and_widgets'), 7); |
|
51 | + add_action('plugins_loaded', array('EE_Bootstrap', 'brew_espresso'), 9); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | new EE_Load_Espresso_Core() |
66 | 66 | ); |
67 | 67 | $this->_request_stack->handle_request( |
68 | - new EE_Request( $_REQUEST ), |
|
68 | + new EE_Request($_REQUEST), |
|
69 | 69 | new EE_Response() |
70 | 70 | ); |
71 | 71 | $this->_request_stack->handle_response(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | protected function load_autoloader() { |
80 | 80 | // load interfaces |
81 | - espresso_load_required( 'EEH_Autoloader', EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php' ); |
|
81 | + espresso_load_required('EEH_Autoloader', EE_CORE.'helpers'.DS.'EEH_Autoloader.helper.php'); |
|
82 | 82 | EEH_Autoloader::instance(); |
83 | 83 | } |
84 | 84 | |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function set_autoloaders_for_required_files() { |
91 | 91 | // load interfaces |
92 | - espresso_load_required( 'EEI_Interfaces', EE_CORE . 'interfaces' . DS . 'EEI_Interfaces.php' ); |
|
92 | + espresso_load_required('EEI_Interfaces', EE_CORE.'interfaces'.DS.'EEI_Interfaces.php'); |
|
93 | 93 | // load helpers |
94 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_HELPERS ); |
|
94 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
95 | 95 | // load request stack |
96 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE . 'request_stack' . DS ); |
|
96 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'request_stack'.DS); |
|
97 | 97 | // load middleware |
98 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE . 'middleware' . DS ); |
|
98 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'middleware'.DS); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | ) |
119 | 119 | ); |
120 | 120 | // load middleware onto stack : FILO (First In Last Out) |
121 | - foreach ( (array)$stack_apps as $stack_app ) { |
|
121 | + foreach ((array) $stack_apps as $stack_app) { |
|
122 | 122 | //$request_stack_builder->push( $stack_app ); |
123 | - $request_stack_builder->unshift( $stack_app ); |
|
123 | + $request_stack_builder->unshift($stack_app); |
|
124 | 124 | } |
125 | 125 | return apply_filters( |
126 | 126 | 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * no other logic should be performed at this point |
138 | 138 | */ |
139 | 139 | public static function load_espresso_addons() { |
140 | - do_action( 'AHEE__EE_Bootstrap__load_espresso_addons' ); |
|
140 | + do_action('AHEE__EE_Bootstrap__load_espresso_addons'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * we can determine if anything needs activating or upgrading |
150 | 150 | */ |
151 | 151 | public static function detect_activations_or_upgrades() { |
152 | - do_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades' ); |
|
152 | + do_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * we can load and set all of the system configurations |
162 | 162 | */ |
163 | 163 | public static function load_core_configuration() { |
164 | - do_action( 'AHEE__EE_Bootstrap__load_core_configuration' ); |
|
164 | + do_action('AHEE__EE_Bootstrap__load_core_configuration'); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * so that they are ready to be used throughout the system |
174 | 174 | */ |
175 | 175 | public static function register_shortcodes_modules_and_widgets() { |
176 | - do_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets' ); |
|
176 | + do_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets'); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * so let the fun begin... |
186 | 186 | */ |
187 | 187 | public static function brew_espresso() { |
188 | - do_action( 'AHEE__EE_Bootstrap__brew_espresso' ); |
|
188 | + do_action('AHEE__EE_Bootstrap__brew_espresso'); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public static function instance() { |
130 | 130 | // check if class object is instantiated, and instantiated properly |
131 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
131 | + if ( ! self::$_instance instanceof EE_Config) { |
|
132 | 132 | self::$_instance = new self(); |
133 | 133 | } |
134 | 134 | return self::$_instance; |
@@ -145,22 +145,22 @@ discard block |
||
145 | 145 | * not be ready to instantiate EE_Config currently (eg if the site was put into maintenance mode) |
146 | 146 | * @return EE_Config |
147 | 147 | */ |
148 | - public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE ){ |
|
149 | - if ( $hard_reset ) { |
|
148 | + public static function reset($hard_reset = FALSE, $reinstantiate = TRUE) { |
|
149 | + if ($hard_reset) { |
|
150 | 150 | self::$_instance->_config_option_names = array(); |
151 | 151 | self::$_instance->_initialize_config(); |
152 | 152 | self::$_instance->update_espresso_config(); |
153 | 153 | } |
154 | - if( self::$_instance instanceof EE_Config ){ |
|
154 | + if (self::$_instance instanceof EE_Config) { |
|
155 | 155 | self::$_instance->shutdown(); |
156 | 156 | } |
157 | 157 | self::$_instance = NULL; |
158 | 158 | //we don't need to reset the static properties imo because those should |
159 | 159 | //only change when a module is added or removed. Currently we don't |
160 | 160 | //support removing a module during a request when it previously existed |
161 | - if( $reinstantiate ){ |
|
161 | + if ($reinstantiate) { |
|
162 | 162 | return self::instance(); |
163 | - }else{ |
|
163 | + } else { |
|
164 | 164 | return NULL; |
165 | 165 | } |
166 | 166 | } |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | * @return \EE_Config |
175 | 175 | */ |
176 | 176 | private function __construct() { |
177 | - do_action( 'AHEE__EE_Config__construct__begin',$this ); |
|
178 | - $this->_config_option_names = get_option( 'ee_config_option_names', array() ); |
|
177 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
178 | + $this->_config_option_names = get_option('ee_config_option_names', array()); |
|
179 | 179 | // setup empty config classes |
180 | 180 | $this->_initialize_config(); |
181 | 181 | // load existing EE site settings |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | // confirm everything loaded correctly and set filtered defaults if not |
184 | 184 | $this->_verify_config(); |
185 | 185 | // register shortcodes and modules |
186 | - add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 ); |
|
186 | + add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999); |
|
187 | 187 | // initialize shortcodes and modules |
188 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' )); |
|
188 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
189 | 189 | // register widgets |
190 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
190 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
191 | 191 | // shutdown |
192 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
192 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
193 | 193 | // construct__end hook |
194 | - do_action( 'AHEE__EE_Config__construct__end',$this ); |
|
194 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
195 | 195 | // hardcoded hack |
196 | 196 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
197 | 197 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @return string current theme set. |
205 | 205 | */ |
206 | 206 | public static function get_current_theme() { |
207 | - return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
207 | + return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -238,27 +238,27 @@ discard block |
||
238 | 238 | */ |
239 | 239 | private function _load_core_config() { |
240 | 240 | // load_core_config__start hook |
241 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
241 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
242 | 242 | $espresso_config = $this->get_espresso_config(); |
243 | - foreach ( $espresso_config as $config => $settings ) { |
|
243 | + foreach ($espresso_config as $config => $settings) { |
|
244 | 244 | // load_core_config__start hook |
245 | - $settings = apply_filters( 'FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this ); |
|
246 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
247 | - $this->$config = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
245 | + $settings = apply_filters('FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this); |
|
246 | + if (is_object($settings) && property_exists($this, $config)) { |
|
247 | + $this->$config = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
248 | 248 | //call configs populate method to ensure any defaults are set for empty values. |
249 | - if ( method_exists( $settings, 'populate' ) ) { |
|
249 | + if (method_exists($settings, 'populate')) { |
|
250 | 250 | $this->$config->populate(); |
251 | 251 | } |
252 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
252 | + if (method_exists($settings, 'do_hooks')) { |
|
253 | 253 | $this->$config->do_hooks(); |
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
257 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', FALSE ) ) { |
|
257 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', FALSE)) { |
|
258 | 258 | $this->update_espresso_config(); |
259 | 259 | } |
260 | 260 | // load_core_config__end hook |
261 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
261 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -272,40 +272,40 @@ discard block |
||
272 | 272 | protected function _verify_config() { |
273 | 273 | |
274 | 274 | $this->core = $this->core instanceof EE_Core_Config |
275 | - ? $this->core : new EE_Core_Config(); |
|
276 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
275 | + ? $this->core : new EE_Core_Config(); |
|
276 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
277 | 277 | |
278 | 278 | $this->organization = $this->organization instanceof EE_Organization_Config |
279 | - ? $this->organization : new EE_Organization_Config(); |
|
280 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
279 | + ? $this->organization : new EE_Organization_Config(); |
|
280 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
281 | 281 | |
282 | 282 | $this->currency = $this->currency instanceof EE_Currency_Config |
283 | 283 | ? $this->currency : new EE_Currency_Config(); |
284 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
284 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
285 | 285 | |
286 | 286 | $this->registration = $this->registration instanceof EE_Registration_Config |
287 | 287 | ? $this->registration : new EE_Registration_Config(); |
288 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
288 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
289 | 289 | |
290 | 290 | $this->admin = $this->admin instanceof EE_Admin_Config |
291 | 291 | ? $this->admin : new EE_Admin_Config(); |
292 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
292 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
293 | 293 | |
294 | 294 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
295 | 295 | ? $this->template_settings : new EE_Template_Config(); |
296 | - $this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', $this->template_settings ); |
|
296 | + $this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', $this->template_settings); |
|
297 | 297 | |
298 | 298 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
299 | 299 | ? $this->map_settings : new EE_Map_Config(); |
300 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
300 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
301 | 301 | |
302 | 302 | $this->environment = $this->environment instanceof EE_Environment_Config |
303 | 303 | ? $this->environment : new EE_Environment_Config(); |
304 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
304 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
305 | 305 | |
306 | 306 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
307 | 307 | ? $this->gateway : new EE_Gateway_Config(); |
308 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
308 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
309 | 309 | |
310 | 310 | } |
311 | 311 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | public function get_espresso_config() { |
321 | 321 | // grab espresso configuration |
322 | - return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() )); |
|
322 | + return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array())); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -332,11 +332,11 @@ discard block |
||
332 | 332 | * @param $old_value |
333 | 333 | * @param $value |
334 | 334 | */ |
335 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
335 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
336 | 336 | // make sure we're checking the ee config |
337 | - if ( $option == 'ee_config' ) { |
|
337 | + if ($option == 'ee_config') { |
|
338 | 338 | // run a loose comparison of the old value against the new value for type and properties, but NOT exact instance like WP update_option does |
339 | - if ( $value != $old_value ) { |
|
339 | + if ($value != $old_value) { |
|
340 | 340 | // if they are NOT the same, then remove the hook, which means the subsequent update results will be based solely on the update query results |
341 | 341 | // the reason we do this is because, as stated above, WP update_option performs an exact instance comparison (===) on any update values passed to it |
342 | 342 | // this happens PRIOR to serialization and any subsequent update. If values are found to match their previous old value, then WP bails before performing any update. |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | // HOWEVER, once the object is serialized and passed off to MySQL to update, |
345 | 345 | // MySQL MAY ALSO NOT perform the update because the string it sees in the db looks the same as the new one it has been passed!!! |
346 | 346 | // This results in the query returning an "affected rows" value of ZERO, which gets returned immediately by WP update_option and looks like an error. |
347 | - remove_action( 'update_option', array( $this, 'check_config_updated' )); |
|
347 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | } |
@@ -359,11 +359,11 @@ discard block |
||
359 | 359 | */ |
360 | 360 | protected function _reset_espresso_addon_config() { |
361 | 361 | $this->_config_option_names = array(); |
362 | - foreach( $this->addons as $addon_name => $addon_config_obj ) { |
|
363 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
364 | - $config_class = get_class( $addon_config_obj ); |
|
365 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
366 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE ); |
|
362 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
363 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
364 | + $config_class = get_class($addon_config_obj); |
|
365 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
366 | + $this->update_config('addons', $addon_name, $addon_config_obj, FALSE); |
|
367 | 367 | } |
368 | 368 | $this->addons->$addon_name = NULL; |
369 | 369 | } |
@@ -379,36 +379,36 @@ discard block |
||
379 | 379 | * @param bool $add_error |
380 | 380 | * @return bool |
381 | 381 | */ |
382 | - public function update_espresso_config( $add_success = FALSE, $add_error = TRUE ) { |
|
382 | + public function update_espresso_config($add_success = FALSE, $add_error = TRUE) { |
|
383 | 383 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
384 | 384 | //$clone = clone( self::$_instance ); |
385 | 385 | //self::$_instance = NULL; |
386 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this ); |
|
386 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
387 | 387 | $this->_reset_espresso_addon_config(); |
388 | 388 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional but BEFORE the actual update occurs |
389 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
389 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
390 | 390 | // now update "ee_config" |
391 | - $saved = update_option( 'ee_config', $this ); |
|
391 | + $saved = update_option('ee_config', $this); |
|
392 | 392 | // if not saved... check if the hook we just added still exists; if it does, it means one of two things: |
393 | 393 | // that update_option bailed at the ( $value === $old_value ) conditional, or... |
394 | 394 | // the db update query returned 0 rows affected (probably because the data value was the same from it's perspective) |
395 | 395 | // so the existence of the hook means that a negative result from update_option is NOT an error, but just means no update occurred, so don't display an error to the user. |
396 | 396 | // BUT... if update_option returns FALSE, AND the hook is missing, then it means that something truly went wrong |
397 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved; |
|
397 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
398 | 398 | // remove our action since we don't want it in the system anymore |
399 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
400 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
399 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
400 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
401 | 401 | //self::$_instance = $clone; |
402 | 402 | //unset( $clone ); |
403 | 403 | // if config remains the same or was updated successfully |
404 | - if ( $saved ) { |
|
405 | - if ( $add_success ) { |
|
406 | - EE_Error::add_success( __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
404 | + if ($saved) { |
|
405 | + if ($add_success) { |
|
406 | + EE_Error::add_success(__('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
407 | 407 | } |
408 | 408 | return TRUE; |
409 | 409 | } else { |
410 | - if ( $add_error ) { |
|
411 | - EE_Error::add_error( __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
410 | + if ($add_error) { |
|
411 | + EE_Error::add_error(__('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
412 | 412 | } |
413 | 413 | return FALSE; |
414 | 414 | } |
@@ -427,77 +427,77 @@ discard block |
||
427 | 427 | * @param bool $display_errors |
428 | 428 | * @return bool TRUE on success, FALSE on fail |
429 | 429 | */ |
430 | - private function _verify_config_params( $section = '', $name = '', $config_class = '', $config_obj = NULL, $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), $display_errors = TRUE ) { |
|
430 | + private function _verify_config_params($section = '', $name = '', $config_class = '', $config_obj = NULL, $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), $display_errors = TRUE) { |
|
431 | 431 | try { |
432 | 432 | // TEST #1 : check that section was set |
433 | - if ( in_array( 1, $tests_to_run ) && empty( $section )) { |
|
434 | - if ( $display_errors ) { |
|
435 | - throw new EE_Error( sprintf( __( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ), $config_class )); |
|
433 | + if (in_array(1, $tests_to_run) && empty($section)) { |
|
434 | + if ($display_errors) { |
|
435 | + throw new EE_Error(sprintf(__('No configuration section has been provided while attempting to save "%s".', 'event_espresso'), $config_class)); |
|
436 | 436 | } |
437 | 437 | return FALSE; |
438 | 438 | } |
439 | 439 | // TEST #2 : check that settings section exists |
440 | - if ( in_array( 2, $tests_to_run ) && ! isset( $this->{$section} )) { |
|
441 | - if ( $display_errors ) { |
|
442 | - throw new EE_Error( sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ), $section )); |
|
440 | + if (in_array(2, $tests_to_run) && ! isset($this->{$section} )) { |
|
441 | + if ($display_errors) { |
|
442 | + throw new EE_Error(sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'), $section)); |
|
443 | 443 | } |
444 | 444 | return FALSE; |
445 | 445 | } |
446 | 446 | // TEST #3 : check that section is the proper format |
447 | - if ( in_array( 3, $tests_to_run ) && ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass )) { |
|
448 | - if ( $display_errors ) { |
|
449 | - throw new EE_Error( sprintf( __( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ), $section )); |
|
447 | + if (in_array(3, $tests_to_run) && ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass)) { |
|
448 | + if ($display_errors) { |
|
449 | + throw new EE_Error(sprintf(__('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'), $section)); |
|
450 | 450 | } |
451 | 451 | return FALSE; |
452 | 452 | } |
453 | 453 | // TEST #4 : check that config section name has been set |
454 | - if ( in_array( 4, $tests_to_run ) && empty( $name )) { |
|
455 | - if ( $display_errors ) { |
|
456 | - throw new EE_Error( __( 'No name has been provided for the specific configuration section.', 'event_espresso' )); |
|
454 | + if (in_array(4, $tests_to_run) && empty($name)) { |
|
455 | + if ($display_errors) { |
|
456 | + throw new EE_Error(__('No name has been provided for the specific configuration section.', 'event_espresso')); |
|
457 | 457 | } |
458 | 458 | return FALSE; |
459 | 459 | } |
460 | 460 | // TEST #5 : check that a config class name has been set |
461 | - if ( in_array( 5, $tests_to_run ) && empty( $config_class )) { |
|
462 | - if ( $display_errors ) { |
|
463 | - throw new EE_Error( __( 'No class name has been provided for the specific configuration section.', 'event_espresso' )); |
|
461 | + if (in_array(5, $tests_to_run) && empty($config_class)) { |
|
462 | + if ($display_errors) { |
|
463 | + throw new EE_Error(__('No class name has been provided for the specific configuration section.', 'event_espresso')); |
|
464 | 464 | } |
465 | 465 | return FALSE; |
466 | 466 | } |
467 | 467 | // TEST #6 : verify config class is accessible |
468 | - if ( in_array( 6, $tests_to_run ) && ! class_exists( $config_class )) { |
|
469 | - if ( $display_errors ) { |
|
470 | - throw new EE_Error( sprintf( __( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ), $config_class )); |
|
468 | + if (in_array(6, $tests_to_run) && ! class_exists($config_class)) { |
|
469 | + if ($display_errors) { |
|
470 | + throw new EE_Error(sprintf(__('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'), $config_class)); |
|
471 | 471 | } |
472 | 472 | return FALSE; |
473 | 473 | } |
474 | 474 | // TEST #7 : check that config has even been set |
475 | - if ( in_array( 7, $tests_to_run )) { |
|
476 | - if ( ! isset( $this->{$section}->{$name} )) { |
|
477 | - if ( $display_errors ) { |
|
478 | - throw new EE_Error( sprintf( __( 'No configuration has been set for "%s->%s".', 'event_espresso' ), $section, $name )); |
|
475 | + if (in_array(7, $tests_to_run)) { |
|
476 | + if ( ! isset($this->{$section}->{$name} )) { |
|
477 | + if ($display_errors) { |
|
478 | + throw new EE_Error(sprintf(__('No configuration has been set for "%s->%s".', 'event_espresso'), $section, $name)); |
|
479 | 479 | } |
480 | 480 | return FALSE; |
481 | 481 | } else { |
482 | 482 | // and make sure it's not serialized |
483 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
483 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
484 | 484 | } |
485 | 485 | } |
486 | 486 | // TEST #8 : check that config is the requested type |
487 | - if ( in_array( 8, $tests_to_run ) && ! $this->{$section}->{$name} instanceof $config_class ) { |
|
488 | - if ( $display_errors ) { |
|
489 | - throw new EE_Error( sprintf( __( 'The configuration for "%s->%s" is not of the "%s" class.', 'event_espresso' ), $section, $name, $config_class )); |
|
487 | + if (in_array(8, $tests_to_run) && ! $this->{$section}->{$name} instanceof $config_class) { |
|
488 | + if ($display_errors) { |
|
489 | + throw new EE_Error(sprintf(__('The configuration for "%s->%s" is not of the "%s" class.', 'event_espresso'), $section, $name, $config_class)); |
|
490 | 490 | } |
491 | 491 | return FALSE; |
492 | 492 | } |
493 | 493 | // TEST #9 : verify config object |
494 | - if ( in_array( 9, $tests_to_run ) && ! $config_obj instanceof EE_Config_Base ) { |
|
495 | - if ( $display_errors ) { |
|
496 | - throw new EE_Error( sprintf( __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), print_r( $config_obj, TRUE ))); |
|
494 | + if (in_array(9, $tests_to_run) && ! $config_obj instanceof EE_Config_Base) { |
|
495 | + if ($display_errors) { |
|
496 | + throw new EE_Error(sprintf(__('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), print_r($config_obj, TRUE))); |
|
497 | 497 | } |
498 | 498 | return FALSE; |
499 | 499 | } |
500 | - } catch( EE_Error $e ) { |
|
500 | + } catch (EE_Error $e) { |
|
501 | 501 | $e->get_error(); |
502 | 502 | } |
503 | 503 | // you have successfully run the gauntlet |
@@ -514,8 +514,8 @@ discard block |
||
514 | 514 | * @param string $name |
515 | 515 | * @return string |
516 | 516 | */ |
517 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
518 | - return 'ee_config-' . $section . '-' . $name; |
|
517 | + private function _generate_config_option_name($section = '', $name = '') { |
|
518 | + return 'ee_config-'.$section.'-'.$name; |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | |
@@ -529,8 +529,8 @@ discard block |
||
529 | 529 | * @param string $name |
530 | 530 | * @return string |
531 | 531 | */ |
532 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
533 | - return ! empty( $config_class ) ? $config_class : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ))) . '_Config'; |
|
532 | + private function _set_config_class($config_class = '', $name = '') { |
|
533 | + return ! empty($config_class) ? $config_class : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | |
@@ -544,35 +544,35 @@ discard block |
||
544 | 544 | * @param \EE_Config_Base $config_obj |
545 | 545 | * @return \EE_Config_Base|bool |
546 | 546 | */ |
547 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = NULL ) { |
|
547 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = NULL) { |
|
548 | 548 | // ensure config class is set to something |
549 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
549 | + $config_class = $this->_set_config_class($config_class, $name); |
|
550 | 550 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
551 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) { |
|
551 | + if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) { |
|
552 | 552 | return FALSE; |
553 | 553 | } |
554 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
554 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
555 | 555 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
556 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
557 | - $this->_config_option_names[ $config_option_name ] = $config_class; |
|
556 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
557 | + $this->_config_option_names[$config_option_name] = $config_class; |
|
558 | 558 | } |
559 | 559 | // verify the incoming config object but suppress errors |
560 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) { |
|
560 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) { |
|
561 | 561 | $config_obj = new $config_class(); |
562 | 562 | } |
563 | - $config_set = get_option( $config_option_name ); |
|
563 | + $config_set = get_option($config_option_name); |
|
564 | 564 | |
565 | - if ( $config_set ) { |
|
566 | - update_option( $config_option_name, $config_obj ); |
|
565 | + if ($config_set) { |
|
566 | + update_option($config_option_name, $config_obj); |
|
567 | 567 | $this->{$section}->{$name} = $config_obj; |
568 | 568 | return $this->{$section}->{$name}; |
569 | 569 | } else { |
570 | 570 | // create a wp-option for this config |
571 | - if ( add_option( $config_option_name, $config_obj, '', 'no' )) { |
|
572 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
571 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
572 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
573 | 573 | return $this->{$section}->{$name}; |
574 | 574 | } else { |
575 | - EE_Error::add_error( sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), __FILE__, __FUNCTION__, __LINE__ ); |
|
575 | + EE_Error::add_error(sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), __FILE__, __FUNCTION__, __LINE__); |
|
576 | 576 | return FALSE; |
577 | 577 | } |
578 | 578 | } |
@@ -591,37 +591,37 @@ discard block |
||
591 | 591 | * @param bool $throw_errors |
592 | 592 | * @return bool |
593 | 593 | */ |
594 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = TRUE ) { |
|
595 | - $config_obj = maybe_unserialize( $config_obj ); |
|
594 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = TRUE) { |
|
595 | + $config_obj = maybe_unserialize($config_obj); |
|
596 | 596 | // get class name of the incoming object |
597 | - $config_class = get_class( $config_obj ); |
|
597 | + $config_class = get_class($config_obj); |
|
598 | 598 | // run tests 1-5 and 9 to verify config |
599 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) { |
|
599 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) { |
|
600 | 600 | return FALSE; |
601 | 601 | } |
602 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
602 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
603 | 603 | // check if config object has been added to db by seeing if config option name is in $this->_config_option_names array |
604 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
604 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
605 | 605 | // save new config to db |
606 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
606 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
607 | 607 | } else { |
608 | 608 | // first check if the record already exists |
609 | - $existing_config = get_option( $config_option_name ); |
|
610 | - $config_obj = serialize( $config_obj ); |
|
609 | + $existing_config = get_option($config_option_name); |
|
610 | + $config_obj = serialize($config_obj); |
|
611 | 611 | // just return if db record is already up to date |
612 | - if ( $existing_config == $config_obj ) { |
|
612 | + if ($existing_config == $config_obj) { |
|
613 | 613 | $this->{$section}->{$name} = $config_obj; |
614 | 614 | return TRUE; |
615 | - } else if ( update_option( $config_option_name, $config_obj )) { |
|
615 | + } else if (update_option($config_option_name, $config_obj)) { |
|
616 | 616 | // update wp-option for this config class |
617 | 617 | $this->{$section}->{$name} = $config_obj; |
618 | 618 | return $this->update_espresso_config(); |
619 | - } elseif ( $throw_errors ) { |
|
619 | + } elseif ($throw_errors) { |
|
620 | 620 | EE_Error::add_error( |
621 | 621 | sprintf( |
622 | - __( 'The "%s" object stored at"%s" was not successfully updated in the database.', 'event_espresso' ), |
|
622 | + __('The "%s" object stored at"%s" was not successfully updated in the database.', 'event_espresso'), |
|
623 | 623 | $config_class, |
624 | - 'EE_Config->' . $section . '->' . $name |
|
624 | + 'EE_Config->'.$section.'->'.$name |
|
625 | 625 | ), |
626 | 626 | __FILE__, __FUNCTION__, __LINE__ |
627 | 627 | ); |
@@ -641,33 +641,33 @@ discard block |
||
641 | 641 | * @param string $config_class |
642 | 642 | * @return mixed EE_Config_Base | NULL |
643 | 643 | */ |
644 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
644 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
645 | 645 | // ensure config class is set to something |
646 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
646 | + $config_class = $this->_set_config_class($config_class, $name); |
|
647 | 647 | // run tests 1-4, 6 and 7 to verify that all params have been set |
648 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) { |
|
648 | + if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) { |
|
649 | 649 | return NULL; |
650 | 650 | } |
651 | 651 | // now test if the requested config object exists, but suppress errors |
652 | - if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) { |
|
652 | + if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) { |
|
653 | 653 | // config already exists, so pass it back |
654 | 654 | return $this->{$section}->{$name}; |
655 | 655 | } |
656 | 656 | // load config option from db if it exists |
657 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name )); |
|
657 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
658 | 658 | // verify the newly retrieved config object, but suppress errors |
659 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) { |
|
659 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) { |
|
660 | 660 | // config is good, so set it and pass it back |
661 | 661 | $this->{$section}->{$name} = $config_obj; |
662 | 662 | return $this->{$section}->{$name}; |
663 | 663 | } |
664 | 664 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
665 | - $config_obj =$this->set_config( $section, $name, $config_class ); |
|
665 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
666 | 666 | // verify the newly created config object |
667 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) { |
|
667 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
668 | 668 | return $this->{$section}->{$name}; |
669 | 669 | } else { |
670 | - EE_Error::add_error( sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), __FILE__, __FUNCTION__, __LINE__ ); |
|
670 | + EE_Error::add_error(sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), __FILE__, __FUNCTION__, __LINE__); |
|
671 | 671 | } |
672 | 672 | return NULL; |
673 | 673 | } |
@@ -680,9 +680,9 @@ discard block |
||
680 | 680 | * @param string $config_option_name |
681 | 681 | * @return mixed EE_Config_Base | FALSE |
682 | 682 | */ |
683 | - public function get_config_option( $config_option_name = '' ) { |
|
683 | + public function get_config_option($config_option_name = '') { |
|
684 | 684 | // retrieve the wp-option for this config class. |
685 | - return maybe_unserialize( get_option( $config_option_name )); |
|
685 | + return maybe_unserialize(get_option($config_option_name)); |
|
686 | 686 | } |
687 | 687 | |
688 | 688 | |
@@ -695,45 +695,45 @@ discard block |
||
695 | 695 | * @param $page_for_posts |
696 | 696 | * @return void |
697 | 697 | */ |
698 | - public function update_post_shortcodes( $page_for_posts = '' ) { |
|
698 | + public function update_post_shortcodes($page_for_posts = '') { |
|
699 | 699 | // make sure page_for_posts is set |
700 | - $page_for_posts = ! empty( $page_for_posts ) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
700 | + $page_for_posts = ! empty($page_for_posts) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
701 | 701 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
702 | 702 | $critical_shortcodes = $this->core->get_critical_pages_shortcodes_array(); |
703 | 703 | // allow others to mess stuff up :D |
704 | - do_action( 'AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts ); |
|
704 | + do_action('AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts); |
|
705 | 705 | // verify that post_shortcodes is set |
706 | - $this->core->post_shortcodes = isset( $this->core->post_shortcodes ) && is_array( $this->core->post_shortcodes ) ? $this->core->post_shortcodes : array(); |
|
706 | + $this->core->post_shortcodes = isset($this->core->post_shortcodes) && is_array($this->core->post_shortcodes) ? $this->core->post_shortcodes : array(); |
|
707 | 707 | // cycle thru post_shortcodes |
708 | - foreach( $this->core->post_shortcodes as $post_name => $shortcodes ){ |
|
708 | + foreach ($this->core->post_shortcodes as $post_name => $shortcodes) { |
|
709 | 709 | // are there any shortcodes to track ? |
710 | - if ( ! empty( $shortcodes )) { |
|
710 | + if ( ! empty($shortcodes)) { |
|
711 | 711 | // loop thru list of tracked shortcodes |
712 | - foreach( $shortcodes as $shortcode => $post_id ) { |
|
712 | + foreach ($shortcodes as $shortcode => $post_id) { |
|
713 | 713 | // if shortcode is for a critical page, BUT this is NOT the corresponding critical page for that shortcode |
714 | - if ( isset( $critical_shortcodes[ $post_id ] ) && $post_name == $page_for_posts ) { |
|
714 | + if (isset($critical_shortcodes[$post_id]) && $post_name == $page_for_posts) { |
|
715 | 715 | // then remove this shortcode, because we don't want critical page shortcodes like ESPRESSO_TXN_PAGE running on the "Posts Page" (blog) |
716 | - unset( $this->core->post_shortcodes[ $post_name ][ $shortcode ] ); |
|
716 | + unset($this->core->post_shortcodes[$post_name][$shortcode]); |
|
717 | 717 | } |
718 | 718 | // skip the posts page, because we want all shortcodes registered for it |
719 | - if ( $post_name == $page_for_posts ) { |
|
719 | + if ($post_name == $page_for_posts) { |
|
720 | 720 | continue; |
721 | 721 | } |
722 | 722 | // make sure post still exists |
723 | - $post = get_post( $post_id ); |
|
724 | - if ( $post ) { |
|
723 | + $post = get_post($post_id); |
|
724 | + if ($post) { |
|
725 | 725 | // check that the post name matches what we have saved |
726 | - if ( $post->post_name == $post_name ) { |
|
726 | + if ($post->post_name == $post_name) { |
|
727 | 727 | // if so, then break before hitting the unset below |
728 | 728 | continue; |
729 | 729 | } |
730 | 730 | } |
731 | 731 | // we don't like missing posts around here >:( |
732 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
732 | + unset($this->core->post_shortcodes[$post_name]); |
|
733 | 733 | } |
734 | 734 | } else { |
735 | 735 | // you got no shortcodes to keep track of ! |
736 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
736 | + unset($this->core->post_shortcodes[$post_name]); |
|
737 | 737 | } |
738 | 738 | } |
739 | 739 | //only show errors |
@@ -752,14 +752,14 @@ discard block |
||
752 | 752 | * @return string |
753 | 753 | */ |
754 | 754 | public static function get_page_for_posts() { |
755 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
756 | - if ( ! $page_for_posts ) { |
|
755 | + $page_for_posts = get_option('page_for_posts'); |
|
756 | + if ( ! $page_for_posts) { |
|
757 | 757 | return 'posts'; |
758 | 758 | } |
759 | 759 | /** @type WPDB $wpdb */ |
760 | 760 | global $wpdb; |
761 | 761 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
762 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts )); |
|
762 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | |
@@ -775,11 +775,11 @@ discard block |
||
775 | 775 | * @return void |
776 | 776 | */ |
777 | 777 | public function register_shortcodes_and_modules() { |
778 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
778 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
779 | 779 | return; |
780 | 780 | } |
781 | 781 | // allow shortcodes to register with WP and to set hooks for the rest of the system |
782 | - EE_Registry::instance()->shortcodes =$this->_register_shortcodes(); |
|
782 | + EE_Registry::instance()->shortcodes = $this->_register_shortcodes(); |
|
783 | 783 | // allow modules to set hooks for the rest of the system |
784 | 784 | EE_Registry::instance()->modules = $this->_register_modules(); |
785 | 785 | } |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | * @return void |
794 | 794 | */ |
795 | 795 | public function initialize_shortcodes_and_modules() { |
796 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
796 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
797 | 797 | return; |
798 | 798 | } |
799 | 799 | // allow shortcodes to set hooks for the rest of the system |
@@ -812,26 +812,26 @@ discard block |
||
812 | 812 | * @return void |
813 | 813 | */ |
814 | 814 | public function widgets_init() { |
815 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
815 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
816 | 816 | return; |
817 | 817 | } |
818 | 818 | //only init widgets on admin pages when not in complete maintenance, and |
819 | 819 | //on frontend when not in any maintenance mode |
820 | - if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level() ) { |
|
820 | + if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) { |
|
821 | 821 | // grab list of installed widgets |
822 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
822 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
823 | 823 | // filter list of modules to register |
824 | - $widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register ); |
|
824 | + $widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register); |
|
825 | 825 | |
826 | - if ( ! empty( $widgets_to_register ) ) { |
|
826 | + if ( ! empty($widgets_to_register)) { |
|
827 | 827 | // cycle thru widget folders |
828 | - foreach ( $widgets_to_register as $widget_path ) { |
|
828 | + foreach ($widgets_to_register as $widget_path) { |
|
829 | 829 | // add to list of installed widget modules |
830 | - EE_Config::register_ee_widget( $widget_path ); |
|
830 | + EE_Config::register_ee_widget($widget_path); |
|
831 | 831 | } |
832 | 832 | } |
833 | 833 | // filter list of installed modules |
834 | - EE_Registry::instance()->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets ); |
|
834 | + EE_Registry::instance()->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets); |
|
835 | 835 | } |
836 | 836 | } |
837 | 837 | |
@@ -844,54 +844,54 @@ discard block |
||
844 | 844 | * @param string $widget_path - full path up to and including widget folder |
845 | 845 | * @return void |
846 | 846 | */ |
847 | - public static function register_ee_widget( $widget_path = NULL ) { |
|
848 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
847 | + public static function register_ee_widget($widget_path = NULL) { |
|
848 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
849 | 849 | $widget_ext = '.widget.php'; |
850 | 850 | // make all separators match |
851 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
851 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
852 | 852 | // does the file path INCLUDE the actual file name as part of the path ? |
853 | - if ( strpos( $widget_path, $widget_ext ) !== FALSE ) { |
|
853 | + if (strpos($widget_path, $widget_ext) !== FALSE) { |
|
854 | 854 | // grab and shortcode file name from directory name and break apart at dots |
855 | - $file_name = explode( '.', basename( $widget_path )); |
|
855 | + $file_name = explode('.', basename($widget_path)); |
|
856 | 856 | // take first segment from file name pieces and remove class prefix if it exists |
857 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
857 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
858 | 858 | // sanitize shortcode directory name |
859 | - $widget = sanitize_key( $widget ); |
|
859 | + $widget = sanitize_key($widget); |
|
860 | 860 | // now we need to rebuild the shortcode path |
861 | - $widget_path = explode( DS, $widget_path ); |
|
861 | + $widget_path = explode(DS, $widget_path); |
|
862 | 862 | // remove last segment |
863 | - array_pop( $widget_path ); |
|
863 | + array_pop($widget_path); |
|
864 | 864 | // glue it back together |
865 | - $widget_path = implode( DS, $widget_path ); |
|
865 | + $widget_path = implode(DS, $widget_path); |
|
866 | 866 | } else { |
867 | 867 | // grab and sanitize widget directory name |
868 | - $widget = sanitize_key( basename( $widget_path )); |
|
868 | + $widget = sanitize_key(basename($widget_path)); |
|
869 | 869 | } |
870 | 870 | // create classname from widget directory name |
871 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ))); |
|
871 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
872 | 872 | // add class prefix |
873 | - $widget_class = 'EEW_' . $widget; |
|
873 | + $widget_class = 'EEW_'.$widget; |
|
874 | 874 | // does the widget exist ? |
875 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) { |
|
875 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
876 | 876 | $msg = sprintf( |
877 | - __( 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso' ), |
|
877 | + __('The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'), |
|
878 | 878 | $widget_class, |
879 | - $widget_path . DS . $widget_class . $widget_ext |
|
879 | + $widget_path.DS.$widget_class.$widget_ext |
|
880 | 880 | ); |
881 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
881 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
882 | 882 | return; |
883 | 883 | } |
884 | 884 | // load the widget class file |
885 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
885 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
886 | 886 | // verify that class exists |
887 | - if ( ! class_exists( $widget_class )) { |
|
888 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
889 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
887 | + if ( ! class_exists($widget_class)) { |
|
888 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
889 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
890 | 890 | return; |
891 | 891 | } |
892 | - register_widget( $widget_class ); |
|
892 | + register_widget($widget_class); |
|
893 | 893 | // add to array of registered widgets |
894 | - EE_Registry::instance()->widgets->$widget_class = $widget_path . DS . $widget_class . $widget_ext; |
|
894 | + EE_Registry::instance()->widgets->$widget_class = $widget_path.DS.$widget_class.$widget_ext; |
|
895 | 895 | } |
896 | 896 | |
897 | 897 | |
@@ -904,18 +904,18 @@ discard block |
||
904 | 904 | */ |
905 | 905 | private function _register_shortcodes() { |
906 | 906 | // grab list of installed shortcodes |
907 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
907 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
908 | 908 | // filter list of modules to register |
909 | - $shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register ); |
|
910 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
909 | + $shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register); |
|
910 | + if ( ! empty($shortcodes_to_register)) { |
|
911 | 911 | // cycle thru shortcode folders |
912 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
912 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
913 | 913 | // add to list of installed shortcode modules |
914 | - EE_Config::register_shortcode( $shortcode_path ); |
|
914 | + EE_Config::register_shortcode($shortcode_path); |
|
915 | 915 | } |
916 | 916 | } |
917 | 917 | // filter list of installed modules |
918 | - return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes ); |
|
918 | + return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes); |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | |
@@ -927,56 +927,56 @@ discard block |
||
927 | 927 | * @param string $shortcode_path - full path up to and including shortcode folder |
928 | 928 | * @return bool |
929 | 929 | */ |
930 | - public static function register_shortcode( $shortcode_path = NULL ) { |
|
931 | - do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path ); |
|
930 | + public static function register_shortcode($shortcode_path = NULL) { |
|
931 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
932 | 932 | $shortcode_ext = '.shortcode.php'; |
933 | 933 | // make all separators match |
934 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
934 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
935 | 935 | // does the file path INCLUDE the actual file name as part of the path ? |
936 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) { |
|
936 | + if (strpos($shortcode_path, $shortcode_ext) !== FALSE) { |
|
937 | 937 | // grab shortcode file name from directory name and break apart at dots |
938 | - $shortcode_file = explode( '.', basename( $shortcode_path )); |
|
938 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
939 | 939 | // take first segment from file name pieces and remove class prefix if it exists |
940 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0]; |
|
940 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0]; |
|
941 | 941 | // sanitize shortcode directory name |
942 | - $shortcode = sanitize_key( $shortcode ); |
|
942 | + $shortcode = sanitize_key($shortcode); |
|
943 | 943 | // now we need to rebuild the shortcode path |
944 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
944 | + $shortcode_path = explode(DS, $shortcode_path); |
|
945 | 945 | // remove last segment |
946 | - array_pop( $shortcode_path ); |
|
946 | + array_pop($shortcode_path); |
|
947 | 947 | // glue it back together |
948 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
948 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
949 | 949 | } else { |
950 | 950 | // we need to generate the filename based off of the folder name |
951 | 951 | // grab and sanitize shortcode directory name |
952 | - $shortcode = sanitize_key( basename( $shortcode_path )); |
|
953 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
952 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
953 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
954 | 954 | } |
955 | 955 | // create classname from shortcode directory or file name |
956 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ))); |
|
956 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
957 | 957 | // add class prefix |
958 | - $shortcode_class = 'EES_' . $shortcode; |
|
958 | + $shortcode_class = 'EES_'.$shortcode; |
|
959 | 959 | // does the shortcode exist ? |
960 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) { |
|
960 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
961 | 961 | $msg = sprintf( |
962 | - __( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ), |
|
962 | + __('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'), |
|
963 | 963 | $shortcode_class, |
964 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
964 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
965 | 965 | ); |
966 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
966 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
967 | 967 | return FALSE; |
968 | 968 | } |
969 | 969 | // load the shortcode class file |
970 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
970 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
971 | 971 | // verify that class exists |
972 | - if ( ! class_exists( $shortcode_class )) { |
|
973 | - $msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class ); |
|
974 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
972 | + if ( ! class_exists($shortcode_class)) { |
|
973 | + $msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class); |
|
974 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
975 | 975 | return FALSE; |
976 | 976 | } |
977 | - $shortcode = strtoupper( $shortcode ); |
|
977 | + $shortcode = strtoupper($shortcode); |
|
978 | 978 | // add to array of registered shortcodes |
979 | - EE_Registry::instance()->shortcodes->$shortcode = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
979 | + EE_Registry::instance()->shortcodes->$shortcode = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
980 | 980 | return TRUE; |
981 | 981 | } |
982 | 982 | |
@@ -991,23 +991,23 @@ discard block |
||
991 | 991 | */ |
992 | 992 | private function _register_modules() { |
993 | 993 | // grab list of installed modules |
994 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
994 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
995 | 995 | // filter list of modules to register |
996 | - $modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register ); |
|
996 | + $modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register); |
|
997 | 997 | |
998 | 998 | |
999 | - if ( ! empty( $modules_to_register ) ) { |
|
999 | + if ( ! empty($modules_to_register)) { |
|
1000 | 1000 | // loop through folders |
1001 | - foreach ( $modules_to_register as $module_path ) { |
|
1001 | + foreach ($modules_to_register as $module_path) { |
|
1002 | 1002 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1003 | - if ( $module_path != EE_MODULES . 'zzz-copy-this-module-template' && $module_path != EE_MODULES . 'gateways' ) { |
|
1003 | + if ($module_path != EE_MODULES.'zzz-copy-this-module-template' && $module_path != EE_MODULES.'gateways') { |
|
1004 | 1004 | // add to list of installed modules |
1005 | - EE_Config::register_module( $module_path ); |
|
1005 | + EE_Config::register_module($module_path); |
|
1006 | 1006 | } |
1007 | 1007 | } |
1008 | 1008 | } |
1009 | 1009 | // filter list of installed modules |
1010 | - return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules ); |
|
1010 | + return apply_filters('FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules); |
|
1011 | 1011 | } |
1012 | 1012 | |
1013 | 1013 | |
@@ -1020,54 +1020,54 @@ discard block |
||
1020 | 1020 | * @param string $module_path - full path up to and including module folder |
1021 | 1021 | * @return bool |
1022 | 1022 | */ |
1023 | - public static function register_module( $module_path = NULL ) { |
|
1024 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1023 | + public static function register_module($module_path = NULL) { |
|
1024 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1025 | 1025 | $module_ext = '.module.php'; |
1026 | 1026 | // make all separators match |
1027 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1027 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1028 | 1028 | // does the file path INCLUDE the actual file name as part of the path ? |
1029 | - if ( strpos( $module_path, $module_ext ) !== FALSE ) { |
|
1029 | + if (strpos($module_path, $module_ext) !== FALSE) { |
|
1030 | 1030 | // grab and shortcode file name from directory name and break apart at dots |
1031 | - $module_file = explode( '.', basename( $module_path )); |
|
1031 | + $module_file = explode('.', basename($module_path)); |
|
1032 | 1032 | // now we need to rebuild the shortcode path |
1033 | - $module_path = explode( DS, $module_path ); |
|
1033 | + $module_path = explode(DS, $module_path); |
|
1034 | 1034 | // remove last segment |
1035 | - array_pop( $module_path ); |
|
1035 | + array_pop($module_path); |
|
1036 | 1036 | // glue it back together |
1037 | - $module_path = implode( DS, $module_path ) . DS; |
|
1037 | + $module_path = implode(DS, $module_path).DS; |
|
1038 | 1038 | // take first segment from file name pieces and sanitize it |
1039 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1039 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1040 | 1040 | // ensure class prefix is added |
1041 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1041 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1042 | 1042 | } else { |
1043 | 1043 | // we need to generate the filename based off of the folder name |
1044 | 1044 | // grab and sanitize module name |
1045 | - $module = strtolower( basename( $module_path )); |
|
1046 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module); |
|
1045 | + $module = strtolower(basename($module_path)); |
|
1046 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1047 | 1047 | // like trailingslashit() |
1048 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1048 | + $module_path = rtrim($module_path, DS).DS; |
|
1049 | 1049 | // create classname from module directory name |
1050 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ))); |
|
1050 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1051 | 1051 | // add class prefix |
1052 | - $module_class = 'EED_' . $module; |
|
1052 | + $module_class = 'EED_'.$module; |
|
1053 | 1053 | } |
1054 | 1054 | // does the module exist ? |
1055 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) { |
|
1056 | - $msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module ); |
|
1057 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1055 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1056 | + $msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module); |
|
1057 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1058 | 1058 | return FALSE; |
1059 | 1059 | } |
1060 | 1060 | // load the module class file |
1061 | - require_once( $module_path . $module_class . $module_ext ); |
|
1061 | + require_once($module_path.$module_class.$module_ext); |
|
1062 | 1062 | // verify that class exists |
1063 | - if ( ! class_exists( $module_class )) { |
|
1064 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1065 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1063 | + if ( ! class_exists($module_class)) { |
|
1064 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1065 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1066 | 1066 | return FALSE; |
1067 | 1067 | } |
1068 | 1068 | // add to array of registered modules |
1069 | - EE_Registry::instance()->modules->$module_class = $module_path . $module_class . $module_ext; |
|
1070 | - do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->$module_class ); |
|
1069 | + EE_Registry::instance()->modules->$module_class = $module_path.$module_class.$module_ext; |
|
1070 | + do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->$module_class); |
|
1071 | 1071 | return TRUE; |
1072 | 1072 | } |
1073 | 1073 | |
@@ -1081,23 +1081,23 @@ discard block |
||
1081 | 1081 | */ |
1082 | 1082 | private function _initialize_shortcodes() { |
1083 | 1083 | // cycle thru shortcode folders |
1084 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1084 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1085 | 1085 | // add class prefix |
1086 | - $shortcode_class = 'EES_' . $shortcode; |
|
1086 | + $shortcode_class = 'EES_'.$shortcode; |
|
1087 | 1087 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1088 | 1088 | // which set hooks ? |
1089 | - if ( is_admin() ) { |
|
1089 | + if (is_admin()) { |
|
1090 | 1090 | // fire immediately |
1091 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' )); |
|
1091 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1092 | 1092 | } else { |
1093 | 1093 | // delay until other systems are online |
1094 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' )); |
|
1094 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks')); |
|
1095 | 1095 | // convert classname to UPPERCASE and create WP shortcode. |
1096 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1096 | + $shortcode_tag = strtoupper($shortcode); |
|
1097 | 1097 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1098 | - if ( ! shortcode_exists( $shortcode_tag )) { |
|
1098 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1099 | 1099 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1100 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' )); |
|
1100 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1101 | 1101 | } |
1102 | 1102 | } |
1103 | 1103 | } |
@@ -1114,15 +1114,15 @@ discard block |
||
1114 | 1114 | */ |
1115 | 1115 | private function _initialize_modules() { |
1116 | 1116 | // cycle thru shortcode folders |
1117 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1117 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1118 | 1118 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1119 | 1119 | // which set hooks ? |
1120 | - if ( is_admin() ) { |
|
1120 | + if (is_admin()) { |
|
1121 | 1121 | // fire immediately |
1122 | - call_user_func( array( $module_class, 'set_hooks_admin' )); |
|
1122 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1123 | 1123 | } else { |
1124 | 1124 | // delay until other systems are online |
1125 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' )); |
|
1125 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks')); |
|
1126 | 1126 | } |
1127 | 1127 | } |
1128 | 1128 | } |
@@ -1140,26 +1140,26 @@ discard block |
||
1140 | 1140 | * @param string $key - url param key indicating a route is being called |
1141 | 1141 | * @return bool |
1142 | 1142 | */ |
1143 | - public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) { |
|
1144 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1145 | - $module = str_replace( 'EED_', '', $module ); |
|
1146 | - $module_class = 'EED_' . $module; |
|
1147 | - if ( ! isset( EE_Registry::instance()->modules->$module_class )) { |
|
1148 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1149 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1143 | + public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') { |
|
1144 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1145 | + $module = str_replace('EED_', '', $module); |
|
1146 | + $module_class = 'EED_'.$module; |
|
1147 | + if ( ! isset(EE_Registry::instance()->modules->$module_class)) { |
|
1148 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1149 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1150 | 1150 | return FALSE; |
1151 | 1151 | } |
1152 | - if ( empty( $route )) { |
|
1153 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1154 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1152 | + if (empty($route)) { |
|
1153 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1154 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1155 | 1155 | return FALSE; |
1156 | 1156 | } |
1157 | - if ( ! method_exists ( 'EED_' . $module, $method_name )) { |
|
1158 | - $msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route ); |
|
1159 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1157 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1158 | + $msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route); |
|
1159 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1160 | 1160 | return FALSE; |
1161 | 1161 | } |
1162 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1162 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1163 | 1163 | return TRUE; |
1164 | 1164 | } |
1165 | 1165 | |
@@ -1173,11 +1173,11 @@ discard block |
||
1173 | 1173 | * @param string $key - url param key indicating a route is being called |
1174 | 1174 | * @return string |
1175 | 1175 | */ |
1176 | - public static function get_route( $route = NULL, $key = 'ee' ) { |
|
1177 | - do_action( 'AHEE__EE_Config__get_route__begin',$route ); |
|
1178 | - $route = apply_filters( 'FHEE__EE_Config__get_route',$route ); |
|
1179 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) { |
|
1180 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1176 | + public static function get_route($route = NULL, $key = 'ee') { |
|
1177 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1178 | + $route = apply_filters('FHEE__EE_Config__get_route', $route); |
|
1179 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1180 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1181 | 1181 | } |
1182 | 1182 | return NULL; |
1183 | 1183 | } |
@@ -1206,35 +1206,35 @@ discard block |
||
1206 | 1206 | * @param string $key - url param key indicating a route is being called |
1207 | 1207 | * @return bool |
1208 | 1208 | */ |
1209 | - public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) { |
|
1210 | - do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward ); |
|
1211 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1212 | - $msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route ); |
|
1213 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1209 | + public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') { |
|
1210 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1211 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1212 | + $msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route); |
|
1213 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1214 | 1214 | return FALSE; |
1215 | 1215 | } |
1216 | - if ( empty( $forward )) { |
|
1217 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1218 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1216 | + if (empty($forward)) { |
|
1217 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1218 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1219 | 1219 | return FALSE; |
1220 | 1220 | } |
1221 | - if ( is_array( $forward )) { |
|
1222 | - if ( ! isset( $forward[1] )) { |
|
1223 | - $msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route ); |
|
1224 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1221 | + if (is_array($forward)) { |
|
1222 | + if ( ! isset($forward[1])) { |
|
1223 | + $msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route); |
|
1224 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1225 | 1225 | return FALSE; |
1226 | 1226 | } |
1227 | - if ( ! method_exists( $forward[0], $forward[1] )) { |
|
1228 | - $msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route ); |
|
1229 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1227 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1228 | + $msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route); |
|
1229 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1230 | 1230 | return FALSE; |
1231 | 1231 | } |
1232 | - } else if ( ! function_exists( $forward )) { |
|
1233 | - $msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route ); |
|
1234 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1232 | + } else if ( ! function_exists($forward)) { |
|
1233 | + $msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route); |
|
1234 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1235 | 1235 | return FALSE; |
1236 | 1236 | } |
1237 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1237 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1238 | 1238 | return TRUE; |
1239 | 1239 | } |
1240 | 1240 | |
@@ -1249,10 +1249,10 @@ discard block |
||
1249 | 1249 | * @param string $key - url param key indicating a route is being called |
1250 | 1250 | * @return string |
1251 | 1251 | */ |
1252 | - public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1253 | - do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status ); |
|
1254 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) { |
|
1255 | - return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1252 | + public static function get_forward($route = NULL, $status = 0, $key = 'ee') { |
|
1253 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1254 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1255 | + return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status); |
|
1256 | 1256 | } |
1257 | 1257 | return NULL; |
1258 | 1258 | } |
@@ -1269,19 +1269,19 @@ discard block |
||
1269 | 1269 | * @param string $key - url param key indicating a route is being called |
1270 | 1270 | * @return bool |
1271 | 1271 | */ |
1272 | - public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) { |
|
1273 | - do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view ); |
|
1274 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1275 | - $msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route ); |
|
1276 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1272 | + public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') { |
|
1273 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1274 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1275 | + $msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route); |
|
1276 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1277 | 1277 | return FALSE; |
1278 | 1278 | } |
1279 | - if ( ! is_readable( $view )) { |
|
1280 | - $msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view ); |
|
1281 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1279 | + if ( ! is_readable($view)) { |
|
1280 | + $msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view); |
|
1281 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1282 | 1282 | return FALSE; |
1283 | 1283 | } |
1284 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1284 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1285 | 1285 | return TRUE; |
1286 | 1286 | } |
1287 | 1287 | |
@@ -1298,10 +1298,10 @@ discard block |
||
1298 | 1298 | * @param string $key - url param key indicating a route is being called |
1299 | 1299 | * @return string |
1300 | 1300 | */ |
1301 | - public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1302 | - do_action( 'AHEE__EE_Config__get_view__begin',$route,$status ); |
|
1303 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) { |
|
1304 | - return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1301 | + public static function get_view($route = NULL, $status = 0, $key = 'ee') { |
|
1302 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1303 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1304 | + return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status); |
|
1305 | 1305 | } |
1306 | 1306 | return NULL; |
1307 | 1307 | } |
@@ -1309,7 +1309,7 @@ discard block |
||
1309 | 1309 | |
1310 | 1310 | |
1311 | 1311 | public function shutdown() { |
1312 | - update_option( 'ee_config_option_names', $this->_config_option_names ); |
|
1312 | + update_option('ee_config_option_names', $this->_config_option_names); |
|
1313 | 1313 | } |
1314 | 1314 | |
1315 | 1315 | |
@@ -1325,7 +1325,7 @@ discard block |
||
1325 | 1325 | * magic functions in use, except we'll allow them to magically set and get stuff... |
1326 | 1326 | * basically, they should just be well-defined stdClasses |
1327 | 1327 | */ |
1328 | -class EE_Config_Base{ |
|
1328 | +class EE_Config_Base { |
|
1329 | 1329 | |
1330 | 1330 | /** |
1331 | 1331 | * Utility function for escaping the value of a property and returning. |
@@ -1334,13 +1334,13 @@ discard block |
||
1334 | 1334 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1335 | 1335 | * @throws \EE_Error |
1336 | 1336 | */ |
1337 | - public function get_pretty( $property ) { |
|
1338 | - if ( ! property_exists( $this, $property ) ) { |
|
1339 | - throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) ); |
|
1337 | + public function get_pretty($property) { |
|
1338 | + if ( ! property_exists($this, $property)) { |
|
1339 | + throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property)); |
|
1340 | 1340 | } |
1341 | 1341 | //just handling escaping of strings for now. |
1342 | - if ( is_string( $this->$property ) ) { |
|
1343 | - return stripslashes( $this->$property ); |
|
1342 | + if (is_string($this->$property)) { |
|
1343 | + return stripslashes($this->$property); |
|
1344 | 1344 | } |
1345 | 1345 | return $this->$property; |
1346 | 1346 | } |
@@ -1349,19 +1349,19 @@ discard block |
||
1349 | 1349 | |
1350 | 1350 | public function populate() { |
1351 | 1351 | //grab defaults via a new instance of this class. |
1352 | - $class_name = get_class( $this ); |
|
1352 | + $class_name = get_class($this); |
|
1353 | 1353 | $defaults = new $class_name; |
1354 | 1354 | |
1355 | 1355 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1356 | 1356 | //default from our $defaults object. |
1357 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1358 | - if ( is_null( $this->$property ) ) { |
|
1357 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1358 | + if (is_null($this->$property)) { |
|
1359 | 1359 | $this->$property = $value; |
1360 | 1360 | } |
1361 | 1361 | } |
1362 | 1362 | |
1363 | 1363 | //cleanup |
1364 | - unset( $defaults ); |
|
1364 | + unset($defaults); |
|
1365 | 1365 | } |
1366 | 1366 | |
1367 | 1367 | |
@@ -1453,12 +1453,12 @@ discard block |
||
1453 | 1453 | */ |
1454 | 1454 | public function __construct() { |
1455 | 1455 | $current_network_main_site = is_multisite() ? get_current_site() : NULL; |
1456 | - $current_main_site_id = !empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1456 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1457 | 1457 | // set default organization settings |
1458 | 1458 | $this->current_blog_id = get_current_blog_id(); |
1459 | 1459 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1460 | - $this->ee_ueip_optin = is_main_site() ? get_option( 'ee_ueip_optin', TRUE ) : get_blog_option( $current_main_site_id, 'ee_ueip_optin', TRUE ); |
|
1461 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', FALSE ) : TRUE; |
|
1460 | + $this->ee_ueip_optin = is_main_site() ? get_option('ee_ueip_optin', TRUE) : get_blog_option($current_main_site_id, 'ee_ueip_optin', TRUE); |
|
1461 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', FALSE) : TRUE; |
|
1462 | 1462 | $this->post_shortcodes = array(); |
1463 | 1463 | $this->module_route_map = array(); |
1464 | 1464 | $this->module_forward_map = array(); |
@@ -1477,7 +1477,7 @@ discard block |
||
1477 | 1477 | $this->event_cpt_slug = __('events', 'event_espresso'); |
1478 | 1478 | |
1479 | 1479 | //ueip constant check |
1480 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1480 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1481 | 1481 | $this->ee_ueip_optin = FALSE; |
1482 | 1482 | $this->ee_ueip_has_notified = TRUE; |
1483 | 1483 | } |
@@ -1517,8 +1517,8 @@ discard block |
||
1517 | 1517 | * @return string |
1518 | 1518 | */ |
1519 | 1519 | public function reg_page_url() { |
1520 | - if ( ! $this->reg_page_url ) { |
|
1521 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
1520 | + if ( ! $this->reg_page_url) { |
|
1521 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
1522 | 1522 | } |
1523 | 1523 | return $this->reg_page_url; |
1524 | 1524 | } |
@@ -1531,12 +1531,12 @@ discard block |
||
1531 | 1531 | * @return string |
1532 | 1532 | */ |
1533 | 1533 | public function txn_page_url($query_args = array()) { |
1534 | - if ( ! $this->txn_page_url ) { |
|
1535 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1534 | + if ( ! $this->txn_page_url) { |
|
1535 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1536 | 1536 | } |
1537 | - if($query_args){ |
|
1538 | - return add_query_arg($query_args,$this->txn_page_url); |
|
1539 | - }else{ |
|
1537 | + if ($query_args) { |
|
1538 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1539 | + } else { |
|
1540 | 1540 | return $this->txn_page_url; |
1541 | 1541 | } |
1542 | 1542 | } |
@@ -1548,12 +1548,12 @@ discard block |
||
1548 | 1548 | * @return string |
1549 | 1549 | */ |
1550 | 1550 | public function thank_you_page_url($query_args = array()) { |
1551 | - if ( ! $this->thank_you_page_url ) { |
|
1552 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1551 | + if ( ! $this->thank_you_page_url) { |
|
1552 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1553 | 1553 | } |
1554 | - if($query_args){ |
|
1555 | - return add_query_arg($query_args,$this->thank_you_page_url); |
|
1556 | - }else{ |
|
1554 | + if ($query_args) { |
|
1555 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1556 | + } else { |
|
1557 | 1557 | return $this->thank_you_page_url; |
1558 | 1558 | } |
1559 | 1559 | } |
@@ -1564,8 +1564,8 @@ discard block |
||
1564 | 1564 | * @return string |
1565 | 1565 | */ |
1566 | 1566 | public function cancel_page_url() { |
1567 | - if ( ! $this->cancel_page_url ) { |
|
1568 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1567 | + if ( ! $this->cancel_page_url) { |
|
1568 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1569 | 1569 | } |
1570 | 1570 | return $this->cancel_page_url; |
1571 | 1571 | } |
@@ -1593,7 +1593,7 @@ discard block |
||
1593 | 1593 | //reset all url properties |
1594 | 1594 | $this->_reset_urls(); |
1595 | 1595 | //return what to save to db |
1596 | - return array_keys( get_object_vars( $this ) ); |
|
1596 | + return array_keys(get_object_vars($this)); |
|
1597 | 1597 | } |
1598 | 1598 | |
1599 | 1599 | } |
@@ -1825,39 +1825,39 @@ discard block |
||
1825 | 1825 | * @param null $CNT_ISO |
1826 | 1826 | * @return \EE_Currency_Config |
1827 | 1827 | */ |
1828 | - public function __construct( $CNT_ISO = NULL ) { |
|
1828 | + public function __construct($CNT_ISO = NULL) { |
|
1829 | 1829 | |
1830 | 1830 | // get country code from organization settings or use default |
1831 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
1831 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
1832 | 1832 | // but override if requested |
1833 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
1834 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
1833 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
1834 | + EE_Registry::instance()->load_helper('Activation'); |
|
1835 | 1835 | // 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 |
1836 | - if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) { |
|
1836 | + if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) { |
|
1837 | 1837 | // retrieve the country settings from the db, just in case they have been customized |
1838 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
1839 | - if ( $country instanceof EE_Country ) { |
|
1840 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1841 | - $this->name = $country->currency_name_single(); // Dollar |
|
1842 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
1843 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
1844 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1845 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1846 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1847 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1838 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
1839 | + if ($country instanceof EE_Country) { |
|
1840 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1841 | + $this->name = $country->currency_name_single(); // Dollar |
|
1842 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
1843 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
1844 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1845 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1846 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1847 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1848 | 1848 | } |
1849 | 1849 | } |
1850 | 1850 | // fallback to hardcoded defaults, in case the above failed |
1851 | - if ( empty( $this->code )) { |
|
1851 | + if (empty($this->code)) { |
|
1852 | 1852 | // set default currency settings |
1853 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1854 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
1855 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
1856 | - $this->sign = '$'; // currency sign: $ |
|
1857 | - $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1858 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1859 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1860 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1853 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1854 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
1855 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
1856 | + $this->sign = '$'; // currency sign: $ |
|
1857 | + $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1858 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1859 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1860 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1861 | 1861 | } |
1862 | 1862 | } |
1863 | 1863 | } |
@@ -1997,7 +1997,7 @@ discard block |
||
1997 | 1997 | * @since 4.8.8.rc.019 |
1998 | 1998 | */ |
1999 | 1999 | public function do_hooks() { |
2000 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' )); |
|
2000 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2001 | 2001 | } |
2002 | 2002 | |
2003 | 2003 | |
@@ -2005,7 +2005,7 @@ discard block |
||
2005 | 2005 | * @return void |
2006 | 2006 | */ |
2007 | 2007 | public function set_default_reg_status_on_EEM_Event() { |
2008 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2008 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2009 | 2009 | } |
2010 | 2010 | |
2011 | 2011 | |
@@ -2110,10 +2110,10 @@ discard block |
||
2110 | 2110 | * @param bool $reset |
2111 | 2111 | * @return string |
2112 | 2112 | */ |
2113 | - public function log_file_name( $reset = FALSE ) { |
|
2114 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2115 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2116 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2113 | + public function log_file_name($reset = FALSE) { |
|
2114 | + if (empty($this->log_file_name) || $reset) { |
|
2115 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt'; |
|
2116 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2117 | 2117 | } |
2118 | 2118 | return $this->log_file_name; |
2119 | 2119 | } |
@@ -2125,10 +2125,10 @@ discard block |
||
2125 | 2125 | * @param bool $reset |
2126 | 2126 | * @return string |
2127 | 2127 | */ |
2128 | - public function debug_file_name( $reset = FALSE ) { |
|
2129 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2130 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2131 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2128 | + public function debug_file_name($reset = FALSE) { |
|
2129 | + if (empty($this->debug_file_name) || $reset) { |
|
2130 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt'; |
|
2131 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2132 | 2132 | } |
2133 | 2133 | return $this->debug_file_name; |
2134 | 2134 | } |
@@ -2306,21 +2306,21 @@ discard block |
||
2306 | 2306 | // set default map settings |
2307 | 2307 | $this->use_google_maps = TRUE; |
2308 | 2308 | // for event details pages (reg page) |
2309 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2310 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2311 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2312 | - $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2313 | - $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2314 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2315 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2309 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2310 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2311 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2312 | + $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2313 | + $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2314 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2315 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2316 | 2316 | // for event list pages |
2317 | - $this->event_list_map_width = 300; // ee_map_width |
|
2318 | - $this->event_list_map_height = 185; // ee_map_height |
|
2319 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2320 | - $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2321 | - $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2322 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2323 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2317 | + $this->event_list_map_width = 300; // ee_map_width |
|
2318 | + $this->event_list_map_height = 185; // ee_map_height |
|
2319 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2320 | + $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2321 | + $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2322 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2323 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2324 | 2324 | } |
2325 | 2325 | |
2326 | 2326 | } |
@@ -2331,7 +2331,7 @@ discard block |
||
2331 | 2331 | /** |
2332 | 2332 | * stores Events_Archive settings |
2333 | 2333 | */ |
2334 | -class EE_Events_Archive_Config extends EE_Config_Base{ |
|
2334 | +class EE_Events_Archive_Config extends EE_Config_Base { |
|
2335 | 2335 | |
2336 | 2336 | public $display_status_banner; |
2337 | 2337 | public $display_description; |
@@ -2350,7 +2350,7 @@ discard block |
||
2350 | 2350 | /** |
2351 | 2351 | * class constructor |
2352 | 2352 | */ |
2353 | - public function __construct(){ |
|
2353 | + public function __construct() { |
|
2354 | 2354 | $this->display_status_banner = 0; |
2355 | 2355 | $this->display_description = 1; |
2356 | 2356 | $this->display_ticket_selector = 0; |
@@ -2370,7 +2370,7 @@ discard block |
||
2370 | 2370 | /** |
2371 | 2371 | * Stores Event_Single_Config settings |
2372 | 2372 | */ |
2373 | -class EE_Event_Single_Config extends EE_Config_Base{ |
|
2373 | +class EE_Event_Single_Config extends EE_Config_Base { |
|
2374 | 2374 | |
2375 | 2375 | public $display_status_banner_single; |
2376 | 2376 | public $display_venue; |
@@ -2399,7 +2399,7 @@ discard block |
||
2399 | 2399 | /** |
2400 | 2400 | * Stores Ticket_Selector_Config settings |
2401 | 2401 | */ |
2402 | -class EE_Ticket_Selector_Config extends EE_Config_Base{ |
|
2402 | +class EE_Ticket_Selector_Config extends EE_Config_Base { |
|
2403 | 2403 | public $show_ticket_sale_columns; |
2404 | 2404 | public $show_ticket_details; |
2405 | 2405 | public $show_expired_tickets; |
@@ -2453,7 +2453,7 @@ discard block |
||
2453 | 2453 | * @return void |
2454 | 2454 | */ |
2455 | 2455 | protected function _set_php_values() { |
2456 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2456 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2457 | 2457 | $this->php->version = phpversion(); |
2458 | 2458 | } |
2459 | 2459 | |
@@ -2472,8 +2472,8 @@ discard block |
||
2472 | 2472 | * @type string $msg Any message to be displayed. |
2473 | 2473 | * } |
2474 | 2474 | */ |
2475 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2476 | - if ( ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) { |
|
2475 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2476 | + if (($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) { |
|
2477 | 2477 | return __('The number of inputs on this page has been exceeded. You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.', 'event_espresso'); |
2478 | 2478 | } else { |
2479 | 2479 | return ''; |
@@ -2509,7 +2509,7 @@ discard block |
||
2509 | 2509 | * stores payment gateway info |
2510 | 2510 | * @deprecated |
2511 | 2511 | */ |
2512 | -class EE_Gateway_Config extends EE_Config_Base{ |
|
2512 | +class EE_Gateway_Config extends EE_Config_Base { |
|
2513 | 2513 | |
2514 | 2514 | /** |
2515 | 2515 | * Array with keys that are payment gateways slugs, and values are arrays |
@@ -2531,9 +2531,9 @@ discard block |
||
2531 | 2531 | * class constructor |
2532 | 2532 | * @deprecated |
2533 | 2533 | */ |
2534 | - public function __construct(){ |
|
2534 | + public function __construct() { |
|
2535 | 2535 | $this->payment_settings = array(); |
2536 | - $this->active_gateways = array( 'Invoice' => FALSE ); |
|
2536 | + $this->active_gateways = array('Invoice' => FALSE); |
|
2537 | 2537 | } |
2538 | 2538 | } |
2539 | 2539 |
@@ -1,26 +1,26 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Event Espresso |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * EE_Config |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage core/ |
|
20 | - * @author Brent Christensen |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Event Espresso |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * EE_Config |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage core/ |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | final class EE_Config { |
25 | 25 | |
26 | 26 | |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | public $map_settings = null; |
90 | 90 | |
91 | 91 | /** |
92 | - * |
|
93 | - * @deprecated |
|
94 | - * @var EE_Gateway_Config |
|
95 | - */ |
|
92 | + * |
|
93 | + * @deprecated |
|
94 | + * @var EE_Gateway_Config |
|
95 | + */ |
|
96 | 96 | public $gateway = null; |
97 | 97 | |
98 | 98 | /** |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | |
583 | 583 | /** |
584 | 584 | * update_config |
585 | - * Important: the config object must ALREADY be set, otherwise this will produce an error. |
|
585 | + * Important: the config object must ALREADY be set, otherwise this will produce an error. |
|
586 | 586 | * |
587 | 587 | * @access public |
588 | 588 | * @param string $section |
@@ -1606,51 +1606,51 @@ discard block |
||
1606 | 1606 | class EE_Organization_Config extends EE_Config_Base { |
1607 | 1607 | |
1608 | 1608 | /** |
1609 | - * @var string $name |
|
1610 | - * eg EE4.1 |
|
1611 | - */ |
|
1609 | + * @var string $name |
|
1610 | + * eg EE4.1 |
|
1611 | + */ |
|
1612 | 1612 | public $name; |
1613 | 1613 | |
1614 | 1614 | /** |
1615 | - * @var string $address_1 |
|
1616 | - * eg 123 Onna Road |
|
1617 | - */ |
|
1615 | + * @var string $address_1 |
|
1616 | + * eg 123 Onna Road |
|
1617 | + */ |
|
1618 | 1618 | public $address_1; |
1619 | 1619 | |
1620 | 1620 | /** |
1621 | - * @var string $address_2 |
|
1622 | - * eg PO Box 123 |
|
1623 | - */ |
|
1621 | + * @var string $address_2 |
|
1622 | + * eg PO Box 123 |
|
1623 | + */ |
|
1624 | 1624 | public $address_2; |
1625 | 1625 | |
1626 | 1626 | /** |
1627 | - * @var string $city |
|
1628 | - * eg Inna City |
|
1629 | - */ |
|
1627 | + * @var string $city |
|
1628 | + * eg Inna City |
|
1629 | + */ |
|
1630 | 1630 | public $city; |
1631 | 1631 | |
1632 | 1632 | /** |
1633 | - * @var int $STA_ID |
|
1634 | - * eg 4 |
|
1635 | - */ |
|
1633 | + * @var int $STA_ID |
|
1634 | + * eg 4 |
|
1635 | + */ |
|
1636 | 1636 | public $STA_ID; |
1637 | 1637 | |
1638 | 1638 | /** |
1639 | - * @var string $CNT_ISO |
|
1640 | - * eg US |
|
1641 | - */ |
|
1639 | + * @var string $CNT_ISO |
|
1640 | + * eg US |
|
1641 | + */ |
|
1642 | 1642 | public $CNT_ISO; |
1643 | 1643 | |
1644 | 1644 | /** |
1645 | - * @var string $zip |
|
1646 | - * eg 12345 or V1A 2B3 |
|
1647 | - */ |
|
1645 | + * @var string $zip |
|
1646 | + * eg 12345 or V1A 2B3 |
|
1647 | + */ |
|
1648 | 1648 | public $zip; |
1649 | 1649 | |
1650 | 1650 | /** |
1651 | - * @var string $email |
|
1652 | - * eg [email protected] |
|
1653 | - */ |
|
1651 | + * @var string $email |
|
1652 | + * eg [email protected] |
|
1653 | + */ |
|
1654 | 1654 | public $email; |
1655 | 1655 | |
1656 | 1656 | |
@@ -1669,9 +1669,9 @@ discard block |
||
1669 | 1669 | public $vat; |
1670 | 1670 | |
1671 | 1671 | /** |
1672 | - * @var string $logo_url |
|
1673 | - * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg |
|
1674 | - */ |
|
1672 | + * @var string $logo_url |
|
1673 | + * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg |
|
1674 | + */ |
|
1675 | 1675 | public $logo_url; |
1676 | 1676 | |
1677 | 1677 | |
@@ -1765,55 +1765,55 @@ discard block |
||
1765 | 1765 | class EE_Currency_Config extends EE_Config_Base { |
1766 | 1766 | |
1767 | 1767 | /** |
1768 | - * @var string $code |
|
1769 | - * eg 'US' |
|
1770 | - */ |
|
1768 | + * @var string $code |
|
1769 | + * eg 'US' |
|
1770 | + */ |
|
1771 | 1771 | public $code; |
1772 | 1772 | |
1773 | 1773 | /** |
1774 | - * @var string $name |
|
1775 | - * eg 'Dollar' |
|
1776 | - */ |
|
1774 | + * @var string $name |
|
1775 | + * eg 'Dollar' |
|
1776 | + */ |
|
1777 | 1777 | public $name; |
1778 | 1778 | |
1779 | 1779 | /** |
1780 | - * plural name |
|
1781 | - * @var string $plural |
|
1782 | - * eg 'Dollars' |
|
1783 | - */ |
|
1780 | + * plural name |
|
1781 | + * @var string $plural |
|
1782 | + * eg 'Dollars' |
|
1783 | + */ |
|
1784 | 1784 | public $plural; |
1785 | 1785 | |
1786 | 1786 | /** |
1787 | - * currency sign |
|
1788 | - * @var string $sign |
|
1789 | - * eg '$' |
|
1790 | - */ |
|
1787 | + * currency sign |
|
1788 | + * @var string $sign |
|
1789 | + * eg '$' |
|
1790 | + */ |
|
1791 | 1791 | public $sign; |
1792 | 1792 | |
1793 | 1793 | /** |
1794 | - * Whether the currency sign should come before the number or not |
|
1795 | - * @var boolean $sign_b4 |
|
1796 | - */ |
|
1794 | + * Whether the currency sign should come before the number or not |
|
1795 | + * @var boolean $sign_b4 |
|
1796 | + */ |
|
1797 | 1797 | public $sign_b4; |
1798 | 1798 | |
1799 | 1799 | /** |
1800 | - * How many digits should come after the decimal place |
|
1801 | - * @var int $dec_plc |
|
1802 | - */ |
|
1800 | + * How many digits should come after the decimal place |
|
1801 | + * @var int $dec_plc |
|
1802 | + */ |
|
1803 | 1803 | public $dec_plc; |
1804 | 1804 | |
1805 | 1805 | /** |
1806 | - * Symbol to use for decimal mark |
|
1807 | - * @var string $dec_mrk |
|
1808 | - * eg '.' |
|
1809 | - */ |
|
1806 | + * Symbol to use for decimal mark |
|
1807 | + * @var string $dec_mrk |
|
1808 | + * eg '.' |
|
1809 | + */ |
|
1810 | 1810 | public $dec_mrk; |
1811 | 1811 | |
1812 | 1812 | /** |
1813 | - * Symbol to use for thousands |
|
1814 | - * @var string $thsnds |
|
1815 | - * eg ',' |
|
1816 | - */ |
|
1813 | + * Symbol to use for thousands |
|
1814 | + * @var string $thsnds |
|
1815 | + * eg ',' |
|
1816 | + */ |
|
1817 | 1817 | public $thsnds; |
1818 | 1818 | |
1819 | 1819 | |
@@ -1881,13 +1881,13 @@ discard block |
||
1881 | 1881 | * whether or not to show alternate payment options during the reg process if payment status is pending |
1882 | 1882 | * @var boolean $show_pending_payment_options |
1883 | 1883 | */ |
1884 | - public $show_pending_payment_options; |
|
1884 | + public $show_pending_payment_options; |
|
1885 | 1885 | |
1886 | 1886 | /** |
1887 | 1887 | * Whether to skip the registration confirmation page |
1888 | 1888 | * @var boolean $skip_reg_confirmation |
1889 | 1889 | */ |
1890 | - public $skip_reg_confirmation; |
|
1890 | + public $skip_reg_confirmation; |
|
1891 | 1891 | |
1892 | 1892 | /** |
1893 | 1893 | * an array of SPCO reg steps where: |
@@ -1898,64 +1898,64 @@ discard block |
||
1898 | 1898 | * "slug" => the URL param used to trigger the reg step |
1899 | 1899 | * @var array $reg_steps |
1900 | 1900 | */ |
1901 | - public $reg_steps; |
|
1901 | + public $reg_steps; |
|
1902 | 1902 | |
1903 | 1903 | /** |
1904 | 1904 | * Whether registration confirmation should be the last page of SPCO |
1905 | 1905 | * @var boolean $reg_confirmation_last |
1906 | 1906 | */ |
1907 | - public $reg_confirmation_last; |
|
1907 | + public $reg_confirmation_last; |
|
1908 | 1908 | |
1909 | 1909 | /** |
1910 | 1910 | * Whether or not to enable the EE Bot Trap |
1911 | 1911 | * @var boolean $use_bot_trap |
1912 | 1912 | */ |
1913 | - public $use_bot_trap; |
|
1913 | + public $use_bot_trap; |
|
1914 | 1914 | |
1915 | 1915 | /** |
1916 | 1916 | * Whether or not to encrypt some data sent by the EE Bot Trap |
1917 | 1917 | * @var boolean $use_encryption |
1918 | 1918 | */ |
1919 | - public $use_encryption; |
|
1919 | + public $use_encryption; |
|
1920 | 1920 | |
1921 | 1921 | /** |
1922 | 1922 | * Whether or not to use ReCaptcha |
1923 | 1923 | * @var boolean $use_captcha |
1924 | 1924 | */ |
1925 | - public $use_captcha; |
|
1925 | + public $use_captcha; |
|
1926 | 1926 | |
1927 | 1927 | /** |
1928 | 1928 | * ReCaptcha Theme |
1929 | 1929 | * @var string $recaptcha_theme |
1930 | 1930 | * options: 'dark ', 'light' |
1931 | 1931 | */ |
1932 | - public $recaptcha_theme; |
|
1932 | + public $recaptcha_theme; |
|
1933 | 1933 | |
1934 | 1934 | /** |
1935 | 1935 | * ReCaptcha Type |
1936 | 1936 | * @var string $recaptcha_type |
1937 | 1937 | * options: 'audio', 'image' |
1938 | 1938 | */ |
1939 | - public $recaptcha_type; |
|
1939 | + public $recaptcha_type; |
|
1940 | 1940 | |
1941 | 1941 | /** |
1942 | 1942 | * ReCaptcha language |
1943 | 1943 | * @var string $recaptcha_language |
1944 | 1944 | * eg 'en' |
1945 | 1945 | */ |
1946 | - public $recaptcha_language; |
|
1946 | + public $recaptcha_language; |
|
1947 | 1947 | |
1948 | 1948 | /** |
1949 | 1949 | * ReCaptcha public key |
1950 | 1950 | * @var string $recaptcha_publickey |
1951 | 1951 | */ |
1952 | - public $recaptcha_publickey; |
|
1952 | + public $recaptcha_publickey; |
|
1953 | 1953 | |
1954 | 1954 | /** |
1955 | 1955 | * ReCaptcha private key |
1956 | 1956 | * @var string $recaptcha_privatekey |
1957 | 1957 | */ |
1958 | - public $recaptcha_privatekey; |
|
1958 | + public $recaptcha_privatekey; |
|
1959 | 1959 | |
1960 | 1960 | /** |
1961 | 1961 | * ReCaptcha width |
@@ -2021,58 +2021,58 @@ discard block |
||
2021 | 2021 | class EE_Admin_Config extends EE_Config_Base { |
2022 | 2022 | |
2023 | 2023 | /** |
2024 | - * @var boolean $use_personnel_manager |
|
2025 | - */ |
|
2024 | + * @var boolean $use_personnel_manager |
|
2025 | + */ |
|
2026 | 2026 | public $use_personnel_manager; |
2027 | 2027 | |
2028 | 2028 | /** |
2029 | - * @var boolean $use_dashboard_widget |
|
2030 | - */ |
|
2029 | + * @var boolean $use_dashboard_widget |
|
2030 | + */ |
|
2031 | 2031 | public $use_dashboard_widget; |
2032 | 2032 | |
2033 | 2033 | /** |
2034 | - * @var int $events_in_dashboard |
|
2035 | - */ |
|
2034 | + * @var int $events_in_dashboard |
|
2035 | + */ |
|
2036 | 2036 | public $events_in_dashboard; |
2037 | 2037 | |
2038 | 2038 | /** |
2039 | - * @var boolean $use_event_timezones |
|
2040 | - */ |
|
2039 | + * @var boolean $use_event_timezones |
|
2040 | + */ |
|
2041 | 2041 | public $use_event_timezones; |
2042 | 2042 | |
2043 | 2043 | /** |
2044 | - * @var boolean $use_full_logging |
|
2045 | - */ |
|
2044 | + * @var boolean $use_full_logging |
|
2045 | + */ |
|
2046 | 2046 | public $use_full_logging; |
2047 | 2047 | |
2048 | 2048 | /** |
2049 | - * @var string $log_file_name |
|
2050 | - */ |
|
2049 | + * @var string $log_file_name |
|
2050 | + */ |
|
2051 | 2051 | public $log_file_name; |
2052 | 2052 | |
2053 | 2053 | /** |
2054 | - * @var string $debug_file_name |
|
2055 | - */ |
|
2054 | + * @var string $debug_file_name |
|
2055 | + */ |
|
2056 | 2056 | public $debug_file_name; |
2057 | 2057 | |
2058 | 2058 | /** |
2059 | - * @var boolean $use_remote_logging |
|
2060 | - */ |
|
2059 | + * @var boolean $use_remote_logging |
|
2060 | + */ |
|
2061 | 2061 | public $use_remote_logging; |
2062 | 2062 | |
2063 | 2063 | /** |
2064 | - * @var string $remote_logging_url |
|
2065 | - */ |
|
2064 | + * @var string $remote_logging_url |
|
2065 | + */ |
|
2066 | 2066 | public $remote_logging_url; |
2067 | 2067 | |
2068 | 2068 | /** |
2069 | - * @var boolean $show_reg_footer |
|
2070 | - */ |
|
2069 | + * @var boolean $show_reg_footer |
|
2070 | + */ |
|
2071 | 2071 | public $show_reg_footer; |
2072 | 2072 | |
2073 | 2073 | /** |
2074 | - * @var string $affiliate_id |
|
2075 | - */ |
|
2074 | + * @var string $affiliate_id |
|
2075 | + */ |
|
2076 | 2076 | public $affiliate_id; |
2077 | 2077 | |
2078 | 2078 | |
@@ -2146,43 +2146,43 @@ discard block |
||
2146 | 2146 | class EE_Template_Config extends EE_Config_Base { |
2147 | 2147 | |
2148 | 2148 | /** |
2149 | - * @var boolean $enable_default_style |
|
2150 | - */ |
|
2149 | + * @var boolean $enable_default_style |
|
2150 | + */ |
|
2151 | 2151 | public $enable_default_style; |
2152 | 2152 | |
2153 | 2153 | /** |
2154 | - * @var string $custom_style_sheet |
|
2155 | - */ |
|
2154 | + * @var string $custom_style_sheet |
|
2155 | + */ |
|
2156 | 2156 | public $custom_style_sheet; |
2157 | 2157 | |
2158 | 2158 | /** |
2159 | - * @var boolean $display_address_in_regform |
|
2160 | - */ |
|
2159 | + * @var boolean $display_address_in_regform |
|
2160 | + */ |
|
2161 | 2161 | public $display_address_in_regform; |
2162 | 2162 | |
2163 | 2163 | /** |
2164 | - * @var int $display_description_on_multi_reg_page |
|
2165 | - */ |
|
2164 | + * @var int $display_description_on_multi_reg_page |
|
2165 | + */ |
|
2166 | 2166 | public $display_description_on_multi_reg_page; |
2167 | 2167 | |
2168 | 2168 | /** |
2169 | - * @var boolean $use_custom_templates |
|
2170 | - */ |
|
2169 | + * @var boolean $use_custom_templates |
|
2170 | + */ |
|
2171 | 2171 | public $use_custom_templates; |
2172 | 2172 | |
2173 | 2173 | /** |
2174 | - * @var string $current_espresso_theme |
|
2175 | - */ |
|
2174 | + * @var string $current_espresso_theme |
|
2175 | + */ |
|
2176 | 2176 | public $current_espresso_theme; |
2177 | 2177 | |
2178 | 2178 | /** |
2179 | - * @var EE_Event_Single_Config $EED_Event_Single |
|
2180 | - */ |
|
2179 | + * @var EE_Event_Single_Config $EED_Event_Single |
|
2180 | + */ |
|
2181 | 2181 | public $EED_Event_Single; |
2182 | 2182 | |
2183 | 2183 | /** |
2184 | - * @var EE_Events_Archive_Config $EED_Events_Archive |
|
2185 | - */ |
|
2184 | + * @var EE_Events_Archive_Config $EED_Events_Archive |
|
2185 | + */ |
|
2186 | 2186 | public $EED_Events_Archive; |
2187 | 2187 | |
2188 | 2188 | |
@@ -2215,78 +2215,78 @@ discard block |
||
2215 | 2215 | class EE_Map_Config extends EE_Config_Base { |
2216 | 2216 | |
2217 | 2217 | /** |
2218 | - * @var boolean $use_google_maps |
|
2219 | - */ |
|
2218 | + * @var boolean $use_google_maps |
|
2219 | + */ |
|
2220 | 2220 | public $use_google_maps; |
2221 | 2221 | |
2222 | 2222 | /** |
2223 | - * @var int $event_details_map_width |
|
2224 | - */ |
|
2223 | + * @var int $event_details_map_width |
|
2224 | + */ |
|
2225 | 2225 | public $event_details_map_width; |
2226 | 2226 | |
2227 | 2227 | /** |
2228 | - * @var int $event_details_map_height |
|
2229 | - */ |
|
2228 | + * @var int $event_details_map_height |
|
2229 | + */ |
|
2230 | 2230 | public $event_details_map_height; |
2231 | 2231 | |
2232 | 2232 | /** |
2233 | - * @var int $event_details_map_zoom |
|
2234 | - */ |
|
2233 | + * @var int $event_details_map_zoom |
|
2234 | + */ |
|
2235 | 2235 | public $event_details_map_zoom; |
2236 | 2236 | |
2237 | 2237 | /** |
2238 | - * @var boolean $event_details_display_nav |
|
2239 | - */ |
|
2238 | + * @var boolean $event_details_display_nav |
|
2239 | + */ |
|
2240 | 2240 | public $event_details_display_nav; |
2241 | 2241 | |
2242 | 2242 | /** |
2243 | - * @var boolean $event_details_nav_size |
|
2244 | - */ |
|
2243 | + * @var boolean $event_details_nav_size |
|
2244 | + */ |
|
2245 | 2245 | public $event_details_nav_size; |
2246 | 2246 | |
2247 | 2247 | /** |
2248 | - * @var string $event_details_control_type |
|
2249 | - */ |
|
2248 | + * @var string $event_details_control_type |
|
2249 | + */ |
|
2250 | 2250 | public $event_details_control_type; |
2251 | 2251 | |
2252 | 2252 | /** |
2253 | - * @var string $event_details_map_align |
|
2254 | - */ |
|
2253 | + * @var string $event_details_map_align |
|
2254 | + */ |
|
2255 | 2255 | public $event_details_map_align; |
2256 | 2256 | |
2257 | 2257 | /** |
2258 | - * @var int $event_list_map_width |
|
2259 | - */ |
|
2258 | + * @var int $event_list_map_width |
|
2259 | + */ |
|
2260 | 2260 | public $event_list_map_width; |
2261 | 2261 | |
2262 | 2262 | /** |
2263 | - * @var int $event_list_map_height |
|
2264 | - */ |
|
2263 | + * @var int $event_list_map_height |
|
2264 | + */ |
|
2265 | 2265 | public $event_list_map_height; |
2266 | 2266 | |
2267 | 2267 | /** |
2268 | - * @var int $event_list_map_zoom |
|
2269 | - */ |
|
2268 | + * @var int $event_list_map_zoom |
|
2269 | + */ |
|
2270 | 2270 | public $event_list_map_zoom; |
2271 | 2271 | |
2272 | 2272 | /** |
2273 | - * @var boolean $event_list_display_nav |
|
2274 | - */ |
|
2273 | + * @var boolean $event_list_display_nav |
|
2274 | + */ |
|
2275 | 2275 | public $event_list_display_nav; |
2276 | 2276 | |
2277 | 2277 | /** |
2278 | - * @var boolean $event_list_nav_size |
|
2279 | - */ |
|
2278 | + * @var boolean $event_list_nav_size |
|
2279 | + */ |
|
2280 | 2280 | public $event_list_nav_size; |
2281 | 2281 | |
2282 | 2282 | /** |
2283 | - * @var string $event_list_control_type |
|
2284 | - */ |
|
2283 | + * @var string $event_list_control_type |
|
2284 | + */ |
|
2285 | 2285 | public $event_list_control_type; |
2286 | 2286 | |
2287 | 2287 | /** |
2288 | - * @var string $event_list_map_align |
|
2289 | - */ |
|
2288 | + * @var string $event_list_map_align |
|
2289 | + */ |
|
2290 | 2290 | public $event_list_map_align; |
2291 | 2291 | |
2292 | 2292 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @param EE_Response $response |
51 | 51 | * @return EE_Response |
52 | 52 | */ |
53 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
53 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
54 | 54 | $this->request = $request; |
55 | 55 | $this->response = $response; |
56 | 56 | // central repository for classes |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | // workarounds for PHP < 5.3 |
59 | 59 | $this->_load_class_tools(); |
60 | 60 | // PSR4 Autoloaders |
61 | - EE_Registry::instance()->load_core( 'EE_Psr4AutoloaderInit' ); |
|
61 | + EE_Registry::instance()->load_core('EE_Psr4AutoloaderInit'); |
|
62 | 62 | // deprecated functions |
63 | - espresso_load_required( 'EE_Deprecated', EE_CORE . 'EE_Deprecated.core.php' ); |
|
63 | + espresso_load_required('EE_Deprecated', EE_CORE.'EE_Deprecated.core.php'); |
|
64 | 64 | // load interfaces |
65 | - espresso_load_required( 'EEI_Payment_Method_Interfaces', EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php' ); |
|
65 | + espresso_load_required('EEI_Payment_Method_Interfaces', EE_LIBRARIES.'payment_methods'.DS.'EEI_Payment_Method_Interfaces.php'); |
|
66 | 66 | //// WP cron jobs |
67 | - EE_Registry::instance()->load_core( 'Cron_Tasks' ); |
|
68 | - EE_Registry::instance()->load_core( 'EE_System' ); |
|
67 | + EE_Registry::instance()->load_core('Cron_Tasks'); |
|
68 | + EE_Registry::instance()->load_core('EE_System'); |
|
69 | 69 | |
70 | 70 | return $this->response; |
71 | 71 | } |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | private function _load_registry() { |
82 | - if ( is_readable( EE_CORE . 'EE_Registry.core.php' )) { |
|
83 | - require_once( EE_CORE . 'EE_Registry.core.php' ); |
|
82 | + if (is_readable(EE_CORE.'EE_Registry.core.php')) { |
|
83 | + require_once(EE_CORE.'EE_Registry.core.php'); |
|
84 | 84 | } else { |
85 | - $msg = __( 'The EE_Registry core class could not be loaded.', 'event_espresso' ); |
|
86 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
87 | - wp_die( EE_Error::get_notices() ); |
|
85 | + $msg = __('The EE_Registry core class could not be loaded.', 'event_espresso'); |
|
86 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
87 | + wp_die(EE_Error::get_notices()); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | * @return void |
97 | 97 | */ |
98 | 98 | private function _load_class_tools() { |
99 | - if ( is_readable( EE_HELPERS . 'EEH_Class_Tools.helper.php' )) { |
|
100 | - require_once( EE_HELPERS . 'EEH_Class_Tools.helper.php' ); |
|
99 | + if (is_readable(EE_HELPERS.'EEH_Class_Tools.helper.php')) { |
|
100 | + require_once(EE_HELPERS.'EEH_Class_Tools.helper.php'); |
|
101 | 101 | } else { |
102 | - $msg = __( 'The EEH_Class_Tools helper could not be loaded.', 'event_espresso' ); |
|
103 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
102 | + $msg = __('The EEH_Class_Tools helper could not be loaded.', 'event_espresso'); |
|
103 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @param \EE_Request $request |
116 | 116 | * @param \EE_Response $response |
117 | 117 | */ |
118 | - public function handle_response( EE_Request $request, EE_Response $response ) { |
|
118 | + public function handle_response(EE_Request $request, EE_Response $response) { |
|
119 | 119 | //EEH_Debug_Tools::printr( $request, '$request', __FILE__, __LINE__ ); |
120 | 120 | //EEH_Debug_Tools::printr( $response, '$response', __FILE__, __LINE__ ); |
121 | 121 | //die(); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public static function instance() { |
158 | 158 | // check if class object is instantiated |
159 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Registry )) { |
|
159 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Registry)) { |
|
160 | 160 | self::$_instance = new self(); |
161 | 161 | } |
162 | 162 | return self::$_instance; |
@@ -171,14 +171,14 @@ discard block |
||
171 | 171 | * @return EE_Registry |
172 | 172 | */ |
173 | 173 | private function __construct() { |
174 | - $this->load_core( 'Base' ); |
|
174 | + $this->load_core('Base'); |
|
175 | 175 | // class library |
176 | 176 | $this->LIB = new StdClass(); |
177 | 177 | $this->addons = new StdClass(); |
178 | 178 | $this->modules = new StdClass(); |
179 | 179 | $this->shortcodes = new StdClass(); |
180 | 180 | $this->widgets = new StdClass(); |
181 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'init' )); |
|
181 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init')); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function init() { |
193 | 193 | // Get current page protocol |
194 | - $protocol = isset( $_SERVER['HTTPS'] ) ? 'https://' : 'http://'; |
|
194 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
195 | 195 | // Output admin-ajax.php URL with same protocol as current page |
196 | - self::$i18n_js_strings['ajax_url'] = admin_url( 'admin-ajax.php', $protocol ); |
|
197 | - self::$i18n_js_strings['wp_debug'] = defined( 'WP_DEBUG' ) ? WP_DEBUG : FALSE; |
|
196 | + self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol); |
|
197 | + self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : FALSE; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -205,14 +205,14 @@ discard block |
||
205 | 205 | * @return string |
206 | 206 | */ |
207 | 207 | public static function localize_i18n_js_strings() { |
208 | - $i18n_js_strings = (array)EE_Registry::$i18n_js_strings; |
|
209 | - foreach ( $i18n_js_strings as $key => $value ) { |
|
210 | - if ( is_scalar( $value ) ) { |
|
211 | - $i18n_js_strings[ $key ] = html_entity_decode( (string)$value, ENT_QUOTES, 'UTF-8' ); |
|
208 | + $i18n_js_strings = (array) EE_Registry::$i18n_js_strings; |
|
209 | + foreach ($i18n_js_strings as $key => $value) { |
|
210 | + if (is_scalar($value)) { |
|
211 | + $i18n_js_strings[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
215 | - return "/* <![CDATA[ */ var eei18n = " . wp_json_encode( $i18n_js_strings ) . '; /* ]]> */'; |
|
215 | + return "/* <![CDATA[ */ var eei18n = ".wp_json_encode($i18n_js_strings).'; /* ]]> */'; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -220,15 +220,15 @@ discard block |
||
220 | 220 | /** |
221 | 221 | * @param mixed string | EED_Module $module |
222 | 222 | */ |
223 | - public function add_module( $module ) { |
|
224 | - if ( $module instanceof EED_Module ) { |
|
225 | - $module_class = get_class( $module ); |
|
223 | + public function add_module($module) { |
|
224 | + if ($module instanceof EED_Module) { |
|
225 | + $module_class = get_class($module); |
|
226 | 226 | $this->modules->{$module_class} = $module; |
227 | 227 | } else { |
228 | - if ( ! class_exists( 'EE_Module_Request_Router' )) { |
|
229 | - $this->load_core( 'Module_Request_Router' ); |
|
228 | + if ( ! class_exists('EE_Module_Request_Router')) { |
|
229 | + $this->load_core('Module_Request_Router'); |
|
230 | 230 | } |
231 | - $this->modules->{$module} = EE_Module_Request_Router::module_factory( $module ); |
|
231 | + $this->modules->{$module} = EE_Module_Request_Router::module_factory($module); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | * @param string $module_name |
239 | 239 | * @return mixed EED_Module | NULL |
240 | 240 | */ |
241 | - public function get_module( $module_name = '' ) { |
|
242 | - return isset( $this->modules->{$module_name} ) ? $this->modules->{$module_name} : NULL; |
|
241 | + public function get_module($module_name = '') { |
|
242 | + return isset($this->modules->{$module_name} ) ? $this->modules->{$module_name} : NULL; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | |
@@ -252,18 +252,18 @@ discard block |
||
252 | 252 | * @param bool $load_only |
253 | 253 | * @return mixed |
254 | 254 | */ |
255 | - public function load_core ( $class_name, $arguments = array(), $load_only = FALSE ) { |
|
255 | + public function load_core($class_name, $arguments = array(), $load_only = FALSE) { |
|
256 | 256 | $core_paths = apply_filters( |
257 | 257 | 'FHEE__EE_Registry__load_core__core_paths', |
258 | 258 | array( |
259 | 259 | EE_CORE, |
260 | 260 | EE_ADMIN, |
261 | 261 | EE_CPTS, |
262 | - EE_CORE . 'data_migration_scripts' . DS |
|
262 | + EE_CORE.'data_migration_scripts'.DS |
|
263 | 263 | ) |
264 | 264 | ); |
265 | 265 | // retrieve instantiated class |
266 | - return $this->_load( $core_paths, 'EE_' , $class_name, 'core', $arguments, FALSE, TRUE, $load_only ); |
|
266 | + return $this->_load($core_paths, 'EE_', $class_name, 'core', $arguments, FALSE, TRUE, $load_only); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -276,9 +276,9 @@ discard block |
||
276 | 276 | * @param mixed $arguments |
277 | 277 | * @return EE_Data_Migration_Script_Base |
278 | 278 | */ |
279 | - public function load_dms ( $class_name, $arguments = array() ) { |
|
279 | + public function load_dms($class_name, $arguments = array()) { |
|
280 | 280 | // retrieve instantiated class |
281 | - return $this->_load( EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_' , $class_name, 'dms', $arguments, FALSE, FALSE, FALSE ); |
|
281 | + return $this->_load(EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, FALSE, FALSE, FALSE); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
@@ -293,14 +293,14 @@ discard block |
||
293 | 293 | * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate (default) |
294 | 294 | * @return EE_Base_Class |
295 | 295 | */ |
296 | - public function load_class ( $class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) { |
|
297 | - $paths = apply_filters('FHEE__EE_Registry__load_class__paths',array( |
|
296 | + public function load_class($class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE) { |
|
297 | + $paths = apply_filters('FHEE__EE_Registry__load_class__paths', array( |
|
298 | 298 | EE_CORE, |
299 | 299 | EE_CLASSES, |
300 | 300 | EE_BUSINESS |
301 | 301 | )); |
302 | 302 | // retrieve instantiated class |
303 | - return $this->_load( $paths, 'EE_' , $class_name, 'class', $arguments, $from_db, $cache, $load_only ); |
|
303 | + return $this->_load($paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -314,10 +314,10 @@ discard block |
||
314 | 314 | * @param bool $load_only |
315 | 315 | * @return EEH_Base |
316 | 316 | */ |
317 | - public function load_helper ( $class_name, $arguments = array(), $load_only = TRUE ) { |
|
318 | - $helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS ) ); |
|
317 | + public function load_helper($class_name, $arguments = array(), $load_only = TRUE) { |
|
318 | + $helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS)); |
|
319 | 319 | // retrieve instantiated class |
320 | - return $this->_load( $helper_paths, 'EEH_', $class_name, 'helper', $arguments, FALSE, TRUE, $load_only ); |
|
320 | + return $this->_load($helper_paths, 'EEH_', $class_name, 'helper', $arguments, FALSE, TRUE, $load_only); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | |
@@ -331,16 +331,16 @@ discard block |
||
331 | 331 | * @param bool $load_only |
332 | 332 | * @return mixed |
333 | 333 | */ |
334 | - public function load_lib ( $class_name, $arguments = array(), $load_only = FALSE ) { |
|
334 | + public function load_lib($class_name, $arguments = array(), $load_only = FALSE) { |
|
335 | 335 | $paths = array( |
336 | 336 | EE_LIBRARIES, |
337 | - EE_LIBRARIES . 'messages' . DS, |
|
338 | - EE_LIBRARIES . 'shortcodes' . DS, |
|
339 | - EE_LIBRARIES . 'qtips' . DS, |
|
340 | - EE_LIBRARIES . 'payment_methods' . DS, |
|
337 | + EE_LIBRARIES.'messages'.DS, |
|
338 | + EE_LIBRARIES.'shortcodes'.DS, |
|
339 | + EE_LIBRARIES.'qtips'.DS, |
|
340 | + EE_LIBRARIES.'payment_methods'.DS, |
|
341 | 341 | ); |
342 | 342 | // retrieve instantiated class |
343 | - return $this->_load( $paths, 'EE_' , $class_name, 'lib', $arguments, FALSE, TRUE, $load_only ); |
|
343 | + return $this->_load($paths, 'EE_', $class_name, 'lib', $arguments, FALSE, TRUE, $load_only); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -353,13 +353,13 @@ discard block |
||
353 | 353 | * @param bool $load_only |
354 | 354 | * @return EEM_Base |
355 | 355 | */ |
356 | - public function load_model ( $class_name, $arguments = array(), $load_only = FALSE ) { |
|
357 | - $paths = apply_filters('FHEE__EE_Registry__load_model__paths',array( |
|
356 | + public function load_model($class_name, $arguments = array(), $load_only = FALSE) { |
|
357 | + $paths = apply_filters('FHEE__EE_Registry__load_model__paths', array( |
|
358 | 358 | EE_MODELS, |
359 | 359 | EE_CORE |
360 | 360 | )); |
361 | 361 | // retrieve instantiated class |
362 | - return $this->_load( $paths, 'EEM_' , $class_name, 'model', $arguments, FALSE, TRUE, $load_only ); |
|
362 | + return $this->_load($paths, 'EEM_', $class_name, 'model', $arguments, FALSE, TRUE, $load_only); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -372,15 +372,15 @@ discard block |
||
372 | 372 | * @param bool $load_only |
373 | 373 | * @return mixed |
374 | 374 | */ |
375 | - public function load_model_class ( $class_name, $arguments = array(), $load_only = TRUE ) { |
|
375 | + public function load_model_class($class_name, $arguments = array(), $load_only = TRUE) { |
|
376 | 376 | $paths = array( |
377 | - EE_MODELS . 'fields' . DS, |
|
378 | - EE_MODELS . 'helpers' . DS, |
|
379 | - EE_MODELS . 'relations' . DS, |
|
380 | - EE_MODELS . 'strategies' . DS |
|
377 | + EE_MODELS.'fields'.DS, |
|
378 | + EE_MODELS.'helpers'.DS, |
|
379 | + EE_MODELS.'relations'.DS, |
|
380 | + EE_MODELS.'strategies'.DS |
|
381 | 381 | ); |
382 | 382 | // retrieve instantiated class |
383 | - return $this->_load( $paths, 'EE_' , $class_name, '', $arguments, FALSE, TRUE, $load_only ); |
|
383 | + return $this->_load($paths, 'EE_', $class_name, '', $arguments, FALSE, TRUE, $load_only); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
@@ -392,8 +392,8 @@ discard block |
||
392 | 392 | * @param string $model_name like Event, Attendee, Question_Group_Question, etc. |
393 | 393 | * @return boolean |
394 | 394 | */ |
395 | - public function is_model_name( $model_name ){ |
|
396 | - return isset( $this->models[ $model_name ] ) ? TRUE : FALSE; |
|
395 | + public function is_model_name($model_name) { |
|
396 | + return isset($this->models[$model_name]) ? TRUE : FALSE; |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | |
@@ -408,9 +408,9 @@ discard block |
||
408 | 408 | * @param bool $load_only |
409 | 409 | * @return mixed |
410 | 410 | */ |
411 | - public function load_file ( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE ) { |
|
411 | + public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE) { |
|
412 | 412 | // retrieve instantiated class |
413 | - return $this->_load( $path_to_file, '', $file_name, $type, $arguments, FALSE, TRUE, $load_only ); |
|
413 | + return $this->_load($path_to_file, '', $file_name, $type, $arguments, FALSE, TRUE, $load_only); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | |
@@ -425,9 +425,9 @@ discard block |
||
425 | 425 | * @param bool $load_only |
426 | 426 | * @return EE_Addon |
427 | 427 | */ |
428 | - public function load_addon ( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE ) { |
|
428 | + public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE) { |
|
429 | 429 | // retrieve instantiated class |
430 | - return $this->_load( $path_to_file, 'addon', $class_name, $type, $arguments, FALSE, TRUE, $load_only ); |
|
430 | + return $this->_load($path_to_file, 'addon', $class_name, $type, $arguments, FALSE, TRUE, $load_only); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | |
@@ -445,15 +445,15 @@ discard block |
||
445 | 445 | * @internal param string $file_path - file path including file name |
446 | 446 | * @return bool | object |
447 | 447 | */ |
448 | - private function _load ( $file_paths = array(), $class_prefix = 'EE_', $class_name = FALSE, $type = 'class', $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) { |
|
448 | + private function _load($file_paths = array(), $class_prefix = 'EE_', $class_name = FALSE, $type = 'class', $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE) { |
|
449 | 449 | // strip php file extension |
450 | - $class_name = str_replace( '.php', '', trim( $class_name )); |
|
450 | + $class_name = str_replace('.php', '', trim($class_name)); |
|
451 | 451 | // does the class have a prefix ? |
452 | - if ( ! empty( $class_prefix ) && $class_prefix != 'addon' ) { |
|
452 | + if ( ! empty($class_prefix) && $class_prefix != 'addon') { |
|
453 | 453 | // make sure $class_prefix is uppercase |
454 | - $class_prefix = strtoupper( trim( $class_prefix )); |
|
454 | + $class_prefix = strtoupper(trim($class_prefix)); |
|
455 | 455 | // add class prefix ONCE!!! |
456 | - $class_name = $class_prefix . str_replace( $class_prefix, '', $class_name ); |
|
456 | + $class_name = $class_prefix.str_replace($class_prefix, '', $class_name); |
|
457 | 457 | } |
458 | 458 | |
459 | 459 | $class_abbreviations = array( |
@@ -466,56 +466,56 @@ discard block |
||
466 | 466 | ); |
467 | 467 | |
468 | 468 | // check if class has already been loaded, and return it if it has been |
469 | - if ( isset( $class_abbreviations[ $class_name ] ) && ! is_null( $this->$class_abbreviations[ $class_name ] )) { |
|
470 | - return $this->$class_abbreviations[ $class_name ]; |
|
471 | - } else if ( isset ( $this->{$class_name} )) { |
|
469 | + if (isset($class_abbreviations[$class_name]) && ! is_null($this->$class_abbreviations[$class_name])) { |
|
470 | + return $this->$class_abbreviations[$class_name]; |
|
471 | + } else if (isset ($this->{$class_name} )) { |
|
472 | 472 | return $this->{$class_name}; |
473 | - } else if ( isset ( $this->LIB->$class_name )) { |
|
473 | + } else if (isset ($this->LIB->$class_name)) { |
|
474 | 474 | return $this->LIB->$class_name; |
475 | - } else if ( $class_prefix == 'addon' && isset ( $this->addons->$class_name )) { |
|
475 | + } else if ($class_prefix == 'addon' && isset ($this->addons->$class_name)) { |
|
476 | 476 | return $this->addons->$class_name; |
477 | 477 | } |
478 | 478 | |
479 | 479 | // assume all paths lead nowhere |
480 | 480 | $path = FALSE; |
481 | 481 | // make sure $file_paths is an array |
482 | - $file_paths = is_array( $file_paths ) ? $file_paths : array( $file_paths ); |
|
482 | + $file_paths = is_array($file_paths) ? $file_paths : array($file_paths); |
|
483 | 483 | // cycle thru paths |
484 | - foreach ( $file_paths as $key => $file_path ) { |
|
484 | + foreach ($file_paths as $key => $file_path) { |
|
485 | 485 | // convert all separators to proper DS, if no filepath, then use EE_CLASSES |
486 | - $file_path = $file_path ? str_replace( array( '/', '\\' ), DS, $file_path ) : EE_CLASSES; |
|
486 | + $file_path = $file_path ? str_replace(array('/', '\\'), DS, $file_path) : EE_CLASSES; |
|
487 | 487 | // prep file type |
488 | - $type = ! empty( $type ) ? trim( $type, '.' ) . '.' : ''; |
|
488 | + $type = ! empty($type) ? trim($type, '.').'.' : ''; |
|
489 | 489 | // build full file path |
490 | - $file_paths[ $key ] = rtrim( $file_path, DS ) . DS . $class_name . '.' . $type . 'php'; |
|
490 | + $file_paths[$key] = rtrim($file_path, DS).DS.$class_name.'.'.$type.'php'; |
|
491 | 491 | //does the file exist and can be read ? |
492 | - if ( is_readable( $file_paths[ $key ] )) { |
|
493 | - $path = $file_paths[ $key ]; |
|
492 | + if (is_readable($file_paths[$key])) { |
|
493 | + $path = $file_paths[$key]; |
|
494 | 494 | break; |
495 | 495 | } |
496 | 496 | } |
497 | 497 | // don't give up! you gotta... |
498 | 498 | try { |
499 | 499 | //does the file exist and can it be read ? |
500 | - if ( ! $path ) { |
|
500 | + if ( ! $path) { |
|
501 | 501 | // so sorry, can't find the file |
502 | - throw new EE_Error ( |
|
503 | - sprintf ( |
|
504 | - __('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s','event_espresso'), |
|
505 | - trim( $type, '.' ), |
|
502 | + throw new EE_Error( |
|
503 | + sprintf( |
|
504 | + __('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso'), |
|
505 | + trim($type, '.'), |
|
506 | 506 | $class_name, |
507 | - '<br />' . implode( ',<br />', $file_paths ) |
|
507 | + '<br />'.implode(',<br />', $file_paths) |
|
508 | 508 | ) |
509 | 509 | ); |
510 | 510 | } |
511 | 511 | // get the file |
512 | - require_once( $path ); |
|
512 | + require_once($path); |
|
513 | 513 | // if the class isn't already declared somewhere |
514 | - if ( class_exists( $class_name, FALSE ) === FALSE ) { |
|
514 | + if (class_exists($class_name, FALSE) === FALSE) { |
|
515 | 515 | // so sorry, not a class |
516 | 516 | throw new EE_Error( |
517 | 517 | sprintf( |
518 | - __('The %s file %s does not appear to contain the %s Class.','event_espresso'), |
|
518 | + __('The %s file %s does not appear to contain the %s Class.', 'event_espresso'), |
|
519 | 519 | $type, |
520 | 520 | $path, |
521 | 521 | $class_name |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | ); |
524 | 524 | } |
525 | 525 | |
526 | - } catch ( EE_Error $e ) { |
|
526 | + } catch (EE_Error $e) { |
|
527 | 527 | $e->get_error(); |
528 | 528 | } |
529 | 529 | |
@@ -531,38 +531,38 @@ discard block |
||
531 | 531 | // don't give up! you gotta... |
532 | 532 | try { |
533 | 533 | // create reflection |
534 | - $reflector = new ReflectionClass( $class_name ); |
|
534 | + $reflector = new ReflectionClass($class_name); |
|
535 | 535 | // instantiate the class and add to the LIB array for tracking |
536 | 536 | // EE_Base_Classes are instantiated via new_instance by default (models call them via new_instance_from_db) |
537 | - if ( $reflector->getConstructor() === NULL || $reflector->isAbstract() || $load_only ) { |
|
537 | + if ($reflector->getConstructor() === NULL || $reflector->isAbstract() || $load_only) { |
|
538 | 538 | // $instantiation_mode = 0; |
539 | 539 | // no constructor = static methods only... nothing to instantiate, loading file was enough |
540 | 540 | return TRUE; |
541 | - } else if ( $from_db && method_exists( $class_name, 'new_instance_from_db' ) ) { |
|
541 | + } else if ($from_db && method_exists($class_name, 'new_instance_from_db')) { |
|
542 | 542 | // $instantiation_mode = 1; |
543 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance_from_db' ), $arguments ); |
|
544 | - } else if ( method_exists( $class_name, 'new_instance' ) ) { |
|
543 | + $class_obj = call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments); |
|
544 | + } else if (method_exists($class_name, 'new_instance')) { |
|
545 | 545 | // $instantiation_mode = 2; |
546 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance' ), $arguments ); |
|
547 | - } else if ( method_exists( $class_name, 'instance' )) { |
|
546 | + $class_obj = call_user_func_array(array($class_name, 'new_instance'), $arguments); |
|
547 | + } else if (method_exists($class_name, 'instance')) { |
|
548 | 548 | // $instantiation_mode = 3; |
549 | - $class_obj = call_user_func_array( array( $class_name, 'instance' ), $arguments ); |
|
550 | - } else if ( $reflector->isInstantiable() ) { |
|
549 | + $class_obj = call_user_func_array(array($class_name, 'instance'), $arguments); |
|
550 | + } else if ($reflector->isInstantiable()) { |
|
551 | 551 | // $instantiation_mode = 4; |
552 | - $class_obj = $reflector->newInstance( $arguments ); |
|
553 | - } else if ( ! $load_only ) { |
|
552 | + $class_obj = $reflector->newInstance($arguments); |
|
553 | + } else if ( ! $load_only) { |
|
554 | 554 | // heh ? something's not right ! |
555 | 555 | // $instantiation_mode = 5; |
556 | 556 | throw new EE_Error( |
557 | 557 | sprintf( |
558 | - __('The %s file %s could not be instantiated.','event_espresso'), |
|
558 | + __('The %s file %s could not be instantiated.', 'event_espresso'), |
|
559 | 559 | $type, |
560 | 560 | $class_name |
561 | 561 | ) |
562 | 562 | ); |
563 | 563 | } |
564 | 564 | |
565 | - } catch ( EE_Error $e ) { |
|
565 | + } catch (EE_Error $e) { |
|
566 | 566 | $e->get_error(); |
567 | 567 | } |
568 | 568 | |
@@ -574,15 +574,15 @@ discard block |
||
574 | 574 | // EEH_Debug_Tools::printr( $class_obj, '$class_obj <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
575 | 575 | |
576 | 576 | |
577 | - if ( isset( $class_obj )) { |
|
577 | + if (isset($class_obj)) { |
|
578 | 578 | // return newly instantiated class |
579 | - if ( isset( $class_abbreviations[ $class_name ] )) { |
|
580 | - $this->$class_abbreviations[ $class_name ] = $class_obj; |
|
581 | - } else if ( EEH_Class_Tools::has_property( $this, $class_name )) { |
|
579 | + if (isset($class_abbreviations[$class_name])) { |
|
580 | + $this->$class_abbreviations[$class_name] = $class_obj; |
|
581 | + } else if (EEH_Class_Tools::has_property($this, $class_name)) { |
|
582 | 582 | $this->{$class_name} = $class_obj; |
583 | - } else if ( $class_prefix == 'addon' && $cache ) { |
|
583 | + } else if ($class_prefix == 'addon' && $cache) { |
|
584 | 584 | $this->addons->$class_name = $class_obj; |
585 | - } else if ( !$from_db && $cache ) { |
|
585 | + } else if ( ! $from_db && $cache) { |
|
586 | 586 | $this->LIB->$class_name = $class_obj; |
587 | 587 | } |
588 | 588 | return $class_obj; |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | * @param $a |
608 | 608 | * @param $b |
609 | 609 | */ |
610 | - final function __call($a,$b) {} |
|
610 | + final function __call($a, $b) {} |
|
611 | 611 | |
612 | 612 | |
613 | 613 | |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | * @param $a |
623 | 623 | * @param $b |
624 | 624 | */ |
625 | - final function __set($a,$b) {} |
|
625 | + final function __set($a, $b) {} |
|
626 | 626 | |
627 | 627 | |
628 | 628 | |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | * @param $a |
663 | 663 | * @param $b |
664 | 664 | */ |
665 | - final static function __callStatic($a,$b) {} |
|
665 | + final static function __callStatic($a, $b) {} |
|
666 | 666 | |
667 | 667 | /** |
668 | 668 | * Gets the addon by its name/slug (not classname. For that, just |
@@ -670,9 +670,9 @@ discard block |
||
670 | 670 | * @param string $name |
671 | 671 | * @return EE_Addon |
672 | 672 | */ |
673 | - public function get_addon_by_name( $name ){ |
|
674 | - foreach($this->addons as $addon){ |
|
675 | - if( $addon->name() == $name){ |
|
673 | + public function get_addon_by_name($name) { |
|
674 | + foreach ($this->addons as $addon) { |
|
675 | + if ($addon->name() == $name) { |
|
676 | 676 | return $addon; |
677 | 677 | } |
678 | 678 | } |
@@ -683,10 +683,10 @@ discard block |
||
683 | 683 | * |
684 | 684 | * @return EE_Addon[] where the KEYS are the addon's name() |
685 | 685 | */ |
686 | - public function get_addons_by_name(){ |
|
686 | + public function get_addons_by_name() { |
|
687 | 687 | $addons = array(); |
688 | - foreach($this->addons as $addon){ |
|
689 | - $addons[ $addon->name() ] = $addon; |
|
688 | + foreach ($this->addons as $addon) { |
|
689 | + $addons[$addon->name()] = $addon; |
|
690 | 690 | } |
691 | 691 | return $addons; |
692 | 692 | } |
@@ -701,14 +701,14 @@ discard block |
||
701 | 701 | * @return EEM_Base |
702 | 702 | * @throws EE_Error |
703 | 703 | */ |
704 | - public function reset_model( $model_name ){ |
|
705 | - $model = $this->load_model( $model_name ); |
|
706 | - $model_class_name = get_class( $model ); |
|
704 | + public function reset_model($model_name) { |
|
705 | + $model = $this->load_model($model_name); |
|
706 | + $model_class_name = get_class($model); |
|
707 | 707 | //get that model reset it and make sure we nuke the old reference to it |
708 | - if ( $model instanceof $model_class_name && is_callable( array( $model_class_name, 'reset' ))) { |
|
708 | + if ($model instanceof $model_class_name && is_callable(array($model_class_name, 'reset'))) { |
|
709 | 709 | $this->LIB->$model_class_name = $model::reset(); |
710 | - }else{ |
|
711 | - throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) ); |
|
710 | + } else { |
|
711 | + throw new EE_Error(sprintf(__('Model %s does not have a method "reset"', 'event_espresso'), $model_name)); |
|
712 | 712 | } |
713 | 713 | return $this->LIB->$model_class_name; |
714 | 714 | } |
@@ -724,15 +724,15 @@ discard block |
||
724 | 724 | * currently reinstantiate the singletons at the moment) |
725 | 725 | * @return EE_Registry |
726 | 726 | */ |
727 | - public static function reset( $hard = FALSE, $reinstantiate = TRUE ){ |
|
727 | + public static function reset($hard = FALSE, $reinstantiate = TRUE) { |
|
728 | 728 | $instance = self::instance(); |
729 | 729 | $instance->load_helper('Activation'); |
730 | 730 | EEH_Activation::reset(); |
731 | - $instance->CFG = EE_Config::reset( $hard, $reinstantiate ); |
|
731 | + $instance->CFG = EE_Config::reset($hard, $reinstantiate); |
|
732 | 732 | $instance->LIB->EE_Data_Migration_Manager = EE_Data_Migration_Manager::reset(); |
733 | 733 | $instance->LIB = new stdClass(); |
734 | - foreach( array_keys( $instance->non_abstract_db_models ) as $model_name ){ |
|
735 | - $instance->reset_model( $model_name ); |
|
734 | + foreach (array_keys($instance->non_abstract_db_models) as $model_name) { |
|
735 | + $instance->reset_model($model_name); |
|
736 | 736 | } |
737 | 737 | return $instance; |
738 | 738 | } |
@@ -743,9 +743,9 @@ discard block |
||
743 | 743 | */ |
744 | 744 | public function cpt_models() { |
745 | 745 | $cpt_models = array(); |
746 | - foreach( $this->non_abstract_db_models as $shortname => $classname ) { |
|
747 | - if( is_subclass_of( $classname, 'EEM_CPT_Base' ) ) { |
|
748 | - $cpt_models[ $shortname ] = $classname; |
|
746 | + foreach ($this->non_abstract_db_models as $shortname => $classname) { |
|
747 | + if (is_subclass_of($classname, 'EEM_CPT_Base')) { |
|
748 | + $cpt_models[$shortname] = $classname; |
|
749 | 749 | } |
750 | 750 | } |
751 | 751 | return $cpt_models; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param object $post The post object of the cpt that was saved. |
114 | 114 | * @return void |
115 | 115 | */ |
116 | - abstract protected function _insert_update_cpt_item( $post_id, $post ); |
|
116 | + abstract protected function _insert_update_cpt_item($post_id, $post); |
|
117 | 117 | |
118 | 118 | |
119 | 119 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param string $post_id The ID of the cpt that was trashed |
127 | 127 | * @return void |
128 | 128 | */ |
129 | - abstract public function trash_cpt_item( $post_id ); |
|
129 | + abstract public function trash_cpt_item($post_id); |
|
130 | 130 | |
131 | 131 | |
132 | 132 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param string $post_id theID of the cpt that was untrashed |
138 | 138 | * @return void |
139 | 139 | */ |
140 | - abstract public function restore_cpt_item( $post_id ); |
|
140 | + abstract public function restore_cpt_item($post_id); |
|
141 | 141 | |
142 | 142 | |
143 | 143 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param string $post_id the ID of the cpt that was deleted |
149 | 149 | * @return void |
150 | 150 | */ |
151 | - abstract public function delete_cpt_item( $post_id ); |
|
151 | + abstract public function delete_cpt_item($post_id); |
|
152 | 152 | |
153 | 153 | |
154 | 154 | |
@@ -161,32 +161,32 @@ discard block |
||
161 | 161 | */ |
162 | 162 | protected function _before_page_setup() { |
163 | 163 | |
164 | - $page = isset( $this->_req_data['page'] ) ? $this->_req_data['page'] : $this->page_slug; |
|
164 | + $page = isset($this->_req_data['page']) ? $this->_req_data['page'] : $this->page_slug; |
|
165 | 165 | |
166 | - $this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes ); |
|
166 | + $this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes); |
|
167 | 167 | |
168 | 168 | //let's see if the current route has a value for cpt_object_slug if it does we use that instead of the page |
169 | - $this->_cpt_object = isset($this->_req_data['action']) && isset( $this->_cpt_routes[$this->_req_data['action']] ) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object( $page ); |
|
169 | + $this->_cpt_object = isset($this->_req_data['action']) && isset($this->_cpt_routes[$this->_req_data['action']]) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object($page); |
|
170 | 170 | |
171 | 171 | //tweak pagenow for page loading. |
172 | - if( ! $this->_pagenow_map ) { |
|
172 | + if ( ! $this->_pagenow_map) { |
|
173 | 173 | $this->_pagenow_map = array( |
174 | 174 | 'create_new' => 'post-new.php', |
175 | 175 | 'edit' => 'post.php', |
176 | 176 | 'trash' => 'post.php' |
177 | 177 | ); |
178 | 178 | } |
179 | - add_action( 'current_screen', array( $this, 'modify_pagenow') ); |
|
179 | + add_action('current_screen', array($this, 'modify_pagenow')); |
|
180 | 180 | |
181 | 181 | |
182 | 182 | //TODO the below will need to be reworked to account for the cpt routes that are NOT based off of page but action param. |
183 | 183 | //get current page from autosave |
184 | - $current_page = isset( $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] ) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL; |
|
185 | - $this->_current_page = isset( $this->_req_data['current_page'] ) ? $this->_req_data['current_page'] : $current_page; |
|
184 | + $current_page = isset($this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page']) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL; |
|
185 | + $this->_current_page = isset($this->_req_data['current_page']) ? $this->_req_data['current_page'] : $current_page; |
|
186 | 186 | |
187 | 187 | |
188 | 188 | //autosave... make sure its only for the correct page |
189 | - if ( !empty($this->_current_page ) && $this->_current_page == $this->page_slug ) { |
|
189 | + if ( ! empty($this->_current_page) && $this->_current_page == $this->page_slug) { |
|
190 | 190 | //setup autosave ajax hook |
191 | 191 | //add_action('wp_ajax_ee-autosave', array( $this, 'do_extra_autosave_stuff' ), 10 ); //TODO reactivate when 4.2 autosave is implemented |
192 | 192 | } |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return void |
204 | 204 | */ |
205 | - public function modify_pagenow( $current_screen ) { |
|
205 | + public function modify_pagenow($current_screen) { |
|
206 | 206 | global $pagenow; |
207 | 207 | //possibly reset pagenow. |
208 | - if ( ! empty( $this->_req_data['page'] ) && $this->_req_data['page'] == $this->page_slug && !empty( $this->_req_data['action'] ) && isset( $this->_pagenow_map[$this->_req_data['action'] ] ) ) { |
|
208 | + if ( ! empty($this->_req_data['page']) && $this->_req_data['page'] == $this->page_slug && ! empty($this->_req_data['action']) && isset($this->_pagenow_map[$this->_req_data['action']])) { |
|
209 | 209 | $pagenow = $this->_pagenow_map[$this->_req_data['action']]; |
210 | 210 | } |
211 | 211 | } |
@@ -220,8 +220,8 @@ discard block |
||
220 | 220 | * @param array $ids an array of ids for containers that hold form inputs we want autosave to pickup. Typically you would send along the id of a metabox container. |
221 | 221 | * @return void |
222 | 222 | */ |
223 | - protected function _register_autosave_containers( $ids ) { |
|
224 | - $this->_autosave_containers = array_merge( $this->_autosave_fields, (array) $ids ); |
|
223 | + protected function _register_autosave_containers($ids) { |
|
224 | + $this->_autosave_containers = array_merge($this->_autosave_fields, (array) $ids); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | |
@@ -236,22 +236,22 @@ discard block |
||
236 | 236 | |
237 | 237 | $containers = array(); |
238 | 238 | |
239 | - if ( empty( $wp_meta_boxes ) ) |
|
239 | + if (empty($wp_meta_boxes)) |
|
240 | 240 | return; |
241 | 241 | |
242 | - $current_metaboxes = isset( $wp_meta_boxes[$this->page_slug] ) ? $wp_meta_boxes[$this->page_slug] : array(); |
|
242 | + $current_metaboxes = isset($wp_meta_boxes[$this->page_slug]) ? $wp_meta_boxes[$this->page_slug] : array(); |
|
243 | 243 | |
244 | - foreach ( $current_metaboxes as $box_context ) { |
|
245 | - foreach ( $box_context as $box_details ) { |
|
246 | - foreach ( $box_details as $box ) { |
|
247 | - if ( is_array( $box['callback'] ) && ( $box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks ) ){ |
|
244 | + foreach ($current_metaboxes as $box_context) { |
|
245 | + foreach ($box_context as $box_details) { |
|
246 | + foreach ($box_details as $box) { |
|
247 | + if (is_array($box['callback']) && ($box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks)) { |
|
248 | 248 | $containers[] = $box['id']; |
249 | 249 | } |
250 | 250 | } |
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
254 | - $this->_autosave_containers = array_merge( $this->_autosave_containers, $containers ); |
|
254 | + $this->_autosave_containers = array_merge($this->_autosave_containers, $containers); |
|
255 | 255 | |
256 | 256 | //add hidden inputs container |
257 | 257 | $this->_autosave_containers[] = 'ee-cpt-hidden-inputs'; |
@@ -268,13 +268,13 @@ discard block |
||
268 | 268 | wp_enqueue_script('cpt-autosave');/**/ //todo re-enable when we start doing autosave again in 4.2 |
269 | 269 | |
270 | 270 | //filter _autosave_containers |
271 | - $containers = apply_filters( 'FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this ); |
|
272 | - $containers = apply_filters( 'FHEE__EE_Admin_Page_CPT__' . get_class($this) . '___load_autosave_scripts_styles__containers', $containers, $this ); |
|
271 | + $containers = apply_filters('FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this); |
|
272 | + $containers = apply_filters('FHEE__EE_Admin_Page_CPT__'.get_class($this).'___load_autosave_scripts_styles__containers', $containers, $this); |
|
273 | 273 | |
274 | - wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers ); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave" |
|
274 | + wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave" |
|
275 | 275 | |
276 | 276 | $unsaved_data_msg = array( |
277 | - 'eventmsg' => sprintf( __("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
277 | + 'eventmsg' => sprintf(__("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
278 | 278 | 'inputChanged' => 0 |
279 | 279 | ); |
280 | 280 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | public function load_page_dependencies() { |
287 | 287 | try { |
288 | 288 | $this->_load_page_dependencies(); |
289 | - } catch ( EE_Error $e ) { |
|
289 | + } catch (EE_Error $e) { |
|
290 | 290 | $e->get_error(); |
291 | 291 | } |
292 | 292 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | protected function _load_page_dependencies() { |
303 | 303 | |
304 | 304 | //we only add stuff if this is a cpt_route! |
305 | - if ( !$this->_cpt_route ) { |
|
305 | + if ( ! $this->_cpt_route) { |
|
306 | 306 | parent::_load_page_dependencies(); |
307 | 307 | return; |
308 | 308 | } |
@@ -312,72 +312,72 @@ discard block |
||
312 | 312 | |
313 | 313 | //the following filters are for setting all the redirects on DEFAULT WP custom post type actions |
314 | 314 | //let's add a hidden input to the post-edit form so we know when we have to trigger our custom redirects! Otherwise the redirects will happen on ALL post saves which wouldn't be good of course! |
315 | - add_action('edit_form_after_title', array( $this, 'cpt_post_form_hidden_input') ); |
|
315 | + add_action('edit_form_after_title', array($this, 'cpt_post_form_hidden_input')); |
|
316 | 316 | |
317 | 317 | //inject our Admin page nav tabs... |
318 | 318 | //let's make sure the nav tabs are set if they aren't already |
319 | 319 | //if ( empty( $this->_nav_tabs ) ) $this->_set_nav_tabs(); |
320 | - add_action('post_edit_form_tag', array( $this, 'inject_nav_tabs' ) ); |
|
320 | + add_action('post_edit_form_tag', array($this, 'inject_nav_tabs')); |
|
321 | 321 | |
322 | 322 | //modify the post_updated messages array |
323 | - add_action('post_updated_messages', array( $this, 'post_update_messages' ), 10 ); |
|
323 | + add_action('post_updated_messages', array($this, 'post_update_messages'), 10); |
|
324 | 324 | |
325 | 325 | //add shortlink button to cpt edit screens. We can do this as a universal thing BECAUSE, cpts use the same format for shortlinks as posts! |
326 | - add_filter( 'pre_get_shortlink', array( $this, 'add_shortlink_button_to_editor' ), 10, 4 ); |
|
326 | + add_filter('pre_get_shortlink', array($this, 'add_shortlink_button_to_editor'), 10, 4); |
|
327 | 327 | |
328 | 328 | //This basically allows us to change the title of the "publish" metabox area on CPT pages by setting a 'publishbox' value in the $_labels property array in the child class. |
329 | - if ( !empty($this->_labels['publishbox'] ) ) { |
|
329 | + if ( ! empty($this->_labels['publishbox'])) { |
|
330 | 330 | |
331 | - $box_label = is_array( $this->_labels['publishbox'] ) && isset( $this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
331 | + $box_label = is_array($this->_labels['publishbox']) && isset($this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
332 | 332 | |
333 | - remove_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
334 | - add_meta_box( 'submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
333 | + remove_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
334 | + add_meta_box('submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | //let's add page_templates metabox if this cpt added support for it. |
338 | - if ( $this->_supports_page_templates($this->_cpt_object->name) ) { |
|
339 | - add_meta_box( 'page_templates', __('Page Template', 'event_espresso' ), array( $this, 'page_template_meta_box' ), $this->_cpt_routes[$this->_req_action], 'side', 'default' ); |
|
338 | + if ($this->_supports_page_templates($this->_cpt_object->name)) { |
|
339 | + add_meta_box('page_templates', __('Page Template', 'event_espresso'), array($this, 'page_template_meta_box'), $this->_cpt_routes[$this->_req_action], 'side', 'default'); |
|
340 | 340 | }/**/ |
341 | 341 | |
342 | 342 | |
343 | 343 | //this is a filter that allows the addition of extra html after the permalink field on the wp post edit-form |
344 | - if ( method_exists( $this, 'extra_permalink_field_buttons' ) ) |
|
345 | - add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 ); |
|
344 | + if (method_exists($this, 'extra_permalink_field_buttons')) |
|
345 | + add_filter('get_sample_permalink_html', array($this, 'extra_permalink_field_buttons'), 10, 4); |
|
346 | 346 | |
347 | 347 | //add preview button |
348 | - add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4 ); |
|
348 | + add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4); |
|
349 | 349 | |
350 | 350 | |
351 | 351 | //insert our own post_stati dropdown |
352 | - add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown' ), 10 ); |
|
352 | + add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown'), 10); |
|
353 | 353 | |
354 | 354 | //This allows adding additional information to the publish post submitbox on the wp post edit form |
355 | - if ( method_exists( $this, 'extra_misc_actions_publish_box' ) ) |
|
356 | - add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 ); |
|
355 | + if (method_exists($this, 'extra_misc_actions_publish_box')) |
|
356 | + add_action('post_submitbox_misc_actions', array($this, 'extra_misc_actions_publish_box'), 10); |
|
357 | 357 | |
358 | 358 | //This allows for adding additional stuff after the title field on the wp post edit form. This is also before the wp_editor for post description field. |
359 | - if ( method_exists( $this, 'edit_form_after_title' ) ) |
|
360 | - add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 ); |
|
359 | + if (method_exists($this, 'edit_form_after_title')) |
|
360 | + add_action('edit_form_after_title', array($this, 'edit_form_after_title'), 10); |
|
361 | 361 | |
362 | 362 | |
363 | 363 | /** |
364 | 364 | * Filtering WP's esc_url to capture urls pointing to core wp routes so they point to our route. |
365 | 365 | */ |
366 | - add_filter( 'clean_url', array( $this, 'switch_core_wp_urls_with_ours' ), 10, 3 ); |
|
366 | + add_filter('clean_url', array($this, 'switch_core_wp_urls_with_ours'), 10, 3); |
|
367 | 367 | |
368 | 368 | |
369 | 369 | parent::_load_page_dependencies(); |
370 | 370 | |
371 | 371 | //notice we are ALSO going to load the pagenow hook set for this route (see _before_page_setup for the reset of the pagenow global ). This is for any plugins that are doing things properly and hooking into the load page hook for core wp cpt routes. |
372 | 372 | global $pagenow; |
373 | - do_action( 'load-' . $pagenow ); |
|
373 | + do_action('load-'.$pagenow); |
|
374 | 374 | |
375 | 375 | $this->modify_current_screen(); |
376 | - add_action( 'admin_enqueue_scripts', array( $this, 'setup_autosave_hooks'), 30 ); |
|
376 | + add_action('admin_enqueue_scripts', array($this, 'setup_autosave_hooks'), 30); |
|
377 | 377 | //we route REALLY early. |
378 | 378 | try { |
379 | 379 | $this->_route_admin_request(); |
380 | - } catch ( EE_Error $e ) { |
|
380 | + } catch (EE_Error $e) { |
|
381 | 381 | $e->get_error(); |
382 | 382 | } |
383 | 383 | } |
@@ -396,21 +396,21 @@ discard block |
||
396 | 396 | * |
397 | 397 | * @return string possibly a new url for our route. |
398 | 398 | */ |
399 | - public function switch_core_wp_urls_with_ours( $good_protocol_url, $original_url, $_context ) { |
|
399 | + public function switch_core_wp_urls_with_ours($good_protocol_url, $original_url, $_context) { |
|
400 | 400 | $routes_to_match = array( |
401 | 401 | 0 => array( |
402 | 402 | 'edit.php?post_type=espresso_attendees', |
403 | 403 | 'admin.php?page=espresso_registrations&action=contact_list' |
404 | 404 | ), |
405 | 405 | 1 => array( |
406 | - 'edit.php?post_type=' . $this->_cpt_object->name, |
|
407 | - 'admin.php?page=' . $this->_cpt_object->name |
|
406 | + 'edit.php?post_type='.$this->_cpt_object->name, |
|
407 | + 'admin.php?page='.$this->_cpt_object->name |
|
408 | 408 | ) |
409 | 409 | ); |
410 | 410 | |
411 | - foreach( $routes_to_match as $route_matches ) { |
|
412 | - if ( strpos( $good_protocol_url, $route_matches[0] ) !== false ) { |
|
413 | - return str_replace( $route_matches[0], $route_matches[1], $good_protocol_url ); |
|
411 | + foreach ($routes_to_match as $route_matches) { |
|
412 | + if (strpos($good_protocol_url, $route_matches[0]) !== false) { |
|
413 | + return str_replace($route_matches[0], $route_matches[1], $good_protocol_url); |
|
414 | 414 | |
415 | 415 | } |
416 | 416 | } |
@@ -426,10 +426,10 @@ discard block |
||
426 | 426 | * @param string $cpt_name The cpt slug we're checking on. |
427 | 427 | * @return bool True supported, false not. |
428 | 428 | */ |
429 | - private function _supports_page_templates( $cpt_name ) { |
|
429 | + private function _supports_page_templates($cpt_name) { |
|
430 | 430 | $cpt_args = EE_Register_CPTs::get_CPTs(); |
431 | - $cpt_args = isset( $cpt_args[$cpt_name] ) ? $cpt_args[$cpt_name]['args'] : array(); |
|
432 | - return ! empty( $cpt_args['page_templates'] ) ? TRUE : FALSE; |
|
431 | + $cpt_args = isset($cpt_args[$cpt_name]) ? $cpt_args[$cpt_name]['args'] : array(); |
|
432 | + return ! empty($cpt_args['page_templates']) ? TRUE : FALSE; |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | |
@@ -444,9 +444,9 @@ discard block |
||
444 | 444 | public function page_template_meta_box() { |
445 | 445 | global $post; |
446 | 446 | $template = ''; |
447 | - if ( count( get_page_templates( $post ) ) != 0 ) { |
|
448 | - $page_template = get_post_meta( $post->ID, '_wp_page_template', TRUE ); |
|
449 | - $template = !empty( $page_template ) ? $page_template : ''; |
|
447 | + if (count(get_page_templates($post)) != 0) { |
|
448 | + $page_template = get_post_meta($post->ID, '_wp_page_template', TRUE); |
|
449 | + $template = ! empty($page_template) ? $page_template : ''; |
|
450 | 450 | } |
451 | 451 | ?> |
452 | 452 | <p><strong><?php _e('Template') ?></strong></p> |
@@ -470,10 +470,10 @@ discard block |
||
470 | 470 | * @param string $new_slug what the slug is |
471 | 471 | * @return string The new html string for the permalink area |
472 | 472 | */ |
473 | - public function preview_button_html( $return, $id, $new_title, $new_slug ) { |
|
474 | - $post = get_post( $id ); |
|
475 | - if ( 'publish' != get_post_status( $post ) ) { |
|
476 | - $return .= '<span_id="view-post-btn"><a href="' . wp_get_shortlink($id, 'post') . '" class="button button-small">' . __('Preview', 'event_espresso') . '</a></span>' . "\n"; |
|
473 | + public function preview_button_html($return, $id, $new_title, $new_slug) { |
|
474 | + $post = get_post($id); |
|
475 | + if ('publish' != get_post_status($post)) { |
|
476 | + $return .= '<span_id="view-post-btn"><a href="'.wp_get_shortlink($id, 'post').'" class="button button-small">'.__('Preview', 'event_espresso').'</a></span>'."\n"; |
|
477 | 477 | } |
478 | 478 | return $return; |
479 | 479 | } |
@@ -493,18 +493,18 @@ discard block |
||
493 | 493 | 'cur_status' => $this->_cpt_model_obj->status(), |
494 | 494 | 'statuses' => $statuses, |
495 | 495 | 'cur_status_label' => $cur_status_label, |
496 | - 'localized_status_save' => sprintf( __('Save %s', 'event_espresso'), $cur_status_label ) |
|
496 | + 'localized_status_save' => sprintf(__('Save %s', 'event_espresso'), $cur_status_label) |
|
497 | 497 | ); |
498 | 498 | |
499 | 499 | //we'll add a trash post status (WP doesn't add one for some reason) |
500 | - if ( $this->_cpt_model_obj->status() == 'trash' ) { |
|
500 | + if ($this->_cpt_model_obj->status() == 'trash') { |
|
501 | 501 | $template_args['cur_status_label'] = __('Trashed', 'event_espresso'); |
502 | 502 | $statuses['trash'] = __('Trashed', 'event_espresso'); |
503 | 503 | $template_args['statuses'] = $statuses; |
504 | 504 | } |
505 | 505 | |
506 | - $template = EE_ADMIN_TEMPLATE . 'status_dropdown.template.php'; |
|
507 | - EEH_Template::display_template( $template, $template_args ); |
|
506 | + $template = EE_ADMIN_TEMPLATE.'status_dropdown.template.php'; |
|
507 | + EEH_Template::display_template($template, $template_args); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
@@ -543,22 +543,22 @@ discard block |
||
543 | 543 | public function do_extra_autosave_stuff() { |
544 | 544 | |
545 | 545 | //next let's check for the autosave nonce (we'll use _verify_nonce ) |
546 | - $nonce = isset( $this->_req_data['autosavenonce'] ) ? $this->_req_data['autosavenonce'] : NULL; |
|
547 | - $this->_verify_nonce( $nonce, 'autosave' ); |
|
546 | + $nonce = isset($this->_req_data['autosavenonce']) ? $this->_req_data['autosavenonce'] : NULL; |
|
547 | + $this->_verify_nonce($nonce, 'autosave'); |
|
548 | 548 | |
549 | 549 | |
550 | 550 | //make sure we define doing autosave (cause WP isn't triggering this we want to make sure we define it) |
551 | - if ( !defined('DOING_AUTOSAVE') ) define('DOING_AUTOSAVE', true); |
|
551 | + if ( ! defined('DOING_AUTOSAVE')) define('DOING_AUTOSAVE', true); |
|
552 | 552 | |
553 | 553 | //if we made it here then the nonce checked out. Let's run our methods and actions |
554 | - if ( method_exists( $this, '_ee_autosave_' . $this->_current_view ) ) { |
|
555 | - call_user_func( array( $this, '_ee_autosave_' . $this->_current_view ) ); |
|
554 | + if (method_exists($this, '_ee_autosave_'.$this->_current_view)) { |
|
555 | + call_user_func(array($this, '_ee_autosave_'.$this->_current_view)); |
|
556 | 556 | } else { |
557 | 557 | $this->_template_args['success'] = TRUE; |
558 | 558 | } |
559 | 559 | |
560 | - do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this ); |
|
561 | - do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_' . get_class( $this ), $this ); |
|
560 | + do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this); |
|
561 | + do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_'.get_class($this), $this); |
|
562 | 562 | |
563 | 563 | //now let's return json |
564 | 564 | $this->_return_json(); |
@@ -578,18 +578,18 @@ discard block |
||
578 | 578 | protected function _extend_page_config_for_cpt() { |
579 | 579 | |
580 | 580 | //before doing anything we need to make sure this runs ONLY when the loaded page matches the set page_slug |
581 | - if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) ) |
|
581 | + if ((isset($this->_req_data['page']) && $this->_req_data['page'] != $this->page_slug)) |
|
582 | 582 | return; |
583 | 583 | |
584 | 584 | //set page routes and page config but ONLY if we're not viewing a custom setup cpt route as defined in _cpt_routes |
585 | - if ( !empty( $this->_cpt_object ) ) { |
|
586 | - $this->_page_routes = array_merge( array( |
|
585 | + if ( ! empty($this->_cpt_object)) { |
|
586 | + $this->_page_routes = array_merge(array( |
|
587 | 587 | 'create_new' => '_create_new_cpt_item', |
588 | 588 | 'edit' => '_edit_cpt_item' |
589 | - ), $this->_page_routes ); |
|
589 | + ), $this->_page_routes); |
|
590 | 590 | |
591 | 591 | |
592 | - $this->_page_config = array_merge( array( |
|
592 | + $this->_page_config = array_merge(array( |
|
593 | 593 | 'create_new' => array( |
594 | 594 | 'nav' => array( |
595 | 595 | 'label' => $this->_cpt_object->labels->add_new_item, |
@@ -611,23 +611,23 @@ discard block |
||
611 | 611 | } |
612 | 612 | |
613 | 613 | //load the next section only if this is a matching cpt route as set in the cpt routes array. |
614 | - if ( !isset( $this->_cpt_routes[$this->_req_action] ) ) |
|
614 | + if ( ! isset($this->_cpt_routes[$this->_req_action])) |
|
615 | 615 | return; |
616 | 616 | |
617 | 617 | |
618 | - $this->_cpt_route = isset( $this->_cpt_routes[$this->_req_action] ) ? TRUE : FALSE; |
|
618 | + $this->_cpt_route = isset($this->_cpt_routes[$this->_req_action]) ? TRUE : FALSE; |
|
619 | 619 | //add_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', array( $this, 'modify_current_screen') ); |
620 | 620 | |
621 | 621 | |
622 | - if ( empty( $this->_cpt_object ) ) { |
|
623 | - $msg = sprintf( __('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this: 1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this) ); |
|
624 | - throw new EE_Error( $msg ); |
|
622 | + if (empty($this->_cpt_object)) { |
|
623 | + $msg = sprintf(__('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this: 1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this)); |
|
624 | + throw new EE_Error($msg); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | |
628 | - if ( $this->_cpt_route ) { |
|
629 | - $id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL; |
|
630 | - $this->_set_model_object( $id ); |
|
628 | + if ($this->_cpt_route) { |
|
629 | + $id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL; |
|
630 | + $this->_set_model_object($id); |
|
631 | 631 | } |
632 | 632 | |
633 | 633 | } |
@@ -643,17 +643,17 @@ discard block |
||
643 | 643 | * @param int $id The id to retrieve the model object for. If empty we set a default object. |
644 | 644 | * @return void |
645 | 645 | */ |
646 | - protected function _set_model_object( $id = NULL ) { |
|
646 | + protected function _set_model_object($id = NULL) { |
|
647 | 647 | |
648 | - if ( empty( $this->_cpt_model_names ) || ! isset( $this->_cpt_routes[ $this->_req_action ] ) || ( is_object( $this->_cpt_model_obj ) && $this->_cpt_model_obj->ID() == $id )) { |
|
648 | + if (empty($this->_cpt_model_names) || ! isset($this->_cpt_routes[$this->_req_action]) || (is_object($this->_cpt_model_obj) && $this->_cpt_model_obj->ID() == $id)) { |
|
649 | 649 | //get out cuz we either don't have a model name OR the object has already been set and it has the same id as what has been sent. |
650 | 650 | return; |
651 | 651 | } |
652 | 652 | // load CPT object model |
653 | - $model = EE_Registry::instance()->load_model( $this->_cpt_model_names[$this->_req_action] ); |
|
654 | - $this->_cpt_model_obj = ! empty( $id ) ? $model->get_one_by_ID( $id ) : $model->create_default_object(); |
|
653 | + $model = EE_Registry::instance()->load_model($this->_cpt_model_names[$this->_req_action]); |
|
654 | + $this->_cpt_model_obj = ! empty($id) ? $model->get_one_by_ID($id) : $model->create_default_object(); |
|
655 | 655 | //d( $this->_cpt_model_obj ); |
656 | - do_action( 'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object' ); |
|
656 | + do_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object'); |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | |
@@ -667,47 +667,47 @@ discard block |
||
667 | 667 | */ |
668 | 668 | public function admin_init_global() { |
669 | 669 | |
670 | - $post = isset( $this->_req_data['post'] ) ? get_post( $this->_req_data['post'] ) : NULL; |
|
670 | + $post = isset($this->_req_data['post']) ? get_post($this->_req_data['post']) : NULL; |
|
671 | 671 | |
672 | 672 | //its possible this is a new save so let's catch that instead |
673 | - $post = isset( $this->_req_data['post_ID'] ) ? get_post( $this->_req_data['post_ID'] ) : $post; |
|
673 | + $post = isset($this->_req_data['post_ID']) ? get_post($this->_req_data['post_ID']) : $post; |
|
674 | 674 | $post_type = $post ? $post->post_type : false; |
675 | 675 | |
676 | 676 | $current_route = isset($this->_req_data['current_route']) ? $this->_req_data['current_route'] : 'shouldneverwork'; |
677 | 677 | |
678 | - $route_to_check = $post_type && isset( $this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : ''; |
|
678 | + $route_to_check = $post_type && isset($this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : ''; |
|
679 | 679 | |
680 | - add_filter( 'get_delete_post_link', array( $this, 'modify_delete_post_link'), 10, 3 ); |
|
681 | - add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link'), 10, 3 ); |
|
680 | + add_filter('get_delete_post_link', array($this, 'modify_delete_post_link'), 10, 3); |
|
681 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3); |
|
682 | 682 | |
683 | 683 | |
684 | - if ( $post_type === $route_to_check ) { |
|
685 | - add_filter('redirect_post_location', array( $this, 'cpt_post_location_redirect'), 10, 2 ); |
|
684 | + if ($post_type === $route_to_check) { |
|
685 | + add_filter('redirect_post_location', array($this, 'cpt_post_location_redirect'), 10, 2); |
|
686 | 686 | //catch trashed wp redirect |
687 | - add_filter('wp_redirect', array( $this, 'cpt_trash_post_location_redirect' ), 10, 2 ); |
|
687 | + add_filter('wp_redirect', array($this, 'cpt_trash_post_location_redirect'), 10, 2); |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | //now let's filter redirect if we're on a revision page and the revision is for an event CPT. |
691 | - $revision = isset( $this->_req_data['revision'] ) ? $this->_req_data['revision'] : NULL; |
|
691 | + $revision = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL; |
|
692 | 692 | |
693 | 693 | /**var_dump($this->_req_data); |
694 | 694 | exit();/**/ |
695 | 695 | |
696 | - if ( !empty( $revision ) ) { |
|
697 | - $action = isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : NULL; |
|
696 | + if ( ! empty($revision)) { |
|
697 | + $action = isset($this->_req_data['action']) ? $this->_req_data['action'] : NULL; |
|
698 | 698 | |
699 | 699 | //doing a restore? |
700 | - if ( !empty( $action ) && $action == 'restore' ) { |
|
700 | + if ( ! empty($action) && $action == 'restore') { |
|
701 | 701 | |
702 | 702 | //get post for revision |
703 | - $rev_post = get_post( $revision ); |
|
704 | - $rev_parent = get_post( $rev_post->post_parent ); |
|
703 | + $rev_post = get_post($revision); |
|
704 | + $rev_parent = get_post($rev_post->post_parent); |
|
705 | 705 | |
706 | 706 | //only do our redirect filter AND our restore revision action if the post_type for the parent is one of our cpts. |
707 | - if ( $rev_parent && $rev_parent->post_type == $this->page_slug ) { |
|
708 | - add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2 ); |
|
707 | + if ($rev_parent && $rev_parent->post_type == $this->page_slug) { |
|
708 | + add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2); |
|
709 | 709 | //restores of revisions |
710 | - add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2 ); |
|
710 | + add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2); |
|
711 | 711 | } |
712 | 712 | } |
713 | 713 | |
@@ -716,15 +716,15 @@ discard block |
||
716 | 716 | //NOTE we ONLY want to run these hooks if we're on the right class for the given post type. Otherwise we could see some really freaky things happen! |
717 | 717 | |
718 | 718 | |
719 | - if ( $post_type && $post_type === $route_to_check ) { |
|
719 | + if ($post_type && $post_type === $route_to_check) { |
|
720 | 720 | //$post_id, $post |
721 | - add_action('save_post', array( $this, 'insert_update'), 10, 2 ); |
|
721 | + add_action('save_post', array($this, 'insert_update'), 10, 2); |
|
722 | 722 | |
723 | 723 | //$post_id |
724 | - add_action('trashed_post', array( $this, 'trash_cpt_item' ), 10 ); |
|
725 | - add_action('trashed_post', array( $this, 'dont_permanently_delete_ee_cpts'), 10 ); |
|
726 | - add_action('untrashed_post', array( $this, 'restore_cpt_item'), 10 ); |
|
727 | - add_action('after_delete_post', array( $this, 'delete_cpt_item'), 10 ); |
|
724 | + add_action('trashed_post', array($this, 'trash_cpt_item'), 10); |
|
725 | + add_action('trashed_post', array($this, 'dont_permanently_delete_ee_cpts'), 10); |
|
726 | + add_action('untrashed_post', array($this, 'restore_cpt_item'), 10); |
|
727 | + add_action('after_delete_post', array($this, 'delete_cpt_item'), 10); |
|
728 | 728 | } |
729 | 729 | |
730 | 730 | } |
@@ -739,15 +739,15 @@ discard block |
||
739 | 739 | * @return void |
740 | 740 | */ |
741 | 741 | public function verify_cpt_object() { |
742 | - $label = !empty( $this->_cpt_object ) ? $this->_cpt_object->labels->singular_name : $this->page_label; |
|
742 | + $label = ! empty($this->_cpt_object) ? $this->_cpt_object->labels->singular_name : $this->page_label; |
|
743 | 743 | // verify event object |
744 | - if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base ) { |
|
745 | - throw new EE_Error( sprintf( __('Something has gone wrong with the page load because we are unable to set up the object for the %1$s. This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso' ), $label ) ); |
|
744 | + if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) { |
|
745 | + throw new EE_Error(sprintf(__('Something has gone wrong with the page load because we are unable to set up the object for the %1$s. This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso'), $label)); |
|
746 | 746 | } |
747 | 747 | //if auto-draft then throw an error |
748 | - if ( $this->_cpt_model_obj->get('status') == 'auto-draft' ) { |
|
748 | + if ($this->_cpt_model_obj->get('status') == 'auto-draft') { |
|
749 | 749 | EE_Error::overwrite_errors(); |
750 | - EE_Error::add_error( sprintf( __('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly. All autodrafts will show up in the "draft" view of your event list table. You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label ), __FILE__, __FUNCTION__, __LINE__ ); |
|
750 | + EE_Error::add_error(sprintf(__('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly. All autodrafts will show up in the "draft" view of your event list table. You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label), __FILE__, __FUNCTION__, __LINE__); |
|
751 | 751 | } |
752 | 752 | } |
753 | 753 | |
@@ -776,22 +776,22 @@ discard block |
||
776 | 776 | public function load_global_scripts_styles() { |
777 | 777 | parent::load_global_scripts_styles(); |
778 | 778 | |
779 | - if ( $this->_cpt_model_obj instanceof EE_CPT_Base ) { |
|
779 | + if ($this->_cpt_model_obj instanceof EE_CPT_Base) { |
|
780 | 780 | //setup custom post status object for localize script but only if we've got a cpt object |
781 | 781 | $statuses = $this->_cpt_model_obj->get_custom_post_statuses(); |
782 | 782 | |
783 | - if ( !empty($statuses) ) { |
|
783 | + if ( ! empty($statuses)) { |
|
784 | 784 | //get ALL statuses! |
785 | 785 | $statuses = $this->_cpt_model_obj->get_all_post_statuses(); |
786 | 786 | //setup object |
787 | 787 | $ee_cpt_statuses = array(); |
788 | - foreach ( $statuses as $status => $label ) { |
|
788 | + foreach ($statuses as $status => $label) { |
|
789 | 789 | $ee_cpt_statuses[$status] = array( |
790 | 790 | 'label' => $label, |
791 | - 'save_label' => sprintf( __('Save as %s', 'event_espresso'), $label ) |
|
791 | + 'save_label' => sprintf(__('Save as %s', 'event_espresso'), $label) |
|
792 | 792 | ); |
793 | 793 | } |
794 | - wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses ); |
|
794 | + wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses); |
|
795 | 795 | } |
796 | 796 | } |
797 | 797 | } |
@@ -805,10 +805,10 @@ discard block |
||
805 | 805 | * @param WP_Post $post Post object from WP |
806 | 806 | * @return void |
807 | 807 | */ |
808 | - public function insert_update( $post_id, $post ) { |
|
808 | + public function insert_update($post_id, $post) { |
|
809 | 809 | |
810 | 810 | //make sure that if this is a revision OR trash action that we don't do any updates! |
811 | - if ( isset( $this->_req_data['action'] ) && ( $this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash' ) ) |
|
811 | + if (isset($this->_req_data['action']) && ($this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash')) |
|
812 | 812 | return; |
813 | 813 | |
814 | 814 | //check for autosave and update our req_data property accordingly. |
@@ -823,19 +823,19 @@ discard block |
||
823 | 823 | }/**/ //TODO reactivate after autosave is implemented in 4.2 |
824 | 824 | |
825 | 825 | //take care of updating any selected page_template IF this cpt supports it. |
826 | - if ( $this->_supports_page_templates($post->post_type ) && !empty( $this->_req_data['page_template'] ) ) { |
|
826 | + if ($this->_supports_page_templates($post->post_type) && ! empty($this->_req_data['page_template'])) { |
|
827 | 827 | $post->page_template = $this->_req_data['page_template']; |
828 | - $page_templates = wp_get_theme()->get_page_templates( $post ); |
|
829 | - if ( 'default' != $this->_req_data['page_template'] && ! isset( $page_templates[ $this->_req_data['page_template'] ] ) ) { |
|
830 | - EE_Error::add_error( __('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
828 | + $page_templates = wp_get_theme()->get_page_templates($post); |
|
829 | + if ('default' != $this->_req_data['page_template'] && ! isset($page_templates[$this->_req_data['page_template']])) { |
|
830 | + EE_Error::add_error(__('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
831 | 831 | } else { |
832 | - update_post_meta( $post_id, '_wp_page_template', $this->_req_data['page_template'] ); |
|
832 | + update_post_meta($post_id, '_wp_page_template', $this->_req_data['page_template']); |
|
833 | 833 | } |
834 | 834 | } |
835 | 835 | |
836 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) |
|
836 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) |
|
837 | 837 | return; //TODO we'll remove this after reimplementing autosave in 4.2 |
838 | - $this->_insert_update_cpt_item( $post_id, $post ); |
|
838 | + $this->_insert_update_cpt_item($post_id, $post); |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | |
@@ -848,8 +848,8 @@ discard block |
||
848 | 848 | * @param int $post_id ID of the post |
849 | 849 | * @return void |
850 | 850 | */ |
851 | - public function dont_permanently_delete_ee_cpts( $post_id ) { |
|
852 | - delete_post_meta( $post_id, '_wp_trash_meta_status' ); |
|
851 | + public function dont_permanently_delete_ee_cpts($post_id) { |
|
852 | + delete_post_meta($post_id, '_wp_trash_meta_status'); |
|
853 | 853 | delete_post_meta($post_id, '_wp_trash_meta_time'); |
854 | 854 | |
855 | 855 | //our cpts may have comments so let's take care of that too |
@@ -868,14 +868,14 @@ discard block |
||
868 | 868 | * @param int $revision_id ID of revision being restored |
869 | 869 | * @return void |
870 | 870 | */ |
871 | - public function restore_revision( $post_id, $revision_id ) { |
|
872 | - $this->_restore_cpt_item( $post_id, $revision_id ); |
|
871 | + public function restore_revision($post_id, $revision_id) { |
|
872 | + $this->_restore_cpt_item($post_id, $revision_id); |
|
873 | 873 | |
874 | 874 | //global action |
875 | - do_action( 'AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id); |
|
875 | + do_action('AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id); |
|
876 | 876 | |
877 | 877 | //class specific action so you can limit hooking into a specific page. |
878 | - do_action( 'AHEE_EE_Admin_Page_CPT_' . get_class($this) . '__restore_revision', $post_id, $revision_id ); |
|
878 | + do_action('AHEE_EE_Admin_Page_CPT_'.get_class($this).'__restore_revision', $post_id, $revision_id); |
|
879 | 879 | } |
880 | 880 | |
881 | 881 | |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | * @param int $revision_id ID of revision for item |
887 | 887 | * @return void |
888 | 888 | */ |
889 | - abstract protected function _restore_cpt_item( $post_id, $revision_id ); |
|
889 | + abstract protected function _restore_cpt_item($post_id, $revision_id); |
|
890 | 890 | |
891 | 891 | |
892 | 892 | |
@@ -905,9 +905,9 @@ discard block |
||
905 | 905 | */ |
906 | 906 | public function modify_current_screen() { |
907 | 907 | //ONLY do this if the current page_route IS a cpt route |
908 | - if ( !$this->_cpt_route ) return; |
|
908 | + if ( ! $this->_cpt_route) return; |
|
909 | 909 | //routing things REALLY early b/c this is a cpt admin page |
910 | - set_current_screen( $this->_cpt_routes[$this->_req_action]); |
|
910 | + set_current_screen($this->_cpt_routes[$this->_req_action]); |
|
911 | 911 | $this->_current_screen = get_current_screen(); |
912 | 912 | $this->_current_screen->base = 'event-espresso'; |
913 | 913 | $this->_add_help_tabs(); //we make sure we add any help tabs back in! |
@@ -928,8 +928,8 @@ discard block |
||
928 | 928 | * @param string $title The new title (or existing if there is no editor_title defined) |
929 | 929 | * @return string |
930 | 930 | */ |
931 | - public function add_custom_editor_default_title( $title ) { |
|
932 | - return isset( $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] ) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title; |
|
931 | + public function add_custom_editor_default_title($title) { |
|
932 | + return isset($this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]]) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title; |
|
933 | 933 | } |
934 | 934 | |
935 | 935 | |
@@ -942,11 +942,11 @@ discard block |
||
942 | 942 | * @param bool $allow_slugs Whether to allow post slugs in the shortlink. |
943 | 943 | * @return string |
944 | 944 | */ |
945 | - public function add_shortlink_button_to_editor( $shortlink, $id, $context, $allow_slugs ) { |
|
946 | - if ( !empty( $id ) && '' != get_option('permalink_structure') ) { |
|
947 | - $post = get_post( $id ); |
|
948 | - if ( isset($post->post_type) && $this->page_slug == $post->post_type ) |
|
949 | - $shortlink = home_url('?p=' . $post->ID); |
|
945 | + public function add_shortlink_button_to_editor($shortlink, $id, $context, $allow_slugs) { |
|
946 | + if ( ! empty($id) && '' != get_option('permalink_structure')) { |
|
947 | + $post = get_post($id); |
|
948 | + if (isset($post->post_type) && $this->page_slug == $post->post_type) |
|
949 | + $shortlink = home_url('?p='.$post->ID); |
|
950 | 950 | } |
951 | 951 | return $shortlink; |
952 | 952 | } |
@@ -959,10 +959,10 @@ discard block |
||
959 | 959 | * @return void |
960 | 960 | */ |
961 | 961 | public function route_admin_request() { |
962 | - if ( $this->_cpt_route ) return; |
|
962 | + if ($this->_cpt_route) return; |
|
963 | 963 | try { |
964 | 964 | $this->_route_admin_request(); |
965 | - } catch ( EE_Error $e ) { |
|
965 | + } catch (EE_Error $e) { |
|
966 | 966 | $e->get_error(); |
967 | 967 | } |
968 | 968 | } |
@@ -975,12 +975,12 @@ discard block |
||
975 | 975 | * @return string html |
976 | 976 | */ |
977 | 977 | public function cpt_post_form_hidden_input() { |
978 | - echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="' . $this->_admin_base_url . '" />'; |
|
978 | + echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="'.$this->_admin_base_url.'" />'; |
|
979 | 979 | |
980 | 980 | //we're also going to add the route value and the current page so we can direct autosave parsing correctly |
981 | 981 | echo '<div id="ee-cpt-hidden-inputs">'; |
982 | - echo '<input type="hidden" id="current_route" name="current_route" value="' . $this->_current_view . '" />'; |
|
983 | - echo '<input type="hidden" id="current_page" name="current_page" value="' . $this->page_slug . '" />'; |
|
982 | + echo '<input type="hidden" id="current_route" name="current_route" value="'.$this->_current_view.'" />'; |
|
983 | + echo '<input type="hidden" id="current_page" name="current_page" value="'.$this->page_slug.'" />'; |
|
984 | 984 | echo '</div>'; |
985 | 985 | } |
986 | 986 | |
@@ -993,12 +993,12 @@ discard block |
||
993 | 993 | * @param int $status Status for http header |
994 | 994 | * @return string new (or original) url to redirect to. |
995 | 995 | */ |
996 | - public function revision_redirect( $location, $status ) { |
|
996 | + public function revision_redirect($location, $status) { |
|
997 | 997 | //get revision |
998 | 998 | $rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL; |
999 | 999 | |
1000 | 1000 | //can't do anything without revision so let's get out if not present |
1001 | - if ( empty( $rev_id ) ) |
|
1001 | + if (empty($rev_id)) |
|
1002 | 1002 | return $location; |
1003 | 1003 | |
1004 | 1004 | //get rev_post_data |
@@ -1012,8 +1012,8 @@ discard block |
||
1012 | 1012 | 'message' => 5 |
1013 | 1013 | ); |
1014 | 1014 | |
1015 | - $this->_process_notices( $query_args, TRUE ); |
|
1016 | - return self::add_query_args_and_nonce( $query_args, $admin_url ); |
|
1015 | + $this->_process_notices($query_args, TRUE); |
|
1016 | + return self::add_query_args_and_nonce($query_args, $admin_url); |
|
1017 | 1017 | } |
1018 | 1018 | |
1019 | 1019 | |
@@ -1026,16 +1026,16 @@ discard block |
||
1026 | 1026 | * @param string $context optional, defaults to display. How to write the '&' |
1027 | 1027 | * @return string the link |
1028 | 1028 | */ |
1029 | - public function modify_edit_post_link( $link, $id, $context ) { |
|
1030 | - $post = get_post( $id ); |
|
1031 | - if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) |
|
1029 | + public function modify_edit_post_link($link, $id, $context) { |
|
1030 | + $post = get_post($id); |
|
1031 | + if ( ! isset($this->_req_data['action']) || ! isset($this->_cpt_routes[$this->_req_data['action']]) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']]) |
|
1032 | 1032 | return $link; |
1033 | 1033 | $query_args = array( |
1034 | 1034 | 'action' => isset($this->_cpt_edit_routes[$post->post_type]) ? $this->_cpt_edit_routes[$post->post_type] : 'edit', |
1035 | 1035 | 'post' => $id |
1036 | 1036 | ); |
1037 | 1037 | |
1038 | - return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1038 | + return self::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | |
@@ -1047,12 +1047,12 @@ discard block |
||
1047 | 1047 | * @param bool $force_delete whether this is forcing a hard delete instead of trash |
1048 | 1048 | * @return string new delete link |
1049 | 1049 | */ |
1050 | - public function modify_delete_post_link( $delete_link, $post_id, $force_delete ) { |
|
1050 | + public function modify_delete_post_link($delete_link, $post_id, $force_delete) { |
|
1051 | 1051 | $post = get_post($post_id); |
1052 | - if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) ) |
|
1052 | + if ( ! isset($this->_req_data['action']) || (isset($this->_cpt_routes[$this->_req_data['action']]) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']])) |
|
1053 | 1053 | return $delete_link; |
1054 | 1054 | |
1055 | - return add_query_arg( array('current_route' => 'trash' ), $delete_link ); |
|
1055 | + return add_query_arg(array('current_route' => 'trash'), $delete_link); |
|
1056 | 1056 | } |
1057 | 1057 | |
1058 | 1058 | |
@@ -1063,16 +1063,16 @@ discard block |
||
1063 | 1063 | * @param string $status status |
1064 | 1064 | * @return string url to redirect to |
1065 | 1065 | */ |
1066 | - public function cpt_trash_post_location_redirect( $location, $status ) { |
|
1067 | - if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) ) |
|
1066 | + public function cpt_trash_post_location_redirect($location, $status) { |
|
1067 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] !== 'trash' && empty($this->_req_data['post'])) |
|
1068 | 1068 | return $location; |
1069 | 1069 | |
1070 | - $post = get_post( $this->_req_data['post'] ); |
|
1071 | - $query_args = array( 'action' => 'default' ); |
|
1070 | + $post = get_post($this->_req_data['post']); |
|
1071 | + $query_args = array('action' => 'default'); |
|
1072 | 1072 | $this->_cpt_object = get_post_type_object($post->post_type); |
1073 | - EE_Error::add_success( sprintf( __('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name) ); |
|
1074 | - $this->_process_notices( $query_args, TRUE ); |
|
1075 | - return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1073 | + EE_Error::add_success(sprintf(__('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name)); |
|
1074 | + $this->_process_notices($query_args, TRUE); |
|
1075 | + return self::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | * @param string $post_id This is the 'ID' value of the wp_posts table |
1088 | 1088 | * @return string the new location to redirect to |
1089 | 1089 | */ |
1090 | - public function cpt_post_location_redirect( $location, $post_id ) { |
|
1090 | + public function cpt_post_location_redirect($location, $post_id) { |
|
1091 | 1091 | //we DO have a match so let's setup the url |
1092 | 1092 | |
1093 | 1093 | //we have to get the post to determine our route |
@@ -1095,14 +1095,14 @@ discard block |
||
1095 | 1095 | $edit_route = $this->_cpt_edit_routes[$post->post_type]; |
1096 | 1096 | |
1097 | 1097 | //shared query_args |
1098 | - $query_args = array( 'action' => $edit_route, 'post' => $post_id ); |
|
1098 | + $query_args = array('action' => $edit_route, 'post' => $post_id); |
|
1099 | 1099 | $admin_url = $this->_admin_base_url; |
1100 | 1100 | // $append = ''; |
1101 | 1101 | |
1102 | - if ( isset( $this->_req_data['save'] ) || isset( $this->_req_data['publish'] ) ) { |
|
1103 | - $status = get_post_status( $post_id ); |
|
1104 | - if ( isset( $this->_req_data['publish'] ) ) { |
|
1105 | - switch ( $status ) { |
|
1102 | + if (isset($this->_req_data['save']) || isset($this->_req_data['publish'])) { |
|
1103 | + $status = get_post_status($post_id); |
|
1104 | + if (isset($this->_req_data['publish'])) { |
|
1105 | + switch ($status) { |
|
1106 | 1106 | case 'pending': |
1107 | 1107 | $message = 8; |
1108 | 1108 | break; |
@@ -1115,13 +1115,13 @@ discard block |
||
1115 | 1115 | } else { |
1116 | 1116 | $message = 'draft' == $status ? 10 : 1; |
1117 | 1117 | } |
1118 | - } else if ( isset( $this->_req_data['addmeta']) && $this->_req_data['addmeta'] ) { |
|
1118 | + } else if (isset($this->_req_data['addmeta']) && $this->_req_data['addmeta']) { |
|
1119 | 1119 | $message = 2; |
1120 | 1120 | // $append = '#postcustom'; |
1121 | - } else if ( isset( $this->_req_data['deletemeta']) && $this->_req_data['deletemeta'] ) { |
|
1121 | + } else if (isset($this->_req_data['deletemeta']) && $this->_req_data['deletemeta']) { |
|
1122 | 1122 | $message = 3; |
1123 | 1123 | // $append = '#postcustom'; |
1124 | - } elseif ( $this->_req_data['action'] == 'post-quickpress-save-cont' ) { |
|
1124 | + } elseif ($this->_req_data['action'] == 'post-quickpress-save-cont') { |
|
1125 | 1125 | $message = 7; |
1126 | 1126 | } else { |
1127 | 1127 | $message = 4; |
@@ -1129,12 +1129,12 @@ discard block |
||
1129 | 1129 | |
1130 | 1130 | //change the message if the post type is not viewable on the frontend |
1131 | 1131 | $this->_cpt_object = get_post_type_object($post->post_type); |
1132 | - $message = $message === 1 && !$this->_cpt_object->publicly_queryable ? 4 : $message; |
|
1132 | + $message = $message === 1 && ! $this->_cpt_object->publicly_queryable ? 4 : $message; |
|
1133 | 1133 | |
1134 | - $query_args = array_merge( array( 'message' => $message ), $query_args ); |
|
1134 | + $query_args = array_merge(array('message' => $message), $query_args); |
|
1135 | 1135 | |
1136 | - $this->_process_notices( $query_args, TRUE ); |
|
1137 | - return self::add_query_args_and_nonce( $query_args, $admin_url ); |
|
1136 | + $this->_process_notices($query_args, TRUE); |
|
1137 | + return self::add_query_args_and_nonce($query_args, $admin_url); |
|
1138 | 1138 | } |
1139 | 1139 | |
1140 | 1140 | |
@@ -1166,10 +1166,10 @@ discard block |
||
1166 | 1166 | * @param array $messages the original messages array |
1167 | 1167 | * @return array the new messages array |
1168 | 1168 | */ |
1169 | - public function post_update_messages( $messages ) { |
|
1169 | + public function post_update_messages($messages) { |
|
1170 | 1170 | global $post; |
1171 | - $id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL; |
|
1172 | - $id = empty( $id ) && is_object( $post ) ? $post->ID : NULL; |
|
1171 | + $id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL; |
|
1172 | + $id = empty($id) && is_object($post) ? $post->ID : NULL; |
|
1173 | 1173 | |
1174 | 1174 | // $post_type = $post ? $post->post_type : false; |
1175 | 1175 | |
@@ -1182,9 +1182,9 @@ discard block |
||
1182 | 1182 | 0 => '', //Unused. Messages start at index 1. |
1183 | 1183 | |
1184 | 1184 | 1 => sprintf( |
1185 | - __( '%1$s updated. %2$sView %1$s%3$s', 'event_espresso'), |
|
1185 | + __('%1$s updated. %2$sView %1$s%3$s', 'event_espresso'), |
|
1186 | 1186 | $this->_cpt_object->labels->singular_name, |
1187 | - '<a href="' . esc_url( get_permalink( $id )) . '">', |
|
1187 | + '<a href="'.esc_url(get_permalink($id)).'">', |
|
1188 | 1188 | '</a>' |
1189 | 1189 | ), |
1190 | 1190 | |
@@ -1192,38 +1192,38 @@ discard block |
||
1192 | 1192 | |
1193 | 1193 | 3 => __('Custom field deleted.'), |
1194 | 1194 | |
1195 | - 4 => sprintf( __( '%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name ), |
|
1195 | + 4 => sprintf(__('%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
1196 | 1196 | |
1197 | - 5 => isset( $_GET['revision'] ) ? sprintf( __('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title( (int) $_GET['revision'], FALSE ) ) : FALSE, |
|
1197 | + 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], FALSE)) : FALSE, |
|
1198 | 1198 | |
1199 | 1199 | 6 => sprintf( |
1200 | - __( '%1$s published. %2$sView %1$s%3$s', 'event_espresso'), |
|
1200 | + __('%1$s published. %2$sView %1$s%3$s', 'event_espresso'), |
|
1201 | 1201 | $this->_cpt_object->labels->singular_name, |
1202 | - '<a href="' . esc_url( get_permalink( $id )) . '">', |
|
1202 | + '<a href="'.esc_url(get_permalink($id)).'">', |
|
1203 | 1203 | '</a>' |
1204 | 1204 | ), |
1205 | 1205 | |
1206 | - 7 => sprintf( __( '%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name ), |
|
1206 | + 7 => sprintf(__('%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
1207 | 1207 | |
1208 | 1208 | 8 => sprintf( |
1209 | 1209 | __('%1$s submitted. %2$sPreview %1$s%3$s', 'event_espresso'), |
1210 | 1210 | $this->_cpt_object->labels->singular_name, |
1211 | - '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) . '">', |
|
1211 | + '<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))).'">', |
|
1212 | 1212 | '</a>' |
1213 | 1213 | ), |
1214 | 1214 | |
1215 | 1215 | 9 => sprintf( |
1216 | - __( '%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'), |
|
1216 | + __('%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'), |
|
1217 | 1217 | $this->_cpt_object->labels->singular_name, |
1218 | - '<strong>' . date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date )) . '</strong>', |
|
1219 | - '<a target="_blank" href="' . esc_url( get_permalink( $id )), |
|
1218 | + '<strong>'.date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)).'</strong>', |
|
1219 | + '<a target="_blank" href="'.esc_url(get_permalink($id)), |
|
1220 | 1220 | '</a>' |
1221 | 1221 | ), |
1222 | 1222 | |
1223 | 1223 | 10 => sprintf( |
1224 | 1224 | __('%1$s draft updated. %2$s">Preview page%3$s', 'event_espresso'), |
1225 | 1225 | $this->_cpt_object->labels->singular_name, |
1226 | - '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) , |
|
1226 | + '<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))), |
|
1227 | 1227 | '</a>' |
1228 | 1228 | ) |
1229 | 1229 | ); |
@@ -1250,24 +1250,24 @@ discard block |
||
1250 | 1250 | $post_type_object = $this->_cpt_object; |
1251 | 1251 | $title = $post_type_object->labels->add_new_item; |
1252 | 1252 | $editing = TRUE; |
1253 | - wp_enqueue_script( 'autosave' ); |
|
1254 | - $post = $post = get_default_post_to_edit( $this->_cpt_routes[$this->_req_action], TRUE ); |
|
1253 | + wp_enqueue_script('autosave'); |
|
1254 | + $post = $post = get_default_post_to_edit($this->_cpt_routes[$this->_req_action], TRUE); |
|
1255 | 1255 | $post_ID = $post->ID; |
1256 | 1256 | $is_IE = $is_IE; |
1257 | 1257 | |
1258 | - add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) ); |
|
1258 | + add_action('admin_print_styles', array($this, 'add_new_admin_page_global')); |
|
1259 | 1259 | |
1260 | 1260 | //modify the default editor title field with default title. |
1261 | - add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 ); |
|
1261 | + add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10); |
|
1262 | 1262 | |
1263 | - include_once WP_ADMIN_PATH . 'edit-form-advanced.php'; |
|
1263 | + include_once WP_ADMIN_PATH.'edit-form-advanced.php'; |
|
1264 | 1264 | } |
1265 | 1265 | |
1266 | 1266 | |
1267 | 1267 | |
1268 | 1268 | |
1269 | 1269 | public function add_new_admin_page_global() { |
1270 | - $admin_page = !empty( $this->_req_data['post'] ) ? 'post-php' : 'post-new-php'; |
|
1270 | + $admin_page = ! empty($this->_req_data['post']) ? 'post-php' : 'post-new-php'; |
|
1271 | 1271 | ?> |
1272 | 1272 | <script type="text/javascript"> |
1273 | 1273 | adminpage = '<?php echo $admin_page; ?>'; |
@@ -1289,16 +1289,16 @@ discard block |
||
1289 | 1289 | */ |
1290 | 1290 | protected function _edit_cpt_item() { |
1291 | 1291 | global $post, $title, $is_IE, $post_type, $post_type_object; |
1292 | - $post_id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL; |
|
1293 | - $post = !empty( $post_id ) ? get_post( $post_id, OBJECT, 'edit' ) : NULL; |
|
1292 | + $post_id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL; |
|
1293 | + $post = ! empty($post_id) ? get_post($post_id, OBJECT, 'edit') : NULL; |
|
1294 | 1294 | |
1295 | - if ( empty ( $post ) ) { |
|
1296 | - wp_die( __('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?') ); |
|
1295 | + if (empty ($post)) { |
|
1296 | + wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?')); |
|
1297 | 1297 | } |
1298 | 1298 | |
1299 | - if ( ! empty( $_GET['get-post-lock'] ) ) { |
|
1300 | - wp_set_post_lock( $post_id ); |
|
1301 | - wp_redirect( get_edit_post_link( $post_id, 'url' ) ); |
|
1299 | + if ( ! empty($_GET['get-post-lock'])) { |
|
1300 | + wp_set_post_lock($post_id); |
|
1301 | + wp_redirect(get_edit_post_link($post_id, 'url')); |
|
1302 | 1302 | exit(); |
1303 | 1303 | } |
1304 | 1304 | |
@@ -1310,32 +1310,32 @@ discard block |
||
1310 | 1310 | $post_type_object = $this->_cpt_object; |
1311 | 1311 | $is_IE = $is_IE; |
1312 | 1312 | |
1313 | - if ( ! wp_check_post_lock( $post->ID ) ) { |
|
1314 | - $active_post_lock = wp_set_post_lock( $post->ID ); |
|
1313 | + if ( ! wp_check_post_lock($post->ID)) { |
|
1314 | + $active_post_lock = wp_set_post_lock($post->ID); |
|
1315 | 1315 | //wp_enqueue_script('autosave'); |
1316 | 1316 | } |
1317 | 1317 | |
1318 | 1318 | $title = $this->_cpt_object->labels->edit_item; |
1319 | 1319 | |
1320 | - add_action('admin_footer', '_admin_notice_post_locked' ); |
|
1320 | + add_action('admin_footer', '_admin_notice_post_locked'); |
|
1321 | 1321 | |
1322 | - if ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && !isset( $this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']] ) ) { |
|
1323 | - $create_new_action = apply_filters( 'FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this ); |
|
1322 | + if (isset($this->_cpt_routes[$this->_req_data['action']]) && ! isset($this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']])) { |
|
1323 | + $create_new_action = apply_filters('FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this); |
|
1324 | 1324 | |
1325 | - $post_new_file = EE_Admin_Page::add_query_args_and_nonce( array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php' ); |
|
1325 | + $post_new_file = EE_Admin_Page::add_query_args_and_nonce(array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php'); |
|
1326 | 1326 | } |
1327 | 1327 | |
1328 | - if ( post_type_supports($this->_cpt_routes[$this->_req_action], 'comments') ) { |
|
1328 | + if (post_type_supports($this->_cpt_routes[$this->_req_action], 'comments')) { |
|
1329 | 1329 | wp_enqueue_script('admin-comments'); |
1330 | 1330 | enqueue_comment_hotkeys_js(); |
1331 | 1331 | } |
1332 | 1332 | |
1333 | - add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) ); |
|
1333 | + add_action('admin_print_styles', array($this, 'add_new_admin_page_global')); |
|
1334 | 1334 | |
1335 | 1335 | //modify the default editor title field with default title. |
1336 | - add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 ); |
|
1336 | + add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10); |
|
1337 | 1337 | |
1338 | - include_once WP_ADMIN_PATH . 'edit-form-advanced.php'; |
|
1338 | + include_once WP_ADMIN_PATH.'edit-form-advanced.php'; |
|
1339 | 1339 | |
1340 | 1340 | } |
1341 | 1341 |
@@ -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 | * Event Espresso |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | * date_format and the second value is the time format |
51 | 51 | * @return EE_Event |
52 | 52 | */ |
53 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
54 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
55 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
53 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
54 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
55 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * the website will be used. |
64 | 64 | * @return EE_Event |
65 | 65 | */ |
66 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
67 | - return new self( $props_n_values, TRUE, $timezone ); |
|
66 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
67 | + return new self($props_n_values, TRUE, $timezone); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @param array $query_params like EEM_Base::get_all |
76 | 76 | * @return EE_Datetime[] |
77 | 77 | */ |
78 | - public function datetimes( $query_params = array() ) { |
|
79 | - return $this->get_many_related( 'Datetime', $query_params ); |
|
78 | + public function datetimes($query_params = array()) { |
|
79 | + return $this->get_many_related('Datetime', $query_params); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @return EE_Datetime[] |
88 | 88 | */ |
89 | 89 | public function datetimes_in_chronological_order() { |
90 | - return $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) ); |
|
90 | + return $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC'))); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | * @param null $limit |
104 | 104 | * @return \EE_Datetime[] |
105 | 105 | */ |
106 | - public function datetimes_ordered( $show_expired = true, $show_deleted = false, $limit = null ) { |
|
107 | - return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_event_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted, $limit ); |
|
106 | + public function datetimes_ordered($show_expired = true, $show_deleted = false, $limit = null) { |
|
107 | + return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_event_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted, $limit); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @return EE_Datetime |
115 | 115 | */ |
116 | 116 | public function first_datetime() { |
117 | - return $this->get_first_related( 'Datetime' ); |
|
117 | + return $this->get_first_related('Datetime'); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | * @param bool $try_to_exclude_deleted |
126 | 126 | * @return EE_Datetime |
127 | 127 | */ |
128 | - public function primary_datetime( $try_to_exclude_expired = TRUE, $try_to_exclude_deleted = TRUE ) { |
|
129 | - if ( !empty ( $this->_Primary_Datetime ) ) { |
|
128 | + public function primary_datetime($try_to_exclude_expired = TRUE, $try_to_exclude_deleted = TRUE) { |
|
129 | + if ( ! empty ($this->_Primary_Datetime)) { |
|
130 | 130 | return $this->_Primary_Datetime; |
131 | 131 | } |
132 | - $this->_Primary_Datetime = EEM_Datetime::instance( $this->_timezone )->get_primary_datetime_for_event( $this->ID(), $try_to_exclude_expired, $try_to_exclude_deleted ); |
|
132 | + $this->_Primary_Datetime = EEM_Datetime::instance($this->_timezone)->get_primary_datetime_for_event($this->ID(), $try_to_exclude_expired, $try_to_exclude_deleted); |
|
133 | 133 | return $this->_Primary_Datetime; |
134 | 134 | } |
135 | 135 | |
@@ -140,30 +140,30 @@ discard block |
||
140 | 140 | * @param array $query_params like EEM_Base::get_all |
141 | 141 | * @return EE_Ticket[] |
142 | 142 | */ |
143 | - public function tickets( $query_params = array() ) { |
|
143 | + public function tickets($query_params = array()) { |
|
144 | 144 | //first get all datetimes |
145 | 145 | $datetimes = $this->datetimes_ordered(); |
146 | - if ( ! $datetimes ) { |
|
146 | + if ( ! $datetimes) { |
|
147 | 147 | return array(); |
148 | 148 | } |
149 | 149 | |
150 | 150 | $datetime_ids = array(); |
151 | - foreach ( $datetimes as $datetime ) { |
|
151 | + foreach ($datetimes as $datetime) { |
|
152 | 152 | $datetime_ids[] = $datetime->ID(); |
153 | 153 | } |
154 | 154 | |
155 | - $where_params = array( 'Datetime.DTT_ID' => array( 'IN', $datetime_ids ) ); |
|
155 | + $where_params = array('Datetime.DTT_ID' => array('IN', $datetime_ids)); |
|
156 | 156 | |
157 | 157 | //if incoming $query_params has where conditions let's merge but not override existing. |
158 | - if ( is_array( $query_params ) && isset( $query_params[0]) ) { |
|
159 | - $where_params = array_merge( $query_params[0], $where_params ); |
|
160 | - unset( $query_params[0] ); |
|
158 | + if (is_array($query_params) && isset($query_params[0])) { |
|
159 | + $where_params = array_merge($query_params[0], $where_params); |
|
160 | + unset($query_params[0]); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | //now add $where_params to $query_params |
164 | 164 | $query_params[0] = $where_params; |
165 | 165 | |
166 | - return EEM_Ticket::instance()->get_all( $query_params ); |
|
166 | + return EEM_Ticket::instance()->get_all($query_params); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @return bool |
173 | 173 | */ |
174 | 174 | function additional_limit() { |
175 | - return $this->get( 'EVT_additional_limit' ); |
|
175 | + return $this->get('EVT_additional_limit'); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @return bool |
182 | 182 | */ |
183 | 183 | function allow_overflow() { |
184 | - return $this->get( 'EVT_allow_overflow' ); |
|
184 | + return $this->get('EVT_allow_overflow'); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @return bool |
191 | 191 | */ |
192 | 192 | function created() { |
193 | - return $this->get( 'EVT_created' ); |
|
193 | + return $this->get('EVT_created'); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @return bool |
200 | 200 | */ |
201 | 201 | function description() { |
202 | - return $this->get( 'EVT_desc' ); |
|
202 | + return $this->get('EVT_desc'); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @return string of html |
210 | 210 | */ |
211 | 211 | function description_filtered() { |
212 | - return $this->get_pretty( 'EVT_desc' ); |
|
212 | + return $this->get_pretty('EVT_desc'); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @return bool |
219 | 219 | */ |
220 | 220 | function display_description() { |
221 | - return $this->get( 'EVT_display_desc' ); |
|
221 | + return $this->get('EVT_display_desc'); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * @return bool |
228 | 228 | */ |
229 | 229 | function display_ticket_selector() { |
230 | - return (bool)$this->get( 'EVT_display_ticket_selector' ); |
|
230 | + return (bool) $this->get('EVT_display_ticket_selector'); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * @return bool |
237 | 237 | */ |
238 | 238 | function external_url() { |
239 | - return $this->get( 'EVT_external_URL' ); |
|
239 | + return $this->get('EVT_external_URL'); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @return bool |
246 | 246 | */ |
247 | 247 | function member_only() { |
248 | - return $this->get( 'EVT_member_only' ); |
|
248 | + return $this->get('EVT_member_only'); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * @return bool |
255 | 255 | */ |
256 | 256 | function phone() { |
257 | - return $this->get( 'EVT_phone' ); |
|
257 | + return $this->get('EVT_phone'); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * @return bool |
264 | 264 | */ |
265 | 265 | function modified() { |
266 | - return $this->get( 'EVT_modified' ); |
|
266 | + return $this->get('EVT_modified'); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @return bool |
273 | 273 | */ |
274 | 274 | function name() { |
275 | - return $this->get( 'EVT_name' ); |
|
275 | + return $this->get('EVT_name'); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * @return bool |
282 | 282 | */ |
283 | 283 | function order() { |
284 | - return $this->get( 'EVT_order' ); |
|
284 | + return $this->get('EVT_order'); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | |
@@ -290,8 +290,8 @@ discard block |
||
290 | 290 | * @return bool|string |
291 | 291 | */ |
292 | 292 | function default_registration_status() { |
293 | - $event_default_registration_status = $this->get( 'EVT_default_registration_status' ); |
|
294 | - return !empty( $event_default_registration_status ) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID; |
|
293 | + $event_default_registration_status = $this->get('EVT_default_registration_status'); |
|
294 | + return ! empty($event_default_registration_status) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | |
@@ -302,14 +302,14 @@ discard block |
||
302 | 302 | * @param bool $not_full_desc |
303 | 303 | * @return bool|string |
304 | 304 | */ |
305 | - function short_description( $num_words = 55, $more = NULL, $not_full_desc = FALSE ) { |
|
306 | - $short_desc = $this->get( 'EVT_short_desc' ); |
|
307 | - if ( !empty( $short_desc ) || $not_full_desc ) { |
|
305 | + function short_description($num_words = 55, $more = NULL, $not_full_desc = FALSE) { |
|
306 | + $short_desc = $this->get('EVT_short_desc'); |
|
307 | + if ( ! empty($short_desc) || $not_full_desc) { |
|
308 | 308 | return $short_desc; |
309 | 309 | } |
310 | 310 | else { |
311 | - $full_desc = $this->get( 'EVT_desc' ); |
|
312 | - return wp_trim_words( $full_desc, $num_words, $more ); |
|
311 | + $full_desc = $this->get('EVT_desc'); |
|
312 | + return wp_trim_words($full_desc, $num_words, $more); |
|
313 | 313 | } |
314 | 314 | } |
315 | 315 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @return bool |
320 | 320 | */ |
321 | 321 | function slug() { |
322 | - return $this->get( 'EVT_slug' ); |
|
322 | + return $this->get('EVT_slug'); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | * @return bool |
329 | 329 | */ |
330 | 330 | function timezone_string() { |
331 | - return $this->get( 'EVT_timezone_string' ); |
|
331 | + return $this->get('EVT_timezone_string'); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | * @return bool |
338 | 338 | */ |
339 | 339 | function visible_on() { |
340 | - return $this->get( 'EVT_visible_on' ); |
|
340 | + return $this->get('EVT_visible_on'); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | * @return bool |
347 | 347 | */ |
348 | 348 | function wp_user() { |
349 | - return $this->get( 'EVT_wp_user' ); |
|
349 | + return $this->get('EVT_wp_user'); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * @return bool |
356 | 356 | */ |
357 | 357 | function donations() { |
358 | - return $this->get( 'EVT_donations' ); |
|
358 | + return $this->get('EVT_donations'); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | |
@@ -363,8 +363,8 @@ discard block |
||
363 | 363 | /** |
364 | 364 | * @param $limit |
365 | 365 | */ |
366 | - function set_additional_limit( $limit ) { |
|
367 | - $this->set( 'EVT_additional_limit', $limit ); |
|
366 | + function set_additional_limit($limit) { |
|
367 | + $this->set('EVT_additional_limit', $limit); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | |
@@ -372,8 +372,8 @@ discard block |
||
372 | 372 | /** |
373 | 373 | * @param $created |
374 | 374 | */ |
375 | - function set_created( $created ) { |
|
376 | - $this->set( 'EVT_created', $created ); |
|
375 | + function set_created($created) { |
|
376 | + $this->set('EVT_created', $created); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | |
@@ -381,8 +381,8 @@ discard block |
||
381 | 381 | /** |
382 | 382 | * @param $desc |
383 | 383 | */ |
384 | - function set_description( $desc ) { |
|
385 | - $this->set( 'EVT_desc', $desc ); |
|
384 | + function set_description($desc) { |
|
385 | + $this->set('EVT_desc', $desc); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -390,8 +390,8 @@ discard block |
||
390 | 390 | /** |
391 | 391 | * @param $display_desc |
392 | 392 | */ |
393 | - function set_display_description( $display_desc ) { |
|
394 | - $this->set( 'EVT_display_desc', $display_desc ); |
|
393 | + function set_display_description($display_desc) { |
|
394 | + $this->set('EVT_display_desc', $display_desc); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | |
@@ -399,8 +399,8 @@ discard block |
||
399 | 399 | /** |
400 | 400 | * @param $display_ticket_selector |
401 | 401 | */ |
402 | - function set_display_ticket_selector( $display_ticket_selector ) { |
|
403 | - $this->set( 'EVT_display_ticket_selector', $display_ticket_selector ); |
|
402 | + function set_display_ticket_selector($display_ticket_selector) { |
|
403 | + $this->set('EVT_display_ticket_selector', $display_ticket_selector); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | |
@@ -408,8 +408,8 @@ discard block |
||
408 | 408 | /** |
409 | 409 | * @param $external_url |
410 | 410 | */ |
411 | - function set_external_url( $external_url ) { |
|
412 | - $this->set( 'EVT_external_URL', $external_url ); |
|
411 | + function set_external_url($external_url) { |
|
412 | + $this->set('EVT_external_URL', $external_url); |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | |
@@ -417,8 +417,8 @@ discard block |
||
417 | 417 | /** |
418 | 418 | * @param $member_only |
419 | 419 | */ |
420 | - function set_member_only( $member_only ) { |
|
421 | - $this->set( 'EVT_member_only', $member_only ); |
|
420 | + function set_member_only($member_only) { |
|
421 | + $this->set('EVT_member_only', $member_only); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | |
@@ -426,8 +426,8 @@ discard block |
||
426 | 426 | /** |
427 | 427 | * @param $event_phone |
428 | 428 | */ |
429 | - function set_event_phone( $event_phone ) { |
|
430 | - $this->set( 'EVT_phone', $event_phone ); |
|
429 | + function set_event_phone($event_phone) { |
|
430 | + $this->set('EVT_phone', $event_phone); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | |
@@ -435,8 +435,8 @@ discard block |
||
435 | 435 | /** |
436 | 436 | * @param $modified |
437 | 437 | */ |
438 | - function set_modified( $modified ) { |
|
439 | - $this->set( 'EVT_modified', $modified ); |
|
438 | + function set_modified($modified) { |
|
439 | + $this->set('EVT_modified', $modified); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | |
@@ -444,8 +444,8 @@ discard block |
||
444 | 444 | /** |
445 | 445 | * @param $name |
446 | 446 | */ |
447 | - function set_name( $name ) { |
|
448 | - $this->set( 'EVT_name', $name ); |
|
447 | + function set_name($name) { |
|
448 | + $this->set('EVT_name', $name); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | |
@@ -453,8 +453,8 @@ discard block |
||
453 | 453 | /** |
454 | 454 | * @param $order |
455 | 455 | */ |
456 | - function set_order( $order ) { |
|
457 | - $this->set( 'EVT_order', $order ); |
|
456 | + function set_order($order) { |
|
457 | + $this->set('EVT_order', $order); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | |
@@ -462,8 +462,8 @@ discard block |
||
462 | 462 | /** |
463 | 463 | * @param $short_desc |
464 | 464 | */ |
465 | - function set_short_description( $short_desc ) { |
|
466 | - $this->set( 'EVT_short_desc', $short_desc ); |
|
465 | + function set_short_description($short_desc) { |
|
466 | + $this->set('EVT_short_desc', $short_desc); |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | |
@@ -471,8 +471,8 @@ discard block |
||
471 | 471 | /** |
472 | 472 | * @param $slug |
473 | 473 | */ |
474 | - function set_slug( $slug ) { |
|
475 | - $this->set( 'EVT_slug', $slug ); |
|
474 | + function set_slug($slug) { |
|
475 | + $this->set('EVT_slug', $slug); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | |
@@ -480,8 +480,8 @@ discard block |
||
480 | 480 | /** |
481 | 481 | * @param $timezone_string |
482 | 482 | */ |
483 | - function set_timezone_string( $timezone_string ) { |
|
484 | - $this->set( 'EVT_timezone_string', $timezone_string ); |
|
483 | + function set_timezone_string($timezone_string) { |
|
484 | + $this->set('EVT_timezone_string', $timezone_string); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | |
@@ -489,8 +489,8 @@ discard block |
||
489 | 489 | /** |
490 | 490 | * @param $visible_on |
491 | 491 | */ |
492 | - function set_visible_on( $visible_on ) { |
|
493 | - $this->set( 'EVT_visible_on', $visible_on ); |
|
492 | + function set_visible_on($visible_on) { |
|
493 | + $this->set('EVT_visible_on', $visible_on); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | |
@@ -498,8 +498,8 @@ discard block |
||
498 | 498 | /** |
499 | 499 | * @param $wp_user |
500 | 500 | */ |
501 | - function set_wp_user( $wp_user ) { |
|
502 | - $this->set( 'EVT_wp_user', $wp_user ); |
|
501 | + function set_wp_user($wp_user) { |
|
502 | + $this->set('EVT_wp_user', $wp_user); |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | |
@@ -507,8 +507,8 @@ discard block |
||
507 | 507 | /** |
508 | 508 | * @param $default_registration_status |
509 | 509 | */ |
510 | - function set_default_registration_status( $default_registration_status ) { |
|
511 | - $this->set( 'EVT_default_registration_status', $default_registration_status ); |
|
510 | + function set_default_registration_status($default_registration_status) { |
|
511 | + $this->set('EVT_default_registration_status', $default_registration_status); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | |
@@ -516,8 +516,8 @@ discard block |
||
516 | 516 | /** |
517 | 517 | * @param $donations |
518 | 518 | */ |
519 | - function set_donations( $donations ) { |
|
520 | - $this->set( 'EVT_donations', $donations ); |
|
519 | + function set_donations($donations) { |
|
520 | + $this->set('EVT_donations', $donations); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | |
@@ -527,8 +527,8 @@ discard block |
||
527 | 527 | * @param EE_Venue /int $venue_id_or_obj |
528 | 528 | * @return EE_Venue |
529 | 529 | */ |
530 | - function add_venue( $venue_id_or_obj ) { |
|
531 | - return $this->_add_relation_to( $venue_id_or_obj, 'Venue' ); |
|
530 | + function add_venue($venue_id_or_obj) { |
|
531 | + return $this->_add_relation_to($venue_id_or_obj, 'Venue'); |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | |
@@ -538,8 +538,8 @@ discard block |
||
538 | 538 | * @param EE_Venue /int $venue_id_or_obj |
539 | 539 | * @return EE_Venue |
540 | 540 | */ |
541 | - function remove_venue( $venue_id_or_obj ) { |
|
542 | - return $this->_remove_relation_to( $venue_id_or_obj, 'Venue' ); |
|
541 | + function remove_venue($venue_id_or_obj) { |
|
542 | + return $this->_remove_relation_to($venue_id_or_obj, 'Venue'); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | |
@@ -549,8 +549,8 @@ discard block |
||
549 | 549 | * @param array $query_params like EEM_Base::get_all's $query_params |
550 | 550 | * @return EE_Venue[] |
551 | 551 | */ |
552 | - function venues( $query_params = array() ) { |
|
553 | - return $this->get_many_related( 'Venue', $query_params ); |
|
552 | + function venues($query_params = array()) { |
|
553 | + return $this->get_many_related('Venue', $query_params); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | */ |
563 | 563 | private function _has_ID_and_is_published() { |
564 | 564 | // first check if event id is present and not NULL, then check if this event is published (or any of the equivalent "published" statuses) |
565 | - return ( $this->ID() && $this->ID() !== NULL && ( $this->status() == 'publish' || $this->status() == EEM_Event::sold_out || $this->status() == EEM_Event::postponed || $this->status() == EEM_Event::cancelled ) ) ? TRUE : FALSE; |
|
565 | + return ($this->ID() && $this->ID() !== NULL && ($this->status() == 'publish' || $this->status() == EEM_Event::sold_out || $this->status() == EEM_Event::postponed || $this->status() == EEM_Event::cancelled)) ? TRUE : FALSE; |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | |
@@ -574,21 +574,21 @@ discard block |
||
574 | 574 | */ |
575 | 575 | public function is_upcoming() { |
576 | 576 | // check if event id is present and if this event is published |
577 | - if ( $this->is_inactive() ) { |
|
577 | + if ($this->is_inactive()) { |
|
578 | 578 | return FALSE; |
579 | 579 | } |
580 | 580 | // set initial value |
581 | 581 | $upcoming = FALSE; |
582 | 582 | //next let's get all datetimes and loop through them |
583 | 583 | $datetimes = $this->datetimes_in_chronological_order(); |
584 | - foreach ( $datetimes as $datetime ) { |
|
585 | - if ( $datetime instanceof EE_Datetime ) { |
|
584 | + foreach ($datetimes as $datetime) { |
|
585 | + if ($datetime instanceof EE_Datetime) { |
|
586 | 586 | //if this dtt is expired then we continue cause one of the other datetimes might be upcoming. |
587 | - if ( $datetime->is_expired() ) { |
|
587 | + if ($datetime->is_expired()) { |
|
588 | 588 | continue; |
589 | 589 | } |
590 | 590 | //if this dtt is active then we return false. |
591 | - if ( $datetime->is_active() ) { |
|
591 | + if ($datetime->is_active()) { |
|
592 | 592 | return FALSE; |
593 | 593 | } |
594 | 594 | //otherwise let's check upcoming status |
@@ -605,21 +605,21 @@ discard block |
||
605 | 605 | */ |
606 | 606 | public function is_active() { |
607 | 607 | // check if event id is present and if this event is published |
608 | - if ( $this->is_inactive() ) { |
|
608 | + if ($this->is_inactive()) { |
|
609 | 609 | return FALSE; |
610 | 610 | } |
611 | 611 | // set initial value |
612 | 612 | $active = FALSE; |
613 | 613 | //next let's get all datetimes and loop through them |
614 | 614 | $datetimes = $this->datetimes_in_chronological_order(); |
615 | - foreach ( $datetimes as $datetime ) { |
|
616 | - if ( $datetime instanceof EE_Datetime ) { |
|
615 | + foreach ($datetimes as $datetime) { |
|
616 | + if ($datetime instanceof EE_Datetime) { |
|
617 | 617 | //if this dtt is expired then we continue cause one of the other datetimes might be active. |
618 | - if ( $datetime->is_expired() ) { |
|
618 | + if ($datetime->is_expired()) { |
|
619 | 619 | continue; |
620 | 620 | } |
621 | 621 | //if this dtt is upcoming then we return false. |
622 | - if ( $datetime->is_upcoming() ) { |
|
622 | + if ($datetime->is_upcoming()) { |
|
623 | 623 | return FALSE; |
624 | 624 | } |
625 | 625 | //otherwise let's check active status |
@@ -636,17 +636,17 @@ discard block |
||
636 | 636 | */ |
637 | 637 | public function is_expired() { |
638 | 638 | // check if event id is present and if this event is published |
639 | - if ( $this->is_inactive() ) { |
|
639 | + if ($this->is_inactive()) { |
|
640 | 640 | return FALSE; |
641 | 641 | } |
642 | 642 | // set initial value |
643 | 643 | $expired = FALSE; |
644 | 644 | //first let's get all datetimes and loop through them |
645 | 645 | $datetimes = $this->datetimes_in_chronological_order(); |
646 | - foreach ( $datetimes as $datetime ) { |
|
647 | - if ( $datetime instanceof EE_Datetime ) { |
|
646 | + foreach ($datetimes as $datetime) { |
|
647 | + if ($datetime instanceof EE_Datetime) { |
|
648 | 648 | //if this dtt is upcoming or active then we return false. |
649 | - if ( $datetime->is_upcoming() || $datetime->is_active() ) { |
|
649 | + if ($datetime->is_upcoming() || $datetime->is_active()) { |
|
650 | 650 | return FALSE; |
651 | 651 | } |
652 | 652 | //otherwise let's check active status |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | */ |
664 | 664 | public function is_inactive() { |
665 | 665 | // check if event id is present and if this event is published |
666 | - if ( $this->_has_ID_and_is_published() ) { |
|
666 | + if ($this->_has_ID_and_is_published()) { |
|
667 | 667 | return FALSE; |
668 | 668 | } |
669 | 669 | return TRUE; |
@@ -681,26 +681,26 @@ discard block |
||
681 | 681 | */ |
682 | 682 | public function perform_sold_out_status_check() { |
683 | 683 | // get all unexpired untrashed tickets |
684 | - $tickets = $this->tickets( array( |
|
684 | + $tickets = $this->tickets(array( |
|
685 | 685 | array( |
686 | - 'TKT_end_date' => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ), |
|
686 | + 'TKT_end_date' => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')), |
|
687 | 687 | 'TKT_deleted' => false |
688 | 688 | ) |
689 | 689 | )); |
690 | 690 | // if all the tickets are just expired, then don't update the event status to sold out |
691 | - if ( empty( $tickets )) { |
|
691 | + if (empty($tickets)) { |
|
692 | 692 | return true; |
693 | 693 | } |
694 | 694 | // set initial value |
695 | 695 | $spaces_remaining = 0; |
696 | - foreach( $tickets as $ticket ) { |
|
697 | - if ( $ticket instanceof EE_Ticket ) { |
|
698 | - $spaces_remaining += $ticket->qty( 'saleable' ); |
|
696 | + foreach ($tickets as $ticket) { |
|
697 | + if ($ticket instanceof EE_Ticket) { |
|
698 | + $spaces_remaining += $ticket->qty('saleable'); |
|
699 | 699 | } |
700 | 700 | } |
701 | - if ( $spaces_remaining === 0 ) { |
|
702 | - $this->set_status( EEM_Event::sold_out ); |
|
703 | - if ( !is_admin() || ( is_admin() && defined( 'DOING_AJAX' ) ) ) { |
|
701 | + if ($spaces_remaining === 0) { |
|
702 | + $this->set_status(EEM_Event::sold_out); |
|
703 | + if ( ! is_admin() || (is_admin() && defined('DOING_AJAX'))) { |
|
704 | 704 | $this->save(); |
705 | 705 | } |
706 | 706 | $sold_out = TRUE; |
@@ -728,15 +728,15 @@ discard block |
||
728 | 728 | */ |
729 | 729 | public function spaces_remaining_for_sale() { |
730 | 730 | //first get total available spaces including consideration for tickets that have already sold. |
731 | - $spaces_available = $this->total_available_spaces( true ); |
|
731 | + $spaces_available = $this->total_available_spaces(true); |
|
732 | 732 | |
733 | 733 | //if total available = 0, then exit right away because that means everything is expired. |
734 | - if ( $spaces_available === 0 ) { |
|
734 | + if ($spaces_available === 0) { |
|
735 | 735 | return 0; |
736 | 736 | } |
737 | 737 | |
738 | 738 | //subtract total approved registrations from spaces available to get how many are remaining. |
739 | - $spots_taken = EEM_Registration::instance()->count( array( array( 'EVT_ID' => $this->ID(), 'STS_ID' => EEM_Registration::status_id_approved ) ), 'REG_ID', true ); |
|
739 | + $spots_taken = EEM_Registration::instance()->count(array(array('EVT_ID' => $this->ID(), 'STS_ID' => EEM_Registration::status_id_approved)), 'REG_ID', true); |
|
740 | 740 | $spaces_remaining = $spaces_available - $spots_taken; |
741 | 741 | |
742 | 742 | return $spaces_remaining > 0 ? $spaces_remaining : 0; |
@@ -769,29 +769,29 @@ discard block |
||
769 | 769 | * |
770 | 770 | * @return int|float (Note: if EE_INF is returned its considered a float by PHP) |
771 | 771 | */ |
772 | - public function total_available_spaces( $current_total_available = false ) { |
|
772 | + public function total_available_spaces($current_total_available = false) { |
|
773 | 773 | $spaces_available = 0; |
774 | 774 | |
775 | 775 | //first get all tickets on the event and include expired tickets |
776 | - $tickets = $this->tickets( array( 'default_where_conditions' => 'none' ) ); |
|
776 | + $tickets = $this->tickets(array('default_where_conditions' => 'none')); |
|
777 | 777 | $ticket_sums = array(); |
778 | 778 | $datetime_limits = array(); |
779 | 779 | |
780 | 780 | //loop through tickets and normalize them |
781 | - foreach ( $tickets as $ticket ) { |
|
782 | - $datetimes = $ticket->datetimes( array( 'order_by' => array( 'DTT_reg_limit' => 'ASC' ) ) ); |
|
781 | + foreach ($tickets as $ticket) { |
|
782 | + $datetimes = $ticket->datetimes(array('order_by' => array('DTT_reg_limit' => 'ASC'))); |
|
783 | 783 | |
784 | - if ( empty( $datetimes ) ) { |
|
784 | + if (empty($datetimes)) { |
|
785 | 785 | continue; |
786 | 786 | } |
787 | 787 | |
788 | 788 | //first datetime should be the lowest datetime |
789 | - $least_datetime = reset( $datetimes ); |
|
789 | + $least_datetime = reset($datetimes); |
|
790 | 790 | |
791 | 791 | //lets reset the ticket quantity to be the lower of either the lowest datetime reg limit or the ticket quantity |
792 | 792 | //IF datetimes sold (and we're not doing current live total available, then use spaces remaining for datetime, not reg_limit. |
793 | - if ( $current_total_available ) { |
|
794 | - if ( $ticket->is_remaining() ) { |
|
793 | + if ($current_total_available) { |
|
794 | + if ($ticket->is_remaining()) { |
|
795 | 795 | $remaining = $ticket->remaining(); |
796 | 796 | } else { |
797 | 797 | $spaces_available += $ticket->sold(); |
@@ -799,23 +799,23 @@ discard block |
||
799 | 799 | continue; |
800 | 800 | } |
801 | 801 | } else { |
802 | - $remaining = min( $ticket->qty(), $least_datetime->reg_limit() ); |
|
802 | + $remaining = min($ticket->qty(), $least_datetime->reg_limit()); |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | //if $ticket_limit == infinity then let's drop out right away and just return that because any infinity amount trumps all other "available" amounts. |
806 | - if ( $remaining == EE_INF ) { |
|
806 | + if ($remaining == EE_INF) { |
|
807 | 807 | return EE_INF; |
808 | 808 | } |
809 | 809 | |
810 | 810 | //multiply normalized $tkt quantity by the number of datetimes on the ticket as the "sum" |
811 | 811 | //also include the sum of all the datetime reg limits on the ticket for breaking ties. |
812 | - $ticket_sums[$ticket->ID()]['sum'] = $remaining * count( $datetimes ); |
|
812 | + $ticket_sums[$ticket->ID()]['sum'] = $remaining * count($datetimes); |
|
813 | 813 | $ticket_sums[$ticket->ID()]['datetime_sums'] = 0; |
814 | - foreach ( $datetimes as $datetime ) { |
|
815 | - if ( $datetime->reg_limit() === EE_INF ) { |
|
814 | + foreach ($datetimes as $datetime) { |
|
815 | + if ($datetime->reg_limit() === EE_INF) { |
|
816 | 816 | $ticket_sums[$ticket->ID()]['datetime_sums'] = EE_INF; |
817 | 817 | } else { |
818 | - $ticket_sums[ $ticket->ID() ]['datetime_sums'] += $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit(); |
|
818 | + $ticket_sums[$ticket->ID()]['datetime_sums'] += $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit(); |
|
819 | 819 | } |
820 | 820 | $datetime_limits[$datetime->ID()] = $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit(); |
821 | 821 | } |
@@ -826,74 +826,74 @@ discard block |
||
826 | 826 | //ticket quantity by the number of datetimes on the ticket). For tie-breakers, then the next sort is based on the |
827 | 827 | //ticket with the greatest sum of all remaining datetime->spaces_remaining() ( or $datetime->reg_limit() if not |
828 | 828 | //$current_total_available ) for the datetimes on the ticket. |
829 | - usort( $ticket_sums, function( $a, $b ) { |
|
830 | - if ( $a['sum'] == $b['sum'] ) { |
|
831 | - if ( $a['datetime_sums'] == $b['datetime_sums'] ) { |
|
829 | + usort($ticket_sums, function($a, $b) { |
|
830 | + if ($a['sum'] == $b['sum']) { |
|
831 | + if ($a['datetime_sums'] == $b['datetime_sums']) { |
|
832 | 832 | return 0; |
833 | 833 | } |
834 | 834 | |
835 | 835 | return $a['datetime_sums'] < $b['datetime_sums'] ? 1 : -1; |
836 | 836 | } |
837 | - return ( $a['sum'] < $b['sum'] ) ? -1 : 1; |
|
837 | + return ($a['sum'] < $b['sum']) ? -1 : 1; |
|
838 | 838 | }); |
839 | 839 | |
840 | 840 | //now let's loop through the sorted tickets and simulate sellouts |
841 | - foreach ( $ticket_sums as $ticket_info ) { |
|
842 | - if ( $ticket_info['ticket'] instanceof EE_Ticket ) { |
|
841 | + foreach ($ticket_sums as $ticket_info) { |
|
842 | + if ($ticket_info['ticket'] instanceof EE_Ticket) { |
|
843 | 843 | |
844 | - $datetimes = $ticket_info['ticket']->datetimes( array( 'order_by' => array( 'DTT_reg_limit' => 'ASC' ) ) ); |
|
844 | + $datetimes = $ticket_info['ticket']->datetimes(array('order_by' => array('DTT_reg_limit' => 'ASC'))); |
|
845 | 845 | //need to sort these $datetimes by remaining (only if $current_total_available) |
846 | 846 | //setup datetimes for simulation |
847 | 847 | $ticket_datetimes_remaining = array(); |
848 | - foreach( $datetimes as $datetime ) { |
|
848 | + foreach ($datetimes as $datetime) { |
|
849 | 849 | $ticket_datetimes_remaining[$datetime->ID()]['rem'] = $datetime_limits[$datetime->ID()]; |
850 | 850 | $ticket_datetimes_remaining[$datetime->ID()]['datetime'] = $datetime; |
851 | 851 | } |
852 | - usort( $ticket_datetimes_remaining, function( $a, $b ) { |
|
853 | - if ( $a['rem'] == $b['rem'] ) { |
|
852 | + usort($ticket_datetimes_remaining, function($a, $b) { |
|
853 | + if ($a['rem'] == $b['rem']) { |
|
854 | 854 | return 0; |
855 | 855 | } |
856 | - return ( $a['rem'] < $b['rem'] ) ? -1 : 1; |
|
856 | + return ($a['rem'] < $b['rem']) ? -1 : 1; |
|
857 | 857 | }); |
858 | 858 | |
859 | 859 | |
860 | 860 | //get the remaining on the first datetime (which should be the one with the least remaining) and that is |
861 | 861 | //what we add to the spaces_available running total. Then we need to decrease the remaining on our datetime tracker. |
862 | - $lowest_datetime = reset( $ticket_datetimes_remaining ); |
|
862 | + $lowest_datetime = reset($ticket_datetimes_remaining); |
|
863 | 863 | |
864 | 864 | //need to get the lower of; what the remaining is on the lowest datetime, and the remaining on the ticket. |
865 | 865 | // If this ends up being 0 (because of previous tickets in our simulation selling out), then it has already |
866 | 866 | // been tracked on $spaces available and this ticket is now sold out for the simulation, so we can continue |
867 | 867 | // to the next ticket. |
868 | - if ( $current_total_available ) { |
|
869 | - $remaining = min( $lowest_datetime['rem'], $ticket_info['ticket']->remaining() ); |
|
868 | + if ($current_total_available) { |
|
869 | + $remaining = min($lowest_datetime['rem'], $ticket_info['ticket']->remaining()); |
|
870 | 870 | } else { |
871 | - $remaining = min( $lowest_datetime['rem'], $ticket_info['ticket']->qty() ); |
|
871 | + $remaining = min($lowest_datetime['rem'], $ticket_info['ticket']->qty()); |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | //if $remaining is infinite that means that all datetimes on this ticket are infinite but we've made it here because all |
875 | 875 | //tickets have a quantity. So we don't have to track datetimes, we can just use ticket quantities for total |
876 | 876 | //available. |
877 | - if ( $remaining === EE_INF ) { |
|
877 | + if ($remaining === EE_INF) { |
|
878 | 878 | $spaces_available += $ticket_info['ticket']->qty(); |
879 | 879 | continue; |
880 | 880 | } |
881 | 881 | |
882 | 882 | //if ticket has sold amounts then we also need to add that (but only if doing live counts) |
883 | - if ( $current_total_available ) { |
|
883 | + if ($current_total_available) { |
|
884 | 884 | $spaces_available += $ticket_info['ticket']->sold(); |
885 | 885 | } |
886 | 886 | |
887 | - if ( $remaining <= 0 ) { |
|
887 | + if ($remaining <= 0) { |
|
888 | 888 | continue; |
889 | 889 | } else { |
890 | 890 | $spaces_available += $remaining; |
891 | 891 | } |
892 | 892 | |
893 | 893 | //loop through the datetimes and sell them out! |
894 | - foreach ( $ticket_datetimes_remaining as $datetime_info ) { |
|
895 | - if ( $datetime_info['datetime'] instanceof EE_Datetime ) { |
|
896 | - $datetime_limits[ $datetime_info['datetime']->ID() ] += - $remaining; |
|
894 | + foreach ($ticket_datetimes_remaining as $datetime_info) { |
|
895 | + if ($datetime_info['datetime'] instanceof EE_Datetime) { |
|
896 | + $datetime_limits[$datetime_info['datetime']->ID()] += - $remaining; |
|
897 | 897 | } |
898 | 898 | } |
899 | 899 | } |
@@ -909,8 +909,8 @@ discard block |
||
909 | 909 | * @param bool $actual whether or not to perform calculations to not only figure the actual status but also to flip the status if necessary to sold out If false, we just check the existing status of the event |
910 | 910 | * @return boolean |
911 | 911 | */ |
912 | - public function is_sold_out( $actual = FALSE ) { |
|
913 | - if ( ! $actual ) { |
|
912 | + public function is_sold_out($actual = FALSE) { |
|
913 | + if ( ! $actual) { |
|
914 | 914 | return $this->status() == EEM_Event::sold_out; |
915 | 915 | } |
916 | 916 | else { |
@@ -948,36 +948,36 @@ discard block |
||
948 | 948 | * @param bool $reset |
949 | 949 | * @return bool | string - based on EE_Datetime active constants or FALSE if error. |
950 | 950 | */ |
951 | - public function get_active_status( $reset = FALSE ) { |
|
951 | + public function get_active_status($reset = FALSE) { |
|
952 | 952 | // if the active status has already been set, then just use that value (unless we are resetting it) |
953 | - if ( ! empty( $this->_active_status ) && ! $reset ) { |
|
953 | + if ( ! empty($this->_active_status) && ! $reset) { |
|
954 | 954 | return $this->_active_status; |
955 | 955 | } |
956 | 956 | //first check if event id is present on this object |
957 | - if ( ! $this->ID() ) { |
|
957 | + if ( ! $this->ID()) { |
|
958 | 958 | return FALSE; |
959 | 959 | } |
960 | 960 | //first get all datetimes ordered by date |
961 | 961 | $datetimes = $this->datetimes_in_chronological_order(); |
962 | 962 | //next loop through $datetimes and setup status array |
963 | 963 | $status_array = array(); |
964 | - foreach ( $datetimes as $datetime ) { |
|
965 | - if ( $datetime instanceof EE_Datetime ) { |
|
964 | + foreach ($datetimes as $datetime) { |
|
965 | + if ($datetime instanceof EE_Datetime) { |
|
966 | 966 | $status_array[] = $datetime->get_active_status(); |
967 | 967 | } |
968 | 968 | } |
969 | 969 | //now we can conditionally determine status |
970 | - if ( $this->status() == 'publish' ) { |
|
971 | - if ( in_array( EE_Datetime::active, $status_array ) ) { |
|
970 | + if ($this->status() == 'publish') { |
|
971 | + if (in_array(EE_Datetime::active, $status_array)) { |
|
972 | 972 | $this->_active_status = EE_Datetime::active; |
973 | 973 | } else { |
974 | - if ( in_array( EE_Datetime::upcoming, $status_array ) ) { |
|
974 | + if (in_array(EE_Datetime::upcoming, $status_array)) { |
|
975 | 975 | $this->_active_status = EE_Datetime::upcoming; |
976 | 976 | } else { |
977 | - if ( in_array( EE_Datetime::expired, $status_array ) ) { |
|
977 | + if (in_array(EE_Datetime::expired, $status_array)) { |
|
978 | 978 | $this->_active_status = EE_Datetime::expired; |
979 | 979 | } else { |
980 | - if ( in_array( EE_Datetime::sold_out, $status_array ) ) { |
|
980 | + if (in_array(EE_Datetime::sold_out, $status_array)) { |
|
981 | 981 | $this->_active_status = EE_Datetime::sold_out; |
982 | 982 | } else { |
983 | 983 | $this->_active_status = EE_Datetime::expired; //catchall |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | } |
987 | 987 | } |
988 | 988 | } else { |
989 | - switch ( $this->status() ) { |
|
989 | + switch ($this->status()) { |
|
990 | 990 | case EEM_Event::sold_out : |
991 | 991 | $this->_active_status = EE_Datetime::sold_out; |
992 | 992 | break; |
@@ -1012,10 +1012,10 @@ discard block |
||
1012 | 1012 | * @param boolean $echo whether to return (FALSE), or echo out the result (TRUE) |
1013 | 1013 | * @return mixed void|string |
1014 | 1014 | */ |
1015 | - public function pretty_active_status( $echo = TRUE ) { |
|
1015 | + public function pretty_active_status($echo = TRUE) { |
|
1016 | 1016 | $active_status = $this->get_active_status(); |
1017 | - $status = '<span class="ee-status event-active-status-' . $active_status . '">' . EEH_Template::pretty_status( $active_status, FALSE, 'sentence' ) . '</span>'; |
|
1018 | - if ( $echo ) { |
|
1017 | + $status = '<span class="ee-status event-active-status-'.$active_status.'">'.EEH_Template::pretty_status($active_status, FALSE, 'sentence').'</span>'; |
|
1018 | + if ($echo) { |
|
1019 | 1019 | echo $status; |
1020 | 1020 | return ''; |
1021 | 1021 | } |
@@ -1029,12 +1029,12 @@ discard block |
||
1029 | 1029 | */ |
1030 | 1030 | public function get_number_of_tickets_sold() { |
1031 | 1031 | $tkt_sold = 0; |
1032 | - if ( !$this->ID() ) { |
|
1032 | + if ( ! $this->ID()) { |
|
1033 | 1033 | return 0; |
1034 | 1034 | } |
1035 | 1035 | $datetimes = $this->datetimes(); |
1036 | - foreach ( $datetimes as $datetime ) { |
|
1037 | - if ( $datetime instanceof EE_Datetime ) { |
|
1036 | + foreach ($datetimes as $datetime) { |
|
1037 | + if ($datetime instanceof EE_Datetime) { |
|
1038 | 1038 | $tkt_sold += $datetime->sold(); |
1039 | 1039 | } |
1040 | 1040 | } |
@@ -1049,7 +1049,7 @@ discard block |
||
1049 | 1049 | * @return int |
1050 | 1050 | */ |
1051 | 1051 | public function get_count_of_all_registrations() { |
1052 | - return EEM_Event::instance()->count_related( $this, 'Registration' ); |
|
1052 | + return EEM_Event::instance()->count_related($this, 'Registration'); |
|
1053 | 1053 | } |
1054 | 1054 | |
1055 | 1055 | |
@@ -1059,9 +1059,9 @@ discard block |
||
1059 | 1059 | * @return EE_Ticket |
1060 | 1060 | */ |
1061 | 1061 | public function get_ticket_with_earliest_start_time() { |
1062 | - $where[ 'Datetime.EVT_ID' ] = $this->ID(); |
|
1063 | - $query_params = array( $where, 'order_by' => array( 'TKT_start_date' => 'ASC' ) ); |
|
1064 | - return EE_Registry::instance()->load_model( 'Ticket' )->get_one( $query_params ); |
|
1062 | + $where['Datetime.EVT_ID'] = $this->ID(); |
|
1063 | + $query_params = array($where, 'order_by' => array('TKT_start_date' => 'ASC')); |
|
1064 | + return EE_Registry::instance()->load_model('Ticket')->get_one($query_params); |
|
1065 | 1065 | } |
1066 | 1066 | |
1067 | 1067 | |
@@ -1071,9 +1071,9 @@ discard block |
||
1071 | 1071 | * @return EE_Ticket |
1072 | 1072 | */ |
1073 | 1073 | public function get_ticket_with_latest_end_time() { |
1074 | - $where[ 'Datetime.EVT_ID' ] = $this->ID(); |
|
1075 | - $query_params = array( $where, 'order_by' => array( 'TKT_end_date' => 'DESC' ) ); |
|
1076 | - return EE_Registry::instance()->load_model( 'Ticket' )->get_one( $query_params ); |
|
1074 | + $where['Datetime.EVT_ID'] = $this->ID(); |
|
1075 | + $query_params = array($where, 'order_by' => array('TKT_end_date' => 'DESC')); |
|
1076 | + return EE_Registry::instance()->load_model('Ticket')->get_one($query_params); |
|
1077 | 1077 | } |
1078 | 1078 | |
1079 | 1079 | |
@@ -1085,11 +1085,11 @@ discard block |
||
1085 | 1085 | public function tickets_on_sale() { |
1086 | 1086 | $earliest_ticket = $this->get_ticket_with_earliest_start_time(); |
1087 | 1087 | $latest_ticket = $this->get_ticket_with_latest_end_time(); |
1088 | - if ( !$latest_ticket instanceof EE_Ticket && !$earliest_ticket instanceof EE_Ticket ) { |
|
1088 | + if ( ! $latest_ticket instanceof EE_Ticket && ! $earliest_ticket instanceof EE_Ticket) { |
|
1089 | 1089 | return FALSE; |
1090 | 1090 | } |
1091 | 1091 | //check on sale for these two tickets. |
1092 | - if ( $latest_ticket->is_on_sale() || $earliest_ticket->is_on_sale() ) { |
|
1092 | + if ($latest_ticket->is_on_sale() || $earliest_ticket->is_on_sale()) { |
|
1093 | 1093 | return TRUE; |
1094 | 1094 | } |
1095 | 1095 | return FALSE; |
@@ -1103,7 +1103,7 @@ discard block |
||
1103 | 1103 | * @return string |
1104 | 1104 | */ |
1105 | 1105 | public function get_permalink() { |
1106 | - if ( $this->external_url() ) { |
|
1106 | + if ($this->external_url()) { |
|
1107 | 1107 | return $this->external_url(); |
1108 | 1108 | } |
1109 | 1109 | else { |
@@ -1118,10 +1118,10 @@ discard block |
||
1118 | 1118 | * @param array $query_params like EEM_Base::get_all |
1119 | 1119 | * @return EE_Term |
1120 | 1120 | */ |
1121 | - public function first_event_category( $query_params = array() ) { |
|
1122 | - $query_params[ 0 ][ 'Term_Taxonomy.taxonomy' ] = 'espresso_event_categories'; |
|
1123 | - $query_params[ 0 ][ 'Term_Taxonomy.Event.EVT_ID' ] = $this->ID(); |
|
1124 | - return EEM_Term::instance()->get_one( $query_params ); |
|
1121 | + public function first_event_category($query_params = array()) { |
|
1122 | + $query_params[0]['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
|
1123 | + $query_params[0]['Term_Taxonomy.Event.EVT_ID'] = $this->ID(); |
|
1124 | + return EEM_Term::instance()->get_one($query_params); |
|
1125 | 1125 | } |
1126 | 1126 | |
1127 | 1127 | |
@@ -1131,10 +1131,10 @@ discard block |
||
1131 | 1131 | * @param array $query_params |
1132 | 1132 | * @return EE_Term[] |
1133 | 1133 | */ |
1134 | - public function get_all_event_categories( $query_params = array() ) { |
|
1135 | - $query_params[ 0 ][ 'Term_Taxonomy.taxonomy' ] = 'espresso_event_categories'; |
|
1136 | - $query_params[ 0 ][ 'Term_Taxonomy.Event.EVT_ID' ] = $this->ID(); |
|
1137 | - return EEM_Term::instance()->get_all( $query_params ); |
|
1134 | + public function get_all_event_categories($query_params = array()) { |
|
1135 | + $query_params[0]['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
|
1136 | + $query_params[0]['Term_Taxonomy.Event.EVT_ID'] = $this->ID(); |
|
1137 | + return EEM_Term::instance()->get_all($query_params); |
|
1138 | 1138 | } |
1139 | 1139 | |
1140 | 1140 | /** |
@@ -1142,8 +1142,8 @@ discard block |
||
1142 | 1142 | * @param array $query_params @see EEM_Base::get_all |
1143 | 1143 | * @return EE_Question_Group[] |
1144 | 1144 | */ |
1145 | - public function question_groups($query_params = array()){ |
|
1146 | - $query_params = ! empty( $query_params ) ? $query_params : array( 'order_by' => array( 'QSG_order' => 'ASC' )); |
|
1145 | + public function question_groups($query_params = array()) { |
|
1146 | + $query_params = ! empty($query_params) ? $query_params : array('order_by' => array('QSG_order' => 'ASC')); |
|
1147 | 1147 | return $this->get_many_related('Question_Group', $query_params); |
1148 | 1148 | } |
1149 | 1149 | |
@@ -1183,12 +1183,12 @@ discard block |
||
1183 | 1183 | */ |
1184 | 1184 | public function get_admin_edit_link() { |
1185 | 1185 | EE_Registry::instance()->load_helper('URL'); |
1186 | - return EEH_URL::add_query_args_and_nonce( array( |
|
1186 | + return EEH_URL::add_query_args_and_nonce(array( |
|
1187 | 1187 | 'page' => 'espresso_events', |
1188 | 1188 | 'action' => 'edit', |
1189 | 1189 | 'post' => $this->ID() |
1190 | 1190 | ), |
1191 | - admin_url( 'admin.php' ) |
|
1191 | + admin_url('admin.php') |
|
1192 | 1192 | ); |
1193 | 1193 | } |
1194 | 1194 | |
@@ -1201,11 +1201,11 @@ discard block |
||
1201 | 1201 | */ |
1202 | 1202 | public function get_admin_settings_link() { |
1203 | 1203 | EE_Registry::instance()->load_helper('URL'); |
1204 | - return EEH_URL::add_query_args_and_nonce( array( |
|
1204 | + return EEH_URL::add_query_args_and_nonce(array( |
|
1205 | 1205 | 'page' => 'espresso_events', |
1206 | 1206 | 'action' => 'default_event_settings' |
1207 | 1207 | ), |
1208 | - admin_url( 'admin.php' ) |
|
1208 | + admin_url('admin.php') |
|
1209 | 1209 | ); |
1210 | 1210 | } |
1211 | 1211 | |
@@ -1221,11 +1221,11 @@ discard block |
||
1221 | 1221 | public function get_admin_overview_link() { |
1222 | 1222 | |
1223 | 1223 | EE_Registry::instance()->load_helper('URL'); |
1224 | - return EEH_URL::add_query_args_and_nonce( array( |
|
1224 | + return EEH_URL::add_query_args_and_nonce(array( |
|
1225 | 1225 | 'page' => 'espresso_events', |
1226 | 1226 | 'action' => 'default' |
1227 | 1227 | ), |
1228 | - admin_url( 'admin.php' ) |
|
1228 | + admin_url('admin.php') |
|
1229 | 1229 | ); |
1230 | 1230 | } |
1231 | 1231 |