@@ -24,10 +24,10 @@ |
||
24 | 24 | class EE_CPT_Strategy extends EE_BASE { |
25 | 25 | |
26 | 26 | /** |
27 | - * EE_CPT_Strategy Object |
|
28 | - * @private _instance |
|
29 | - * @private protected |
|
30 | - */ |
|
27 | + * EE_CPT_Strategy Object |
|
28 | + * @private _instance |
|
29 | + * @private protected |
|
30 | + */ |
|
31 | 31 | private static $_instance = NULL; |
32 | 32 | |
33 | 33 |
@@ -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 === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_CPT_Strategy )) { |
|
81 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (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 | // load EE_Request_Handler |
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,34 +286,34 @@ 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 postz-type is set |
291 | - if ( ! $WP_Query instanceof WP_Query ) { |
|
291 | + if ( ! $WP_Query instanceof WP_Query) { |
|
292 | 292 | return; |
293 | 293 | } |
294 | 294 | // add our conditionals |
295 | - $this->_set_EE_tags_on_WP_Query( $WP_Query ); |
|
295 | + $this->_set_EE_tags_on_WP_Query($WP_Query); |
|
296 | 296 | // check for terms |
297 | - $this->_set_post_type_for_terms( $WP_Query ); |
|
297 | + $this->_set_post_type_for_terms($WP_Query); |
|
298 | 298 | // make sure paging is always set |
299 | - $this->_set_paging( $WP_Query ); |
|
299 | + $this->_set_paging($WP_Query); |
|
300 | 300 | |
301 | 301 | // is a taxonomy set ? |
302 | - if ( $WP_Query->is_tax ) { |
|
302 | + if ($WP_Query->is_tax) { |
|
303 | 303 | // loop thru our taxonomies |
304 | - foreach ( $this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details ) { |
|
304 | + foreach ($this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details) { |
|
305 | 305 | // check if one of our taxonomies is set as a query var |
306 | - if ( isset( $WP_Query->query[ $CPT_taxonomy ] )) { |
|
306 | + if (isset($WP_Query->query[$CPT_taxonomy])) { |
|
307 | 307 | // but which CPT does that correspond to??? hmmm... guess we gotta go looping |
308 | - foreach ( $this->_CPTs as $post_type => $CPT ) { |
|
308 | + foreach ($this->_CPTs as $post_type => $CPT) { |
|
309 | 309 | // verify our CPT has args, is public and has taxonomies set |
310 | - if ( isset( $CPT['args'] ) && $CPT['args']['public'] && ! empty( $CPT['args']['taxonomies'] )) { |
|
310 | + if (isset($CPT['args']) && $CPT['args']['public'] && ! empty($CPT['args']['taxonomies'])) { |
|
311 | 311 | // does the captured taxonomy belong to this CPT ? |
312 | - if ( in_array( $CPT_taxonomy, $CPT['args']['taxonomies'] )) { |
|
312 | + if (in_array($CPT_taxonomy, $CPT['args']['taxonomies'])) { |
|
313 | 313 | // if so, then add this CPT post_type to the current query's array of post_types' |
314 | - $WP_Query->query_vars['post_type'] = isset( $WP_Query->query_vars['post_type'] ) ? (array)$WP_Query->query_vars['post_type'] : array(); |
|
314 | + $WP_Query->query_vars['post_type'] = isset($WP_Query->query_vars['post_type']) ? (array) $WP_Query->query_vars['post_type'] : array(); |
|
315 | 315 | $WP_Query->query_vars['post_type'][] = $post_type; |
316 | - switch( $post_type ) { |
|
316 | + switch ($post_type) { |
|
317 | 317 | case 'espresso_events' : |
318 | 318 | $WP_Query->is_espresso_event_taxonomy = TRUE; |
319 | 319 | break; |
@@ -334,21 +334,21 @@ discard block |
||
334 | 334 | // d( $CPT_taxonomy ); |
335 | 335 | // d( $WP_Query ); |
336 | 336 | |
337 | - if ( isset( $WP_Query->query_vars['post_type'] )) { |
|
337 | + if (isset($WP_Query->query_vars['post_type'])) { |
|
338 | 338 | // loop thru post_types as array |
339 | - foreach ( (array)$WP_Query->query_vars['post_type'] as $post_type ) { |
|
339 | + foreach ((array) $WP_Query->query_vars['post_type'] as $post_type) { |
|
340 | 340 | // is current query for an EE CPT ? |
341 | - if ( isset( $this->_CPTs[ $post_type ] )) { |
|
341 | + if (isset($this->_CPTs[$post_type])) { |
|
342 | 342 | // is EE on or off ? |
343 | - if ( EE_Maintenance_Mode::instance()->level() ) { |
|
343 | + if (EE_Maintenance_Mode::instance()->level()) { |
|
344 | 344 | // reroute CPT template view to maintenance_mode.template.php |
345 | - if( ! has_filter( 'template_include',array( 'EE_Maintenance_Mode', 'template_include' ))){ |
|
346 | - add_filter( 'template_include', array( 'EE_Maintenance_Mode', 'template_include' ), 99999 ); |
|
345 | + if ( ! has_filter('template_include', array('EE_Maintenance_Mode', 'template_include'))) { |
|
346 | + add_filter('template_include', array('EE_Maintenance_Mode', 'template_include'), 99999); |
|
347 | 347 | } |
348 | 348 | return; |
349 | 349 | } |
350 | 350 | // grab details for the CPT the current query is for |
351 | - $this->CPT = $this->_CPTs[ $post_type ]; |
|
351 | + $this->CPT = $this->_CPTs[$post_type]; |
|
352 | 352 | // set post type |
353 | 353 | $this->CPT['post_type'] = $post_type; |
354 | 354 | // set taxonomies |
@@ -356,27 +356,27 @@ discard block |
||
356 | 356 | // the post or category or term that is triggering EE |
357 | 357 | $this->CPT['espresso_page'] = EE_Registry::instance()->REQ->is_espresso_page(); |
358 | 358 | // requested post name |
359 | - $this->CPT['post_name'] = EE_Registry::instance()->REQ->get( 'post_name' ); |
|
359 | + $this->CPT['post_name'] = EE_Registry::instance()->REQ->get('post_name'); |
|
360 | 360 | //d( $this->CPT ); |
361 | 361 | // add support for viewing 'private', 'draft', or 'pending' posts |
362 | - 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'] )) { |
|
362 | + 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'])) { |
|
363 | 363 | // we can just inject directly into the WP_Query object |
364 | - $WP_Query->query['post_status'] = array( 'publish', 'private', 'draft', 'pending' ); |
|
364 | + $WP_Query->query['post_status'] = array('publish', 'private', 'draft', 'pending'); |
|
365 | 365 | // now set the main 'ee' request var so that the appropriate module can load the appropriate template(s) |
366 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] ); |
|
366 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']); |
|
367 | 367 | } |
368 | - $this->_possibly_set_ee_request_var( $post_type ); |
|
368 | + $this->_possibly_set_ee_request_var($post_type); |
|
369 | 369 | // convert post_type to model name |
370 | - $model_name = str_replace( 'EE_', '', $this->CPT['class_name'] ); |
|
370 | + $model_name = str_replace('EE_', '', $this->CPT['class_name']); |
|
371 | 371 | // get CPT table data via CPT Model |
372 | - $this->CPT_model = EE_Registry::instance()->load_model( $model_name ); |
|
372 | + $this->CPT_model = EE_Registry::instance()->load_model($model_name); |
|
373 | 373 | $this->CPT['tables'] = $this->CPT_model->get_tables(); |
374 | 374 | // is there a Meta Table for this CPT? |
375 | - $this->CPT['meta_table'] = isset( $this->CPT['tables'][ $model_name . '_Meta' ] ) ? $this->CPT['tables'][ $model_name . '_Meta' ] : FALSE; |
|
375 | + $this->CPT['meta_table'] = isset($this->CPT['tables'][$model_name.'_Meta']) ? $this->CPT['tables'][$model_name.'_Meta'] : FALSE; |
|
376 | 376 | // creates classname like: CPT_Event_Strategy |
377 | - $CPT_Strategy_class_name = 'CPT_' . $model_name . '_Strategy'; |
|
377 | + $CPT_Strategy_class_name = 'CPT_'.$model_name.'_Strategy'; |
|
378 | 378 | // load and instantiate |
379 | - $CPT_Strategy = EE_Registry::instance()->load_core ( $CPT_Strategy_class_name, array( 'WP_Query' => $WP_Query, 'CPT' => $this->CPT )); |
|
379 | + $CPT_Strategy = EE_Registry::instance()->load_core($CPT_Strategy_class_name, array('WP_Query' => $WP_Query, 'CPT' => $this->CPT)); |
|
380 | 380 | |
381 | 381 | // !!!!!!!!!! IMPORTANT !!!!!!!!!!!! |
382 | 382 | // here's the list of available filters in the WP_Query object |
@@ -388,13 +388,13 @@ discard block |
||
388 | 388 | // 'post_limits' |
389 | 389 | // 'posts_fields' |
390 | 390 | // 'posts_join' |
391 | - add_filter( 'posts_fields', array( $this, 'posts_fields' )); |
|
392 | - add_filter( 'posts_join', array( $this, 'posts_join' )); |
|
393 | - add_filter( 'get_' . $this->CPT['post_type'] . '_metadata', array( $CPT_Strategy, 'get_EE_post_type_metadata' ), 1, 4 ); |
|
394 | - add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 1 ); |
|
395 | - add_filter( 'get_edit_post_link', array( $this, 'get_edit_post_link' ), 10, 2 ); |
|
391 | + add_filter('posts_fields', array($this, 'posts_fields')); |
|
392 | + add_filter('posts_join', array($this, 'posts_join')); |
|
393 | + add_filter('get_'.$this->CPT['post_type'].'_metadata', array($CPT_Strategy, 'get_EE_post_type_metadata'), 1, 4); |
|
394 | + add_filter('the_posts', array($this, 'the_posts'), 1, 1); |
|
395 | + add_filter('get_edit_post_link', array($this, 'get_edit_post_link'), 10, 2); |
|
396 | 396 | |
397 | - $this->_do_template_filters( $WP_Query ); |
|
397 | + $this->_do_template_filters($WP_Query); |
|
398 | 398 | } |
399 | 399 | } |
400 | 400 | } |
@@ -409,13 +409,13 @@ discard block |
||
409 | 409 | * @param $SQL |
410 | 410 | * @return string |
411 | 411 | */ |
412 | - public function posts_fields( $SQL ) { |
|
412 | + public function posts_fields($SQL) { |
|
413 | 413 | // does this CPT have a meta table ? |
414 | - if ( ! empty( $this->CPT['meta_table'] )) { |
|
414 | + if ( ! empty($this->CPT['meta_table'])) { |
|
415 | 415 | // adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement |
416 | - $SQL .= ', ' . $this->CPT['meta_table']->get_table_name() . '.* ' ; |
|
416 | + $SQL .= ', '.$this->CPT['meta_table']->get_table_name().'.* '; |
|
417 | 417 | } |
418 | - remove_filter( 'posts_fields', array( $this, 'posts_fields' )); |
|
418 | + remove_filter('posts_fields', array($this, 'posts_fields')); |
|
419 | 419 | return $SQL; |
420 | 420 | } |
421 | 421 | |
@@ -428,14 +428,14 @@ discard block |
||
428 | 428 | * @param $SQL |
429 | 429 | * @return string |
430 | 430 | */ |
431 | - public function posts_join( $SQL ) { |
|
431 | + public function posts_join($SQL) { |
|
432 | 432 | // does this CPT have a meta table ? |
433 | - if ( ! empty( $this->CPT['meta_table'] )) { |
|
433 | + if ( ! empty($this->CPT['meta_table'])) { |
|
434 | 434 | global $wpdb; |
435 | 435 | // adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement |
436 | - $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 ) '; |
|
436 | + $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 ) '; |
|
437 | 437 | } |
438 | - remove_filter( 'posts_join', array( $this, 'posts_join' )); |
|
438 | + remove_filter('posts_join', array($this, 'posts_join')); |
|
439 | 439 | return $SQL; |
440 | 440 | } |
441 | 441 | |
@@ -448,18 +448,18 @@ discard block |
||
448 | 448 | * @param \WP_Post[] $posts |
449 | 449 | * @return \WP_Post[] |
450 | 450 | */ |
451 | - public function the_posts( $posts ) { |
|
451 | + public function the_posts($posts) { |
|
452 | 452 | // d( $posts ); |
453 | 453 | $CPT_class = $this->CPT['class_name']; |
454 | 454 | // loop thru posts |
455 | - if ( is_array( $posts )) { |
|
456 | - foreach( $posts as $key => $post ) { |
|
457 | - if ( isset( $this->_CPTs[ $post->post_type ] )) { |
|
458 | - $post->$CPT_class = $this->CPT_model->instantiate_class_from_post_object( $post ); |
|
455 | + if (is_array($posts)) { |
|
456 | + foreach ($posts as $key => $post) { |
|
457 | + if (isset($this->_CPTs[$post->post_type])) { |
|
458 | + $post->$CPT_class = $this->CPT_model->instantiate_class_from_post_object($post); |
|
459 | 459 | } |
460 | 460 | } |
461 | 461 | } |
462 | - remove_filter( 'the_posts', array( $this, 'the_posts' ), 1, 1 ); |
|
462 | + remove_filter('the_posts', array($this, 'the_posts'), 1, 1); |
|
463 | 463 | return $posts; |
464 | 464 | } |
465 | 465 | |
@@ -470,17 +470,17 @@ discard block |
||
470 | 470 | * @param $ID |
471 | 471 | * @return string |
472 | 472 | */ |
473 | - function get_edit_post_link( $url, $ID ) { |
|
473 | + function get_edit_post_link($url, $ID) { |
|
474 | 474 | //need to make sure we only edit links if our cpt |
475 | 475 | global $post; |
476 | - if ( ! isset( $this->_CPTs[ $post->post_type ] )) { |
|
476 | + if ( ! isset($this->_CPTs[$post->post_type])) { |
|
477 | 477 | return $url; |
478 | 478 | } |
479 | 479 | //k made it here so all is good. |
480 | 480 | $scheme = is_ssl() ? 'https' : 'http'; |
481 | - $url = get_admin_url( EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme ); |
|
481 | + $url = get_admin_url(EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme); |
|
482 | 482 | // http://example.com/wp-admin/admin.php?page=espresso_events&action=edit&post=205&edit_nonce=0d403530d6 |
483 | - return wp_nonce_url( add_query_arg( array( 'page' => $this->CPT['post_type'], 'post' =>$ID, 'action' =>'edit' ), $url ), 'edit', 'edit_nonce' ); |
|
483 | + return wp_nonce_url(add_query_arg(array('page' => $this->CPT['post_type'], 'post' =>$ID, 'action' =>'edit'), $url), 'edit', 'edit_nonce'); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | |
@@ -494,11 +494,11 @@ discard block |
||
494 | 494 | * @param WP_Query $WP_Query |
495 | 495 | * @return void |
496 | 496 | */ |
497 | - protected function _do_template_filters( WP_Query $WP_Query ) { |
|
497 | + protected function _do_template_filters(WP_Query $WP_Query) { |
|
498 | 498 | // if it's the main query and requested cpt supports page_templates, |
499 | - if ( $WP_Query->is_main_query() && ! empty( $this->CPT['args']['page_templates'] ) ) { |
|
499 | + if ($WP_Query->is_main_query() && ! empty($this->CPT['args']['page_templates'])) { |
|
500 | 500 | // then let's hook into the appropriate query_template hook |
501 | - add_filter( 'single_template', array( $this, 'single_cpt_template' ) ); |
|
501 | + add_filter('single_template', array($this, 'single_cpt_template')); |
|
502 | 502 | } |
503 | 503 | } |
504 | 504 | |
@@ -512,17 +512,17 @@ discard block |
||
512 | 512 | * @param string $current_template Existing default template path derived for this page call. |
513 | 513 | * @return string the path to the full template file. |
514 | 514 | */ |
515 | - public function single_cpt_template( $current_template ) { |
|
515 | + public function single_cpt_template($current_template) { |
|
516 | 516 | $object = get_queried_object(); |
517 | 517 | //does this called object HAVE a page template set that is something other than the default. |
518 | - $template = get_post_meta( $object->ID, '_wp_page_template', true ); |
|
518 | + $template = get_post_meta($object->ID, '_wp_page_template', true); |
|
519 | 519 | |
520 | 520 | //exit early if default or not set or invalid path (accounts for theme changes) |
521 | - if ( $template == 'default' || empty( $template ) || ! is_readable( get_stylesheet_directory() . '/' . $template ) ) { |
|
521 | + if ($template == 'default' || empty($template) || ! is_readable(get_stylesheet_directory().'/'.$template)) { |
|
522 | 522 | return $current_template; |
523 | 523 | } |
524 | 524 | //made it here so we SHOULD be able to just locate the template and then return it. |
525 | - $template = locate_template( array($template) ); |
|
525 | + $template = locate_template(array($template)); |
|
526 | 526 | |
527 | 527 | return $template; |
528 | 528 | } |
@@ -570,9 +570,9 @@ discard block |
||
570 | 570 | * @param array $arguments |
571 | 571 | * @return \EE_CPT_Default_Strategy |
572 | 572 | */ |
573 | - public function __construct( $arguments = array() ) { |
|
574 | - $this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL; |
|
575 | - $WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL; |
|
573 | + public function __construct($arguments = array()) { |
|
574 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL; |
|
575 | + $WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL; |
|
576 | 576 | //EEH_Debug_Tools::printr( $this->CPT, '$this->CPT <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
577 | 577 | // add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ), 999 ); |
578 | 578 | // add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 ); |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | * @param \WP_Query $WP_Query |
588 | 588 | * @return \WP_Query |
589 | 589 | */ |
590 | - public function pre_get_posts( WP_Query $WP_Query ) { |
|
590 | + public function pre_get_posts(WP_Query $WP_Query) { |
|
591 | 591 | //EEH_Debug_Tools::printr( $WP_Query, '$WP_Query <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
592 | - if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive() ) { |
|
592 | + if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) { |
|
593 | 593 | return $WP_Query; |
594 | 594 | } |
595 | 595 | // $WP_Query->set( 'post_type', array( $this->CPT['post_type'] )); |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | * @param \WP_Query $WP_Query |
608 | 608 | * @return \WP_Post[] |
609 | 609 | */ |
610 | - public function the_posts( $posts, WP_Query $WP_Query ) { |
|
610 | + public function the_posts($posts, WP_Query $WP_Query) { |
|
611 | 611 | return $posts; |
612 | 612 | } |
613 | 613 | |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | * @param string $single |
624 | 624 | * @return mixed |
625 | 625 | */ |
626 | - public function get_EE_post_type_metadata( $meta_value = NULL, $post_id, $meta_key, $single ) { |
|
626 | + public function get_EE_post_type_metadata($meta_value = NULL, $post_id, $meta_key, $single) { |
|
627 | 627 | return $meta_value; |
628 | 628 | } |
629 | 629 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -39,15 +39,15 @@ discard block |
||
39 | 39 | * @param array $arguments |
40 | 40 | * @return \EE_CPT_Venue_Strategy |
41 | 41 | */ |
42 | - public function __construct( $arguments = array() ) { |
|
43 | - $this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL; |
|
44 | - $WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL; |
|
45 | - if ( $WP_Query instanceof WP_Query && ! $WP_Query->is_tag ) { |
|
46 | - $WP_Query->is_espresso_venue_single = is_singular() && isset( $WP_Query->query->post_type ) && $WP_Query->query->post_type == 'espresso_venues' ? TRUE : FALSE; |
|
42 | + public function __construct($arguments = array()) { |
|
43 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL; |
|
44 | + $WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL; |
|
45 | + if ($WP_Query instanceof WP_Query && ! $WP_Query->is_tag) { |
|
46 | + $WP_Query->is_espresso_venue_single = is_singular() && isset($WP_Query->query->post_type) && $WP_Query->query->post_type == 'espresso_venues' ? TRUE : FALSE; |
|
47 | 47 | $WP_Query->is_espresso_venue_archive = is_post_type_archive('espresso_venues') ? TRUE : FALSE; |
48 | - $WP_Query->is_espresso_venue_taxonomy = is_tax( 'espresso_venue_categories' ) ? TRUE : FALSE; |
|
48 | + $WP_Query->is_espresso_venue_taxonomy = is_tax('espresso_venue_categories') ? TRUE : FALSE; |
|
49 | 49 | } |
50 | - add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 ); |
|
50 | + add_filter('the_posts', array($this, 'the_posts'), 1, 2); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | * @param WP_Query $wp_query |
61 | 61 | * @return void |
62 | 62 | */ |
63 | - public function the_posts( $posts, WP_Query $wp_query) { |
|
63 | + public function the_posts($posts, WP_Query $wp_query) { |
|
64 | 64 | // automagically load the EEH_Venue_View helper so that it's functions are available |
65 | 65 | EE_Registry::instance()->load_helper('Venue_View'); |
66 | - if ( isset( EE_Registry::instance()->CFG->map_settings->use_google_maps ) && EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
67 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
66 | + if (isset(EE_Registry::instance()->CFG->map_settings->use_google_maps) && EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
67 | + EE_Registry::instance()->load_helper('Maps'); |
|
68 | 68 | EEH_Maps::espresso_google_map_js(); |
69 | 69 | } |
70 | - remove_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 ); |
|
70 | + remove_filter('the_posts', array($this, 'the_posts'), 1, 2); |
|
71 | 71 | return $posts; |
72 | 72 | } |
73 | 73 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * |
4 | 6 | * EE_Register_CPTs |
@@ -353,8 +355,9 @@ discard block |
||
353 | 355 | $CPTs = self::get_CPTs(); |
354 | 356 | $private_CPTs = array(); |
355 | 357 | foreach ( $CPTs as $CPT => $details ) { |
356 | - if ( empty( $details['args']['public'] ) ) |
|
357 | - $private_CPTs[ $CPT ] = $details; |
|
358 | + if ( empty( $details['args']['public'] ) ) { |
|
359 | + $private_CPTs[ $CPT ] = $details; |
|
360 | + } |
|
358 | 361 | } |
359 | 362 | return $private_CPTs; |
360 | 363 | } |
@@ -534,8 +537,10 @@ discard block |
||
534 | 537 | * @return void |
535 | 538 | */ |
536 | 539 | function save_default_term( $post_id, $post ) { |
537 | - if ( empty( $this->_default_terms ) ) |
|
538 | - return; //no default terms set so lets just exit. |
|
540 | + if ( empty( $this->_default_terms ) ) { |
|
541 | + return; |
|
542 | + } |
|
543 | + //no default terms set so lets just exit. |
|
539 | 544 | |
540 | 545 | foreach ( $this->_default_terms as $defaults ) { |
541 | 546 | foreach ( $defaults as $default_obj ) { |
@@ -23,33 +23,33 @@ discard block |
||
23 | 23 | * constructor |
24 | 24 | * instantiated at init priority 5 |
25 | 25 | */ |
26 | - function __construct(){ |
|
26 | + function __construct() { |
|
27 | 27 | // register taxonomies |
28 | 28 | $taxonomies = self::get_taxonomies(); |
29 | - foreach ( $taxonomies as $taxonomy => $tax ) { |
|
30 | - $this->register_taxonomy( $taxonomy, $tax['singular_name'], $tax['plural_name'], $tax['args'] ); |
|
29 | + foreach ($taxonomies as $taxonomy => $tax) { |
|
30 | + $this->register_taxonomy($taxonomy, $tax['singular_name'], $tax['plural_name'], $tax['args']); |
|
31 | 31 | } |
32 | 32 | // register CPTs |
33 | - $CPTs =self::get_CPTs(); |
|
34 | - foreach ( $CPTs as $CPT_name => $CPT ) { |
|
35 | - $this->register_CPT( $CPT_name, $CPT['singular_name'], $CPT['plural_name'], $CPT['args'], $CPT['singular_slug'], $CPT['plural_slug'] ); |
|
33 | + $CPTs = self::get_CPTs(); |
|
34 | + foreach ($CPTs as $CPT_name => $CPT) { |
|
35 | + $this->register_CPT($CPT_name, $CPT['singular_name'], $CPT['plural_name'], $CPT['args'], $CPT['singular_slug'], $CPT['plural_slug']); |
|
36 | 36 | } |
37 | 37 | // setup default terms in any of our taxonomies (but only if we're in admin). |
38 | 38 | // Why not added via register_activation_hook? |
39 | 39 | // Because it's possible that in future iterations of EE we may add new defaults for specialized taxonomies (think event_types) and register_activation_hook only reliably runs when a user manually activates the plugin. |
40 | 40 | // Keep in mind that this will READ these terms if they are deleted by the user. Hence MUST use terms. |
41 | - if ( is_admin() ) { |
|
41 | + if (is_admin()) { |
|
42 | 42 | $this->set_must_use_event_types(); |
43 | 43 | } |
44 | 44 | //set default terms |
45 | - $this->set_default_term( 'espresso_event_type', 'single-event', array('espresso_events') ); |
|
45 | + $this->set_default_term('espresso_event_type', 'single-event', array('espresso_events')); |
|
46 | 46 | |
47 | 47 | |
48 | - add_action( 'AHEE__EE_System__initialize_last', array( __CLASS__, 'maybe_flush_rewrite_rules' ), 10 ); |
|
48 | + add_action('AHEE__EE_System__initialize_last', array(__CLASS__, 'maybe_flush_rewrite_rules'), 10); |
|
49 | 49 | |
50 | 50 | //hook into save_post so that we can make sure that the default terms get saved on publish of registered cpts IF they don't have a term for that taxonomy set. |
51 | - add_action('save_post', array( $this, 'save_default_term' ), 100, 2 ); |
|
52 | - do_action( 'AHEE__EE_Register_CPTs__construct_end', $this ); |
|
51 | + add_action('save_post', array($this, 'save_default_term'), 100, 2); |
|
52 | + do_action('AHEE__EE_Register_CPTs__construct_end', $this); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | * @return void |
63 | 63 | */ |
64 | 64 | public static function maybe_flush_rewrite_rules() { |
65 | - if ( get_option( 'ee_flush_rewrite_rules', TRUE )) { |
|
65 | + if (get_option('ee_flush_rewrite_rules', TRUE)) { |
|
66 | 66 | flush_rewrite_rules(); |
67 | - update_option( 'ee_flush_rewrite_rules', FALSE ); |
|
67 | + update_option('ee_flush_rewrite_rules', FALSE); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | * @access public |
79 | 79 | * @return array |
80 | 80 | */ |
81 | - public static function get_taxonomies(){ |
|
81 | + public static function get_taxonomies() { |
|
82 | 82 | // define taxonomies |
83 | - return apply_filters( 'FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array( |
|
83 | + return apply_filters('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array( |
|
84 | 84 | 'espresso_event_categories' => array( |
85 | 85 | 'singular_name' => __("Event Category", "event_espresso"), |
86 | 86 | 'plural_name' => __("Event Categories", "event_espresso"), |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | 'delete_terms' => 'ee_delete_event_category', |
94 | 94 | 'assign_terms' => 'ee_assign_event_category' |
95 | 95 | ), |
96 | - 'rewrite' => array( 'slug' => __( 'event-category', 'event_espresso' )) |
|
96 | + 'rewrite' => array('slug' => __('event-category', 'event_espresso')) |
|
97 | 97 | )), |
98 | 98 | 'espresso_venue_categories' => array( |
99 | 99 | 'singular_name' => __("Venue Category", "event_espresso"), |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | 'delete_terms' => 'ee_delete_venue_category', |
108 | 108 | 'assign_terms' => 'ee_assign_venue_category' |
109 | 109 | ), |
110 | - 'rewrite' => array( 'slug' => __( 'venue-category', 'event_espresso' )) |
|
110 | + 'rewrite' => array('slug' => __('venue-category', 'event_espresso')) |
|
111 | 111 | )), |
112 | 112 | 'espresso_event_type' => array( |
113 | 113 | 'singular_name' => __("Event Type", "event_espresso"), |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | 'delete_terms' => 'ee_delete_event_type', |
122 | 122 | 'assign_terms' => 'ee_assign_event_type' |
123 | 123 | ), |
124 | - 'rewrite' => array( 'slug' => __( 'event-type', 'event_espresso' )), |
|
124 | + 'rewrite' => array('slug' => __('event-type', 'event_espresso')), |
|
125 | 125 | 'hierarchical'=>true |
126 | 126 | )) |
127 | - ) ); |
|
127 | + )); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | |
@@ -142,26 +142,26 @@ discard block |
||
142 | 142 | * @return array Empty array if no matching model names for the given slug or an array of model |
143 | 143 | * names indexed by post type slug. |
144 | 144 | */ |
145 | - public static function get_cpt_model_names( $post_type_slug = '' ) { |
|
145 | + public static function get_cpt_model_names($post_type_slug = '') { |
|
146 | 146 | $cpts = self::get_CPTs(); |
147 | 147 | |
148 | 148 | //first if slug passed in... |
149 | - if ( ! empty( $post_type_slug ) ) { |
|
149 | + if ( ! empty($post_type_slug)) { |
|
150 | 150 | //match? |
151 | - if ( ! isset( $cpts[$post_type_slug] ) || ( isset( $cpts[$post_type_slug] ) && empty( $cpts[$post_type_slug]['class_name'] ) ) ) { |
|
151 | + if ( ! isset($cpts[$post_type_slug]) || (isset($cpts[$post_type_slug]) && empty($cpts[$post_type_slug]['class_name']))) { |
|
152 | 152 | return array(); |
153 | 153 | } |
154 | 154 | |
155 | 155 | //k let's get the model name for this cpt. |
156 | - return array( $post_type_slug => str_replace( 'EE', 'EEM', $cpts[$post_type_slug]['class_name'] ) ); |
|
156 | + return array($post_type_slug => str_replace('EE', 'EEM', $cpts[$post_type_slug]['class_name'])); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
160 | 160 | //if we made it here then we're returning an array of cpt model names indexed by post_type_slug. |
161 | 161 | $cpt_models = array(); |
162 | - foreach ( $cpts as $slug => $args ) { |
|
163 | - if ( ! empty( $args['class_name'] ) ) { |
|
164 | - $cpt_models[$slug] = str_replace( 'EE', 'EEM', $args['class_name'] ); |
|
162 | + foreach ($cpts as $slug => $args) { |
|
163 | + if ( ! empty($args['class_name'])) { |
|
164 | + $cpt_models[$slug] = str_replace('EE', 'EEM', $args['class_name']); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | return $cpt_models; |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | * @return EEM_CPT_Base[] successful instantiation will return an array of successfully instantiated EEM |
183 | 183 | * models indexed by post slug. |
184 | 184 | */ |
185 | - public static function instantiate_cpt_models( $post_type_slug = '' ) { |
|
186 | - $cpt_model_names = self::get_cpt_model_names( $post_type_slug ); |
|
185 | + public static function instantiate_cpt_models($post_type_slug = '') { |
|
186 | + $cpt_model_names = self::get_cpt_model_names($post_type_slug); |
|
187 | 187 | $instantiated = array(); |
188 | - foreach ( $cpt_model_names as $slug => $model_name ) { |
|
189 | - $instance = EE_Registry::instance()->load_model( str_replace( 'EEM_', '', $model_name ) ); |
|
190 | - if ( $instance instanceof EEM_CPT_Base ) { |
|
188 | + foreach ($cpt_model_names as $slug => $model_name) { |
|
189 | + $instance = EE_Registry::instance()->load_model(str_replace('EEM_', '', $model_name)); |
|
190 | + if ($instance instanceof EEM_CPT_Base) { |
|
191 | 191 | $instantiated[$slug] = $instance; |
192 | 192 | } |
193 | 193 | } |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | * @access public |
205 | 205 | * @return array |
206 | 206 | */ |
207 | - public static function get_CPTs(){ |
|
207 | + public static function get_CPTs() { |
|
208 | 208 | // define CPTs |
209 | 209 | // NOTE the ['args']['page_templates'] array index is something specific to our CPTs and not part of the WP custom post type api. |
210 | - return apply_filters( 'FHEE__EE_Register_CPTs__get_CPTs__cpts', array( |
|
210 | + return apply_filters('FHEE__EE_Register_CPTs__get_CPTs__cpts', array( |
|
211 | 211 | 'espresso_events' => array( |
212 | 212 | 'singular_name' => __("Event", "event_espresso"), |
213 | 213 | 'plural_name' => __("Events", "event_espresso"), |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | 'publicly_queryable'=> FALSE, |
283 | 283 | 'hierarchical'=> FALSE, |
284 | 284 | 'has_archive' => FALSE, |
285 | - 'taxonomies' => array( 'post_tag' ), |
|
285 | + 'taxonomies' => array('post_tag'), |
|
286 | 286 | 'capability_type' => 'contact', |
287 | 287 | 'capabilities' => array( |
288 | 288 | 'edit_post' => 'ee_edit_contact', |
@@ -299,9 +299,9 @@ discard block |
||
299 | 299 | 'edit_private_posts' => 'ee_edit_contacts', |
300 | 300 | 'edit_published_posts' => 'ee_edit_contacts' |
301 | 301 | ), |
302 | - 'supports' => array( 'editor', 'thumbnail', 'excerpt', 'custom-fields', 'comments' ), |
|
302 | + 'supports' => array('editor', 'thumbnail', 'excerpt', 'custom-fields', 'comments'), |
|
303 | 303 | )) |
304 | - ) ); |
|
304 | + )); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | public static function get_private_CPTs() { |
315 | 315 | $CPTs = self::get_CPTs(); |
316 | 316 | $private_CPTs = array(); |
317 | - foreach ( $CPTs as $CPT => $details ) { |
|
318 | - if ( empty( $details['args']['public'] ) ) |
|
319 | - $private_CPTs[ $CPT ] = $details; |
|
317 | + foreach ($CPTs as $CPT => $details) { |
|
318 | + if (empty($details['args']['public'])) |
|
319 | + $private_CPTs[$CPT] = $details; |
|
320 | 320 | } |
321 | 321 | return $private_CPTs; |
322 | 322 | } |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | * @param string $plural_name internationalized plural name |
335 | 335 | * @param array $override_args like $args on http://codex.wordpress.org/Function_Reference/register_taxonomy |
336 | 336 | */ |
337 | - function register_taxonomy( $taxonomy_name, $singular_name, $plural_name, $override_args = array() ){ |
|
337 | + function register_taxonomy($taxonomy_name, $singular_name, $plural_name, $override_args = array()) { |
|
338 | 338 | |
339 | 339 | $args = array( |
340 | 340 | 'hierarchical' => true, |
@@ -350,15 +350,15 @@ discard block |
||
350 | 350 | //'rewrite' => array( 'slug' => 'genre' ), |
351 | 351 | ); |
352 | 352 | |
353 | - if($override_args){ |
|
354 | - if(isset($override_args['labels'])){ |
|
355 | - $labels = array_merge($args['labels'],$override_args['labels']); |
|
353 | + if ($override_args) { |
|
354 | + if (isset($override_args['labels'])) { |
|
355 | + $labels = array_merge($args['labels'], $override_args['labels']); |
|
356 | 356 | $args['labels'] = $labels; |
357 | 357 | } |
358 | - $args = array_merge($args,$override_args); |
|
358 | + $args = array_merge($args, $override_args); |
|
359 | 359 | |
360 | 360 | } |
361 | - register_taxonomy($taxonomy_name,null, $args); |
|
361 | + register_taxonomy($taxonomy_name, null, $args); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | |
@@ -372,27 +372,27 @@ discard block |
||
372 | 372 | * The default values set in this function will be overridden by whatever you set in $override_args |
373 | 373 | * @return void, but registers the custom post type |
374 | 374 | */ |
375 | - function register_CPT($post_type, $singular_name,$plural_name,$override_args = array(), $singular_slug = '', $plural_slug = '' ) { |
|
375 | + function register_CPT($post_type, $singular_name, $plural_name, $override_args = array(), $singular_slug = '', $plural_slug = '') { |
|
376 | 376 | |
377 | 377 | $labels = array( |
378 | 378 | 'name' => $plural_name, |
379 | 379 | 'singular_name' => $singular_name, |
380 | - 'add_new' => sprintf(__("Add %s", "event_espresso"),$singular_name), |
|
381 | - 'add_new_item' => sprintf(__("Add New %s", "event_espresso"),$singular_name), |
|
382 | - 'edit_item' => sprintf(__("Edit %s", "event_espresso"),$singular_name), |
|
383 | - 'new_item' => sprintf(__("New %s", "event_espresso"),$singular_name), |
|
384 | - 'all_items' => sprintf(__("All %s", "event_espresso"),$plural_name), |
|
385 | - 'view_item' => sprintf(__("View %s", "event_espresso"),$singular_name), |
|
386 | - 'search_items' => sprintf(__("Search %s", "event_espresso"),$plural_name), |
|
387 | - 'not_found' => sprintf(__("No %s found", "event_espresso"),$plural_name), |
|
388 | - 'not_found_in_trash' => sprintf(__("No %s found in Trash", "event_espresso"),$plural_name), |
|
380 | + 'add_new' => sprintf(__("Add %s", "event_espresso"), $singular_name), |
|
381 | + 'add_new_item' => sprintf(__("Add New %s", "event_espresso"), $singular_name), |
|
382 | + 'edit_item' => sprintf(__("Edit %s", "event_espresso"), $singular_name), |
|
383 | + 'new_item' => sprintf(__("New %s", "event_espresso"), $singular_name), |
|
384 | + 'all_items' => sprintf(__("All %s", "event_espresso"), $plural_name), |
|
385 | + 'view_item' => sprintf(__("View %s", "event_espresso"), $singular_name), |
|
386 | + 'search_items' => sprintf(__("Search %s", "event_espresso"), $plural_name), |
|
387 | + 'not_found' => sprintf(__("No %s found", "event_espresso"), $plural_name), |
|
388 | + 'not_found_in_trash' => sprintf(__("No %s found in Trash", "event_espresso"), $plural_name), |
|
389 | 389 | 'parent_item_colon' => '', |
390 | - 'menu_name' => sprintf(__("%s", "event_espresso"),$plural_name) |
|
390 | + 'menu_name' => sprintf(__("%s", "event_espresso"), $plural_name) |
|
391 | 391 | ); |
392 | 392 | |
393 | 393 | //verify plural slug and singular slug, if they aren't we'll use $singular_name and $plural_name |
394 | - $singular_slug = ! empty( $singular_slug ) ? $singular_slug : $singular_name; |
|
395 | - $plural_slug = ! empty( $plural_slug ) ? $plural_slug : $plural_name; |
|
394 | + $singular_slug = ! empty($singular_slug) ? $singular_slug : $singular_name; |
|
395 | + $plural_slug = ! empty($plural_slug) ? $plural_slug : $plural_name; |
|
396 | 396 | |
397 | 397 | |
398 | 398 | //note the page_templates arg in the supports index is something specific to EE. WordPress doesn't actually have that in their register_post_type api. |
@@ -404,24 +404,24 @@ discard block |
||
404 | 404 | 'show_in_menu' => false, |
405 | 405 | 'show_in_nav_menus' => false, |
406 | 406 | 'query_var' => true, |
407 | - 'rewrite' => apply_filters( 'FHEE__EE_Register_CPTs__register_CPT__rewrite', array( 'slug' => $plural_slug ), $post_type ), |
|
407 | + 'rewrite' => apply_filters('FHEE__EE_Register_CPTs__register_CPT__rewrite', array('slug' => $plural_slug), $post_type), |
|
408 | 408 | 'capability_type' => 'post', |
409 | 409 | 'map_meta_cap' => true, |
410 | 410 | 'has_archive' => true, |
411 | 411 | 'hierarchical' => true, |
412 | 412 | 'menu_position' => null, |
413 | - 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments' ) |
|
413 | + 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments') |
|
414 | 414 | ); |
415 | 415 | |
416 | - if($override_args){ |
|
417 | - if(isset($override_args['labels'])){ |
|
418 | - $labels = array_merge($args['labels'],$override_args['labels']); |
|
416 | + if ($override_args) { |
|
417 | + if (isset($override_args['labels'])) { |
|
418 | + $labels = array_merge($args['labels'], $override_args['labels']); |
|
419 | 419 | } |
420 | - $args = array_merge($args,$override_args); |
|
420 | + $args = array_merge($args, $override_args); |
|
421 | 421 | $args['labels'] = $labels; |
422 | 422 | } |
423 | 423 | |
424 | - register_post_type( $post_type, $args ); |
|
424 | + register_post_type($post_type, $args); |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | |
@@ -429,15 +429,15 @@ discard block |
||
429 | 429 | |
430 | 430 | function set_must_use_event_types() { |
431 | 431 | $term_details = array( |
432 | - 'single-event' => array( __('Single Event', 'event_espresso'), __('A single event that spans one or more consecutive days. Attendee\'s register for the first date-time only', 'event_espresso') ), //example: a party or two-day long workshop |
|
432 | + 'single-event' => array(__('Single Event', 'event_espresso'), __('A single event that spans one or more consecutive days. Attendee\'s register for the first date-time only', 'event_espresso')), //example: a party or two-day long workshop |
|
433 | 433 | |
434 | - 'multi-event' => array( __('Multi Event', 'event_espresso'), __('Multiple, separate, but related events that occur on consecutive days. Attendee\'s can register for any of the date-times', 'event_espresso') ), //example: a three day music festival or week long conference |
|
434 | + 'multi-event' => array(__('Multi Event', 'event_espresso'), __('Multiple, separate, but related events that occur on consecutive days. Attendee\'s can register for any of the date-times', 'event_espresso')), //example: a three day music festival or week long conference |
|
435 | 435 | |
436 | - 'event-series' => array( __('Event Series', 'event_espresso'), __(' Multiple events that occur over multiple non-consecutive days. Attendee\'s register for the first date-time only', 'event_espresso') ), //example: an 8 week introduction to basket weaving course |
|
436 | + 'event-series' => array(__('Event Series', 'event_espresso'), __(' Multiple events that occur over multiple non-consecutive days. Attendee\'s register for the first date-time only', 'event_espresso')), //example: an 8 week introduction to basket weaving course |
|
437 | 437 | |
438 | - 'recurring-event' => array( __('Recurring Event', 'event_espresso'), __('Multiple events that occur over multiple non-consecutive days. Attendee\'s can register for any of the date-times.', 'event_espresso') ), //example: a yoga class |
|
438 | + 'recurring-event' => array(__('Recurring Event', 'event_espresso'), __('Multiple events that occur over multiple non-consecutive days. Attendee\'s can register for any of the date-times.', 'event_espresso')), //example: a yoga class |
|
439 | 439 | |
440 | - 'ongoing' => array( __('Ongoing Event', 'event_espresso'), __('An "event" that people can purchase tickets to gain access for anytime for this event regardless of date times on the event', 'event_espresso') ) //example: access to a museum |
|
440 | + 'ongoing' => array(__('Ongoing Event', 'event_espresso'), __('An "event" that people can purchase tickets to gain access for anytime for this event regardless of date times on the event', 'event_espresso')) //example: access to a museum |
|
441 | 441 | |
442 | 442 | //'walk-in' => array( __('Walk In', 'event_espresso'), __('Single datetime and single entry recurring events. Attendees register for one or multiple datetimes individually.', 'event_espresso') ), |
443 | 443 | //'reservation' => array( __('Reservation', 'event_espresso'), __('Reservations are created by specifying available datetimes and quantities. Attendees choose from the available datetimes and specify the quantity available (if the maximum is greater than 1)') ), //@TODO to avoid confusion we'll implement this in a later iteration > EE4.1 |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | //'appointment' => array( __('Appointments', 'event_espresso'), __('Time slotted events where datetimes are generally in hours or minutes. For example, attendees can register for a single 15 minute or 1 hour time slot and this type of availability frequently reoccurs.', 'event_espresso') ) |
446 | 446 | |
447 | 447 | ); |
448 | - $this->set_must_use_terms( 'espresso_event_type', $term_details ); |
|
448 | + $this->set_must_use_terms('espresso_event_type', $term_details); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | |
@@ -459,16 +459,16 @@ discard block |
||
459 | 459 | * |
460 | 460 | * @return void |
461 | 461 | */ |
462 | - function set_must_use_terms( $taxonomy, $term_details ) { |
|
462 | + function set_must_use_terms($taxonomy, $term_details) { |
|
463 | 463 | $term_details = (array) $term_details; |
464 | 464 | |
465 | - foreach ( $term_details as $slug => $details ) { |
|
466 | - if ( !term_exists( $slug, $taxonomy ) ) { |
|
465 | + foreach ($term_details as $slug => $details) { |
|
466 | + if ( ! term_exists($slug, $taxonomy)) { |
|
467 | 467 | $insert_arr = array( |
468 | 468 | 'slug' => $slug, |
469 | 469 | 'description' => $details[1] |
470 | 470 | ); |
471 | - wp_insert_term( $details[0], $taxonomy, $insert_arr ); |
|
471 | + wp_insert_term($details[0], $taxonomy, $insert_arr); |
|
472 | 472 | } |
473 | 473 | } |
474 | 474 | } |
@@ -482,8 +482,8 @@ discard block |
||
482 | 482 | * @param string $term_slug The slug of the term that will be the default. |
483 | 483 | * @param array $cpt_slugs An array of custom post types we want the default assigned to |
484 | 484 | */ |
485 | - function set_default_term( $taxonomy, $term_slug, $cpt_slugs = array() ) { |
|
486 | - $this->_default_terms[][$term_slug] = new EE_Default_Term( $taxonomy, $term_slug, $cpt_slugs ); |
|
485 | + function set_default_term($taxonomy, $term_slug, $cpt_slugs = array()) { |
|
486 | + $this->_default_terms[][$term_slug] = new EE_Default_Term($taxonomy, $term_slug, $cpt_slugs); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | |
@@ -495,20 +495,20 @@ discard block |
||
495 | 495 | * @param object $post Post object |
496 | 496 | * @return void |
497 | 497 | */ |
498 | - function save_default_term( $post_id, $post ) { |
|
499 | - if ( empty( $this->_default_terms ) ) |
|
498 | + function save_default_term($post_id, $post) { |
|
499 | + if (empty($this->_default_terms)) |
|
500 | 500 | return; //no default terms set so lets just exit. |
501 | 501 | |
502 | - foreach ( $this->_default_terms as $defaults ) { |
|
503 | - foreach ( $defaults as $default_obj ) { |
|
504 | - if ( $post->post_status == 'publish' && in_array( $post->post_type, $default_obj->cpt_slugs ) ) { |
|
502 | + foreach ($this->_default_terms as $defaults) { |
|
503 | + foreach ($defaults as $default_obj) { |
|
504 | + if ($post->post_status == 'publish' && in_array($post->post_type, $default_obj->cpt_slugs)) { |
|
505 | 505 | |
506 | 506 | //note some error proofing going on here to save unnecessary db queries |
507 | - $taxonomies = get_object_taxonomies( $post->post_type ); |
|
508 | - foreach ( (array) $taxonomies as $taxonomy ) { |
|
509 | - $terms = wp_get_post_terms( $post_id, $taxonomy); |
|
510 | - if ( empty( $terms ) && $taxonomy == $default_obj->taxonomy ) { |
|
511 | - wp_set_object_terms( $post_id, array( $default_obj->term_slug ), $taxonomy ); |
|
507 | + $taxonomies = get_object_taxonomies($post->post_type); |
|
508 | + foreach ((array) $taxonomies as $taxonomy) { |
|
509 | + $terms = wp_get_post_terms($post_id, $taxonomy); |
|
510 | + if (empty($terms) && $taxonomy == $default_obj->taxonomy) { |
|
511 | + wp_set_object_terms($post_id, array($default_obj->term_slug), $taxonomy); |
|
512 | 512 | } |
513 | 513 | } |
514 | 514 | } |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | * @param string $term_slug The slug of the term that will be the default. |
541 | 541 | * @param array $cpt_slugs The custom post type the default term gets saved with |
542 | 542 | */ |
543 | - public function __construct( $taxonomy, $term_slug, $cpt_slugs = array() ) { |
|
543 | + public function __construct($taxonomy, $term_slug, $cpt_slugs = array()) { |
|
544 | 544 | $this->taxonomy = $taxonomy; |
545 | 545 | $this->cpt_slugs = (array) $cpt_slugs; |
546 | 546 | $this->term_slug = $term_slug; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @var WP $WP |
74 | 74 | * @return void |
75 | 75 | */ |
76 | - public abstract function run( $WP ); |
|
76 | + public abstract function run($WP); |
|
77 | 77 | |
78 | 78 | |
79 | 79 | |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | * @param $module_name |
97 | 97 | * @return EED_Module |
98 | 98 | */ |
99 | - protected static function get_instance( $module_name = '' ) { |
|
100 | - $module_name = ! empty( $module_name ) ? $module_name : get_called_class(); |
|
101 | - if ( ! isset( EE_Registry::instance()->modules->{$module_name} ) || ! EE_Registry::instance()->modules->{$module_name} instanceof EED_Module ) { |
|
102 | - EE_Registry::instance()->add_module( $module_name ); |
|
99 | + protected static function get_instance($module_name = '') { |
|
100 | + $module_name = ! empty($module_name) ? $module_name : get_called_class(); |
|
101 | + if ( ! isset(EE_Registry::instance()->modules->{$module_name} ) || ! EE_Registry::instance()->modules->{$module_name} instanceof EED_Module) { |
|
102 | + EE_Registry::instance()->add_module($module_name); |
|
103 | 103 | } |
104 | - return EE_Registry::instance()->get_module( $module_name ); |
|
104 | + return EE_Registry::instance()->get_module($module_name); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @return string |
114 | 114 | */ |
115 | 115 | public function module_name() { |
116 | - return get_class( $this ); |
|
116 | + return get_class($this); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -229,15 +229,15 @@ |
||
229 | 229 | */ |
230 | 230 | interface EEHI_Money{ |
231 | 231 | /** |
232 | - * For comparing floats. Default operator is '=', but see the $operator below for all options. |
|
233 | - * This should be used to compare floats instead of normal '==' because floats |
|
234 | - * are inherently inprecise, and so you can sometimes have two floats that appear to be identical |
|
235 | - * but actually differ by 0.00000001. |
|
236 | - * @param float $float1 |
|
237 | - * @param float $float2 |
|
238 | - * $param string $operator The operator. Valid options are =, <=, <, >=, >, <>, eq, lt, lte, gt, gte, ne |
|
239 | - * @return boolean whether the equation is true or false |
|
240 | - */ |
|
232 | + * For comparing floats. Default operator is '=', but see the $operator below for all options. |
|
233 | + * This should be used to compare floats instead of normal '==' because floats |
|
234 | + * are inherently inprecise, and so you can sometimes have two floats that appear to be identical |
|
235 | + * but actually differ by 0.00000001. |
|
236 | + * @param float $float1 |
|
237 | + * @param float $float2 |
|
238 | + * $param string $operator The operator. Valid options are =, <=, <, >=, >, <>, eq, lt, lte, gt, gte, ne |
|
239 | + * @return boolean whether the equation is true or false |
|
240 | + */ |
|
241 | 241 | function compare_floats( $float1, $float2, $operator='=' ); |
242 | 242 | } |
243 | 243 |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | /** |
6 | 6 | * Interface EEI_Base |
7 | 7 | */ |
8 | -interface EEI_Base{ |
|
8 | +interface EEI_Base { |
|
9 | 9 | /** |
10 | 10 | * gets the unique ID of the model object. If it hasn't been saved yet |
11 | 11 | * to the database, this should be 0 or NULL |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * Interface EEI_Line_Item |
71 | 71 | */ |
72 | -interface EEI_Line_Item{ |
|
72 | +interface EEI_Line_Item { |
|
73 | 73 | /** |
74 | 74 | * @return string |
75 | 75 | */ |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @param int $txn_id if none is provided, assumes $this->TXN_ID() |
130 | 130 | * @return int count of items saved |
131 | 131 | */ |
132 | - public function save_this_and_descendants_to_txn( $txn_id = NULL ); |
|
132 | + public function save_this_and_descendants_to_txn($txn_id = NULL); |
|
133 | 133 | |
134 | 134 | /** |
135 | 135 | * Indicates whether or not taxes should apply to this line item |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @param string $zip |
257 | 257 | * @param string mixed |
258 | 258 | */ |
259 | - public function format( $address, $address2, $city, $state, $country, $zip ); |
|
259 | + public function format($address, $address2, $city, $state, $country, $zip); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | |
@@ -266,13 +266,13 @@ discard block |
||
266 | 266 | /** |
267 | 267 | * Interface EEHI_Line_Item |
268 | 268 | */ |
269 | -interface EEHI_Line_Item{ |
|
269 | +interface EEHI_Line_Item { |
|
270 | 270 | /** |
271 | 271 | * Adds an item to the purchase in the right spot |
272 | 272 | * @param EE_Line_Item $total_line_item |
273 | 273 | * @param EE_Line_Item $line_item |
274 | 274 | */ |
275 | - public function add_item( EE_line_Item $total_line_item, EE_Line_Item $line_item ); |
|
275 | + public function add_item(EE_line_Item $total_line_item, EE_Line_Item $line_item); |
|
276 | 276 | /** |
277 | 277 | * Overwrites the previous tax by clearing out the old taxes, and creates a new |
278 | 278 | * tax and updates the total line item accordingly |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * @param string $description |
283 | 283 | * @return EE_Line_Item the new tax created |
284 | 284 | */ |
285 | - public function set_total_tax_to( EE_Line_Item $total_line_item, $amount, $name = NULL, $description = NULL ); |
|
285 | + public function set_total_tax_to(EE_Line_Item $total_line_item, $amount, $name = NULL, $description = NULL); |
|
286 | 286 | |
287 | 287 | /** |
288 | 288 | * Adds a simple item ( unrelated to any other model object) to the total line item, |
@@ -295,14 +295,14 @@ discard block |
||
295 | 295 | * @param boolean $taxable |
296 | 296 | * @return boolean success |
297 | 297 | */ |
298 | - public function add_unrelated_item( EE_Line_Item $total_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE ); |
|
298 | + public function add_unrelated_item(EE_Line_Item $total_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | |
302 | 302 | /** |
303 | 303 | * Money-related helper |
304 | 304 | */ |
305 | -interface EEHI_Money{ |
|
305 | +interface EEHI_Money { |
|
306 | 306 | /** |
307 | 307 | * For comparing floats. Default operator is '=', but see the $operator below for all options. |
308 | 308 | * This should be used to compare floats instead of normal '==' because floats |
@@ -313,13 +313,13 @@ discard block |
||
313 | 313 | * $param string $operator The operator. Valid options are =, <=, <, >=, >, <>, eq, lt, lte, gt, gte, ne |
314 | 314 | * @return boolean whether the equation is true or false |
315 | 315 | */ |
316 | - function compare_floats( $float1, $float2, $operator='=' ); |
|
316 | + function compare_floats($float1, $float2, $operator = '='); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
320 | 320 | * Interface EEHI_Template |
321 | 321 | */ |
322 | -interface EEHI_Template{ |
|
322 | +interface EEHI_Template { |
|
323 | 323 | |
324 | 324 | /** |
325 | 325 | * EEH_Template::format_currency |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @param string $cur_code_span_class |
333 | 333 | * @return string the html output for the formatted money value |
334 | 334 | */ |
335 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ); |
|
335 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code'); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | * @param array $options |
348 | 348 | * @return mixed |
349 | 349 | */ |
350 | - public function display_line_item( EE_Line_Item $line_item, $options = array() ); |
|
350 | + public function display_line_item(EE_Line_Item $line_item, $options = array()); |
|
351 | 351 | |
352 | 352 | } |
353 | 353 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @param WP $WP |
38 | 38 | * @return void |
39 | 39 | */ |
40 | - public abstract function run( WP $WP ); |
|
40 | + public abstract function run(WP $WP); |
|
41 | 41 | |
42 | 42 | |
43 | 43 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param array $attributes |
50 | 50 | * @return mixed |
51 | 51 | */ |
52 | - public abstract function process_shortcode( $attributes = array() ); |
|
52 | + public abstract function process_shortcode($attributes = array()); |
|
53 | 53 | |
54 | 54 | |
55 | 55 | |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | * @param string $shortcode_class |
61 | 61 | * @return \EES_Shortcode |
62 | 62 | */ |
63 | - final public static function instance( $shortcode_class = NULL ) { |
|
64 | - $shortcode_class = ! empty( $shortcode_class ) ? $shortcode_class : get_called_class(); |
|
65 | - if ( $shortcode_class == 'EES_Shortcode' || empty( $shortcode_class )) { |
|
63 | + final public static function instance($shortcode_class = NULL) { |
|
64 | + $shortcode_class = ! empty($shortcode_class) ? $shortcode_class : get_called_class(); |
|
65 | + if ($shortcode_class == 'EES_Shortcode' || empty($shortcode_class)) { |
|
66 | 66 | return NULL; |
67 | 67 | } |
68 | - $shortcode = str_replace( 'EES_', '', strtoupper( $shortcode_class )); |
|
69 | - $shortcode_obj = isset( EE_Registry::instance()->shortcodes->$shortcode ) ? EE_Registry::instance()->shortcodes->$shortcode : NULL; |
|
68 | + $shortcode = str_replace('EES_', '', strtoupper($shortcode_class)); |
|
69 | + $shortcode_obj = isset(EE_Registry::instance()->shortcodes->$shortcode) ? EE_Registry::instance()->shortcodes->$shortcode : NULL; |
|
70 | 70 | return $shortcode_obj instanceof $shortcode_class || $shortcode_class == 'self' ? $shortcode_obj : new $shortcode_class(); |
71 | 71 | } |
72 | 72 | |
@@ -81,20 +81,20 @@ discard block |
||
81 | 81 | * @param $attributes |
82 | 82 | * @return mixed |
83 | 83 | */ |
84 | - final public static function fallback_shortcode_processor( $attributes ) { |
|
84 | + final public static function fallback_shortcode_processor($attributes) { |
|
85 | 85 | // what shortcode was actually parsed ? |
86 | 86 | $shortcode_class = get_called_class(); |
87 | 87 | // notify rest of system that fallback processor was triggered |
88 | - add_filter( 'FHEE__fallback_shortcode_processor__' . $shortcode_class, '__return_true' ); |
|
88 | + add_filter('FHEE__fallback_shortcode_processor__'.$shortcode_class, '__return_true'); |
|
89 | 89 | // get instance of actual shortcode |
90 | - $shortcode_obj = self::instance( $shortcode_class ); |
|
90 | + $shortcode_obj = self::instance($shortcode_class); |
|
91 | 91 | // verify class |
92 | - if ( $shortcode_obj instanceof EES_Shortcode ) { |
|
92 | + if ($shortcode_obj instanceof EES_Shortcode) { |
|
93 | 93 | global $wp; |
94 | - $shortcode_obj->run( $wp ); |
|
94 | + $shortcode_obj->run($wp); |
|
95 | 95 | // set attributes and run the shortcode |
96 | - $shortcode_obj->_attributes = (array)$attributes; |
|
97 | - return $shortcode_obj->process_shortcode( $shortcode_obj->_attributes ); |
|
96 | + $shortcode_obj->_attributes = (array) $attributes; |
|
97 | + return $shortcode_obj->process_shortcode($shortcode_obj->_attributes); |
|
98 | 98 | } else { |
99 | 99 | return NULL; |
100 | 100 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @param $attributes |
111 | 111 | * @return string |
112 | 112 | */ |
113 | - final public static function invalid_shortcode_processor( $attributes ) { |
|
113 | + final public static function invalid_shortcode_processor($attributes) { |
|
114 | 114 | return ''; |
115 | 115 | } |
116 | 116 | |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | */ |
125 | 125 | final public function __construct() { |
126 | 126 | // get classname, remove EES_prefix, and convert to UPPERCASE |
127 | - $shortcode = strtoupper( str_replace( 'EES_', '', get_class( $this ))); |
|
127 | + $shortcode = strtoupper(str_replace('EES_', '', get_class($this))); |
|
128 | 128 | // assign shortcode to the preferred callback, which overwrites the "fallback shortcode processor" assigned earlier |
129 | - add_shortcode( $shortcode, array( $this, 'process_shortcode' )); |
|
129 | + add_shortcode($shortcode, array($this, 'process_shortcode')); |
|
130 | 130 | // make sure system knows this is an EE page |
131 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
131 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -1,31 +1,31 @@ |
||
1 | 1 | <?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );/** |
3 | - * |
|
4 | - * Event Espresso |
|
5 | - * |
|
6 | - * Event Registration and Management Plugin for WordPress |
|
7 | - * |
|
8 | - * @ package Event Espresso |
|
9 | - * @ author Seth Shoultes |
|
10 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
11 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
12 | - * @ link http://www.eventespresso.com |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * EE_Cart class |
|
17 | - * Used to keep track of which tickets the user has specified they want to purchase. |
|
18 | - * This data is used for generating the Transaction and Registrations, and the |
|
19 | - * Line Items on cart are themselves saved for creating a persistent snapshot of |
|
20 | - * what was purchased and for how much. |
|
21 | - * |
|
22 | - * |
|
23 | - * @ version 2.0 |
|
24 | - * @subpackage includes/core/EE_Cart.core.php |
|
25 | - * @ author Mike Nelson, Brent Christensen |
|
26 | - * |
|
27 | - * ------------------------------------------------------------------------ |
|
28 | - */ |
|
3 | + * |
|
4 | + * Event Espresso |
|
5 | + * |
|
6 | + * Event Registration and Management Plugin for WordPress |
|
7 | + * |
|
8 | + * @ package Event Espresso |
|
9 | + * @ author Seth Shoultes |
|
10 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
11 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
12 | + * @ link http://www.eventespresso.com |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * EE_Cart class |
|
17 | + * Used to keep track of which tickets the user has specified they want to purchase. |
|
18 | + * This data is used for generating the Transaction and Registrations, and the |
|
19 | + * Line Items on cart are themselves saved for creating a persistent snapshot of |
|
20 | + * what was purchased and for how much. |
|
21 | + * |
|
22 | + * |
|
23 | + * @ version 2.0 |
|
24 | + * @subpackage includes/core/EE_Cart.core.php |
|
25 | + * @ author Mike Nelson, Brent Christensen |
|
26 | + * |
|
27 | + * ------------------------------------------------------------------------ |
|
28 | + */ |
|
29 | 29 | class EE_Cart { |
30 | 30 | |
31 | 31 | /** |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );/** |
3 | 5 | * |
4 | 6 | * Event Espresso |
@@ -64,7 +66,7 @@ discard block |
||
64 | 66 | // check if class object is instantiated |
65 | 67 | if( ! empty( $grand_total ) ){ |
66 | 68 | self::$_instance = new self( $grand_total ); |
67 | - }elseif ( ! self::$_instance instanceof EE_Cart) { |
|
69 | + } elseif ( ! self::$_instance instanceof EE_Cart) { |
|
68 | 70 | //try getting the cart out of the session |
69 | 71 | $saved_cart = EE_Registry::instance()->SSN->cart(); |
70 | 72 | self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self( $grand_total ); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * @access public |
195 | 195 | * @param EE_Ticket $ticket |
196 | 196 | * @param int $qty |
197 | - * @return TRUE on success, FALSE on fail |
|
197 | + * @return boolean on success, FALSE on fail |
|
198 | 198 | */ |
199 | 199 | public function add_ticket_to_cart( EE_Ticket $ticket, $qty = 1 ) { |
200 | 200 | EEH_Line_Item::add_ticket_purchase( $this->_grand_total, $ticket, $qty ); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | /** |
218 | 218 | * gets the total amount of tax paid for items in this cart |
219 | 219 | * @access public |
220 | - * @return float |
|
220 | + * @return boolean |
|
221 | 221 | */ |
222 | 222 | public function get_applied_taxes() { |
223 | 223 | return EEH_Line_Item::ensure_taxes_applied( $this->_grand_total ); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | /** |
229 | 229 | * Gets the total amount to be paid for the items in the cart, including taxes and other modifiers |
230 | 230 | * @access public |
231 | - * @return float |
|
231 | + * @return boolean |
|
232 | 232 | */ |
233 | 233 | public function get_cart_grand_total() { |
234 | 234 | EEH_Line_Item::ensure_taxes_applied( $this->_grand_total ); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | /** |
295 | 295 | * @save cart to session |
296 | 296 | * @access public |
297 | - * @return TRUE on success, FALSE on fail |
|
297 | + * @return boolean on success, FALSE on fail |
|
298 | 298 | */ |
299 | 299 | public function save_cart() { |
300 | 300 | EEH_Line_Item::ensure_taxes_applied( $this->_grand_total ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | -do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );/** |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | +do_action('AHEE_log', __FILE__, __FUNCTION__, ''); /** |
|
3 | 3 | * |
4 | 4 | * Event Espresso |
5 | 5 | * |
@@ -59,20 +59,20 @@ discard block |
||
59 | 59 | * @param EE_Line_Item $grand_total |
60 | 60 | * @return \EE_Cart |
61 | 61 | */ |
62 | - public static function instance( EE_Line_Item $grand_total = NULL ) { |
|
62 | + public static function instance(EE_Line_Item $grand_total = NULL) { |
|
63 | 63 | EE_Registry::instance()->load_helper('Line_Item'); |
64 | 64 | // check if class object is instantiated |
65 | - if( ! empty( $grand_total ) ){ |
|
66 | - self::$_instance = new self( $grand_total ); |
|
65 | + if ( ! empty($grand_total)) { |
|
66 | + self::$_instance = new self($grand_total); |
|
67 | 67 | }elseif ( ! self::$_instance instanceof EE_Cart) { |
68 | 68 | //try getting the cart out of the session |
69 | 69 | $saved_cart = EE_Registry::instance()->SSN->cart(); |
70 | - self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self( $grand_total ); |
|
71 | - unset( $saved_cart ); |
|
70 | + self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self($grand_total); |
|
71 | + unset($saved_cart); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | // once everything is all said and done, save the cart to the EE_Session |
75 | - add_action( 'shutdown', array( self::$_instance, 'save_cart' ), 90 ); |
|
75 | + add_action('shutdown', array(self::$_instance, 'save_cart'), 90); |
|
76 | 76 | return self::$_instance; |
77 | 77 | } |
78 | 78 | |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | * @param EE_Line_Item $grand_total |
86 | 86 | * @return \EE_Cart |
87 | 87 | */ |
88 | - private function __construct( EE_Line_Item $grand_total = NULL ) { |
|
89 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
90 | - if ( ! defined( 'ESPRESSO_CART' )) { |
|
91 | - define( 'ESPRESSO_CART', TRUE ); |
|
88 | + private function __construct(EE_Line_Item $grand_total = NULL) { |
|
89 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
90 | + if ( ! defined('ESPRESSO_CART')) { |
|
91 | + define('ESPRESSO_CART', TRUE); |
|
92 | 92 | } |
93 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
94 | - $this->set_grand_total_line_item( $grand_total ); |
|
93 | + if ($grand_total instanceof EE_Line_Item) { |
|
94 | + $this->set_grand_total_line_item($grand_total); |
|
95 | 95 | } |
96 | 96 | $this->get_grand_total(); |
97 | 97 | } |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | * @param EE_Line_Item $grand_total |
104 | 104 | * @return EE_Cart |
105 | 105 | */ |
106 | - public static function reset( EE_Line_Item $grand_total = NULL ){ |
|
107 | - remove_action( 'shutdown', array( self::$_instance, 'save_cart'), 90 ); |
|
106 | + public static function reset(EE_Line_Item $grand_total = NULL) { |
|
107 | + remove_action('shutdown', array(self::$_instance, 'save_cart'), 90); |
|
108 | 108 | EE_Registry::instance()->SSN->reset_cart(); |
109 | 109 | self::$_instance = NULL; |
110 | - return self::instance( $grand_total ); |
|
110 | + return self::instance($grand_total); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | * @param EE_Transaction $transaction |
119 | 119 | * @return \EE_Cart |
120 | 120 | */ |
121 | - public static function get_cart_from_txn( EE_Transaction $transaction ) { |
|
121 | + public static function get_cart_from_txn(EE_Transaction $transaction) { |
|
122 | 122 | $grand_total = $transaction->total_line_item(); |
123 | 123 | $grand_total->get_items(); |
124 | 124 | $grand_total->tax_descendants(); |
125 | - return EE_Cart::instance( $grand_total ); |
|
125 | + return EE_Cart::instance($grand_total); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * Creates the total line item, and ensures it has its 'tickets' and 'taxes' sub-items |
132 | 132 | * @return EE_Line_Item |
133 | 133 | */ |
134 | - private function _create_grand_total(){ |
|
134 | + private function _create_grand_total() { |
|
135 | 135 | $this->_grand_total = EEH_Line_Item::create_default_total_line_item(); |
136 | 136 | return $this->_grand_total; |
137 | 137 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @return \EE_Line_Item[] |
145 | 145 | */ |
146 | 146 | public function get_tickets() { |
147 | - return EEH_Line_Item::get_items_subtotal( $this->_grand_total )->children(); |
|
147 | + return EEH_Line_Item::get_items_subtotal($this->_grand_total)->children(); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function all_ticket_quantity_count() { |
159 | 159 | $tickets = $this->get_tickets(); |
160 | - if ( empty( $tickets )) { |
|
160 | + if (empty($tickets)) { |
|
161 | 161 | return 0; |
162 | 162 | } |
163 | 163 | $count = 0; |
164 | - foreach ( $tickets as $ticket ) { |
|
164 | + foreach ($tickets as $ticket) { |
|
165 | 165 | $count = $count + $ticket->get('LIN_quantity'); |
166 | 166 | } |
167 | 167 | return $count; |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * Gets all tha tax line items |
174 | 174 | * @return \EE_Line_Item[] |
175 | 175 | */ |
176 | - public function get_taxes(){ |
|
177 | - return EEH_Line_Item::get_taxes_subtotal( $this->_grand_total )->children(); |
|
176 | + public function get_taxes() { |
|
177 | + return EEH_Line_Item::get_taxes_subtotal($this->_grand_total)->children(); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * Gets the total line item (which is a parent of all other line items) on this cart |
184 | 184 | * @return EE_Line_Item |
185 | 185 | */ |
186 | - public function get_grand_total(){ |
|
186 | + public function get_grand_total() { |
|
187 | 187 | return $this->_grand_total instanceof EE_Line_Item ? $this->_grand_total : $this->_create_grand_total(); |
188 | 188 | } |
189 | 189 | |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | * @param int $qty |
197 | 197 | * @return TRUE on success, FALSE on fail |
198 | 198 | */ |
199 | - public function add_ticket_to_cart( EE_Ticket $ticket, $qty = 1 ) { |
|
200 | - EEH_Line_Item::add_ticket_purchase( $this->_grand_total, $ticket, $qty ); |
|
199 | + public function add_ticket_to_cart(EE_Ticket $ticket, $qty = 1) { |
|
200 | + EEH_Line_Item::add_ticket_purchase($this->_grand_total, $ticket, $qty); |
|
201 | 201 | return $this->save_cart() ? TRUE : FALSE; |
202 | 202 | } |
203 | 203 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @return float |
221 | 221 | */ |
222 | 222 | public function get_applied_taxes() { |
223 | - return EEH_Line_Item::ensure_taxes_applied( $this->_grand_total ); |
|
223 | + return EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @return float |
232 | 232 | */ |
233 | 233 | public function get_cart_grand_total() { |
234 | - EEH_Line_Item::ensure_taxes_applied( $this->_grand_total ); |
|
234 | + EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
235 | 235 | return $this->get_grand_total()->total(); |
236 | 236 | } |
237 | 237 | |
@@ -243,10 +243,10 @@ discard block |
||
243 | 243 | * @param mixed - string or array - line_item_ids |
244 | 244 | * @return int on success, FALSE on fail |
245 | 245 | */ |
246 | - public function delete_items( $line_item_codes = FALSE ) { |
|
246 | + public function delete_items($line_item_codes = FALSE) { |
|
247 | 247 | |
248 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
249 | - return EEH_Line_Item::delete_items($this->get_grand_total(), $line_item_codes ); |
|
248 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
249 | + return EEH_Line_Item::delete_items($this->get_grand_total(), $line_item_codes); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | * @return bool |
258 | 258 | */ |
259 | 259 | public function empty_cart() { |
260 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
260 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
261 | 261 | $this->_grand_total = $this->_create_grand_total(); |
262 | - return $this->save_cart( TRUE ); |
|
262 | + return $this->save_cart(TRUE); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | * @return bool |
271 | 271 | */ |
272 | 272 | public function delete_cart() { |
273 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
274 | - $deleted = EEH_Line_Item::delete_all_child_items( $this->_grand_total ); |
|
275 | - if ( $deleted ) { |
|
273 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
274 | + $deleted = EEH_Line_Item::delete_all_child_items($this->_grand_total); |
|
275 | + if ($deleted) { |
|
276 | 276 | $deleted += $this->_grand_total->delete(); |
277 | 277 | } |
278 | 278 | return $deleted; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * know the grand total line item on it |
286 | 286 | * @param EE_Line_Item $line_item |
287 | 287 | */ |
288 | - public function set_grand_total_line_item( EE_Line_Item $line_item ) { |
|
288 | + public function set_grand_total_line_item(EE_Line_Item $line_item) { |
|
289 | 289 | $this->_grand_total = $line_item; |
290 | 290 | } |
291 | 291 | |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | * @return TRUE on success, FALSE on fail |
298 | 298 | */ |
299 | 299 | public function save_cart() { |
300 | - EEH_Line_Item::ensure_taxes_applied( $this->_grand_total ); |
|
301 | - return EE_Registry::instance()->SSN->set_cart( $this ); |
|
300 | + EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
301 | + return EE_Registry::instance()->SSN->set_cart($this); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | public $map_settings; |
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; |
97 | 97 | |
98 | 98 | /** |
@@ -1562,51 +1562,51 @@ discard block |
||
1562 | 1562 | class EE_Organization_Config extends EE_Config_Base { |
1563 | 1563 | |
1564 | 1564 | /** |
1565 | - * @var string $name |
|
1566 | - * eg EE4.1 |
|
1567 | - */ |
|
1565 | + * @var string $name |
|
1566 | + * eg EE4.1 |
|
1567 | + */ |
|
1568 | 1568 | public $name; |
1569 | 1569 | |
1570 | 1570 | /** |
1571 | - * @var string $address_1 |
|
1572 | - * eg 123 Onna Road |
|
1573 | - */ |
|
1571 | + * @var string $address_1 |
|
1572 | + * eg 123 Onna Road |
|
1573 | + */ |
|
1574 | 1574 | public $address_1; |
1575 | 1575 | |
1576 | 1576 | /** |
1577 | - * @var string $address_2 |
|
1578 | - * eg PO Box 123 |
|
1579 | - */ |
|
1577 | + * @var string $address_2 |
|
1578 | + * eg PO Box 123 |
|
1579 | + */ |
|
1580 | 1580 | public $address_2; |
1581 | 1581 | |
1582 | 1582 | /** |
1583 | - * @var string $city |
|
1584 | - * eg Inna City |
|
1585 | - */ |
|
1583 | + * @var string $city |
|
1584 | + * eg Inna City |
|
1585 | + */ |
|
1586 | 1586 | public $city; |
1587 | 1587 | |
1588 | 1588 | /** |
1589 | - * @var int $STA_ID |
|
1590 | - * eg 4 |
|
1591 | - */ |
|
1589 | + * @var int $STA_ID |
|
1590 | + * eg 4 |
|
1591 | + */ |
|
1592 | 1592 | public $STA_ID; |
1593 | 1593 | |
1594 | 1594 | /** |
1595 | - * @var string $CNT_ISO |
|
1596 | - * eg US |
|
1597 | - */ |
|
1595 | + * @var string $CNT_ISO |
|
1596 | + * eg US |
|
1597 | + */ |
|
1598 | 1598 | public $CNT_ISO; |
1599 | 1599 | |
1600 | 1600 | /** |
1601 | - * @var string $zip |
|
1602 | - * eg 12345 or V1A 2B3 |
|
1603 | - */ |
|
1601 | + * @var string $zip |
|
1602 | + * eg 12345 or V1A 2B3 |
|
1603 | + */ |
|
1604 | 1604 | public $zip; |
1605 | 1605 | |
1606 | 1606 | /** |
1607 | - * @var string $email |
|
1608 | - * eg [email protected] |
|
1609 | - */ |
|
1607 | + * @var string $email |
|
1608 | + * eg [email protected] |
|
1609 | + */ |
|
1610 | 1610 | public $email; |
1611 | 1611 | |
1612 | 1612 | |
@@ -1625,9 +1625,9 @@ discard block |
||
1625 | 1625 | public $vat; |
1626 | 1626 | |
1627 | 1627 | /** |
1628 | - * @var string $logo_url |
|
1629 | - * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg |
|
1630 | - */ |
|
1628 | + * @var string $logo_url |
|
1629 | + * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg |
|
1630 | + */ |
|
1631 | 1631 | public $logo_url; |
1632 | 1632 | |
1633 | 1633 | |
@@ -1721,55 +1721,55 @@ discard block |
||
1721 | 1721 | class EE_Currency_Config extends EE_Config_Base { |
1722 | 1722 | |
1723 | 1723 | /** |
1724 | - * @var string $code |
|
1725 | - * eg 'US' |
|
1726 | - */ |
|
1724 | + * @var string $code |
|
1725 | + * eg 'US' |
|
1726 | + */ |
|
1727 | 1727 | public $code; |
1728 | 1728 | |
1729 | 1729 | /** |
1730 | - * @var string $name |
|
1731 | - * eg 'Dollar' |
|
1732 | - */ |
|
1730 | + * @var string $name |
|
1731 | + * eg 'Dollar' |
|
1732 | + */ |
|
1733 | 1733 | public $name; |
1734 | 1734 | |
1735 | 1735 | /** |
1736 | - * plural name |
|
1737 | - * @var string $plural |
|
1738 | - * eg 'Dollars' |
|
1739 | - */ |
|
1736 | + * plural name |
|
1737 | + * @var string $plural |
|
1738 | + * eg 'Dollars' |
|
1739 | + */ |
|
1740 | 1740 | public $plural; |
1741 | 1741 | |
1742 | 1742 | /** |
1743 | - * currency sign |
|
1744 | - * @var string $sign |
|
1745 | - * eg '$' |
|
1746 | - */ |
|
1743 | + * currency sign |
|
1744 | + * @var string $sign |
|
1745 | + * eg '$' |
|
1746 | + */ |
|
1747 | 1747 | public $sign; |
1748 | 1748 | |
1749 | 1749 | /** |
1750 | - * Whether the currency sign should come before the number or not |
|
1751 | - * @var boolean $sign_b4 |
|
1752 | - */ |
|
1750 | + * Whether the currency sign should come before the number or not |
|
1751 | + * @var boolean $sign_b4 |
|
1752 | + */ |
|
1753 | 1753 | public $sign_b4; |
1754 | 1754 | |
1755 | 1755 | /** |
1756 | - * How many digits should come after the decimal place |
|
1757 | - * @var int $dec_plc |
|
1758 | - */ |
|
1756 | + * How many digits should come after the decimal place |
|
1757 | + * @var int $dec_plc |
|
1758 | + */ |
|
1759 | 1759 | public $dec_plc; |
1760 | 1760 | |
1761 | 1761 | /** |
1762 | - * Symbol to use for decimal mark |
|
1763 | - * @var string $dec_mrk |
|
1764 | - * eg '.' |
|
1765 | - */ |
|
1762 | + * Symbol to use for decimal mark |
|
1763 | + * @var string $dec_mrk |
|
1764 | + * eg '.' |
|
1765 | + */ |
|
1766 | 1766 | public $dec_mrk; |
1767 | 1767 | |
1768 | 1768 | /** |
1769 | - * Symbol to use for thousands |
|
1770 | - * @var string $thsnds |
|
1771 | - * eg ',' |
|
1772 | - */ |
|
1769 | + * Symbol to use for thousands |
|
1770 | + * @var string $thsnds |
|
1771 | + * eg ',' |
|
1772 | + */ |
|
1773 | 1773 | public $thsnds; |
1774 | 1774 | |
1775 | 1775 | |
@@ -1837,13 +1837,13 @@ discard block |
||
1837 | 1837 | * whether or not to show alternate payment options during the reg process if payment status is pending |
1838 | 1838 | * @var boolean $show_pending_payment_options |
1839 | 1839 | */ |
1840 | - public $show_pending_payment_options; |
|
1840 | + public $show_pending_payment_options; |
|
1841 | 1841 | |
1842 | 1842 | /** |
1843 | 1843 | * Whether to skip the registration confirmation page |
1844 | 1844 | * @var boolean $skip_reg_confirmation |
1845 | 1845 | */ |
1846 | - public $skip_reg_confirmation; |
|
1846 | + public $skip_reg_confirmation; |
|
1847 | 1847 | |
1848 | 1848 | /** |
1849 | 1849 | * an array of SPCO reg steps where: |
@@ -1854,52 +1854,52 @@ discard block |
||
1854 | 1854 | * "slug" => the URL param used to trigger the reg step |
1855 | 1855 | * @var array $reg_steps |
1856 | 1856 | */ |
1857 | - public $reg_steps; |
|
1857 | + public $reg_steps; |
|
1858 | 1858 | |
1859 | 1859 | /** |
1860 | 1860 | * Whether registration confirmation should be the last page of SPCO |
1861 | 1861 | * @var boolean $reg_confirmation_last |
1862 | 1862 | */ |
1863 | - public $reg_confirmation_last; |
|
1863 | + public $reg_confirmation_last; |
|
1864 | 1864 | |
1865 | 1865 | /** |
1866 | 1866 | * Whether or not to use ReCaptcha |
1867 | 1867 | * @var boolean $use_captcha |
1868 | 1868 | */ |
1869 | - public $use_captcha; |
|
1869 | + public $use_captcha; |
|
1870 | 1870 | |
1871 | 1871 | /** |
1872 | 1872 | * ReCaptcha Theme |
1873 | 1873 | * @var string $recaptcha_theme |
1874 | 1874 | * options: 'dark ', 'light' |
1875 | 1875 | */ |
1876 | - public $recaptcha_theme; |
|
1876 | + public $recaptcha_theme; |
|
1877 | 1877 | |
1878 | 1878 | /** |
1879 | 1879 | * ReCaptcha Type |
1880 | 1880 | * @var string $recaptcha_type |
1881 | 1881 | * options: 'audio', 'image' |
1882 | 1882 | */ |
1883 | - public $recaptcha_type; |
|
1883 | + public $recaptcha_type; |
|
1884 | 1884 | |
1885 | 1885 | /** |
1886 | 1886 | * ReCaptcha language |
1887 | 1887 | * @var string $recaptcha_language |
1888 | 1888 | * eg 'en' |
1889 | 1889 | */ |
1890 | - public $recaptcha_language; |
|
1890 | + public $recaptcha_language; |
|
1891 | 1891 | |
1892 | 1892 | /** |
1893 | 1893 | * ReCaptcha public key |
1894 | 1894 | * @var string $recaptcha_publickey |
1895 | 1895 | */ |
1896 | - public $recaptcha_publickey; |
|
1896 | + public $recaptcha_publickey; |
|
1897 | 1897 | |
1898 | 1898 | /** |
1899 | 1899 | * ReCaptcha private key |
1900 | 1900 | * @var string $recaptcha_privatekey |
1901 | 1901 | */ |
1902 | - public $recaptcha_privatekey; |
|
1902 | + public $recaptcha_privatekey; |
|
1903 | 1903 | |
1904 | 1904 | /** |
1905 | 1905 | * ReCaptcha width |
@@ -1957,58 +1957,58 @@ discard block |
||
1957 | 1957 | class EE_Admin_Config extends EE_Config_Base { |
1958 | 1958 | |
1959 | 1959 | /** |
1960 | - * @var boolean $use_personnel_manager |
|
1961 | - */ |
|
1960 | + * @var boolean $use_personnel_manager |
|
1961 | + */ |
|
1962 | 1962 | public $use_personnel_manager; |
1963 | 1963 | |
1964 | 1964 | /** |
1965 | - * @var boolean $use_dashboard_widget |
|
1966 | - */ |
|
1965 | + * @var boolean $use_dashboard_widget |
|
1966 | + */ |
|
1967 | 1967 | public $use_dashboard_widget; |
1968 | 1968 | |
1969 | 1969 | /** |
1970 | - * @var int $events_in_dashboard |
|
1971 | - */ |
|
1970 | + * @var int $events_in_dashboard |
|
1971 | + */ |
|
1972 | 1972 | public $events_in_dashboard; |
1973 | 1973 | |
1974 | 1974 | /** |
1975 | - * @var boolean $use_event_timezones |
|
1976 | - */ |
|
1975 | + * @var boolean $use_event_timezones |
|
1976 | + */ |
|
1977 | 1977 | public $use_event_timezones; |
1978 | 1978 | |
1979 | 1979 | /** |
1980 | - * @var boolean $use_full_logging |
|
1981 | - */ |
|
1980 | + * @var boolean $use_full_logging |
|
1981 | + */ |
|
1982 | 1982 | public $use_full_logging; |
1983 | 1983 | |
1984 | 1984 | /** |
1985 | - * @var string $log_file_name |
|
1986 | - */ |
|
1985 | + * @var string $log_file_name |
|
1986 | + */ |
|
1987 | 1987 | public $log_file_name; |
1988 | 1988 | |
1989 | 1989 | /** |
1990 | - * @var string $debug_file_name |
|
1991 | - */ |
|
1990 | + * @var string $debug_file_name |
|
1991 | + */ |
|
1992 | 1992 | public $debug_file_name; |
1993 | 1993 | |
1994 | 1994 | /** |
1995 | - * @var boolean $use_remote_logging |
|
1996 | - */ |
|
1995 | + * @var boolean $use_remote_logging |
|
1996 | + */ |
|
1997 | 1997 | public $use_remote_logging; |
1998 | 1998 | |
1999 | 1999 | /** |
2000 | - * @var string $remote_logging_url |
|
2001 | - */ |
|
2000 | + * @var string $remote_logging_url |
|
2001 | + */ |
|
2002 | 2002 | public $remote_logging_url; |
2003 | 2003 | |
2004 | 2004 | /** |
2005 | - * @var boolean $show_reg_footer |
|
2006 | - */ |
|
2005 | + * @var boolean $show_reg_footer |
|
2006 | + */ |
|
2007 | 2007 | public $show_reg_footer; |
2008 | 2008 | |
2009 | 2009 | /** |
2010 | - * @var string $affiliate_id |
|
2011 | - */ |
|
2010 | + * @var string $affiliate_id |
|
2011 | + */ |
|
2012 | 2012 | public $affiliate_id; |
2013 | 2013 | |
2014 | 2014 | |
@@ -2082,33 +2082,33 @@ discard block |
||
2082 | 2082 | class EE_Template_Config extends EE_Config_Base { |
2083 | 2083 | |
2084 | 2084 | /** |
2085 | - * @var boolean $enable_default_style |
|
2086 | - */ |
|
2085 | + * @var boolean $enable_default_style |
|
2086 | + */ |
|
2087 | 2087 | public $enable_default_style; |
2088 | 2088 | |
2089 | 2089 | /** |
2090 | - * @var string $custom_style_sheet |
|
2091 | - */ |
|
2090 | + * @var string $custom_style_sheet |
|
2091 | + */ |
|
2092 | 2092 | public $custom_style_sheet; |
2093 | 2093 | |
2094 | 2094 | /** |
2095 | - * @var boolean $display_address_in_regform |
|
2096 | - */ |
|
2095 | + * @var boolean $display_address_in_regform |
|
2096 | + */ |
|
2097 | 2097 | public $display_address_in_regform; |
2098 | 2098 | |
2099 | 2099 | /** |
2100 | - * @var int $display_description_on_multi_reg_page |
|
2101 | - */ |
|
2100 | + * @var int $display_description_on_multi_reg_page |
|
2101 | + */ |
|
2102 | 2102 | public $display_description_on_multi_reg_page; |
2103 | 2103 | |
2104 | 2104 | /** |
2105 | - * @var boolean $use_custom_templates |
|
2106 | - */ |
|
2105 | + * @var boolean $use_custom_templates |
|
2106 | + */ |
|
2107 | 2107 | public $use_custom_templates; |
2108 | 2108 | |
2109 | 2109 | /** |
2110 | - * @var string $current_espresso_theme |
|
2111 | - */ |
|
2110 | + * @var string $current_espresso_theme |
|
2111 | + */ |
|
2112 | 2112 | public $current_espresso_theme; |
2113 | 2113 | |
2114 | 2114 | |
@@ -2139,78 +2139,78 @@ discard block |
||
2139 | 2139 | class EE_Map_Config extends EE_Config_Base { |
2140 | 2140 | |
2141 | 2141 | /** |
2142 | - * @var boolean $use_google_maps |
|
2143 | - */ |
|
2142 | + * @var boolean $use_google_maps |
|
2143 | + */ |
|
2144 | 2144 | public $use_google_maps; |
2145 | 2145 | |
2146 | 2146 | /** |
2147 | - * @var int $event_details_map_width |
|
2148 | - */ |
|
2147 | + * @var int $event_details_map_width |
|
2148 | + */ |
|
2149 | 2149 | public $event_details_map_width; |
2150 | 2150 | |
2151 | 2151 | /** |
2152 | - * @var int $event_details_map_height |
|
2153 | - */ |
|
2152 | + * @var int $event_details_map_height |
|
2153 | + */ |
|
2154 | 2154 | public $event_details_map_height; |
2155 | 2155 | |
2156 | 2156 | /** |
2157 | - * @var int $event_details_map_zoom |
|
2158 | - */ |
|
2157 | + * @var int $event_details_map_zoom |
|
2158 | + */ |
|
2159 | 2159 | public $event_details_map_zoom; |
2160 | 2160 | |
2161 | 2161 | /** |
2162 | - * @var boolean $event_details_display_nav |
|
2163 | - */ |
|
2162 | + * @var boolean $event_details_display_nav |
|
2163 | + */ |
|
2164 | 2164 | public $event_details_display_nav; |
2165 | 2165 | |
2166 | 2166 | /** |
2167 | - * @var boolean $event_details_nav_size |
|
2168 | - */ |
|
2167 | + * @var boolean $event_details_nav_size |
|
2168 | + */ |
|
2169 | 2169 | public $event_details_nav_size; |
2170 | 2170 | |
2171 | 2171 | /** |
2172 | - * @var string $event_details_control_type |
|
2173 | - */ |
|
2172 | + * @var string $event_details_control_type |
|
2173 | + */ |
|
2174 | 2174 | public $event_details_control_type; |
2175 | 2175 | |
2176 | 2176 | /** |
2177 | - * @var string $event_details_map_align |
|
2178 | - */ |
|
2177 | + * @var string $event_details_map_align |
|
2178 | + */ |
|
2179 | 2179 | public $event_details_map_align; |
2180 | 2180 | |
2181 | 2181 | /** |
2182 | - * @var int $event_list_map_width |
|
2183 | - */ |
|
2182 | + * @var int $event_list_map_width |
|
2183 | + */ |
|
2184 | 2184 | public $event_list_map_width; |
2185 | 2185 | |
2186 | 2186 | /** |
2187 | - * @var int $event_list_map_height |
|
2188 | - */ |
|
2187 | + * @var int $event_list_map_height |
|
2188 | + */ |
|
2189 | 2189 | public $event_list_map_height; |
2190 | 2190 | |
2191 | 2191 | /** |
2192 | - * @var int $event_list_map_zoom |
|
2193 | - */ |
|
2192 | + * @var int $event_list_map_zoom |
|
2193 | + */ |
|
2194 | 2194 | public $event_list_map_zoom; |
2195 | 2195 | |
2196 | 2196 | /** |
2197 | - * @var boolean $event_list_display_nav |
|
2198 | - */ |
|
2197 | + * @var boolean $event_list_display_nav |
|
2198 | + */ |
|
2199 | 2199 | public $event_list_display_nav; |
2200 | 2200 | |
2201 | 2201 | /** |
2202 | - * @var boolean $event_list_nav_size |
|
2203 | - */ |
|
2202 | + * @var boolean $event_list_nav_size |
|
2203 | + */ |
|
2204 | 2204 | public $event_list_nav_size; |
2205 | 2205 | |
2206 | 2206 | /** |
2207 | - * @var string $event_list_control_type |
|
2208 | - */ |
|
2207 | + * @var string $event_list_control_type |
|
2208 | + */ |
|
2209 | 2209 | public $event_list_control_type; |
2210 | 2210 | |
2211 | 2211 | /** |
2212 | - * @var string $event_list_map_align |
|
2213 | - */ |
|
2212 | + * @var string $event_list_map_align |
|
2213 | + */ |
|
2214 | 2214 | public $event_list_map_align; |
2215 | 2215 | |
2216 | 2216 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * |
4 | 6 | * Class EE_Payment_Method_Manager |
@@ -139,7 +141,7 @@ discard block |
||
139 | 141 | if(isset($this->_payment_method_types[$payment_method_name])){ |
140 | 142 | require_once($this->_payment_method_types[$payment_method_name]); |
141 | 143 | return true; |
142 | - }else{ |
|
144 | + } else{ |
|
143 | 145 | return false; |
144 | 146 | } |
145 | 147 | } |
@@ -159,7 +161,7 @@ discard block |
||
159 | 161 | $payment_methods[] = $this->payment_method_class_from_type($classname); |
160 | 162 | } |
161 | 163 | return $payment_methods; |
162 | - }else{ |
|
164 | + } else{ |
|
163 | 165 | return array_keys($this->_payment_method_types); |
164 | 166 | } |
165 | 167 | } |
@@ -242,7 +244,7 @@ discard block |
||
242 | 244 | } |
243 | 245 | } |
244 | 246 | |
245 | - }else{ |
|
247 | + } else{ |
|
246 | 248 | $payment_method->set_active(); |
247 | 249 | $payment_method->save(); |
248 | 250 | } |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | * @param string $name |
429 | 429 | * @param string $config_class |
430 | 430 | * @param EE_Config_Base $config_obj |
431 | - * @param array $tests_to_run |
|
431 | + * @param integer[] $tests_to_run |
|
432 | 432 | * @param bool $display_errors |
433 | 433 | * @return bool TRUE on success, FALSE on fail |
434 | 434 | */ |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | * @access public |
578 | 578 | * @param string $section |
579 | 579 | * @param string $name |
580 | - * @param \EE_Config_Base|string $config_obj |
|
580 | + * @param null|EE_Config_Base $config_obj |
|
581 | 581 | * @return bool |
582 | 582 | */ |
583 | 583 | public function update_config( $section = '', $name = '', $config_obj = '' ) { |
@@ -1477,7 +1477,7 @@ discard block |
||
1477 | 1477 | |
1478 | 1478 | |
1479 | 1479 | /** |
1480 | - * @return array |
|
1480 | + * @return integer[] |
|
1481 | 1481 | */ |
1482 | 1482 | public function get_critical_pages_array() { |
1483 | 1483 | return array( |
@@ -1490,7 +1490,7 @@ discard block |
||
1490 | 1490 | |
1491 | 1491 | |
1492 | 1492 | /** |
1493 | - * @return array |
|
1493 | + * @return string[] |
|
1494 | 1494 | */ |
1495 | 1495 | public function get_critical_pages_shortcodes_array() { |
1496 | 1496 | return array( |
@@ -1813,7 +1813,7 @@ discard block |
||
1813 | 1813 | * class constructor |
1814 | 1814 | * |
1815 | 1815 | * @access public |
1816 | - * @param null $CNT_ISO |
|
1816 | + * @param string $CNT_ISO |
|
1817 | 1817 | * @return \EE_Currency_Config |
1818 | 1818 | */ |
1819 | 1819 | public function __construct( $CNT_ISO = NULL ) { |
@@ -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,22 +174,22 @@ 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 |
182 | 182 | $this->_load_core_config(); |
183 | 183 | // register shortcodes and modules |
184 | - add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 ); |
|
184 | + add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999); |
|
185 | 185 | // initialize shortcodes and modules |
186 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' )); |
|
186 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
187 | 187 | // register widgets |
188 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
188 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
189 | 189 | // shutdown |
190 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
190 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
191 | 191 | // construct__end hook |
192 | - do_action( 'AHEE__EE_Config__construct__end',$this ); |
|
192 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
193 | 193 | // hardcoded hack |
194 | 194 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
195 | 195 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @return string current theme set. |
203 | 203 | */ |
204 | 204 | public static function get_current_theme() { |
205 | - return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
205 | + return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -217,15 +217,15 @@ discard block |
||
217 | 217 | private function _initialize_config() { |
218 | 218 | //set defaults |
219 | 219 | |
220 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', new EE_Core_Config() ); |
|
221 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', new EE_Organization_Config() ); |
|
222 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', new EE_Currency_Config() ); |
|
223 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', new EE_Registration_Config() ); |
|
224 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', new EE_Admin_Config() ); |
|
225 | - $this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', new EE_Template_Config() ); |
|
226 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', new EE_Map_Config() ); |
|
227 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', new EE_Environment_Config() ); |
|
228 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', new EE_Gateway_Config() ); |
|
220 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', new EE_Core_Config()); |
|
221 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', new EE_Organization_Config()); |
|
222 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', new EE_Currency_Config()); |
|
223 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', new EE_Registration_Config()); |
|
224 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', new EE_Admin_Config()); |
|
225 | + $this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', new EE_Template_Config()); |
|
226 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', new EE_Map_Config()); |
|
227 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', new EE_Environment_Config()); |
|
228 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', new EE_Gateway_Config()); |
|
229 | 229 | $this->addons = new stdClass(); |
230 | 230 | // set _module_route_map |
231 | 231 | EE_Config::$_module_route_map = array(); |
@@ -247,28 +247,28 @@ discard block |
||
247 | 247 | private function _load_core_config() { |
248 | 248 | $update = FALSE; |
249 | 249 | $this->_load_calendar_config(); |
250 | - $convert_from_array = array( 'addons' ); |
|
250 | + $convert_from_array = array('addons'); |
|
251 | 251 | $espresso_config = $this->get_espresso_config(); |
252 | - foreach ( $espresso_config as $config => $settings ) { |
|
252 | + foreach ($espresso_config as $config => $settings) { |
|
253 | 253 | // in case old settings were saved as an array |
254 | - if ( is_array( $settings ) && in_array( $config, $convert_from_array )) { |
|
255 | - $settings = $this->_migrate_old_config_data( $settings ); |
|
254 | + if (is_array($settings) && in_array($config, $convert_from_array)) { |
|
255 | + $settings = $this->_migrate_old_config_data($settings); |
|
256 | 256 | $update = TRUE; |
257 | 257 | } |
258 | - $config_class = is_object( $settings ) && is_object( $this->$config ) ? get_class( $this->$config ) : ''; |
|
259 | - if ( ! empty( $settings ) && $settings instanceof $config_class ) { |
|
260 | - $this->$config = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
258 | + $config_class = is_object($settings) && is_object($this->$config) ? get_class($this->$config) : ''; |
|
259 | + if ( ! empty($settings) && $settings instanceof $config_class) { |
|
260 | + $this->$config = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
261 | 261 | //call configs populate method to ensure any defaults are set for empty values. |
262 | - if ( method_exists( $settings, 'populate' ) ) { |
|
262 | + if (method_exists($settings, 'populate')) { |
|
263 | 263 | $this->$config->populate(); |
264 | 264 | } |
265 | 265 | } |
266 | 266 | } |
267 | - if ( $update ) { |
|
267 | + if ($update) { |
|
268 | 268 | $this->update_espresso_config(); |
269 | 269 | } |
270 | 270 | // construct__end hook |
271 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
271 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
@@ -281,23 +281,23 @@ discard block |
||
281 | 281 | */ |
282 | 282 | private function _load_calendar_config() { |
283 | 283 | // grab array of all plugin folders and loop thru it |
284 | - $plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR ); |
|
285 | - if ( empty( $plugins ) ) { |
|
284 | + $plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR); |
|
285 | + if (empty($plugins)) { |
|
286 | 286 | return; |
287 | 287 | } |
288 | - foreach ( $plugins as $plugin_path ) { |
|
288 | + foreach ($plugins as $plugin_path) { |
|
289 | 289 | // grab plugin folder name from path |
290 | - $plugin = basename( $plugin_path ); |
|
290 | + $plugin = basename($plugin_path); |
|
291 | 291 | // drill down to Espresso plugins |
292 | - if ( strpos( $plugin, 'espresso' ) !== FALSE || strpos( $plugin, 'Espresso' ) !== FALSE || strpos( $plugin, 'ee4' ) !== FALSE || strpos( $plugin, 'EE4' ) !== FALSE ) { |
|
292 | + if (strpos($plugin, 'espresso') !== FALSE || strpos($plugin, 'Espresso') !== FALSE || strpos($plugin, 'ee4') !== FALSE || strpos($plugin, 'EE4') !== FALSE) { |
|
293 | 293 | // then to calendar related plugins |
294 | - if ( strpos( $plugin, 'calendar' ) !== FALSE ) { |
|
294 | + if (strpos($plugin, 'calendar') !== FALSE) { |
|
295 | 295 | // this is what we are looking for |
296 | - $calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php'; |
|
296 | + $calendar_config = $plugin_path.DS.'EE_Calendar_Config.php'; |
|
297 | 297 | // does it exist in this folder ? |
298 | - if ( is_readable( $calendar_config )) { |
|
298 | + if (is_readable($calendar_config)) { |
|
299 | 299 | // YEAH! let's load it |
300 | - require_once( $calendar_config ); |
|
300 | + require_once($calendar_config); |
|
301 | 301 | } |
302 | 302 | } |
303 | 303 | } |
@@ -313,13 +313,13 @@ discard block |
||
313 | 313 | * @param array $settings |
314 | 314 | * @return stdClass |
315 | 315 | */ |
316 | - private function _migrate_old_config_data( $settings = array() ) { |
|
316 | + private function _migrate_old_config_data($settings = array()) { |
|
317 | 317 | // convert existing settings to an object |
318 | 318 | $config_array = $settings; |
319 | 319 | $settings = new stdClass(); |
320 | - foreach ( $config_array as $key => $value ){ |
|
321 | - if ( $key == 'calendar' && class_exists( 'EE_Calendar_Config' )) { |
|
322 | - $this->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value ); |
|
320 | + foreach ($config_array as $key => $value) { |
|
321 | + if ($key == 'calendar' && class_exists('EE_Calendar_Config')) { |
|
322 | + $this->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value); |
|
323 | 323 | // $config_option_name = $this->_generate_config_option_name( 'addons', 'EE_Calendar' ); |
324 | 324 | // delete_option( $config_option_name ); |
325 | 325 | // // save calendar settings using new methods |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | */ |
347 | 347 | public function get_espresso_config() { |
348 | 348 | // grab espresso configuration |
349 | - return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() )); |
|
349 | + return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array())); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | |
@@ -359,11 +359,11 @@ discard block |
||
359 | 359 | * @param $old_value |
360 | 360 | * @param $value |
361 | 361 | */ |
362 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
362 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
363 | 363 | // make sure we're checking the ee config |
364 | - if ( $option == 'ee_config' ) { |
|
364 | + if ($option == 'ee_config') { |
|
365 | 365 | // 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 |
366 | - if ( $value != $old_value ) { |
|
366 | + if ($value != $old_value) { |
|
367 | 367 | // 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 |
368 | 368 | // 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 |
369 | 369 | // 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. |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | // HOWEVER, once the object is serialized and passed off to MySQL to update, |
372 | 372 | // 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!!! |
373 | 373 | // 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. |
374 | - remove_action( 'update_option', array( $this, 'check_config_updated' )); |
|
374 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | } |
@@ -386,34 +386,34 @@ discard block |
||
386 | 386 | * @param bool $add_error |
387 | 387 | * @return bool |
388 | 388 | */ |
389 | - public function update_espresso_config( $add_success = FALSE, $add_error = TRUE ) { |
|
389 | + public function update_espresso_config($add_success = FALSE, $add_error = TRUE) { |
|
390 | 390 | $instance = self::$_instance; |
391 | 391 | self::$_instance = NULL; |
392 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this ); |
|
392 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
393 | 393 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional but BEFORE the actual update occurs |
394 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
394 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
395 | 395 | // now update "ee_config" |
396 | - $saved = update_option( 'ee_config', $this ); |
|
396 | + $saved = update_option('ee_config', $this); |
|
397 | 397 | // if not saved... check if the hook we just added still exists; if it does, it means one of two things: |
398 | 398 | // that update_option bailed at the ( $value === $old_value ) conditional, or... |
399 | 399 | // the db update query returned 0 rows affected (probably because the data value was the same from it's perspective) |
400 | 400 | // 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. |
401 | 401 | // BUT... if update_option returns FALSE, AND the hook is missing, then it means that something truly went wrong |
402 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved; |
|
402 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
403 | 403 | // remove our action since we don't want it in the system anymore |
404 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
405 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
404 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
405 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
406 | 406 | self::$_instance = $instance; |
407 | - unset( $instance ); |
|
407 | + unset($instance); |
|
408 | 408 | // if config remains the same or was updated successfully |
409 | - if ( $saved ) { |
|
410 | - if ( $add_success ) { |
|
411 | - EE_Error::add_success( __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
409 | + if ($saved) { |
|
410 | + if ($add_success) { |
|
411 | + EE_Error::add_success(__('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
412 | 412 | } |
413 | 413 | return TRUE; |
414 | 414 | } else { |
415 | - if ( $add_error ) { |
|
416 | - EE_Error::add_error( __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
415 | + if ($add_error) { |
|
416 | + EE_Error::add_error(__('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
417 | 417 | } |
418 | 418 | return FALSE; |
419 | 419 | } |
@@ -432,72 +432,72 @@ discard block |
||
432 | 432 | * @param bool $display_errors |
433 | 433 | * @return bool TRUE on success, FALSE on fail |
434 | 434 | */ |
435 | - 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 ) { |
|
435 | + 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) { |
|
436 | 436 | try { |
437 | 437 | // TEST #1 : check that section was set |
438 | - if ( in_array( 1, $tests_to_run ) && empty( $section )) { |
|
439 | - if ( $display_errors ) { |
|
440 | - throw new EE_Error( sprintf( __( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ), $config_class )); |
|
438 | + if (in_array(1, $tests_to_run) && empty($section)) { |
|
439 | + if ($display_errors) { |
|
440 | + throw new EE_Error(sprintf(__('No configuration section has been provided while attempting to save "%s".', 'event_espresso'), $config_class)); |
|
441 | 441 | } |
442 | 442 | return FALSE; |
443 | 443 | } |
444 | 444 | // TEST #2 : check that settings section exists |
445 | - if ( in_array( 2, $tests_to_run ) && ! isset( $this->{$section} )) { |
|
446 | - if ( $display_errors ) { |
|
447 | - throw new EE_Error( sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ), $section )); |
|
445 | + if (in_array(2, $tests_to_run) && ! isset($this->{$section} )) { |
|
446 | + if ($display_errors) { |
|
447 | + throw new EE_Error(sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'), $section)); |
|
448 | 448 | } |
449 | 449 | return FALSE; |
450 | 450 | } |
451 | 451 | // TEST #3 : check that section is the proper format |
452 | - if ( in_array( 3, $tests_to_run ) && ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass )) { |
|
453 | - if ( $display_errors ) { |
|
454 | - throw new EE_Error( sprintf( __( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ), $section )); |
|
452 | + if (in_array(3, $tests_to_run) && ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass)) { |
|
453 | + if ($display_errors) { |
|
454 | + throw new EE_Error(sprintf(__('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'), $section)); |
|
455 | 455 | } |
456 | 456 | return FALSE; |
457 | 457 | } |
458 | 458 | // TEST #4 : check that config section name has been set |
459 | - if ( in_array( 4, $tests_to_run ) && empty( $name )) { |
|
460 | - if ( $display_errors ) { |
|
461 | - throw new EE_Error( __( 'No name has been provided for the specific configuration section.', 'event_espresso' )); |
|
459 | + if (in_array(4, $tests_to_run) && empty($name)) { |
|
460 | + if ($display_errors) { |
|
461 | + throw new EE_Error(__('No name has been provided for the specific configuration section.', 'event_espresso')); |
|
462 | 462 | } |
463 | 463 | return FALSE; |
464 | 464 | } |
465 | 465 | // TEST #5 : check that config has even been set |
466 | - if ( in_array( 5, $tests_to_run ) && ! isset( $this->{$section}->{$name} )) { |
|
467 | - if ( $display_errors ) { |
|
468 | - throw new EE_Error( sprintf( __( 'No configuration has been set for "%s->%s".', 'event_espresso' ), $section, $name )); |
|
466 | + if (in_array(5, $tests_to_run) && ! isset($this->{$section}->{$name} )) { |
|
467 | + if ($display_errors) { |
|
468 | + throw new EE_Error(sprintf(__('No configuration has been set for "%s->%s".', 'event_espresso'), $section, $name)); |
|
469 | 469 | } |
470 | 470 | return FALSE; |
471 | 471 | } |
472 | 472 | // TEST #6 : check that a config class name has been set |
473 | - if ( in_array( 6, $tests_to_run ) && empty( $config_class )) { |
|
474 | - if ( $display_errors ) { |
|
475 | - throw new EE_Error( __( 'No class name has been provided for the specific configuration section.', 'event_espresso' )); |
|
473 | + if (in_array(6, $tests_to_run) && empty($config_class)) { |
|
474 | + if ($display_errors) { |
|
475 | + throw new EE_Error(__('No class name has been provided for the specific configuration section.', 'event_espresso')); |
|
476 | 476 | } |
477 | 477 | return FALSE; |
478 | 478 | } |
479 | 479 | // TEST #7 : verify config class is accessible |
480 | - if ( in_array( 7, $tests_to_run ) && ! class_exists( $config_class )) { |
|
481 | - if ( $display_errors ) { |
|
482 | - 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 )); |
|
480 | + if (in_array(7, $tests_to_run) && ! class_exists($config_class)) { |
|
481 | + if ($display_errors) { |
|
482 | + 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)); |
|
483 | 483 | } |
484 | 484 | return FALSE; |
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 ) { // d( $config_obj ); |
|
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) { // d( $config_obj ); |
|
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,27 +544,27 @@ 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, 6, 7 ))) { |
|
551 | + if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 6, 7))) { |
|
552 | 552 | return FALSE; |
553 | 553 | } |
554 | 554 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
555 | - if ( ! in_array( $this->_generate_config_option_name( $section, $name ), $this->_config_option_names )) { |
|
556 | - $this->_config_option_names[] = $this->_generate_config_option_name( $section, $name ); |
|
555 | + if ( ! in_array($this->_generate_config_option_name($section, $name), $this->_config_option_names)) { |
|
556 | + $this->_config_option_names[] = $this->_generate_config_option_name($section, $name); |
|
557 | 557 | } |
558 | 558 | // verify the incoming config object but suppress errors |
559 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) { |
|
559 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) { |
|
560 | 560 | $config_obj = new $config_class(); |
561 | 561 | } |
562 | 562 | // create a wp-option for this config |
563 | - if ( add_option( $this->_generate_config_option_name( $section, $name ), $config_obj, '', 'no' )) { |
|
563 | + if (add_option($this->_generate_config_option_name($section, $name), $config_obj, '', 'no')) { |
|
564 | 564 | $this->{$section}->{$name} = $config_obj; |
565 | 565 | return $this->{$section}->{$name}; |
566 | 566 | } else { |
567 | - EE_Error::add_error( sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), __FILE__, __FUNCTION__, __LINE__ ); |
|
567 | + EE_Error::add_error(sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), __FILE__, __FUNCTION__, __LINE__); |
|
568 | 568 | return FALSE; |
569 | 569 | } |
570 | 570 | } |
@@ -580,35 +580,35 @@ discard block |
||
580 | 580 | * @param \EE_Config_Base|string $config_obj |
581 | 581 | * @return bool |
582 | 582 | */ |
583 | - public function update_config( $section = '', $name = '', $config_obj = '' ) { |
|
583 | + public function update_config($section = '', $name = '', $config_obj = '') { |
|
584 | 584 | // get class name of the incoming object |
585 | - $config_class = get_class( $config_obj ); |
|
585 | + $config_class = get_class($config_obj); |
|
586 | 586 | // run tests 1-5 and 9 to verify config |
587 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 5, 9 ))) { |
|
587 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 5, 9))) { |
|
588 | 588 | return FALSE; |
589 | 589 | } |
590 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
590 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
591 | 591 | // check if config object has been added to db by seeing if config option name is in $this->_config_option_names array |
592 | - if ( ! in_array( $config_option_name, $this->_config_option_names )) { |
|
592 | + if ( ! in_array($config_option_name, $this->_config_option_names)) { |
|
593 | 593 | // save new config to db |
594 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
594 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
595 | 595 | } else { |
596 | 596 | // first check if the record already exists |
597 | - $existing_config = get_option( $config_option_name ); |
|
597 | + $existing_config = get_option($config_option_name); |
|
598 | 598 | // just return if db record is already up to date |
599 | - if ( $existing_config == $config_obj ) { |
|
599 | + if ($existing_config == $config_obj) { |
|
600 | 600 | $this->{$section}->{$name} = $config_obj; |
601 | 601 | return TRUE; |
602 | - } else if ( update_option( $config_option_name, $config_obj )) { |
|
602 | + } else if (update_option($config_option_name, $config_obj)) { |
|
603 | 603 | // update wp-option for this config class |
604 | 604 | $this->{$section}->{$name} = $config_obj; |
605 | 605 | return $this->update_espresso_config(); |
606 | 606 | } else { |
607 | 607 | EE_Error::add_error( |
608 | 608 | sprintf( |
609 | - __( 'The "%s" object stored at"%s" was not successfully updated in the database.', 'event_espresso' ), |
|
609 | + __('The "%s" object stored at"%s" was not successfully updated in the database.', 'event_espresso'), |
|
610 | 610 | $config_class, |
611 | - 'EE_Config->' . $section . '->' . $name |
|
611 | + 'EE_Config->'.$section.'->'.$name |
|
612 | 612 | ), |
613 | 613 | __FILE__, __FUNCTION__, __LINE__ |
614 | 614 | ); |
@@ -628,33 +628,33 @@ discard block |
||
628 | 628 | * @param string $config_class |
629 | 629 | * @return mixed EE_Config_Base | NULL |
630 | 630 | */ |
631 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
631 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
632 | 632 | // ensure config class is set to something |
633 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
633 | + $config_class = $this->_set_config_class($config_class, $name); |
|
634 | 634 | // run tests 1-4, 6 and 7 to verify that all params have been set |
635 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 6, 7 ))) { |
|
635 | + if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 6, 7))) { |
|
636 | 636 | return NULL; |
637 | 637 | } |
638 | 638 | // now test if the requested config object exists, but suppress errors |
639 | - if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 5, 8 ), FALSE )) { |
|
639 | + if ($this->_verify_config_params($section, $name, $config_class, NULL, array(5, 8), FALSE)) { |
|
640 | 640 | // config already exists, so pass it back |
641 | 641 | return $this->{$section}->{$name}; |
642 | 642 | } |
643 | 643 | // load config option from db if it exists |
644 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name )); |
|
644 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
645 | 645 | // verify the newly retrieved config object, but suppress errors |
646 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) { |
|
646 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) { |
|
647 | 647 | // config is good, so set it and pass it back |
648 | 648 | $this->{$section}->{$name} = $config_obj; |
649 | 649 | return $this->{$section}->{$name}; |
650 | 650 | } |
651 | 651 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
652 | - $config_obj =$this->set_config( $section, $name, $config_class ); |
|
652 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
653 | 653 | // verify the newly created config object |
654 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) { |
|
654 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
655 | 655 | return $this->{$section}->{$name}; |
656 | 656 | } else { |
657 | - EE_Error::add_error( sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), __FILE__, __FUNCTION__, __LINE__ ); |
|
657 | + EE_Error::add_error(sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), __FILE__, __FUNCTION__, __LINE__); |
|
658 | 658 | } |
659 | 659 | return NULL; |
660 | 660 | } |
@@ -667,9 +667,9 @@ discard block |
||
667 | 667 | * @param string $config_option_name |
668 | 668 | * @return mixed EE_Config_Base | FALSE |
669 | 669 | */ |
670 | - public function get_config_option( $config_option_name = '' ) { |
|
670 | + public function get_config_option($config_option_name = '') { |
|
671 | 671 | // retrieve the wp-option for this config class. |
672 | - return maybe_unserialize( get_option( $config_option_name )); |
|
672 | + return maybe_unserialize(get_option($config_option_name)); |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | |
@@ -682,45 +682,45 @@ discard block |
||
682 | 682 | * @param $page_for_posts |
683 | 683 | * @return void |
684 | 684 | */ |
685 | - public function update_post_shortcodes( $page_for_posts = '' ) { |
|
685 | + public function update_post_shortcodes($page_for_posts = '') { |
|
686 | 686 | // make sure page_for_posts is set |
687 | - $page_for_posts = ! empty( $page_for_posts ) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
687 | + $page_for_posts = ! empty($page_for_posts) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
688 | 688 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
689 | 689 | $critical_shortcodes = $this->core->get_critical_pages_shortcodes_array(); |
690 | 690 | // allow others to mess stuff up :D |
691 | - do_action( 'AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts ); |
|
691 | + do_action('AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts); |
|
692 | 692 | // verify that post_shortcodes is set |
693 | - $this->core->post_shortcodes = isset( $this->core->post_shortcodes ) && is_array( $this->core->post_shortcodes ) ? $this->core->post_shortcodes : array(); |
|
693 | + $this->core->post_shortcodes = isset($this->core->post_shortcodes) && is_array($this->core->post_shortcodes) ? $this->core->post_shortcodes : array(); |
|
694 | 694 | // cycle thru post_shortcodes |
695 | - foreach( $this->core->post_shortcodes as $post_name => $shortcodes ){ |
|
695 | + foreach ($this->core->post_shortcodes as $post_name => $shortcodes) { |
|
696 | 696 | // are there any shortcodes to track ? |
697 | - if ( ! empty( $shortcodes )) { |
|
697 | + if ( ! empty($shortcodes)) { |
|
698 | 698 | // loop thru list of tracked shortcodes |
699 | - foreach( $shortcodes as $shortcode => $post_id ) { |
|
699 | + foreach ($shortcodes as $shortcode => $post_id) { |
|
700 | 700 | // if shortcode is for a critical page, BUT this is NOT the corresponding critical page for that shortcode |
701 | - if ( isset( $critical_shortcodes[ $post_id ] ) && $post_name == $page_for_posts ) { |
|
701 | + if (isset($critical_shortcodes[$post_id]) && $post_name == $page_for_posts) { |
|
702 | 702 | // then remove this shortcode, because we don't want critical page shortcodes like ESPRESSO_TXN_PAGE running on the "Posts Page" (blog) |
703 | - unset( $this->core->post_shortcodes[ $post_name ][ $shortcode ] ); |
|
703 | + unset($this->core->post_shortcodes[$post_name][$shortcode]); |
|
704 | 704 | } |
705 | 705 | // skip the posts page, because we want all shortcodes registered for it |
706 | - if ( $post_name == $page_for_posts ) { |
|
706 | + if ($post_name == $page_for_posts) { |
|
707 | 707 | continue; |
708 | 708 | } |
709 | 709 | // make sure post still exists |
710 | - $post = get_post( $post_id ); |
|
711 | - if ( $post ) { |
|
710 | + $post = get_post($post_id); |
|
711 | + if ($post) { |
|
712 | 712 | // check that the post name matches what we have saved |
713 | - if ( $post->post_name == $post_name ) { |
|
713 | + if ($post->post_name == $post_name) { |
|
714 | 714 | // if so, then break before hitting the unset below |
715 | 715 | continue; |
716 | 716 | } |
717 | 717 | } |
718 | 718 | // we don't like missing posts around here >:( |
719 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
719 | + unset($this->core->post_shortcodes[$post_name]); |
|
720 | 720 | } |
721 | 721 | } else { |
722 | 722 | // you got no shortcodes to keep track of ! |
723 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
723 | + unset($this->core->post_shortcodes[$post_name]); |
|
724 | 724 | } |
725 | 725 | } |
726 | 726 | //only show errors |
@@ -739,13 +739,13 @@ discard block |
||
739 | 739 | * @return string |
740 | 740 | */ |
741 | 741 | public static function get_page_for_posts() { |
742 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
743 | - if ( ! $page_for_posts ) { |
|
742 | + $page_for_posts = get_option('page_for_posts'); |
|
743 | + if ( ! $page_for_posts) { |
|
744 | 744 | return 'posts'; |
745 | 745 | } |
746 | 746 | global $wpdb; |
747 | 747 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
748 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts )); |
|
748 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
749 | 749 | } |
750 | 750 | |
751 | 751 | |
@@ -761,11 +761,11 @@ discard block |
||
761 | 761 | * @return void |
762 | 762 | */ |
763 | 763 | public function register_shortcodes_and_modules() { |
764 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
764 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
765 | 765 | return; |
766 | 766 | } |
767 | 767 | // allow shortcodes to register with WP and to set hooks for the rest of the system |
768 | - EE_Registry::instance()->shortcodes =$this->_register_shortcodes(); |
|
768 | + EE_Registry::instance()->shortcodes = $this->_register_shortcodes(); |
|
769 | 769 | // allow modules to set hooks for the rest of the system |
770 | 770 | EE_Registry::instance()->modules = $this->_register_modules(); |
771 | 771 | } |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | * @return void |
780 | 780 | */ |
781 | 781 | public function initialize_shortcodes_and_modules() { |
782 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
782 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
783 | 783 | return; |
784 | 784 | } |
785 | 785 | // allow shortcodes to set hooks for the rest of the system |
@@ -798,26 +798,26 @@ discard block |
||
798 | 798 | * @return void |
799 | 799 | */ |
800 | 800 | public function widgets_init() { |
801 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
801 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
802 | 802 | return; |
803 | 803 | } |
804 | 804 | //only init widgets on admin pages when not in complete maintenance, and |
805 | 805 | //on frontend when not in any maintenance mode |
806 | - if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level() ) { |
|
806 | + if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) { |
|
807 | 807 | // grab list of installed widgets |
808 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
808 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
809 | 809 | // filter list of modules to register |
810 | - $widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register ); |
|
810 | + $widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register); |
|
811 | 811 | |
812 | - if ( ! empty( $widgets_to_register ) ) { |
|
812 | + if ( ! empty($widgets_to_register)) { |
|
813 | 813 | // cycle thru widget folders |
814 | - foreach ( $widgets_to_register as $widget_path ) { |
|
814 | + foreach ($widgets_to_register as $widget_path) { |
|
815 | 815 | // add to list of installed widget modules |
816 | - EE_Config::register_ee_widget( $widget_path ); |
|
816 | + EE_Config::register_ee_widget($widget_path); |
|
817 | 817 | } |
818 | 818 | } |
819 | 819 | // filter list of installed modules |
820 | - EE_Registry::instance()->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets ); |
|
820 | + EE_Registry::instance()->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets); |
|
821 | 821 | } |
822 | 822 | } |
823 | 823 | |
@@ -830,54 +830,54 @@ discard block |
||
830 | 830 | * @param string $widget_path - full path up to and including widget folder |
831 | 831 | * @return void |
832 | 832 | */ |
833 | - public static function register_ee_widget( $widget_path = NULL ) { |
|
834 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
833 | + public static function register_ee_widget($widget_path = NULL) { |
|
834 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
835 | 835 | $widget_ext = '.widget.php'; |
836 | 836 | // make all separators match |
837 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
837 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
838 | 838 | // does the file path INCLUDE the actual file name as part of the path ? |
839 | - if ( strpos( $widget_path, $widget_ext ) !== FALSE ) { |
|
839 | + if (strpos($widget_path, $widget_ext) !== FALSE) { |
|
840 | 840 | // grab and shortcode file name from directory name and break apart at dots |
841 | - $file_name = explode( '.', basename( $widget_path )); |
|
841 | + $file_name = explode('.', basename($widget_path)); |
|
842 | 842 | // take first segment from file name pieces and remove class prefix if it exists |
843 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
843 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
844 | 844 | // sanitize shortcode directory name |
845 | - $widget = sanitize_key( $widget ); |
|
845 | + $widget = sanitize_key($widget); |
|
846 | 846 | // now we need to rebuild the shortcode path |
847 | - $widget_path = explode( DS, $widget_path ); |
|
847 | + $widget_path = explode(DS, $widget_path); |
|
848 | 848 | // remove last segment |
849 | - array_pop( $widget_path ); |
|
849 | + array_pop($widget_path); |
|
850 | 850 | // glue it back together |
851 | - $widget_path = implode( DS, $widget_path ); |
|
851 | + $widget_path = implode(DS, $widget_path); |
|
852 | 852 | } else { |
853 | 853 | // grab and sanitize widget directory name |
854 | - $widget = sanitize_key( basename( $widget_path )); |
|
854 | + $widget = sanitize_key(basename($widget_path)); |
|
855 | 855 | } |
856 | 856 | // create classname from widget directory name |
857 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ))); |
|
857 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
858 | 858 | // add class prefix |
859 | - $widget_class = 'EEW_' . $widget; |
|
859 | + $widget_class = 'EEW_'.$widget; |
|
860 | 860 | // does the widget exist ? |
861 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) { |
|
861 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
862 | 862 | $msg = sprintf( |
863 | - __( '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' ), |
|
863 | + __('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'), |
|
864 | 864 | $widget_class, |
865 | - $widget_path . DS . $widget_class . $widget_ext |
|
865 | + $widget_path.DS.$widget_class.$widget_ext |
|
866 | 866 | ); |
867 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
867 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
868 | 868 | return; |
869 | 869 | } |
870 | 870 | // load the widget class file |
871 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
871 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
872 | 872 | // verify that class exists |
873 | - if ( ! class_exists( $widget_class )) { |
|
874 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
875 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
873 | + if ( ! class_exists($widget_class)) { |
|
874 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
875 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
876 | 876 | return; |
877 | 877 | } |
878 | - register_widget( $widget_class ); |
|
878 | + register_widget($widget_class); |
|
879 | 879 | // add to array of registered widgets |
880 | - EE_Registry::instance()->widgets->$widget_class = $widget_path . DS . $widget_class . $widget_ext; |
|
880 | + EE_Registry::instance()->widgets->$widget_class = $widget_path.DS.$widget_class.$widget_ext; |
|
881 | 881 | } |
882 | 882 | |
883 | 883 | |
@@ -890,20 +890,20 @@ discard block |
||
890 | 890 | */ |
891 | 891 | private function _register_shortcodes() { |
892 | 892 | // grab list of installed shortcodes |
893 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
893 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
894 | 894 | // filter list of modules to register |
895 | - $shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register ); |
|
895 | + $shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register); |
|
896 | 896 | |
897 | 897 | |
898 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
898 | + if ( ! empty($shortcodes_to_register)) { |
|
899 | 899 | // cycle thru shortcode folders |
900 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
900 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
901 | 901 | // add to list of installed shortcode modules |
902 | - EE_Config::register_shortcode( $shortcode_path ); |
|
902 | + EE_Config::register_shortcode($shortcode_path); |
|
903 | 903 | } |
904 | 904 | } |
905 | 905 | // filter list of installed modules |
906 | - return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes ); |
|
906 | + return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes); |
|
907 | 907 | } |
908 | 908 | |
909 | 909 | |
@@ -915,56 +915,56 @@ discard block |
||
915 | 915 | * @param string $shortcode_path - full path up to and including shortcode folder |
916 | 916 | * @return bool |
917 | 917 | */ |
918 | - public static function register_shortcode( $shortcode_path = NULL ) { |
|
919 | - do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path ); |
|
918 | + public static function register_shortcode($shortcode_path = NULL) { |
|
919 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
920 | 920 | $shortcode_ext = '.shortcode.php'; |
921 | 921 | // make all separators match |
922 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
922 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
923 | 923 | // does the file path INCLUDE the actual file name as part of the path ? |
924 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) { |
|
924 | + if (strpos($shortcode_path, $shortcode_ext) !== FALSE) { |
|
925 | 925 | // grab shortcode file name from directory name and break apart at dots |
926 | - $shortcode_file = explode( '.', basename( $shortcode_path )); |
|
926 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
927 | 927 | // take first segment from file name pieces and remove class prefix if it exists |
928 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0]; |
|
928 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0]; |
|
929 | 929 | // sanitize shortcode directory name |
930 | - $shortcode = sanitize_key( $shortcode ); |
|
930 | + $shortcode = sanitize_key($shortcode); |
|
931 | 931 | // now we need to rebuild the shortcode path |
932 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
932 | + $shortcode_path = explode(DS, $shortcode_path); |
|
933 | 933 | // remove last segment |
934 | - array_pop( $shortcode_path ); |
|
934 | + array_pop($shortcode_path); |
|
935 | 935 | // glue it back together |
936 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
936 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
937 | 937 | } else { |
938 | 938 | // we need to generate the filename based off of the folder name |
939 | 939 | // grab and sanitize shortcode directory name |
940 | - $shortcode = sanitize_key( basename( $shortcode_path )); |
|
941 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
940 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
941 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
942 | 942 | } |
943 | 943 | // create classname from shortcode directory or file name |
944 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ))); |
|
944 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
945 | 945 | // add class prefix |
946 | - $shortcode_class = 'EES_' . $shortcode; |
|
946 | + $shortcode_class = 'EES_'.$shortcode; |
|
947 | 947 | // does the shortcode exist ? |
948 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) { |
|
948 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
949 | 949 | $msg = sprintf( |
950 | - __( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ), |
|
950 | + __('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'), |
|
951 | 951 | $shortcode_class, |
952 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
952 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
953 | 953 | ); |
954 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
954 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
955 | 955 | return FALSE; |
956 | 956 | } |
957 | 957 | // load the shortcode class file |
958 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
958 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
959 | 959 | // verify that class exists |
960 | - if ( ! class_exists( $shortcode_class )) { |
|
961 | - $msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class ); |
|
962 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
960 | + if ( ! class_exists($shortcode_class)) { |
|
961 | + $msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class); |
|
962 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
963 | 963 | return FALSE; |
964 | 964 | } |
965 | - $shortcode = strtoupper( $shortcode ); |
|
965 | + $shortcode = strtoupper($shortcode); |
|
966 | 966 | // add to array of registered shortcodes |
967 | - EE_Registry::instance()->shortcodes->$shortcode = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
967 | + EE_Registry::instance()->shortcodes->$shortcode = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
968 | 968 | return TRUE; |
969 | 969 | } |
970 | 970 | |
@@ -979,23 +979,23 @@ discard block |
||
979 | 979 | */ |
980 | 980 | private function _register_modules() { |
981 | 981 | // grab list of installed modules |
982 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
982 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
983 | 983 | // filter list of modules to register |
984 | - $modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register ); |
|
984 | + $modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register); |
|
985 | 985 | |
986 | 986 | |
987 | - if ( ! empty( $modules_to_register ) ) { |
|
987 | + if ( ! empty($modules_to_register)) { |
|
988 | 988 | // loop through folders |
989 | - foreach ( $modules_to_register as $module_path ) { |
|
989 | + foreach ($modules_to_register as $module_path) { |
|
990 | 990 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
991 | - if ( $module_path != EE_MODULES . 'zzz-copy-this-module-template' && $module_path != EE_MODULES . 'gateways' ) { |
|
991 | + if ($module_path != EE_MODULES.'zzz-copy-this-module-template' && $module_path != EE_MODULES.'gateways') { |
|
992 | 992 | // add to list of installed modules |
993 | - EE_Config::register_module( $module_path ); |
|
993 | + EE_Config::register_module($module_path); |
|
994 | 994 | } |
995 | 995 | } |
996 | 996 | } |
997 | 997 | // filter list of installed modules |
998 | - return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules ); |
|
998 | + return apply_filters('FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules); |
|
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | |
@@ -1008,54 +1008,54 @@ discard block |
||
1008 | 1008 | * @param string $module_path - full path up to and including module folder |
1009 | 1009 | * @return bool |
1010 | 1010 | */ |
1011 | - public static function register_module( $module_path = NULL ) { |
|
1012 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1011 | + public static function register_module($module_path = NULL) { |
|
1012 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1013 | 1013 | $module_ext = '.module.php'; |
1014 | 1014 | // make all separators match |
1015 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1015 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1016 | 1016 | // does the file path INCLUDE the actual file name as part of the path ? |
1017 | - if ( strpos( $module_path, $module_ext ) !== FALSE ) { |
|
1017 | + if (strpos($module_path, $module_ext) !== FALSE) { |
|
1018 | 1018 | // grab and shortcode file name from directory name and break apart at dots |
1019 | - $module_file = explode( '.', basename( $module_path )); |
|
1019 | + $module_file = explode('.', basename($module_path)); |
|
1020 | 1020 | // now we need to rebuild the shortcode path |
1021 | - $module_path = explode( DS, $module_path ); |
|
1021 | + $module_path = explode(DS, $module_path); |
|
1022 | 1022 | // remove last segment |
1023 | - array_pop( $module_path ); |
|
1023 | + array_pop($module_path); |
|
1024 | 1024 | // glue it back together |
1025 | - $module_path = implode( DS, $module_path ) . DS; |
|
1025 | + $module_path = implode(DS, $module_path).DS; |
|
1026 | 1026 | // take first segment from file name pieces and sanitize it |
1027 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1027 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1028 | 1028 | // ensure class prefix is added |
1029 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1029 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1030 | 1030 | } else { |
1031 | 1031 | // we need to generate the filename based off of the folder name |
1032 | 1032 | // grab and sanitize module name |
1033 | - $module = strtolower( basename( $module_path )); |
|
1034 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module); |
|
1033 | + $module = strtolower(basename($module_path)); |
|
1034 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1035 | 1035 | // like trailingslashit() |
1036 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1036 | + $module_path = rtrim($module_path, DS).DS; |
|
1037 | 1037 | // create classname from module directory name |
1038 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ))); |
|
1038 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1039 | 1039 | // add class prefix |
1040 | - $module_class = 'EED_' . $module; |
|
1040 | + $module_class = 'EED_'.$module; |
|
1041 | 1041 | } |
1042 | 1042 | // does the module exist ? |
1043 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) { |
|
1044 | - $msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module ); |
|
1045 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1043 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1044 | + $msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module); |
|
1045 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1046 | 1046 | return FALSE; |
1047 | 1047 | } |
1048 | 1048 | // load the module class file |
1049 | - require_once( $module_path . $module_class . $module_ext ); |
|
1049 | + require_once($module_path.$module_class.$module_ext); |
|
1050 | 1050 | // verify that class exists |
1051 | - if ( ! class_exists( $module_class )) { |
|
1052 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1053 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1051 | + if ( ! class_exists($module_class)) { |
|
1052 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1053 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1054 | 1054 | return FALSE; |
1055 | 1055 | } |
1056 | 1056 | // add to array of registered modules |
1057 | - EE_Registry::instance()->modules->$module_class = $module_path . $module_class . $module_ext; |
|
1058 | - do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->$module_class ); |
|
1057 | + EE_Registry::instance()->modules->$module_class = $module_path.$module_class.$module_ext; |
|
1058 | + do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->$module_class); |
|
1059 | 1059 | return TRUE; |
1060 | 1060 | } |
1061 | 1061 | |
@@ -1069,23 +1069,23 @@ discard block |
||
1069 | 1069 | */ |
1070 | 1070 | private function _initialize_shortcodes() { |
1071 | 1071 | // cycle thru shortcode folders |
1072 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1072 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1073 | 1073 | // add class prefix |
1074 | - $shortcode_class = 'EES_' . $shortcode; |
|
1074 | + $shortcode_class = 'EES_'.$shortcode; |
|
1075 | 1075 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1076 | 1076 | // which set hooks ? |
1077 | - if ( is_admin() ) { |
|
1077 | + if (is_admin()) { |
|
1078 | 1078 | // fire immediately |
1079 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' )); |
|
1079 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1080 | 1080 | } else { |
1081 | 1081 | // delay until other systems are online |
1082 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' )); |
|
1082 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks')); |
|
1083 | 1083 | // convert classname to UPPERCASE and create WP shortcode. |
1084 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1084 | + $shortcode_tag = strtoupper($shortcode); |
|
1085 | 1085 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1086 | - if ( ! shortcode_exists( $shortcode_tag )) { |
|
1086 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1087 | 1087 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1088 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' )); |
|
1088 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1089 | 1089 | } |
1090 | 1090 | } |
1091 | 1091 | } |
@@ -1102,15 +1102,15 @@ discard block |
||
1102 | 1102 | */ |
1103 | 1103 | private function _initialize_modules() { |
1104 | 1104 | // cycle thru shortcode folders |
1105 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1105 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1106 | 1106 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1107 | 1107 | // which set hooks ? |
1108 | - if ( is_admin() ) { |
|
1108 | + if (is_admin()) { |
|
1109 | 1109 | // fire immediately |
1110 | - call_user_func( array( $module_class, 'set_hooks_admin' )); |
|
1110 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1111 | 1111 | } else { |
1112 | 1112 | // delay until other systems are online |
1113 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' )); |
|
1113 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks')); |
|
1114 | 1114 | } |
1115 | 1115 | } |
1116 | 1116 | } |
@@ -1128,26 +1128,26 @@ discard block |
||
1128 | 1128 | * @param string $key - url param key indicating a route is being called |
1129 | 1129 | * @return bool |
1130 | 1130 | */ |
1131 | - public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) { |
|
1132 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1133 | - $module = str_replace( 'EED_', '', $module ); |
|
1134 | - $module_class = 'EED_' . $module; |
|
1135 | - if ( ! isset( EE_Registry::instance()->modules->$module_class )) { |
|
1136 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1137 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1131 | + public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') { |
|
1132 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1133 | + $module = str_replace('EED_', '', $module); |
|
1134 | + $module_class = 'EED_'.$module; |
|
1135 | + if ( ! isset(EE_Registry::instance()->modules->$module_class)) { |
|
1136 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1137 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1138 | 1138 | return FALSE; |
1139 | 1139 | } |
1140 | - if ( empty( $route )) { |
|
1141 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1142 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1140 | + if (empty($route)) { |
|
1141 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1142 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1143 | 1143 | return FALSE; |
1144 | 1144 | } |
1145 | - if ( ! method_exists ( 'EED_' . $module, $method_name )) { |
|
1146 | - $msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route ); |
|
1147 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1145 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1146 | + $msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route); |
|
1147 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1148 | 1148 | return FALSE; |
1149 | 1149 | } |
1150 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1150 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1151 | 1151 | return TRUE; |
1152 | 1152 | } |
1153 | 1153 | |
@@ -1161,11 +1161,11 @@ discard block |
||
1161 | 1161 | * @param string $key - url param key indicating a route is being called |
1162 | 1162 | * @return string |
1163 | 1163 | */ |
1164 | - public static function get_route( $route = NULL, $key = 'ee' ) { |
|
1165 | - do_action( 'AHEE__EE_Config__get_route__begin',$route ); |
|
1166 | - $route = apply_filters( 'FHEE__EE_Config__get_route',$route ); |
|
1167 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) { |
|
1168 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1164 | + public static function get_route($route = NULL, $key = 'ee') { |
|
1165 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1166 | + $route = apply_filters('FHEE__EE_Config__get_route', $route); |
|
1167 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1168 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1169 | 1169 | } |
1170 | 1170 | return NULL; |
1171 | 1171 | } |
@@ -1194,35 +1194,35 @@ discard block |
||
1194 | 1194 | * @param string $key - url param key indicating a route is being called |
1195 | 1195 | * @return bool |
1196 | 1196 | */ |
1197 | - public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) { |
|
1198 | - do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward ); |
|
1199 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1200 | - $msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route ); |
|
1201 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1197 | + public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') { |
|
1198 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1199 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1200 | + $msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route); |
|
1201 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1202 | 1202 | return FALSE; |
1203 | 1203 | } |
1204 | - if ( empty( $forward )) { |
|
1205 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1206 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1204 | + if (empty($forward)) { |
|
1205 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1206 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1207 | 1207 | return FALSE; |
1208 | 1208 | } |
1209 | - if ( is_array( $forward )) { |
|
1210 | - if ( ! isset( $forward[1] )) { |
|
1211 | - $msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route ); |
|
1212 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1209 | + if (is_array($forward)) { |
|
1210 | + if ( ! isset($forward[1])) { |
|
1211 | + $msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route); |
|
1212 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1213 | 1213 | return FALSE; |
1214 | 1214 | } |
1215 | - if ( ! method_exists( $forward[0], $forward[1] )) { |
|
1216 | - $msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route ); |
|
1217 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1215 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1216 | + $msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route); |
|
1217 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1218 | 1218 | return FALSE; |
1219 | 1219 | } |
1220 | - } else if ( ! function_exists( $forward )) { |
|
1221 | - $msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route ); |
|
1222 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1220 | + } else if ( ! function_exists($forward)) { |
|
1221 | + $msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route); |
|
1222 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1223 | 1223 | return FALSE; |
1224 | 1224 | } |
1225 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1225 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1226 | 1226 | return TRUE; |
1227 | 1227 | } |
1228 | 1228 | |
@@ -1237,10 +1237,10 @@ discard block |
||
1237 | 1237 | * @param string $key - url param key indicating a route is being called |
1238 | 1238 | * @return string |
1239 | 1239 | */ |
1240 | - public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1241 | - do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status ); |
|
1242 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) { |
|
1243 | - return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1240 | + public static function get_forward($route = NULL, $status = 0, $key = 'ee') { |
|
1241 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1242 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1243 | + return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status); |
|
1244 | 1244 | } |
1245 | 1245 | return NULL; |
1246 | 1246 | } |
@@ -1257,19 +1257,19 @@ discard block |
||
1257 | 1257 | * @param string $key - url param key indicating a route is being called |
1258 | 1258 | * @return bool |
1259 | 1259 | */ |
1260 | - public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) { |
|
1261 | - do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view ); |
|
1262 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1263 | - $msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route ); |
|
1264 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1260 | + public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') { |
|
1261 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1262 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1263 | + $msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route); |
|
1264 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1265 | 1265 | return FALSE; |
1266 | 1266 | } |
1267 | - if ( ! is_readable( $view )) { |
|
1268 | - $msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view ); |
|
1269 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1267 | + if ( ! is_readable($view)) { |
|
1268 | + $msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view); |
|
1269 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1270 | 1270 | return FALSE; |
1271 | 1271 | } |
1272 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1272 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1273 | 1273 | return TRUE; |
1274 | 1274 | } |
1275 | 1275 | |
@@ -1286,10 +1286,10 @@ discard block |
||
1286 | 1286 | * @param string $key - url param key indicating a route is being called |
1287 | 1287 | * @return string |
1288 | 1288 | */ |
1289 | - public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1290 | - do_action( 'AHEE__EE_Config__get_view__begin',$route,$status ); |
|
1291 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) { |
|
1292 | - return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1289 | + public static function get_view($route = NULL, $status = 0, $key = 'ee') { |
|
1290 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1291 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1292 | + return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status); |
|
1293 | 1293 | } |
1294 | 1294 | return NULL; |
1295 | 1295 | } |
@@ -1297,7 +1297,7 @@ discard block |
||
1297 | 1297 | |
1298 | 1298 | |
1299 | 1299 | public function shutdown() { |
1300 | - update_option( 'ee_config_option_names', $this->_config_option_names ); |
|
1300 | + update_option('ee_config_option_names', $this->_config_option_names); |
|
1301 | 1301 | } |
1302 | 1302 | |
1303 | 1303 | |
@@ -1313,7 +1313,7 @@ discard block |
||
1313 | 1313 | * magic functions in use, except we'll allow them to magically set and get stuff... |
1314 | 1314 | * basically, they should just be well-defined stdClasses |
1315 | 1315 | */ |
1316 | -class EE_Config_Base{ |
|
1316 | +class EE_Config_Base { |
|
1317 | 1317 | |
1318 | 1318 | |
1319 | 1319 | /** |
@@ -1323,14 +1323,14 @@ discard block |
||
1323 | 1323 | * |
1324 | 1324 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1325 | 1325 | */ |
1326 | - public function get_pretty( $property ) { |
|
1327 | - if ( ! property_exists( $this, $property ) ) { |
|
1328 | - 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 ) ); |
|
1326 | + public function get_pretty($property) { |
|
1327 | + if ( ! property_exists($this, $property)) { |
|
1328 | + 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)); |
|
1329 | 1329 | } |
1330 | 1330 | |
1331 | 1331 | //just handling escaping of strings for now. |
1332 | - if ( is_string( $this->$property ) ) { |
|
1333 | - return stripslashes( $this->$property ); |
|
1332 | + if (is_string($this->$property)) { |
|
1333 | + return stripslashes($this->$property); |
|
1334 | 1334 | } |
1335 | 1335 | |
1336 | 1336 | return $this->$property; |
@@ -1340,19 +1340,19 @@ discard block |
||
1340 | 1340 | |
1341 | 1341 | public function populate() { |
1342 | 1342 | //grab defaults via a new instance of this class. |
1343 | - $class_name = get_class( $this ); |
|
1343 | + $class_name = get_class($this); |
|
1344 | 1344 | $defaults = new $class_name; |
1345 | 1345 | |
1346 | 1346 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1347 | 1347 | //default from our $defaults object. |
1348 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1349 | - if ( is_null( $this->$property ) ) { |
|
1348 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1349 | + if (is_null($this->$property)) { |
|
1350 | 1350 | $this->$property = $value; |
1351 | 1351 | } |
1352 | 1352 | } |
1353 | 1353 | |
1354 | 1354 | //cleanup |
1355 | - unset( $defaults ); |
|
1355 | + unset($defaults); |
|
1356 | 1356 | } |
1357 | 1357 | |
1358 | 1358 | |
@@ -1444,12 +1444,12 @@ discard block |
||
1444 | 1444 | */ |
1445 | 1445 | public function __construct() { |
1446 | 1446 | $current_network_main_site = is_multisite() ? get_current_site() : NULL; |
1447 | - $current_main_site_id = !empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1447 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1448 | 1448 | // set default organization settings |
1449 | 1449 | $this->current_blog_id = get_current_blog_id(); |
1450 | 1450 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1451 | - $this->ee_ueip_optin = is_main_site() ? get_option( 'ee_ueip_optin', TRUE ) : get_blog_option( $current_main_site_id, 'ee_ueip_optin', TRUE ); |
|
1452 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', FALSE ) : TRUE; |
|
1451 | + $this->ee_ueip_optin = is_main_site() ? get_option('ee_ueip_optin', TRUE) : get_blog_option($current_main_site_id, 'ee_ueip_optin', TRUE); |
|
1452 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', FALSE) : TRUE; |
|
1453 | 1453 | $this->post_shortcodes = array(); |
1454 | 1454 | $this->module_route_map = array(); |
1455 | 1455 | $this->module_forward_map = array(); |
@@ -1468,7 +1468,7 @@ discard block |
||
1468 | 1468 | $this->event_cpt_slug = __('events', 'event_espresso'); |
1469 | 1469 | |
1470 | 1470 | //ueip constant check |
1471 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1471 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1472 | 1472 | $this->ee_ueip_optin = FALSE; |
1473 | 1473 | $this->ee_ueip_has_notified = TRUE; |
1474 | 1474 | } |
@@ -1508,8 +1508,8 @@ discard block |
||
1508 | 1508 | * @return string |
1509 | 1509 | */ |
1510 | 1510 | public function reg_page_url() { |
1511 | - if ( ! $this->reg_page_url ) { |
|
1512 | - $this->reg_page_url = get_permalink( $this->reg_page_id ); |
|
1511 | + if ( ! $this->reg_page_url) { |
|
1512 | + $this->reg_page_url = get_permalink($this->reg_page_id); |
|
1513 | 1513 | } |
1514 | 1514 | return $this->reg_page_url; |
1515 | 1515 | } |
@@ -1522,12 +1522,12 @@ discard block |
||
1522 | 1522 | * @return string |
1523 | 1523 | */ |
1524 | 1524 | public function txn_page_url($query_args = array()) { |
1525 | - if ( ! $this->txn_page_url ) { |
|
1526 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1525 | + if ( ! $this->txn_page_url) { |
|
1526 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1527 | 1527 | } |
1528 | - if($query_args){ |
|
1529 | - return add_query_arg($query_args,$this->txn_page_url); |
|
1530 | - }else{ |
|
1528 | + if ($query_args) { |
|
1529 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1530 | + } else { |
|
1531 | 1531 | return $this->txn_page_url; |
1532 | 1532 | } |
1533 | 1533 | } |
@@ -1539,12 +1539,12 @@ discard block |
||
1539 | 1539 | * @return string |
1540 | 1540 | */ |
1541 | 1541 | public function thank_you_page_url($query_args = array()) { |
1542 | - if ( ! $this->thank_you_page_url ) { |
|
1543 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1542 | + if ( ! $this->thank_you_page_url) { |
|
1543 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1544 | 1544 | } |
1545 | - if($query_args){ |
|
1546 | - return add_query_arg($query_args,$this->thank_you_page_url); |
|
1547 | - }else{ |
|
1545 | + if ($query_args) { |
|
1546 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1547 | + } else { |
|
1548 | 1548 | return $this->thank_you_page_url; |
1549 | 1549 | } |
1550 | 1550 | } |
@@ -1555,8 +1555,8 @@ discard block |
||
1555 | 1555 | * @return string |
1556 | 1556 | */ |
1557 | 1557 | public function cancel_page_url() { |
1558 | - if ( ! $this->cancel_page_url ) { |
|
1559 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1558 | + if ( ! $this->cancel_page_url) { |
|
1559 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1560 | 1560 | } |
1561 | 1561 | return $this->cancel_page_url; |
1562 | 1562 | } |
@@ -1584,7 +1584,7 @@ discard block |
||
1584 | 1584 | //reset all url properties |
1585 | 1585 | $this->_reset_urls(); |
1586 | 1586 | //return what to save to db |
1587 | - return array_keys( get_object_vars( $this ) ); |
|
1587 | + return array_keys(get_object_vars($this)); |
|
1588 | 1588 | } |
1589 | 1589 | |
1590 | 1590 | } |
@@ -1816,39 +1816,39 @@ discard block |
||
1816 | 1816 | * @param null $CNT_ISO |
1817 | 1817 | * @return \EE_Currency_Config |
1818 | 1818 | */ |
1819 | - public function __construct( $CNT_ISO = NULL ) { |
|
1819 | + public function __construct($CNT_ISO = NULL) { |
|
1820 | 1820 | |
1821 | 1821 | // get country code from organization settings or use default |
1822 | - $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; |
|
1822 | + $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; |
|
1823 | 1823 | // but override if requested |
1824 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
1825 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
1824 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
1825 | + EE_Registry::instance()->load_helper('Activation'); |
|
1826 | 1826 | // 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 |
1827 | - if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) { |
|
1827 | + if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) { |
|
1828 | 1828 | // retrieve the country settings from the db, just in case they have been customized |
1829 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
1830 | - if ( $country instanceof EE_Country ) { |
|
1831 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1832 | - $this->name = $country->currency_name_single(); // Dollar |
|
1833 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
1834 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
1835 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1836 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1837 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1838 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1829 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
1830 | + if ($country instanceof EE_Country) { |
|
1831 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1832 | + $this->name = $country->currency_name_single(); // Dollar |
|
1833 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
1834 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
1835 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1836 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1837 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1838 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1839 | 1839 | } |
1840 | 1840 | } |
1841 | 1841 | // fallback to hardcoded defaults, in case the above failed |
1842 | - if ( empty( $this->code )) { |
|
1842 | + if (empty($this->code)) { |
|
1843 | 1843 | // set default currency settings |
1844 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1845 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
1846 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
1847 | - $this->sign = '$'; // currency sign: $ |
|
1848 | - $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1849 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1850 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1851 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1844 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1845 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
1846 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
1847 | + $this->sign = '$'; // currency sign: $ |
|
1848 | + $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1849 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1850 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1851 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1852 | 1852 | } |
1853 | 1853 | } |
1854 | 1854 | } |
@@ -2070,10 +2070,10 @@ discard block |
||
2070 | 2070 | * @param bool $reset |
2071 | 2071 | * @return string |
2072 | 2072 | */ |
2073 | - public function log_file_name( $reset = FALSE ) { |
|
2074 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2075 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2076 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2073 | + public function log_file_name($reset = FALSE) { |
|
2074 | + if (empty($this->log_file_name) || $reset) { |
|
2075 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt'; |
|
2076 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2077 | 2077 | } |
2078 | 2078 | return $this->log_file_name; |
2079 | 2079 | } |
@@ -2085,10 +2085,10 @@ discard block |
||
2085 | 2085 | * @param bool $reset |
2086 | 2086 | * @return string |
2087 | 2087 | */ |
2088 | - public function debug_file_name( $reset = FALSE ) { |
|
2089 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2090 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2091 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2088 | + public function debug_file_name($reset = FALSE) { |
|
2089 | + if (empty($this->debug_file_name) || $reset) { |
|
2090 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt'; |
|
2091 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2092 | 2092 | } |
2093 | 2093 | return $this->debug_file_name; |
2094 | 2094 | } |
@@ -2249,21 +2249,21 @@ discard block |
||
2249 | 2249 | // set default map settings |
2250 | 2250 | $this->use_google_maps = TRUE; |
2251 | 2251 | // for event details pages (reg page) |
2252 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2253 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2254 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2255 | - $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2256 | - $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2257 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2258 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2252 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2253 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2254 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2255 | + $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2256 | + $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2257 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2258 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2259 | 2259 | // for event list pages |
2260 | - $this->event_list_map_width = 300; // ee_map_width |
|
2261 | - $this->event_list_map_height = 185; // ee_map_height |
|
2262 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2263 | - $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2264 | - $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2265 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2266 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2260 | + $this->event_list_map_width = 300; // ee_map_width |
|
2261 | + $this->event_list_map_height = 185; // ee_map_height |
|
2262 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2263 | + $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2264 | + $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2265 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2266 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2267 | 2267 | } |
2268 | 2268 | |
2269 | 2269 | } |
@@ -2274,7 +2274,7 @@ discard block |
||
2274 | 2274 | /** |
2275 | 2275 | * stores Events_Archive settings |
2276 | 2276 | */ |
2277 | -class EE_Events_Archive_Config extends EE_Config_Base{ |
|
2277 | +class EE_Events_Archive_Config extends EE_Config_Base { |
|
2278 | 2278 | |
2279 | 2279 | public $display_status_banner; |
2280 | 2280 | public $display_description; |
@@ -2288,7 +2288,7 @@ discard block |
||
2288 | 2288 | /** |
2289 | 2289 | * class constructor |
2290 | 2290 | */ |
2291 | - public function __construct(){ |
|
2291 | + public function __construct() { |
|
2292 | 2292 | $this->display_status_banner = 0; |
2293 | 2293 | $this->display_description = 1; |
2294 | 2294 | $this->display_ticket_selector = 0; |
@@ -2303,7 +2303,7 @@ discard block |
||
2303 | 2303 | /** |
2304 | 2304 | * Stores Event_Single_Config settings |
2305 | 2305 | */ |
2306 | -class EE_Event_Single_Config extends EE_Config_Base{ |
|
2306 | +class EE_Event_Single_Config extends EE_Config_Base { |
|
2307 | 2307 | public $display_status_banner_single; |
2308 | 2308 | public $display_venue; |
2309 | 2309 | |
@@ -2321,7 +2321,7 @@ discard block |
||
2321 | 2321 | /** |
2322 | 2322 | * Stores Ticket_Selector_Config settings |
2323 | 2323 | */ |
2324 | -class EE_Ticket_Selector_Config extends EE_Config_Base{ |
|
2324 | +class EE_Ticket_Selector_Config extends EE_Config_Base { |
|
2325 | 2325 | public $show_ticket_sale_columns; |
2326 | 2326 | public $show_ticket_details; |
2327 | 2327 | public $show_expired_tickets; |
@@ -2375,7 +2375,7 @@ discard block |
||
2375 | 2375 | * @return void |
2376 | 2376 | */ |
2377 | 2377 | protected function _set_php_values() { |
2378 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2378 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2379 | 2379 | $this->php->version = phpversion(); |
2380 | 2380 | } |
2381 | 2381 | |
@@ -2394,8 +2394,8 @@ discard block |
||
2394 | 2394 | * @type string $msg Any message to be displayed. |
2395 | 2395 | * } |
2396 | 2396 | */ |
2397 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2398 | - if ( ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) { |
|
2397 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2398 | + if (($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) { |
|
2399 | 2399 | 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'); |
2400 | 2400 | } else { |
2401 | 2401 | return ''; |
@@ -2431,7 +2431,7 @@ discard block |
||
2431 | 2431 | * stores payment gateway info |
2432 | 2432 | * @deprecated |
2433 | 2433 | */ |
2434 | -class EE_Gateway_Config extends EE_Config_Base{ |
|
2434 | +class EE_Gateway_Config extends EE_Config_Base { |
|
2435 | 2435 | |
2436 | 2436 | /** |
2437 | 2437 | * Array with keys that are payment gateways slugs, and values are arrays |
@@ -2453,9 +2453,9 @@ discard block |
||
2453 | 2453 | * class constructor |
2454 | 2454 | * @deprecated |
2455 | 2455 | */ |
2456 | - public function __construct(){ |
|
2456 | + public function __construct() { |
|
2457 | 2457 | $this->payment_settings = array(); |
2458 | - $this->active_gateways = array( 'Invoice' => FALSE ); |
|
2458 | + $this->active_gateways = array('Invoice' => FALSE); |
|
2459 | 2459 | } |
2460 | 2460 | } |
2461 | 2461 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @return EE_Cron_Tasks |
23 | 23 | */ |
24 | 24 | public static function instance() { |
25 | - if ( ! self::$_instance instanceof EE_Cron_Tasks ) { |
|
25 | + if ( ! self::$_instance instanceof EE_Cron_Tasks) { |
|
26 | 26 | self::$_instance = new self(); |
27 | 27 | } |
28 | 28 | return self::$_instance; |
@@ -38,19 +38,19 @@ discard block |
||
38 | 38 | // UPDATE TRANSACTION WITH PAYMENT |
39 | 39 | add_action( |
40 | 40 | 'AHEE__EE_Cron_Tasks__update_transaction_with_payment', |
41 | - array( 'EE_Cron_Tasks', 'setup_update_for_transaction_with_payment' ), |
|
41 | + array('EE_Cron_Tasks', 'setup_update_for_transaction_with_payment'), |
|
42 | 42 | 10, 2 |
43 | 43 | ); |
44 | 44 | // FINALIZE ABANDONED TRANSACTIONS |
45 | 45 | add_action( |
46 | 46 | 'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions', |
47 | - array( 'EE_Cron_Tasks', 'check_for_abandoned_transactions' ), |
|
47 | + array('EE_Cron_Tasks', 'check_for_abandoned_transactions'), |
|
48 | 48 | 10, 1 |
49 | 49 | ); |
50 | 50 | // CLEAN OUT JUNK TRANSACTIONS AND RELATED DATA |
51 | 51 | add_action( |
52 | 52 | 'AHEE__EE_Cron_Tasks__clean_up_junk_transactions', |
53 | - array( 'EE_Cron_Tasks', 'clean_out_junk_transactions' ) |
|
53 | + array('EE_Cron_Tasks', 'clean_out_junk_transactions') |
|
54 | 54 | ); |
55 | 55 | } |
56 | 56 | |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | $payment |
85 | 85 | ) { |
86 | 86 | // validate $TXN_ID and $timestamp |
87 | - $TXN_ID = absint( $TXN_ID ); |
|
88 | - $timestamp = absint( $timestamp ); |
|
89 | - if ( $TXN_ID && $timestamp ) { |
|
87 | + $TXN_ID = absint($TXN_ID); |
|
88 | + $timestamp = absint($timestamp); |
|
89 | + if ($TXN_ID && $timestamp) { |
|
90 | 90 | wp_schedule_single_event( |
91 | 91 | $timestamp, |
92 | 92 | 'AHEE__EE_Cron_Tasks__update_transaction_with_payment', |
93 | - array( $TXN_ID, $payment ) |
|
93 | + array($TXN_ID, $payment) |
|
94 | 94 | ); |
95 | 95 | } |
96 | 96 | } |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | * @param int $TXN_ID |
113 | 113 | * @param null $payment |
114 | 114 | */ |
115 | - public static function setup_update_for_transaction_with_payment( $TXN_ID = 0, $payment = null ) { |
|
116 | - if ( absint( $TXN_ID )) { |
|
117 | - self::$_update_transactions_with_payment[ $TXN_ID ] = $payment; |
|
115 | + public static function setup_update_for_transaction_with_payment($TXN_ID = 0, $payment = null) { |
|
116 | + if (absint($TXN_ID)) { |
|
117 | + self::$_update_transactions_with_payment[$TXN_ID] = $payment; |
|
118 | 118 | add_action( |
119 | 119 | 'shutdown', |
120 | - array( 'EE_Cron_Tasks', 'update_transaction_with_payment' ), |
|
120 | + array('EE_Cron_Tasks', 'update_transaction_with_payment'), |
|
121 | 121 | 5 |
122 | 122 | ); |
123 | 123 | } |
@@ -135,31 +135,31 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public static function update_transaction_with_payment() { |
137 | 137 | // are there any TXNs that need cleaning up ? |
138 | - if ( ! empty( self::$_update_transactions_with_payment ) ) { |
|
138 | + if ( ! empty(self::$_update_transactions_with_payment)) { |
|
139 | 139 | /** @type EE_Payment_Processor $payment_processor */ |
140 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
140 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
141 | 141 | // set revisit flag for payment processor |
142 | - $payment_processor->set_revisit( false ); |
|
142 | + $payment_processor->set_revisit(false); |
|
143 | 143 | // load EEM_Transaction |
144 | - EE_Registry::instance()->load_model( 'Transaction' ); |
|
145 | - foreach ( self::$_update_transactions_with_payment as $TXN_ID => $payment ) { |
|
144 | + EE_Registry::instance()->load_model('Transaction'); |
|
145 | + foreach (self::$_update_transactions_with_payment as $TXN_ID => $payment) { |
|
146 | 146 | // reschedule the cron if we can't hit the db right now |
147 | - if ( ! EE_Maintenance_Mode::instance()->models_can_query() ) { |
|
147 | + if ( ! EE_Maintenance_Mode::instance()->models_can_query()) { |
|
148 | 148 | // reset cron job for updating the TXN |
149 | 149 | EE_Cron_Tasks::schedule_update_transaction_with_payment( |
150 | - time() + ( 10 * MINUTE_IN_SECONDS ) + 1, |
|
150 | + time() + (10 * MINUTE_IN_SECONDS) + 1, |
|
151 | 151 | $TXN_ID, |
152 | 152 | $payment |
153 | 153 | ); |
154 | 154 | continue; |
155 | 155 | } |
156 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
156 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
157 | 157 | // verify transaction |
158 | - if ( $transaction instanceof EE_Transaction ) { |
|
158 | + if ($transaction instanceof EE_Transaction) { |
|
159 | 159 | // now try to update the TXN with any payments |
160 | - $payment_processor->update_txn_based_on_payment( $transaction, $payment, true, true ); |
|
160 | + $payment_processor->update_txn_based_on_payment($transaction, $payment, true, true); |
|
161 | 161 | } |
162 | - unset( self::$_update_transactions_with_payment[ $TXN_ID ] ); |
|
162 | + unset(self::$_update_transactions_with_payment[$TXN_ID]); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | } |
@@ -196,13 +196,13 @@ discard block |
||
196 | 196 | $TXN_ID |
197 | 197 | ) { |
198 | 198 | // validate $TXN_ID and $timestamp |
199 | - $TXN_ID = absint( $TXN_ID ); |
|
200 | - $timestamp = absint( $timestamp ); |
|
201 | - if ( $TXN_ID && $timestamp ) { |
|
199 | + $TXN_ID = absint($TXN_ID); |
|
200 | + $timestamp = absint($timestamp); |
|
201 | + if ($TXN_ID && $timestamp) { |
|
202 | 202 | wp_schedule_single_event( |
203 | 203 | $timestamp, |
204 | 204 | 'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions', |
205 | - array( $TXN_ID ) |
|
205 | + array($TXN_ID) |
|
206 | 206 | ); |
207 | 207 | } |
208 | 208 | } |
@@ -224,12 +224,12 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @param int $TXN_ID |
226 | 226 | */ |
227 | - public static function check_for_abandoned_transactions( $TXN_ID = 0 ) { |
|
228 | - if ( absint( $TXN_ID )) { |
|
229 | - self::$_abandoned_transactions[] = $TXN_ID; |
|
227 | + public static function check_for_abandoned_transactions($TXN_ID = 0) { |
|
228 | + if (absint($TXN_ID)) { |
|
229 | + self::$_abandoned_transactions[] = $TXN_ID; |
|
230 | 230 | add_action( |
231 | 231 | 'shutdown', |
232 | - array( 'EE_Cron_Tasks', 'finalize_abandoned_transactions' ), |
|
232 | + array('EE_Cron_Tasks', 'finalize_abandoned_transactions'), |
|
233 | 233 | 5 |
234 | 234 | ); |
235 | 235 | } |
@@ -247,38 +247,38 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public static function finalize_abandoned_transactions() { |
249 | 249 | // are there any TXNs that need cleaning up ? |
250 | - if ( ! empty( self::$_abandoned_transactions ) ) { |
|
250 | + if ( ! empty(self::$_abandoned_transactions)) { |
|
251 | 251 | /** @type EE_Transaction_Processor $transaction_processor */ |
252 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
252 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
253 | 253 | // set revisit flag for txn processor |
254 | - $transaction_processor->set_revisit( false ); |
|
254 | + $transaction_processor->set_revisit(false); |
|
255 | 255 | /** @type EE_Transaction_Payments $transaction_payments */ |
256 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
256 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
257 | 257 | // load EEM_Transaction |
258 | - EE_Registry::instance()->load_model( 'Transaction' ); |
|
259 | - foreach ( self::$_abandoned_transactions as $TXN_ID ) { |
|
258 | + EE_Registry::instance()->load_model('Transaction'); |
|
259 | + foreach (self::$_abandoned_transactions as $TXN_ID) { |
|
260 | 260 | // reschedule the cron if we can't hit the db right now |
261 | - if ( ! EE_Maintenance_Mode::instance()->models_can_query() ) { |
|
261 | + if ( ! EE_Maintenance_Mode::instance()->models_can_query()) { |
|
262 | 262 | // reset cron job for finalizing the TXN |
263 | 263 | EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check( |
264 | - time() + ( 10 * MINUTE_IN_SECONDS ) + 1, |
|
264 | + time() + (10 * MINUTE_IN_SECONDS) + 1, |
|
265 | 265 | $TXN_ID |
266 | 266 | ); |
267 | 267 | continue; |
268 | 268 | } |
269 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
269 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
270 | 270 | // verify transaction |
271 | - if ( $transaction instanceof EE_Transaction ) { |
|
271 | + if ($transaction instanceof EE_Transaction) { |
|
272 | 272 | // or have had all of their reg steps completed |
273 | - if ( $transaction_processor->all_reg_steps_completed( $transaction ) === true ) { |
|
273 | + if ($transaction_processor->all_reg_steps_completed($transaction) === true) { |
|
274 | 274 | continue; |
275 | 275 | } |
276 | 276 | // maybe update status, but don't save transaction just yet |
277 | - $transaction_payments ->update_transaction_status_based_on_total_paid( $transaction, false ); |
|
277 | + $transaction_payments ->update_transaction_status_based_on_total_paid($transaction, false); |
|
278 | 278 | // check if enough Reg Steps have been completed to warrant finalizing the TXN |
279 | - if ( $transaction_processor->all_reg_steps_completed_except_final_step( $transaction ) ) { |
|
279 | + if ($transaction_processor->all_reg_steps_completed_except_final_step($transaction)) { |
|
280 | 280 | // and if it hasn't already been set as being started... |
281 | - $transaction_processor->set_reg_step_initiated( $transaction, 'finalize_registration' ); |
|
281 | + $transaction_processor->set_reg_step_initiated($transaction, 'finalize_registration'); |
|
282 | 282 | } |
283 | 283 | // now update the TXN and trigger notifications |
284 | 284 | $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $transaction->last_payment() |
287 | 287 | ); |
288 | 288 | } |
289 | - unset( self::$_abandoned_transactions[ $TXN_ID ] ); |
|
289 | + unset(self::$_abandoned_transactions[$TXN_ID]); |
|
290 | 290 | } |
291 | 291 | } |
292 | 292 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | //when a transaction is initially made, schedule this check. |
301 | 301 | //if it has NO REG data by the time it has expired, forget about it |
302 | 302 | public static function clean_out_junk_transactions() { |
303 | - if( EE_Maintenance_Mode::instance()->models_can_query() ) { |
|
303 | + if (EE_Maintenance_Mode::instance()->models_can_query()) { |
|
304 | 304 | EEM_Transaction::instance('')->delete_junk_transactions(); |
305 | 305 | EEM_Registration::instance('')->delete_registrations_with_no_transaction(); |
306 | 306 | EEM_Line_Item::instance('')->delete_line_items_with_no_transaction(); |