@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * EE_Email_Input |
|
4 | - * |
|
5 | - * @package Event Espresso |
|
6 | - * @subpackage |
|
7 | - * @author Mike Nelson |
|
8 | - */ |
|
3 | + * EE_Email_Input |
|
4 | + * |
|
5 | + * @package Event Espresso |
|
6 | + * @subpackage |
|
7 | + * @author Mike Nelson |
|
8 | + */ |
|
9 | 9 | class EE_Email_Input extends EE_Form_Input_Base{ |
10 | 10 | |
11 | 11 | /** |
@@ -6,22 +6,22 @@ |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_Email_Input extends EE_Form_Input_Base{ |
|
9 | +class EE_Email_Input extends EE_Form_Input_Base { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @param array $input_settings |
13 | 13 | */ |
14 | - function __construct( $input_settings = array() ){ |
|
15 | - $this->_set_display_strategy( new EE_Text_Input_Display_Strategy('email') ); |
|
16 | - $this->_set_normalization_strategy( new EE_Text_Normalization() ); |
|
14 | + function __construct($input_settings = array()) { |
|
15 | + $this->_set_display_strategy(new EE_Text_Input_Display_Strategy('email')); |
|
16 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
17 | 17 | $this->_add_validation_strategy( |
18 | 18 | new EE_Email_Validation_Strategy( |
19 | - isset( $input_settings[ 'validation_error_message' ] ) |
|
20 | - ? $input_settings[ 'validation_error_message' ] |
|
19 | + isset($input_settings['validation_error_message']) |
|
20 | + ? $input_settings['validation_error_message'] |
|
21 | 21 | : NULL |
22 | 22 | ) |
23 | 23 | ); |
24 | - parent::__construct( $input_settings ); |
|
25 | - $this->set_html_class( $this->html_class() . ' email' ); |
|
24 | + parent::__construct($input_settings); |
|
25 | + $this->set_html_class($this->html_class().' email'); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -1,33 +1,33 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * EE_Admin |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage /core/admin/ |
|
20 | - * @author Brent Christensen |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * EE_Admin |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage /core/admin/ |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | final class EE_Admin { |
25 | 25 | |
26 | 26 | /** |
27 | - * EE_Admin Object |
|
28 | - * @private _instance |
|
29 | - * @private protected |
|
30 | - */ |
|
27 | + * EE_Admin Object |
|
28 | + * @private _instance |
|
29 | + * @private protected |
|
30 | + */ |
|
31 | 31 | private static $_instance = NULL; |
32 | 32 | |
33 | 33 | /** |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | |
57 | 57 | |
58 | 58 | /** |
59 | - * class constructor |
|
60 | - */ |
|
59 | + * class constructor |
|
60 | + */ |
|
61 | 61 | protected function __construct() { |
62 | 62 | // define global EE_Admin constants |
63 | 63 | $this->_define_all_constants(); |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | |
169 | 169 | |
170 | 170 | /** |
171 | - * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
172 | - * |
|
173 | - * @access public |
|
174 | - * @return void |
|
175 | - */ |
|
171 | + * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
172 | + * |
|
173 | + * @access public |
|
174 | + * @return void |
|
175 | + */ |
|
176 | 176 | public function init() { |
177 | 177 | |
178 | 178 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
@@ -463,11 +463,11 @@ discard block |
||
463 | 463 | |
464 | 464 | |
465 | 465 | /** |
466 | - * admin_init |
|
467 | - * |
|
468 | - * @access public |
|
469 | - * @return void |
|
470 | - */ |
|
466 | + * admin_init |
|
467 | + * |
|
468 | + * @access public |
|
469 | + * @return void |
|
470 | + */ |
|
471 | 471 | public function admin_init() { |
472 | 472 | |
473 | 473 | /** |
@@ -624,11 +624,11 @@ discard block |
||
624 | 624 | |
625 | 625 | |
626 | 626 | /** |
627 | - * dismiss_persistent_admin_notice |
|
628 | - * |
|
629 | - * @access public |
|
630 | - * @return void |
|
631 | - */ |
|
627 | + * dismiss_persistent_admin_notice |
|
628 | + * |
|
629 | + * @access public |
|
630 | + * @return void |
|
631 | + */ |
|
632 | 632 | public function dismiss_ee_nag_notice_callback() { |
633 | 633 | EE_Error::dismiss_persistent_admin_notice(); |
634 | 634 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public static function instance() { |
49 | 49 | // check if class object is instantiated |
50 | - if ( ! self::$_instance instanceof EE_Admin ) { |
|
50 | + if ( ! self::$_instance instanceof EE_Admin) { |
|
51 | 51 | self::$_instance = new self(); |
52 | 52 | } |
53 | 53 | return self::$_instance; |
@@ -62,25 +62,25 @@ discard block |
||
62 | 62 | // define global EE_Admin constants |
63 | 63 | $this->_define_all_constants(); |
64 | 64 | // set autoloaders for our admin page classes based on included path information |
65 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN ); |
|
65 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN); |
|
66 | 66 | // admin hooks |
67 | - add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 ); |
|
67 | + add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2); |
|
68 | 68 | // load EE_Request_Handler early |
69 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' )); |
|
70 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' )); |
|
71 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 ); |
|
72 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 ); |
|
73 | - add_action( 'admin_init', array( $this, 'admin_init' ), 100 ); |
|
74 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 ); |
|
75 | - add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
76 | - add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
77 | - add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 ); |
|
78 | - add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' )); |
|
69 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request')); |
|
70 | + add_action('AHEE__EE_System__initialize_last', array($this, 'init')); |
|
71 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2); |
|
72 | + add_action('wp_loaded', array($this, 'wp_loaded'), 100); |
|
73 | + add_action('admin_init', array($this, 'admin_init'), 100); |
|
74 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20); |
|
75 | + add_action('admin_notices', array($this, 'display_admin_notices'), 10); |
|
76 | + add_action('network_admin_notices', array($this, 'display_admin_notices'), 10); |
|
77 | + add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2); |
|
78 | + add_filter('admin_footer_text', array($this, 'espresso_admin_footer')); |
|
79 | 79 | |
80 | 80 | //reset Environment config (we only do this on admin page loads); |
81 | 81 | EE_Registry::instance()->CFG->environment->recheck_values(); |
82 | 82 | |
83 | - do_action( 'AHEE__EE_Admin__loaded' ); |
|
83 | + do_action('AHEE__EE_Admin__loaded'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | private function _define_all_constants() { |
98 | - define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' ); |
|
99 | - define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' ); |
|
100 | - define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS ); |
|
101 | - define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' ); |
|
102 | - define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' )); |
|
98 | + define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/'); |
|
99 | + define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/'); |
|
100 | + define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS); |
|
101 | + define('WP_ADMIN_PATH', ABSPATH.'wp-admin/'); |
|
102 | + define('WP_AJAX_URL', admin_url('admin-ajax.php')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -112,23 +112,23 @@ discard block |
||
112 | 112 | * @param string $plugin |
113 | 113 | * @return array |
114 | 114 | */ |
115 | - public function filter_plugin_actions( $links, $plugin ) { |
|
115 | + public function filter_plugin_actions($links, $plugin) { |
|
116 | 116 | // set $main_file in stone |
117 | 117 | static $main_file; |
118 | 118 | // if $main_file is not set yet |
119 | - if ( ! $main_file ) { |
|
120 | - $main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE ); |
|
119 | + if ( ! $main_file) { |
|
120 | + $main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE); |
|
121 | 121 | } |
122 | - if ( $plugin == $main_file ) { |
|
122 | + if ($plugin == $main_file) { |
|
123 | 123 | // compare current plugin to this one |
124 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
125 | - $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>'; |
|
126 | - array_unshift( $links, $maintenance_link ); |
|
124 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
125 | + $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>'; |
|
126 | + array_unshift($links, $maintenance_link); |
|
127 | 127 | } else { |
128 | - $org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>'; |
|
129 | - $events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>'; |
|
128 | + $org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>'; |
|
129 | + $events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>'; |
|
130 | 130 | // add before other links |
131 | - array_unshift( $links, $org_settings_link, $events_link ); |
|
131 | + array_unshift($links, $org_settings_link, $events_link); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | return $links; |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | * @return void |
144 | 144 | */ |
145 | 145 | public function get_request() { |
146 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
147 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
146 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
147 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | * @param array $admin_page_folder_names |
157 | 157 | * @return array |
158 | 158 | */ |
159 | - public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){ |
|
159 | + public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) { |
|
160 | 160 | return array( |
161 | - 'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS, |
|
162 | - 'about' => EE_ADMIN_PAGES . 'about' . DS, |
|
163 | - 'support' => EE_ADMIN_PAGES . 'support' . DS |
|
161 | + 'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS, |
|
162 | + 'about' => EE_ADMIN_PAGES.'about'.DS, |
|
163 | + 'support' => EE_ADMIN_PAGES.'support'.DS |
|
164 | 164 | ); |
165 | 165 | } |
166 | 166 | |
@@ -175,36 +175,36 @@ discard block |
||
175 | 175 | public function init() { |
176 | 176 | |
177 | 177 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
178 | - if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
178 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
179 | 179 | //ok so we want to enable the entire admin |
180 | - add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' )); |
|
181 | - add_action( 'save_post', array( 'EE_Admin', 'parse_post_content_on_save' ), 100, 2 ); |
|
182 | - add_action( 'update_option', array( $this, 'reset_page_for_posts_on_change' ), 100, 3 ); |
|
183 | - add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 ); |
|
184 | - add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
185 | - add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
180 | + add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback')); |
|
181 | + add_action('save_post', array('EE_Admin', 'parse_post_content_on_save'), 100, 2); |
|
182 | + add_action('update_option', array($this, 'reset_page_for_posts_on_change'), 100, 3); |
|
183 | + add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1); |
|
184 | + add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
185 | + add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
186 | 186 | //at a glance dashboard widget |
187 | - add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items'), 10 ); |
|
187 | + add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10); |
|
188 | 188 | //filter for get_edit_post_link used on comments for custom post types |
189 | - add_filter('get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 3 ); |
|
189 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | // run the admin page factory but ONLY if we are doing an ee admin ajax request |
193 | - if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) { |
|
193 | + if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) { |
|
194 | 194 | try { |
195 | 195 | //this loads the controller for the admin pages which will setup routing etc |
196 | - EE_Registry::instance()->load_core( 'Admin_Page_Loader' ); |
|
197 | - } catch ( EE_Error $e ) { |
|
196 | + EE_Registry::instance()->load_core('Admin_Page_Loader'); |
|
197 | + } catch (EE_Error $e) { |
|
198 | 198 | $e->get_error(); |
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
202 | 202 | //make sure our CPTs and custom taxonomy metaboxes get shown for first time users |
203 | - add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 ); |
|
204 | - add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 ); |
|
203 | + add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10); |
|
204 | + add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10); |
|
205 | 205 | |
206 | 206 | //exclude EE critical pages from all nav menus and wp_list_pages |
207 | - add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 ); |
|
207 | + add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -217,9 +217,9 @@ discard block |
||
217 | 217 | * @param object $post_type WP post type object |
218 | 218 | * @return object WP post type object |
219 | 219 | */ |
220 | - public function remove_pages_from_nav_menu( $post_type ) { |
|
220 | + public function remove_pages_from_nav_menu($post_type) { |
|
221 | 221 | //if this isn't the "pages" post type let's get out |
222 | - if ( $post_type->name !== 'page' ) |
|
222 | + if ($post_type->name !== 'page') |
|
223 | 223 | return $post_type; |
224 | 224 | |
225 | 225 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
@@ -239,28 +239,28 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function enable_hidden_ee_nav_menu_metaboxes() { |
241 | 241 | global $wp_meta_boxes, $pagenow; |
242 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) { |
|
242 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') { |
|
243 | 243 | return; |
244 | 244 | } |
245 | 245 | $user = wp_get_current_user(); |
246 | 246 | //has this been done yet? |
247 | - if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) { |
|
247 | + if (get_user_option('ee_nav_menu_initialized', $user->ID)) { |
|
248 | 248 | return; |
249 | 249 | } |
250 | 250 | |
251 | - $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID ); |
|
252 | - $initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) ); |
|
251 | + $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID); |
|
252 | + $initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page')); |
|
253 | 253 | |
254 | - if ( is_array( $hidden_meta_boxes ) ) { |
|
255 | - foreach ( $hidden_meta_boxes as $key => $meta_box_id ) { |
|
256 | - if ( in_array( $meta_box_id, $initial_meta_boxes ) ) { |
|
257 | - unset( $hidden_meta_boxes[ $key ] ); |
|
254 | + if (is_array($hidden_meta_boxes)) { |
|
255 | + foreach ($hidden_meta_boxes as $key => $meta_box_id) { |
|
256 | + if (in_array($meta_box_id, $initial_meta_boxes)) { |
|
257 | + unset($hidden_meta_boxes[$key]); |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | } |
261 | 261 | |
262 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
263 | - update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true ); |
|
262 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
263 | + update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @return void |
280 | 280 | */ |
281 | 281 | public function register_custom_nav_menu_boxes() { |
282 | - add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' ); |
|
282 | + add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core'); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | |
@@ -296,17 +296,17 @@ discard block |
||
296 | 296 | * |
297 | 297 | * @return string the (maybe) modified link |
298 | 298 | */ |
299 | - public function modify_edit_post_link( $link, $id, $context ) { |
|
300 | - if ( ! $post = get_post( $id ) ) |
|
299 | + public function modify_edit_post_link($link, $id, $context) { |
|
300 | + if ( ! $post = get_post($id)) |
|
301 | 301 | return $link; |
302 | 302 | |
303 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
303 | + if ($post->post_type == 'espresso_attendees') { |
|
304 | 304 | $query_args = array( |
305 | 305 | 'action' => 'edit_attendee', |
306 | 306 | 'post' => $id |
307 | 307 | ); |
308 | 308 | EE_Registry::instance()->load_helper('URL'); |
309 | - return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') ); |
|
309 | + return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations')); |
|
310 | 310 | } |
311 | 311 | return $link; |
312 | 312 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | global $nav_menu_selected_id; |
319 | 319 | |
320 | 320 | $db_fields = false; |
321 | - $walker = new Walker_Nav_Menu_Checklist( $db_fields ); |
|
321 | + $walker = new Walker_Nav_Menu_Checklist($db_fields); |
|
322 | 322 | $current_tab = 'event-archives'; |
323 | 323 | |
324 | 324 | /*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { |
@@ -337,9 +337,9 @@ discard block |
||
337 | 337 | ?> |
338 | 338 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
339 | 339 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
340 | - <li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>> |
|
341 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
342 | - <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
|
340 | + <li <?php echo ('event-archives' == $current_tab ? ' class="tabs"' : ''); ?>> |
|
341 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
342 | + <?php _e('Event Archive Pages', 'event_espresso'); ?> |
|
343 | 343 | </a> |
344 | 344 | </li> |
345 | 345 | <?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs. |
@@ -357,13 +357,13 @@ discard block |
||
357 | 357 | <?php */ ?> |
358 | 358 | |
359 | 359 | <div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php |
360 | - echo ( 'event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); |
|
360 | + echo ('event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive'); |
|
361 | 361 | ?>"> |
362 | 362 | <ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear"> |
363 | 363 | <?php |
364 | 364 | $pages = $this->_get_extra_nav_menu_pages_items(); |
365 | 365 | $args['walker'] = $walker; |
366 | - echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args ); |
|
366 | + echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args); |
|
367 | 367 | ?> |
368 | 368 | </ul> |
369 | 369 | </div><!-- /.tabs-panel --> |
@@ -371,18 +371,18 @@ discard block |
||
371 | 371 | <p class="button-controls"> |
372 | 372 | <span class="list-controls"> |
373 | 373 | <a href="<?php |
374 | - echo esc_url( add_query_arg( |
|
374 | + echo esc_url(add_query_arg( |
|
375 | 375 | array( |
376 | 376 | 'extra-nav-menu-pages-tab' => 'event-archives', |
377 | 377 | 'selectall' => 1, |
378 | 378 | ), |
379 | - remove_query_arg( $removed_args ) |
|
379 | + remove_query_arg($removed_args) |
|
380 | 380 | )); |
381 | 381 | ?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a> |
382 | 382 | </span> |
383 | 383 | |
384 | 384 | <span class="add-to-menu"> |
385 | - <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" /> |
|
385 | + <input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" /> |
|
386 | 386 | <span class="spinner"></span> |
387 | 387 | </span> |
388 | 388 | </p> |
@@ -403,10 +403,10 @@ discard block |
||
403 | 403 | private function _get_extra_nav_menu_pages_items() { |
404 | 404 | $menuitems[] = array( |
405 | 405 | 'title' => __('Event List', 'event_espresso'), |
406 | - 'url' => get_post_type_archive_link( 'espresso_events' ), |
|
406 | + 'url' => get_post_type_archive_link('espresso_events'), |
|
407 | 407 | 'description' => __('Archive page for all events.', 'event_espresso') |
408 | 408 | ); |
409 | - return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems ); |
|
409 | + return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * @param $menu_item_values |
419 | 419 | * @return stdClass |
420 | 420 | */ |
421 | - private function _setup_extra_nav_menu_pages_items( $menu_item_values ) { |
|
421 | + private function _setup_extra_nav_menu_pages_items($menu_item_values) { |
|
422 | 422 | $menu_item = new stdClass(); |
423 | 423 | $keys = array( |
424 | 424 | 'ID' => 0, |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | 'xfn' => '' |
439 | 439 | ); |
440 | 440 | |
441 | - foreach ( $keys as $key => $value) { |
|
442 | - $menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value; |
|
441 | + foreach ($keys as $key => $value) { |
|
442 | + $menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value; |
|
443 | 443 | } |
444 | 444 | return $menu_item; |
445 | 445 | } |
@@ -478,10 +478,10 @@ discard block |
||
478 | 478 | * - check if doing post processing of one of EE CPTs |
479 | 479 | * - instantiate the corresponding EE CPT model for the post_type being processed. |
480 | 480 | */ |
481 | - if ( isset( $_POST['action'] ) && $_POST['action'] == 'editpost' ) { |
|
482 | - if ( isset( $_POST['post_type'] ) ) { |
|
483 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
484 | - EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] ); |
|
481 | + if (isset($_POST['action']) && $_POST['action'] == 'editpost') { |
|
482 | + if (isset($_POST['post_type'])) { |
|
483 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
484 | + EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); |
|
485 | 485 | } |
486 | 486 | } |
487 | 487 | |
@@ -491,8 +491,8 @@ discard block |
||
491 | 491 | * 'options-reading.php' core WordPress admin settings page. This is for user-proofing. |
492 | 492 | */ |
493 | 493 | global $pagenow; |
494 | - if ( $pagenow == 'options-reading.php' ) { |
|
495 | - add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) ); |
|
494 | + if ($pagenow == 'options-reading.php') { |
|
495 | + add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages')); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | } |
@@ -504,25 +504,25 @@ discard block |
||
504 | 504 | * @param string $output Current output. |
505 | 505 | * @return string |
506 | 506 | */ |
507 | - public function modify_dropdown_pages( $output ) { |
|
507 | + public function modify_dropdown_pages($output) { |
|
508 | 508 | //get critical pages |
509 | 509 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
510 | 510 | |
511 | 511 | //split current output by line break for easier parsing. |
512 | - $split_output = explode( "\n", $output ); |
|
512 | + $split_output = explode("\n", $output); |
|
513 | 513 | |
514 | 514 | //loop through to remove any critical pages from the array. |
515 | - foreach ( $critical_pages as $page_id ) { |
|
516 | - $needle = 'value="' . $page_id . '"'; |
|
517 | - foreach( $split_output as $key => $haystack ) { |
|
518 | - if( strpos( $haystack, $needle ) !== false ) { |
|
519 | - unset( $split_output[$key] ); |
|
515 | + foreach ($critical_pages as $page_id) { |
|
516 | + $needle = 'value="'.$page_id.'"'; |
|
517 | + foreach ($split_output as $key => $haystack) { |
|
518 | + if (strpos($haystack, $needle) !== false) { |
|
519 | + unset($split_output[$key]); |
|
520 | 520 | } |
521 | 521 | } |
522 | 522 | } |
523 | 523 | |
524 | 524 | //replace output with the new contents |
525 | - $output = implode( "\n", $split_output ); |
|
525 | + $output = implode("\n", $split_output); |
|
526 | 526 | |
527 | 527 | return $output; |
528 | 528 | } |
@@ -538,37 +538,37 @@ discard block |
||
538 | 538 | public function enqueue_admin_scripts() { |
539 | 539 | // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js. |
540 | 540 | // Note: the intention of this script is to only do TARGETED injections. I.E, only injecting on certain script calls. |
541 | - wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
541 | + wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
542 | 542 | // register cookie script for future dependencies |
543 | - wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE ); |
|
543 | + wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE); |
|
544 | 544 | // jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
545 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
545 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
546 | 546 | // register jQuery Validate |
547 | - wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
547 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
548 | 548 | } |
549 | 549 | //joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' ); |
550 | - if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) { |
|
550 | + if (apply_filters('FHEE_load_joyride', FALSE)) { |
|
551 | 551 | //joyride style |
552 | - wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1'); |
|
553 | - wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION ); |
|
554 | - wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE ); |
|
552 | + wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1'); |
|
553 | + wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION); |
|
554 | + wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE); |
|
555 | 555 | //joyride JS |
556 | - wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE ); |
|
556 | + wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE); |
|
557 | 557 | // wanna go for a joyride? |
558 | 558 | wp_enqueue_style('ee-joyride-css'); |
559 | 559 | wp_enqueue_script('jquery-joyride'); |
560 | 560 | } |
561 | 561 | //qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' ); |
562 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
562 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
563 | 563 | EE_Registry::instance()->load_helper('Qtip_Loader'); |
564 | 564 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
565 | 565 | } |
566 | 566 | //accounting.js library |
567 | 567 | // @link http://josscrowcroft.github.io/accounting.js/ |
568 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
569 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
570 | - wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE ); |
|
571 | - wp_enqueue_script( 'ee-accounting' ); |
|
568 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
569 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
570 | + wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE); |
|
571 | + wp_enqueue_script('ee-accounting'); |
|
572 | 572 | // array of settings to get converted to JSON array via wp_localize_script |
573 | 573 | $currency_config = array( |
574 | 574 | 'currency' => array( |
@@ -615,11 +615,11 @@ discard block |
||
615 | 615 | public function get_persistent_admin_notices() { |
616 | 616 | // http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30 |
617 | 617 | $args = array( |
618 | - 'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '', |
|
619 | - 'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '', |
|
618 | + 'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '', |
|
619 | + 'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '', |
|
620 | 620 | ); |
621 | - $return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL ); |
|
622 | - echo EE_Error::get_persistent_admin_notices( $return_url ); |
|
621 | + $return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL); |
|
622 | + echo EE_Error::get_persistent_admin_notices($return_url); |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | |
@@ -640,26 +640,26 @@ discard block |
||
640 | 640 | * @param $elements |
641 | 641 | * @return array |
642 | 642 | */ |
643 | - public function dashboard_glance_items( $elements ) { |
|
643 | + public function dashboard_glance_items($elements) { |
|
644 | 644 | $events = EEM_Event::instance()->count(); |
645 | - $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') ); |
|
646 | - $items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) ); |
|
645 | + $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php')); |
|
646 | + $items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events)); |
|
647 | 647 | $items['events']['title'] = __('Click to view all Events', 'event_espresso'); |
648 | 648 | $registrations = EEM_Registration::instance()->count( |
649 | 649 | array( |
650 | 650 | array( |
651 | - 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) |
|
651 | + 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete) |
|
652 | 652 | ) |
653 | 653 | ) |
654 | 654 | ); |
655 | - $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') ); |
|
656 | - $items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) ); |
|
655 | + $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php')); |
|
656 | + $items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations)); |
|
657 | 657 | $items['registrations']['title'] = __('Click to view all registrations', 'event_espresso'); |
658 | 658 | |
659 | - $items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items ); |
|
659 | + $items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items); |
|
660 | 660 | |
661 | - foreach ( $items as $type => $item_properties ) { |
|
662 | - $elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] ); |
|
661 | + foreach ($items as $type => $item_properties) { |
|
662 | + $elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']); |
|
663 | 663 | } |
664 | 664 | return $elements; |
665 | 665 | } |
@@ -678,63 +678,63 @@ discard block |
||
678 | 678 | * @param $post |
679 | 679 | * @return void |
680 | 680 | */ |
681 | - public static function parse_post_content_on_save( $post_ID, $post ) { |
|
681 | + public static function parse_post_content_on_save($post_ID, $post) { |
|
682 | 682 | // default post types |
683 | - $post_types = array( 'post' => 0, 'page' => 1 ); |
|
683 | + $post_types = array('post' => 0, 'page' => 1); |
|
684 | 684 | // add CPTs |
685 | 685 | $CPTs = EE_Register_CPTs::get_CPTs(); |
686 | - $post_types = array_merge( $post_types, $CPTs ); |
|
686 | + $post_types = array_merge($post_types, $CPTs); |
|
687 | 687 | // for default or CPT posts... |
688 | - if ( isset( $post_types[ $post->post_type ] )) { |
|
688 | + if (isset($post_types[$post->post_type])) { |
|
689 | 689 | // post on frontpage ? |
690 | 690 | $page_for_posts = EE_Config::get_page_for_posts(); |
691 | 691 | $maybe_remove_from_posts = array(); |
692 | 692 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
693 | 693 | $critical_shortcodes = EE_Registry::instance()->CFG->core->get_critical_pages_shortcodes_array(); |
694 | 694 | // array of shortcodes indexed by post name |
695 | - EE_Registry::instance()->CFG->core->post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
695 | + EE_Registry::instance()->CFG->core->post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
696 | 696 | // whether to proceed with update, if an entry already exists for this post, then we want to update |
697 | - $update_post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] ) ? true : false; |
|
697 | + $update_post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name]) ? true : false; |
|
698 | 698 | // empty both arrays |
699 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] = array(); |
|
699 | + EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name] = array(); |
|
700 | 700 | // check that posts page is already being tracked |
701 | - if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] ) ) { |
|
701 | + if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) { |
|
702 | 702 | // if not, then ensure that it is properly added |
703 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] = array(); |
|
703 | + EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts] = array(); |
|
704 | 704 | } |
705 | 705 | // loop thru shortcodes |
706 | - foreach ( EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) { |
|
706 | + foreach (EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) { |
|
707 | 707 | // convert to UPPERCASE to get actual shortcode |
708 | - $EES_Shortcode = strtoupper( $EES_Shortcode ); |
|
708 | + $EES_Shortcode = strtoupper($EES_Shortcode); |
|
709 | 709 | // is the shortcode in the post_content ? |
710 | - if ( strpos( $post->post_content, $EES_Shortcode ) !== FALSE ) { |
|
710 | + if (strpos($post->post_content, $EES_Shortcode) !== FALSE) { |
|
711 | 711 | // map shortcode to post names and post IDs |
712 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID; |
|
712 | + EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID; |
|
713 | 713 | // if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE |
714 | - if ( ! in_array( $EES_Shortcode, $critical_shortcodes )) { |
|
714 | + if ( ! in_array($EES_Shortcode, $critical_shortcodes)) { |
|
715 | 715 | // add shortcode to "Posts page" tracking |
716 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = $post_ID; |
|
716 | + EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = $post_ID; |
|
717 | 717 | } |
718 | 718 | $update_post_shortcodes = TRUE; |
719 | - unset( $maybe_remove_from_posts[ $EES_Shortcode ] ); |
|
719 | + unset($maybe_remove_from_posts[$EES_Shortcode]); |
|
720 | 720 | } else { |
721 | - $maybe_remove_from_posts[ $EES_Shortcode ] = $post_ID; |
|
721 | + $maybe_remove_from_posts[$EES_Shortcode] = $post_ID; |
|
722 | 722 | } |
723 | 723 | } |
724 | - if ( $update_post_shortcodes ) { |
|
724 | + if ($update_post_shortcodes) { |
|
725 | 725 | // remove shortcodes from $maybe_remove_from_posts that are still being used |
726 | - foreach ( EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes ) { |
|
727 | - if ( $post_name == $page_for_posts ) { |
|
726 | + foreach (EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes) { |
|
727 | + if ($post_name == $page_for_posts) { |
|
728 | 728 | continue; |
729 | 729 | } |
730 | 730 | // compute difference between active post_shortcodes array and $maybe_remove_from_posts array |
731 | - $maybe_remove_from_posts = array_diff_key( $maybe_remove_from_posts, $shortcodes ); |
|
731 | + $maybe_remove_from_posts = array_diff_key($maybe_remove_from_posts, $shortcodes); |
|
732 | 732 | } |
733 | 733 | // now unset unused shortcodes from the $page_for_posts post_shortcodes |
734 | - foreach ( $maybe_remove_from_posts as $shortcode => $post_ID ) { |
|
735 | - unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode ] ); |
|
734 | + foreach ($maybe_remove_from_posts as $shortcode => $post_ID) { |
|
735 | + unset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$shortcode]); |
|
736 | 736 | } |
737 | - EE_Registry::instance()->CFG->update_post_shortcodes( $page_for_posts ); |
|
737 | + EE_Registry::instance()->CFG->update_post_shortcodes($page_for_posts); |
|
738 | 738 | } |
739 | 739 | } |
740 | 740 | } |
@@ -752,32 +752,32 @@ discard block |
||
752 | 752 | * @throws EE_Error |
753 | 753 | * @return string |
754 | 754 | */ |
755 | - public function check_for_invalid_datetime_formats( $value, $option ) { |
|
756 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
755 | + public function check_for_invalid_datetime_formats($value, $option) { |
|
756 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
757 | 757 | // check for date_format or time_format |
758 | - switch ( $option ) { |
|
758 | + switch ($option) { |
|
759 | 759 | case 'date_format' : |
760 | - $date_time_format = $value . ' ' . get_option('time_format'); |
|
760 | + $date_time_format = $value.' '.get_option('time_format'); |
|
761 | 761 | break; |
762 | 762 | case 'time_format' : |
763 | - $date_time_format = get_option('date_format') . ' ' . $value; |
|
763 | + $date_time_format = get_option('date_format').' '.$value; |
|
764 | 764 | break; |
765 | 765 | default : |
766 | 766 | $date_time_format = FALSE; |
767 | 767 | } |
768 | 768 | // do we have a date_time format to check ? |
769 | - if ( $date_time_format ) { |
|
770 | - $error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format ); |
|
769 | + if ($date_time_format) { |
|
770 | + $error_msg = EEH_DTT_Helper::validate_format_string($date_time_format); |
|
771 | 771 | |
772 | - if ( is_array( $error_msg ) ) { |
|
773 | - $msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format ) . '</p><p><ul>'; |
|
772 | + if (is_array($error_msg)) { |
|
773 | + $msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>'; |
|
774 | 774 | |
775 | 775 | |
776 | - foreach ( $error_msg as $error ) { |
|
777 | - $msg .= '<li>' . $error . '</li>'; |
|
776 | + foreach ($error_msg as $error) { |
|
777 | + $msg .= '<li>'.$error.'</li>'; |
|
778 | 778 | } |
779 | 779 | |
780 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
780 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
781 | 781 | |
782 | 782 | // trigger WP settings error |
783 | 783 | add_settings_error( |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | ); |
788 | 788 | |
789 | 789 | // set format to something valid |
790 | - switch ( $option ) { |
|
790 | + switch ($option) { |
|
791 | 791 | case 'date_format' : |
792 | 792 | $value = 'F j, Y'; |
793 | 793 | break; |
@@ -813,14 +813,14 @@ discard block |
||
813 | 813 | * @param $value |
814 | 814 | * @return void |
815 | 815 | */ |
816 | - public function reset_page_for_posts_on_change( $option, $old_value, $value ) { |
|
817 | - if ( $option == 'page_for_posts' ) { |
|
816 | + public function reset_page_for_posts_on_change($option, $old_value, $value) { |
|
817 | + if ($option == 'page_for_posts') { |
|
818 | 818 | global $wpdb; |
819 | - $SQL = 'SELECT post_name from ' . $wpdb->posts . ' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s'; |
|
820 | - $old_page_for_posts = $old_value ? $wpdb->get_var( $wpdb->prepare( $SQL, $old_value )) : 'posts'; |
|
821 | - $new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value )) : 'posts'; |
|
822 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $new_page_for_posts ] = EE_Registry::instance()->CFG->core->post_shortcodes[ $old_page_for_posts ]; |
|
823 | - EE_Registry::instance()->CFG->update_post_shortcodes( $new_page_for_posts ); |
|
819 | + $SQL = 'SELECT post_name from '.$wpdb->posts.' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s'; |
|
820 | + $old_page_for_posts = $old_value ? $wpdb->get_var($wpdb->prepare($SQL, $old_value)) : 'posts'; |
|
821 | + $new_page_for_posts = $value ? $wpdb->get_var($wpdb->prepare($SQL, $value)) : 'posts'; |
|
822 | + EE_Registry::instance()->CFG->core->post_shortcodes[$new_page_for_posts] = EE_Registry::instance()->CFG->core->post_shortcodes[$old_page_for_posts]; |
|
823 | + EE_Registry::instance()->CFG->update_post_shortcodes($new_page_for_posts); |
|
824 | 824 | } |
825 | 825 | } |
826 | 826 | |
@@ -833,8 +833,8 @@ discard block |
||
833 | 833 | * @param $content |
834 | 834 | * @return string |
835 | 835 | */ |
836 | - public function its_eSpresso( $content ) { |
|
837 | - return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content ); |
|
836 | + public function its_eSpresso($content) { |
|
837 | + return str_replace('[EXPRESSO_', '[ESPRESSO_', $content); |
|
838 | 838 | } |
839 | 839 | |
840 | 840 | |
@@ -847,9 +847,9 @@ discard block |
||
847 | 847 | */ |
848 | 848 | public function espresso_admin_footer() { |
849 | 849 | return sprintf( |
850 | - __( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ), |
|
850 | + __('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'), |
|
851 | 851 | '<a href="https://eventespresso.com/" title="', |
852 | - '">' . EVENT_ESPRESSO_POWERED_BY . '</a>' |
|
852 | + '">'.EVENT_ESPRESSO_POWERED_BY.'</a>' |
|
853 | 853 | ); |
854 | 854 | } |
855 | 855 | |
@@ -869,11 +869,11 @@ discard block |
||
869 | 869 | * @param array $config |
870 | 870 | * @return void |
871 | 871 | */ |
872 | - public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
|
873 | - EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
|
874 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) |
|
872 | + public static function register_ee_admin_page($page_basename, $page_path, $config = array()) { |
|
873 | + EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3'); |
|
874 | + if (class_exists('EE_Register_Admin_Page')) |
|
875 | 875 | $config['page_path'] = $page_path; |
876 | - EE_Register_Admin_Page::register( $page_basename, $config ); |
|
876 | + EE_Register_Admin_Page::register($page_basename, $config); |
|
877 | 877 | } |
878 | 878 | |
879 | 879 |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Espresso Template functions |
|
4 | - * |
|
5 | - * @ package Event Espresso |
|
6 | - * @ author Seth Shoultes |
|
7 | - * @ copyright (c) 2008-2014 Event Espresso All Rights Reserved. |
|
8 | - * @ license http://venueespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
9 | - * @ link http://www.eventespresso.com |
|
10 | - * @ version 4+ |
|
11 | - */ |
|
3 | + * Espresso Template functions |
|
4 | + * |
|
5 | + * @ package Event Espresso |
|
6 | + * @ author Seth Shoultes |
|
7 | + * @ copyright (c) 2008-2014 Event Espresso All Rights Reserved. |
|
8 | + * @ license http://venueespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
9 | + * @ link http://www.eventespresso.com |
|
10 | + * @ version 4+ |
|
11 | + */ |
|
12 | 12 | define( 'EE_THEME_FUNCTIONS_LOADED', TRUE ); |
13 | 13 | |
14 | 14 | /** |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | * @ link http://www.eventespresso.com |
10 | 10 | * @ version 4+ |
11 | 11 | */ |
12 | -define( 'EE_THEME_FUNCTIONS_LOADED', TRUE ); |
|
12 | +define('EE_THEME_FUNCTIONS_LOADED', TRUE); |
|
13 | 13 | |
14 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
14 | +if ( ! function_exists('espresso_pagination')) { |
|
15 | 15 | /** |
16 | 16 | * espresso_pagination |
17 | 17 | * |
@@ -23,21 +23,21 @@ discard block |
||
23 | 23 | $big = 999999999; // need an unlikely integer |
24 | 24 | $pagination = paginate_links( |
25 | 25 | array( |
26 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
26 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
27 | 27 | 'format' => '?paged=%#%', |
28 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
28 | + 'current' => max(1, get_query_var('paged')), |
|
29 | 29 | 'total' => $wp_query->max_num_pages, |
30 | 30 | 'show_all' => true, |
31 | 31 | 'end_size' => 10, |
32 | 32 | 'mid_size' => 6, |
33 | 33 | 'prev_next' => true, |
34 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
35 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
34 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
35 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
36 | 36 | 'type' => 'plain', |
37 | 37 | 'add_args' => false, |
38 | 38 | 'add_fragment' => '' |
39 | 39 | ) |
40 | 40 | ); |
41 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
41 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @since 4.6 |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Text_Input_Display_Strategy extends EE_Display_Strategy_Base{ |
|
14 | +class EE_Text_Input_Display_Strategy extends EE_Display_Strategy_Base { |
|
15 | 15 | /** |
16 | 16 | * The html "type" attribute value. default is "text" |
17 | 17 | * @var string |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * @param string $type |
25 | 25 | */ |
26 | - function __construct( $type = 'text' ) { |
|
26 | + function __construct($type = 'text') { |
|
27 | 27 | $this->_type = $type; |
28 | 28 | parent::__construct(); |
29 | 29 | } |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | * Gets the html "type" attribute's value |
35 | 35 | * @return string |
36 | 36 | */ |
37 | - function get_type(){ |
|
37 | + function get_type() { |
|
38 | 38 | if ( |
39 | 39 | $this->_type == 'email' |
40 | - && ! apply_filters( 'FHEE__EE_Text_Input_Display_Strategy__use_html5_email', false ) |
|
40 | + && ! apply_filters('FHEE__EE_Text_Input_Display_Strategy__use_html5_email', false) |
|
41 | 41 | ) { |
42 | 42 | return 'text'; |
43 | 43 | } |
@@ -50,16 +50,16 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return string of html to display the field |
52 | 52 | */ |
53 | - function display(){ |
|
54 | - $input = '<input type="'. $this->get_type() .'"'; |
|
55 | - $input .= ' name="' . $this->_input->html_name() . '"'; |
|
56 | - $input .= ' id="' . $this->_input->html_id() . '"'; |
|
57 | - $class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class(); |
|
58 | - $input .= ' class="' . $class . '"'; |
|
53 | + function display() { |
|
54 | + $input = '<input type="'.$this->get_type().'"'; |
|
55 | + $input .= ' name="'.$this->_input->html_name().'"'; |
|
56 | + $input .= ' id="'.$this->_input->html_id().'"'; |
|
57 | + $class = $this->_input->required() ? $this->_input->required_css_class().' '.$this->_input->html_class() : $this->_input->html_class(); |
|
58 | + $input .= ' class="'.$class.'"'; |
|
59 | 59 | // add html5 required |
60 | 60 | $input .= $this->_input->required() ? ' required' : ''; |
61 | - $input .= ' value="' . $this->_input->raw_value_in_form() . '"'; |
|
62 | - $input .= ' style="' . $this->_input->html_style() . '"'; |
|
61 | + $input .= ' value="'.$this->_input->raw_value_in_form().'"'; |
|
62 | + $input .= ' style="'.$this->_input->html_style().'"'; |
|
63 | 63 | $input .= $this->_input->html_other_attributes(); |
64 | 64 | $input .= '/>'; |
65 | 65 | return $input; |
@@ -1,18 +1,18 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * Class EE_Email_Validation_Strategy |
|
4 | - * |
|
5 | - * @package Event Espresso |
|
6 | - * @subpackage core |
|
7 | - * @author Mike Nelson |
|
8 | - * @since 4.6 |
|
9 | - * |
|
10 | - */ |
|
3 | + * Class EE_Email_Validation_Strategy |
|
4 | + * |
|
5 | + * @package Event Espresso |
|
6 | + * @subpackage core |
|
7 | + * @author Mike Nelson |
|
8 | + * @since 4.6 |
|
9 | + * |
|
10 | + */ |
|
11 | 11 | class EE_Email_Validation_Strategy extends EE_Text_Validation_Strategy{ |
12 | 12 | |
13 | 13 | /** |
14 | - * @param null $validation_error_message |
|
15 | - */ |
|
14 | + * @param null $validation_error_message |
|
15 | + */ |
|
16 | 16 | public function __construct( $validation_error_message = NULL ) { |
17 | 17 | if( ! $validation_error_message ){ |
18 | 18 | $validation_error_message = __("Please enter a valid email address.", "event_espresso"); |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | |
39 | 39 | |
40 | 40 | /** |
41 | - * @return array |
|
42 | - */ |
|
41 | + * @return array |
|
42 | + */ |
|
43 | 43 | function get_jquery_validation_rule_array(){ |
44 | 44 | return array( 'email'=>true, 'messages' => array( 'email' => $this->get_validation_error_message() ) ); |
45 | 45 | } |
@@ -8,16 +8,16 @@ discard block |
||
8 | 8 | * @since 4.6 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EE_Email_Validation_Strategy extends EE_Text_Validation_Strategy{ |
|
11 | +class EE_Email_Validation_Strategy extends EE_Text_Validation_Strategy { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @param null $validation_error_message |
15 | 15 | */ |
16 | - public function __construct( $validation_error_message = NULL ) { |
|
17 | - if( ! $validation_error_message ){ |
|
16 | + public function __construct($validation_error_message = NULL) { |
|
17 | + if ( ! $validation_error_message) { |
|
18 | 18 | $validation_error_message = __("Please enter a valid email address.", "event_espresso"); |
19 | 19 | } |
20 | - parent::__construct( $validation_error_message ); |
|
20 | + parent::__construct($validation_error_message); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | * @return bool |
30 | 30 | * @throws \EE_Validation_Error |
31 | 31 | */ |
32 | - function validate( $normalized_value ) { |
|
33 | - if( $normalized_value && ! $this->_validate_email( $normalized_value ) ){ |
|
34 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'required'); |
|
32 | + function validate($normalized_value) { |
|
33 | + if ($normalized_value && ! $this->_validate_email($normalized_value)) { |
|
34 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * @return array |
42 | 42 | */ |
43 | - function get_jquery_validation_rule_array(){ |
|
44 | - return array( 'email'=>true, 'messages' => array( 'email' => $this->get_validation_error_message() ) ); |
|
43 | + function get_jquery_validation_rule_array() { |
|
44 | + return array('email'=>true, 'messages' => array('email' => $this->get_validation_error_message())); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -54,29 +54,29 @@ discard block |
||
54 | 54 | * @return bool of whether the email is valid or not |
55 | 55 | * @throws \EE_Validation_Error |
56 | 56 | */ |
57 | - private function _validate_email( $email ) { |
|
58 | - if ( ! preg_match( '/^.+\@\S+\.\S+$/', $email ) ) { |
|
57 | + private function _validate_email($email) { |
|
58 | + if ( ! preg_match('/^.+\@\S+\.\S+$/', $email)) { |
|
59 | 59 | // email not in correct {string}@{string}.{string} format |
60 | 60 | return false; |
61 | 61 | } else { |
62 | - $atIndex = strrpos( $email, "@" ); |
|
63 | - $domain = substr( $email, $atIndex + 1 ); |
|
64 | - $local = substr( $email, 0, $atIndex ); |
|
65 | - $localLen = strlen( $local ); |
|
66 | - $domainLen = strlen( $domain ); |
|
67 | - if ( $localLen < 1 || $localLen > 64 ) { |
|
62 | + $atIndex = strrpos($email, "@"); |
|
63 | + $domain = substr($email, $atIndex + 1); |
|
64 | + $local = substr($email, 0, $atIndex); |
|
65 | + $localLen = strlen($local); |
|
66 | + $domainLen = strlen($domain); |
|
67 | + if ($localLen < 1 || $localLen > 64) { |
|
68 | 68 | // local part length exceeded |
69 | 69 | return false; |
70 | - } else if ( $domainLen < 1 || $domainLen > 255 ) { |
|
70 | + } else if ($domainLen < 1 || $domainLen > 255) { |
|
71 | 71 | // domain part length exceeded |
72 | 72 | return false; |
73 | - } else if ( $local[ 0 ] == '.' || $local[ $localLen - 1 ] == '.' ) { |
|
73 | + } else if ($local[0] == '.' || $local[$localLen - 1] == '.') { |
|
74 | 74 | // local part starts or ends with '.' |
75 | 75 | return false; |
76 | - } else if ( preg_match( '/\\.\\./', $local ) ) { |
|
76 | + } else if (preg_match('/\\.\\./', $local)) { |
|
77 | 77 | // local part has two consecutive dots |
78 | 78 | return false; |
79 | - } else if ( preg_match( '/\\.\\./', $domain ) ) { |
|
79 | + } else if (preg_match('/\\.\\./', $domain)) { |
|
80 | 80 | // domain part has two consecutive dots |
81 | 81 | return false; |
82 | 82 | } else if ( |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | ) |
88 | 88 | ) { |
89 | 89 | return false; |
90 | - } else if ( apply_filters( 'FHEE__EE_Email_Validation_Strategy___validate_email__perform_dns_checks', false ) ) { |
|
91 | - if ( ! checkdnsrr( $domain, "MX" ) ) { |
|
90 | + } else if (apply_filters('FHEE__EE_Email_Validation_Strategy___validate_email__perform_dns_checks', false)) { |
|
91 | + if ( ! checkdnsrr($domain, "MX")) { |
|
92 | 92 | // domain not found in MX records |
93 | 93 | throw new EE_Validation_Error( |
94 | 94 | __( |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | 'event_espresso' |
97 | 97 | ) |
98 | 98 | ); |
99 | - } else if ( ! checkdnsrr( $domain, "A" ) ) { |
|
99 | + } else if ( ! checkdnsrr($domain, "A")) { |
|
100 | 100 | // domain not found in A records |
101 | 101 | throw new EE_Validation_Error( |
102 | 102 | __( |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public static function instance() { |
130 | 130 | // check if class object is instantiated, and instantiated properly |
131 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
131 | + if ( ! self::$_instance instanceof EE_Config) { |
|
132 | 132 | self::$_instance = new self(); |
133 | 133 | } |
134 | 134 | return self::$_instance; |
@@ -145,22 +145,22 @@ discard block |
||
145 | 145 | * not be ready to instantiate EE_Config currently (eg if the site was put into maintenance mode) |
146 | 146 | * @return EE_Config |
147 | 147 | */ |
148 | - public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE ){ |
|
149 | - if ( $hard_reset ) { |
|
148 | + public static function reset($hard_reset = FALSE, $reinstantiate = TRUE) { |
|
149 | + if ($hard_reset) { |
|
150 | 150 | self::$_instance->_config_option_names = array(); |
151 | 151 | self::$_instance->_initialize_config(); |
152 | 152 | self::$_instance->update_espresso_config(); |
153 | 153 | } |
154 | - if( self::$_instance instanceof EE_Config ){ |
|
154 | + if (self::$_instance instanceof EE_Config) { |
|
155 | 155 | self::$_instance->shutdown(); |
156 | 156 | } |
157 | 157 | self::$_instance = NULL; |
158 | 158 | //we don't need to reset the static properties imo because those should |
159 | 159 | //only change when a module is added or removed. Currently we don't |
160 | 160 | //support removing a module during a request when it previously existed |
161 | - if( $reinstantiate ){ |
|
161 | + if ($reinstantiate) { |
|
162 | 162 | return self::instance(); |
163 | - }else{ |
|
163 | + } else { |
|
164 | 164 | return NULL; |
165 | 165 | } |
166 | 166 | } |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | * @return \EE_Config |
175 | 175 | */ |
176 | 176 | private function __construct() { |
177 | - do_action( 'AHEE__EE_Config__construct__begin',$this ); |
|
178 | - $this->_config_option_names = get_option( 'ee_config_option_names', array() ); |
|
177 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
178 | + $this->_config_option_names = get_option('ee_config_option_names', array()); |
|
179 | 179 | // setup empty config classes |
180 | 180 | $this->_initialize_config(); |
181 | 181 | // load existing EE site settings |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | // confirm everything loaded correctly and set filtered defaults if not |
184 | 184 | $this->_verify_config(); |
185 | 185 | // register shortcodes and modules |
186 | - add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 ); |
|
186 | + add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999); |
|
187 | 187 | // initialize shortcodes and modules |
188 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' )); |
|
188 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
189 | 189 | // register widgets |
190 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
190 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
191 | 191 | // shutdown |
192 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
192 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
193 | 193 | // construct__end hook |
194 | - do_action( 'AHEE__EE_Config__construct__end',$this ); |
|
194 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
195 | 195 | // hardcoded hack |
196 | 196 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
197 | 197 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @return string current theme set. |
205 | 205 | */ |
206 | 206 | public static function get_current_theme() { |
207 | - return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
207 | + return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -238,27 +238,27 @@ discard block |
||
238 | 238 | */ |
239 | 239 | private function _load_core_config() { |
240 | 240 | // load_core_config__start hook |
241 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
241 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
242 | 242 | $espresso_config = $this->get_espresso_config(); |
243 | - foreach ( $espresso_config as $config => $settings ) { |
|
243 | + foreach ($espresso_config as $config => $settings) { |
|
244 | 244 | // load_core_config__start hook |
245 | - $settings = apply_filters( 'FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this ); |
|
246 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
247 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
245 | + $settings = apply_filters('FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this); |
|
246 | + if (is_object($settings) && property_exists($this, $config)) { |
|
247 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
248 | 248 | //call configs populate method to ensure any defaults are set for empty values. |
249 | - if ( method_exists( $settings, 'populate' ) ) { |
|
249 | + if (method_exists($settings, 'populate')) { |
|
250 | 250 | $this->{$config}->populate(); |
251 | 251 | } |
252 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
252 | + if (method_exists($settings, 'do_hooks')) { |
|
253 | 253 | $this->{$config}->do_hooks(); |
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
257 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', FALSE ) ) { |
|
257 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', FALSE)) { |
|
258 | 258 | $this->update_espresso_config(); |
259 | 259 | } |
260 | 260 | // load_core_config__end hook |
261 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
261 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -272,40 +272,40 @@ discard block |
||
272 | 272 | protected function _verify_config() { |
273 | 273 | |
274 | 274 | $this->core = $this->core instanceof EE_Core_Config |
275 | - ? $this->core : new EE_Core_Config(); |
|
276 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
275 | + ? $this->core : new EE_Core_Config(); |
|
276 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
277 | 277 | |
278 | 278 | $this->organization = $this->organization instanceof EE_Organization_Config |
279 | - ? $this->organization : new EE_Organization_Config(); |
|
280 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
279 | + ? $this->organization : new EE_Organization_Config(); |
|
280 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
281 | 281 | |
282 | 282 | $this->currency = $this->currency instanceof EE_Currency_Config |
283 | 283 | ? $this->currency : new EE_Currency_Config(); |
284 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
284 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
285 | 285 | |
286 | 286 | $this->registration = $this->registration instanceof EE_Registration_Config |
287 | 287 | ? $this->registration : new EE_Registration_Config(); |
288 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
288 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
289 | 289 | |
290 | 290 | $this->admin = $this->admin instanceof EE_Admin_Config |
291 | 291 | ? $this->admin : new EE_Admin_Config(); |
292 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
292 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
293 | 293 | |
294 | 294 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
295 | 295 | ? $this->template_settings : new EE_Template_Config(); |
296 | - $this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', $this->template_settings ); |
|
296 | + $this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', $this->template_settings); |
|
297 | 297 | |
298 | 298 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
299 | 299 | ? $this->map_settings : new EE_Map_Config(); |
300 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
300 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
301 | 301 | |
302 | 302 | $this->environment = $this->environment instanceof EE_Environment_Config |
303 | 303 | ? $this->environment : new EE_Environment_Config(); |
304 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
304 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
305 | 305 | |
306 | 306 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
307 | 307 | ? $this->gateway : new EE_Gateway_Config(); |
308 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
308 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
309 | 309 | |
310 | 310 | } |
311 | 311 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | public function get_espresso_config() { |
321 | 321 | // grab espresso configuration |
322 | - return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() )); |
|
322 | + return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array())); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -332,12 +332,12 @@ discard block |
||
332 | 332 | * @param $old_value |
333 | 333 | * @param $value |
334 | 334 | */ |
335 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
335 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
336 | 336 | // make sure we're checking the ee config |
337 | - if ( $option == 'ee_config' ) { |
|
337 | + if ($option == 'ee_config') { |
|
338 | 338 | // run a loose comparison of the old value against the new value for type and properties, |
339 | 339 | // but NOT exact instance like WP update_option does |
340 | - if ( $value != $old_value ) { |
|
340 | + if ($value != $old_value) { |
|
341 | 341 | // if they are NOT the same, then remove the hook, |
342 | 342 | // which means the subsequent update results will be based solely on the update query results |
343 | 343 | // the reason we do this is because, as stated above, |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | // the string it sees in the db looks the same as the new one it has been passed!!! |
353 | 353 | // This results in the query returning an "affected rows" value of ZERO, |
354 | 354 | // which gets returned immediately by WP update_option and looks like an error. |
355 | - remove_action( 'update_option', array( $this, 'check_config_updated' )); |
|
355 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 | } |
@@ -367,11 +367,11 @@ discard block |
||
367 | 367 | */ |
368 | 368 | protected function _reset_espresso_addon_config() { |
369 | 369 | $this->_config_option_names = array(); |
370 | - foreach( $this->addons as $addon_name => $addon_config_obj ) { |
|
371 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
372 | - $config_class = get_class( $addon_config_obj ); |
|
373 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
374 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE ); |
|
370 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
371 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
372 | + $config_class = get_class($addon_config_obj); |
|
373 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
374 | + $this->update_config('addons', $addon_name, $addon_config_obj, FALSE); |
|
375 | 375 | } |
376 | 376 | $this->addons->{$addon_name} = NULL; |
377 | 377 | } |
@@ -387,17 +387,17 @@ discard block |
||
387 | 387 | * @param bool $add_error |
388 | 388 | * @return bool |
389 | 389 | */ |
390 | - public function update_espresso_config( $add_success = FALSE, $add_error = TRUE ) { |
|
390 | + public function update_espresso_config($add_success = FALSE, $add_error = TRUE) { |
|
391 | 391 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
392 | 392 | //$clone = clone( self::$_instance ); |
393 | 393 | //self::$_instance = NULL; |
394 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this ); |
|
394 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
395 | 395 | $this->_reset_espresso_addon_config(); |
396 | 396 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
397 | 397 | // but BEFORE the actual update occurs |
398 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
398 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
399 | 399 | // now update "ee_config" |
400 | - $saved = update_option( 'ee_config', $this ); |
|
400 | + $saved = update_option('ee_config', $this); |
|
401 | 401 | // if not saved... check if the hook we just added still exists; |
402 | 402 | // if it does, it means one of two things: |
403 | 403 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -408,25 +408,25 @@ discard block |
||
408 | 408 | // but just means no update occurred, so don't display an error to the user. |
409 | 409 | // BUT... if update_option returns FALSE, AND the hook is missing, |
410 | 410 | // then it means that something truly went wrong |
411 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved; |
|
411 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
412 | 412 | // remove our action since we don't want it in the system anymore |
413 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
414 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
413 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
414 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
415 | 415 | //self::$_instance = $clone; |
416 | 416 | //unset( $clone ); |
417 | 417 | // if config remains the same or was updated successfully |
418 | - if ( $saved ) { |
|
419 | - if ( $add_success ) { |
|
418 | + if ($saved) { |
|
419 | + if ($add_success) { |
|
420 | 420 | EE_Error::add_success( |
421 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
421 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
422 | 422 | __FILE__, __FUNCTION__, __LINE__ |
423 | 423 | ); |
424 | 424 | } |
425 | 425 | return TRUE; |
426 | 426 | } else { |
427 | - if ( $add_error ) { |
|
427 | + if ($add_error) { |
|
428 | 428 | EE_Error::add_error( |
429 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
429 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
430 | 430 | __FILE__, __FUNCTION__, __LINE__ |
431 | 431 | ); |
432 | 432 | } |
@@ -452,20 +452,20 @@ discard block |
||
452 | 452 | $name = '', |
453 | 453 | $config_class = '', |
454 | 454 | $config_obj = NULL, |
455 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
455 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
456 | 456 | $display_errors = TRUE |
457 | 457 | ) { |
458 | 458 | try { |
459 | - foreach ( $tests_to_run as $test ) { |
|
460 | - switch ( $test ) { |
|
459 | + foreach ($tests_to_run as $test) { |
|
460 | + switch ($test) { |
|
461 | 461 | |
462 | 462 | // TEST #1 : check that section was set |
463 | 463 | case 1 : |
464 | - if ( empty( $section ) ) { |
|
465 | - if ( $display_errors ) { |
|
464 | + if (empty($section)) { |
|
465 | + if ($display_errors) { |
|
466 | 466 | throw new EE_Error( |
467 | 467 | sprintf( |
468 | - __( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ), |
|
468 | + __('No configuration section has been provided while attempting to save "%s".', 'event_espresso'), |
|
469 | 469 | $config_class |
470 | 470 | ) |
471 | 471 | ); |
@@ -476,11 +476,11 @@ discard block |
||
476 | 476 | |
477 | 477 | // TEST #2 : check that settings section exists |
478 | 478 | case 2 : |
479 | - if ( ! isset( $this->{$section} ) ) { |
|
480 | - if ( $display_errors ) { |
|
479 | + if ( ! isset($this->{$section} )) { |
|
480 | + if ($display_errors) { |
|
481 | 481 | throw new EE_Error( |
482 | - sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
483 | - $section ) |
|
482 | + sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'), |
|
483 | + $section) |
|
484 | 484 | ); |
485 | 485 | } |
486 | 486 | return false; |
@@ -490,12 +490,12 @@ discard block |
||
490 | 490 | // TEST #3 : check that section is the proper format |
491 | 491 | case 3 : |
492 | 492 | if ( |
493 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
493 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
494 | 494 | ) { |
495 | - if ( $display_errors ) { |
|
495 | + if ($display_errors) { |
|
496 | 496 | throw new EE_Error( |
497 | 497 | sprintf( |
498 | - __( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ), |
|
498 | + __('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'), |
|
499 | 499 | $section |
500 | 500 | ) |
501 | 501 | ); |
@@ -506,10 +506,10 @@ discard block |
||
506 | 506 | |
507 | 507 | // TEST #4 : check that config section name has been set |
508 | 508 | case 4 : |
509 | - if ( empty( $name ) ) { |
|
510 | - if ( $display_errors ) { |
|
509 | + if (empty($name)) { |
|
510 | + if ($display_errors) { |
|
511 | 511 | throw new EE_Error( |
512 | - __( 'No name has been provided for the specific configuration section.', 'event_espresso' ) |
|
512 | + __('No name has been provided for the specific configuration section.', 'event_espresso') |
|
513 | 513 | ); |
514 | 514 | } |
515 | 515 | return false; |
@@ -518,10 +518,10 @@ discard block |
||
518 | 518 | |
519 | 519 | // TEST #5 : check that a config class name has been set |
520 | 520 | case 5 : |
521 | - if ( empty( $config_class ) ) { |
|
522 | - if ( $display_errors ) { |
|
521 | + if (empty($config_class)) { |
|
522 | + if ($display_errors) { |
|
523 | 523 | throw new EE_Error( |
524 | - __( 'No class name has been provided for the specific configuration section.', 'event_espresso' ) |
|
524 | + __('No class name has been provided for the specific configuration section.', 'event_espresso') |
|
525 | 525 | ); |
526 | 526 | } |
527 | 527 | return false; |
@@ -530,11 +530,11 @@ discard block |
||
530 | 530 | |
531 | 531 | // TEST #6 : verify config class is accessible |
532 | 532 | case 6 : |
533 | - if ( ! class_exists( $config_class ) ) { |
|
534 | - if ( $display_errors ) { |
|
533 | + if ( ! class_exists($config_class)) { |
|
534 | + if ($display_errors) { |
|
535 | 535 | throw new EE_Error( |
536 | 536 | sprintf( |
537 | - __( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ), |
|
537 | + __('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'), |
|
538 | 538 | $config_class |
539 | 539 | ) |
540 | 540 | ); |
@@ -545,11 +545,11 @@ discard block |
||
545 | 545 | |
546 | 546 | // TEST #7 : check that config has even been set |
547 | 547 | case 7 : |
548 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
549 | - if ( $display_errors ) { |
|
548 | + if ( ! isset($this->{$section}->{$name} )) { |
|
549 | + if ($display_errors) { |
|
550 | 550 | throw new EE_Error( |
551 | 551 | sprintf( |
552 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
552 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
553 | 553 | $section, |
554 | 554 | $name |
555 | 555 | ) |
@@ -558,17 +558,17 @@ discard block |
||
558 | 558 | return false; |
559 | 559 | } else { |
560 | 560 | // and make sure it's not serialized |
561 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
561 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
562 | 562 | } |
563 | 563 | break; |
564 | 564 | |
565 | 565 | // TEST #8 : check that config is the requested type |
566 | 566 | case 8 : |
567 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
568 | - if ( $display_errors ) { |
|
567 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
568 | + if ($display_errors) { |
|
569 | 569 | throw new EE_Error( |
570 | 570 | sprintf( |
571 | - __( 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso' ), |
|
571 | + __('The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso'), |
|
572 | 572 | $section, |
573 | 573 | $name, |
574 | 574 | $config_class |
@@ -581,12 +581,12 @@ discard block |
||
581 | 581 | |
582 | 582 | // TEST #9 : verify config object |
583 | 583 | case 9 : |
584 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
585 | - if ( $display_errors ) { |
|
584 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
585 | + if ($display_errors) { |
|
586 | 586 | throw new EE_Error( |
587 | 587 | sprintf( |
588 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
589 | - print_r( $config_obj, true ) |
|
588 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
589 | + print_r($config_obj, true) |
|
590 | 590 | ) |
591 | 591 | ); |
592 | 592 | } |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | } |
598 | 598 | } |
599 | 599 | |
600 | - } catch( EE_Error $e ) { |
|
600 | + } catch (EE_Error $e) { |
|
601 | 601 | $e->get_error(); |
602 | 602 | } |
603 | 603 | // you have successfully run the gauntlet |
@@ -614,8 +614,8 @@ discard block |
||
614 | 614 | * @param string $name |
615 | 615 | * @return string |
616 | 616 | */ |
617 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
618 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
617 | + private function _generate_config_option_name($section = '', $name = '') { |
|
618 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | |
@@ -629,10 +629,10 @@ discard block |
||
629 | 629 | * @param string $name |
630 | 630 | * @return string |
631 | 631 | */ |
632 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
633 | - return ! empty( $config_class ) |
|
632 | + private function _set_config_class($config_class = '', $name = '') { |
|
633 | + return ! empty($config_class) |
|
634 | 634 | ? $config_class |
635 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
635 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | |
@@ -646,34 +646,34 @@ discard block |
||
646 | 646 | * @param EE_Config_Base $config_obj |
647 | 647 | * @return EE_Config_Base |
648 | 648 | */ |
649 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
649 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
650 | 650 | // ensure config class is set to something |
651 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
651 | + $config_class = $this->_set_config_class($config_class, $name); |
|
652 | 652 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
653 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ))) { |
|
653 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
654 | 654 | return null; |
655 | 655 | } |
656 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
656 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
657 | 657 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
658 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
659 | - $this->_config_option_names[ $config_option_name ] = $config_class; |
|
658 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
659 | + $this->_config_option_names[$config_option_name] = $config_class; |
|
660 | 660 | } |
661 | 661 | // verify the incoming config object but suppress errors |
662 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false )) { |
|
662 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
663 | 663 | $config_obj = new $config_class(); |
664 | 664 | } |
665 | - if ( get_option( $config_option_name ) ) { |
|
666 | - update_option( $config_option_name, $config_obj ); |
|
665 | + if (get_option($config_option_name)) { |
|
666 | + update_option($config_option_name, $config_obj); |
|
667 | 667 | $this->{$section}->{$name} = $config_obj; |
668 | 668 | return $this->{$section}->{$name}; |
669 | 669 | } else { |
670 | 670 | // create a wp-option for this config |
671 | - if ( add_option( $config_option_name, $config_obj, '', 'no' )) { |
|
672 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
671 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
672 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
673 | 673 | return $this->{$section}->{$name}; |
674 | 674 | } else { |
675 | 675 | EE_Error::add_error( |
676 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
676 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
677 | 677 | __FILE__, __FUNCTION__, __LINE__ |
678 | 678 | ); |
679 | 679 | return null; |
@@ -694,37 +694,37 @@ discard block |
||
694 | 694 | * @param bool $throw_errors |
695 | 695 | * @return bool |
696 | 696 | */ |
697 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
698 | - $config_obj = maybe_unserialize( $config_obj ); |
|
697 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
698 | + $config_obj = maybe_unserialize($config_obj); |
|
699 | 699 | // get class name of the incoming object |
700 | - $config_class = get_class( $config_obj ); |
|
700 | + $config_class = get_class($config_obj); |
|
701 | 701 | // run tests 1-5 and 9 to verify config |
702 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) { |
|
702 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) { |
|
703 | 703 | return false; |
704 | 704 | } |
705 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
705 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
706 | 706 | // check if config object has been added to db by seeing if config option name is in $this->_config_option_names array |
707 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
707 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
708 | 708 | // save new config to db |
709 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
709 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
710 | 710 | } else { |
711 | 711 | // first check if the record already exists |
712 | - $existing_config = get_option( $config_option_name ); |
|
713 | - $config_obj = serialize( $config_obj ); |
|
712 | + $existing_config = get_option($config_option_name); |
|
713 | + $config_obj = serialize($config_obj); |
|
714 | 714 | // just return if db record is already up to date |
715 | - if ( $existing_config == $config_obj ) { |
|
715 | + if ($existing_config == $config_obj) { |
|
716 | 716 | $this->{$section}->{$name} = $config_obj; |
717 | 717 | return true; |
718 | - } else if ( update_option( $config_option_name, $config_obj )) { |
|
718 | + } else if (update_option($config_option_name, $config_obj)) { |
|
719 | 719 | // update wp-option for this config class |
720 | 720 | $this->{$section}->{$name} = $config_obj; |
721 | 721 | return true; |
722 | - } elseif ( $throw_errors ) { |
|
722 | + } elseif ($throw_errors) { |
|
723 | 723 | EE_Error::add_error( |
724 | 724 | sprintf( |
725 | - __( 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso' ), |
|
725 | + __('The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso'), |
|
726 | 726 | $config_class, |
727 | - 'EE_Config->' . $section . '->' . $name |
|
727 | + 'EE_Config->'.$section.'->'.$name |
|
728 | 728 | ), |
729 | 729 | __FILE__, __FUNCTION__, __LINE__ |
730 | 730 | ); |
@@ -744,34 +744,34 @@ discard block |
||
744 | 744 | * @param string $config_class |
745 | 745 | * @return mixed EE_Config_Base | NULL |
746 | 746 | */ |
747 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
747 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
748 | 748 | // ensure config class is set to something |
749 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
749 | + $config_class = $this->_set_config_class($config_class, $name); |
|
750 | 750 | // run tests 1-4, 6 and 7 to verify that all params have been set |
751 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) { |
|
751 | + if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) { |
|
752 | 752 | return NULL; |
753 | 753 | } |
754 | 754 | // now test if the requested config object exists, but suppress errors |
755 | - if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) { |
|
755 | + if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) { |
|
756 | 756 | // config already exists, so pass it back |
757 | 757 | return $this->{$section}->{$name}; |
758 | 758 | } |
759 | 759 | // load config option from db if it exists |
760 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name )); |
|
760 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
761 | 761 | // verify the newly retrieved config object, but suppress errors |
762 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) { |
|
762 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) { |
|
763 | 763 | // config is good, so set it and pass it back |
764 | 764 | $this->{$section}->{$name} = $config_obj; |
765 | 765 | return $this->{$section}->{$name}; |
766 | 766 | } |
767 | 767 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
768 | - $config_obj =$this->set_config( $section, $name, $config_class ); |
|
768 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
769 | 769 | // verify the newly created config object |
770 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) { |
|
770 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
771 | 771 | return $this->{$section}->{$name}; |
772 | 772 | } else { |
773 | 773 | EE_Error::add_error( |
774 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
774 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
775 | 775 | __FILE__, __FUNCTION__, __LINE__ |
776 | 776 | ); |
777 | 777 | } |
@@ -786,9 +786,9 @@ discard block |
||
786 | 786 | * @param string $config_option_name |
787 | 787 | * @return mixed EE_Config_Base | FALSE |
788 | 788 | */ |
789 | - public function get_config_option( $config_option_name = '' ) { |
|
789 | + public function get_config_option($config_option_name = '') { |
|
790 | 790 | // retrieve the wp-option for this config class. |
791 | - return maybe_unserialize( get_option( $config_option_name )); |
|
791 | + return maybe_unserialize(get_option($config_option_name)); |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | |
@@ -801,45 +801,45 @@ discard block |
||
801 | 801 | * @param $page_for_posts |
802 | 802 | * @return void |
803 | 803 | */ |
804 | - public function update_post_shortcodes( $page_for_posts = '' ) { |
|
804 | + public function update_post_shortcodes($page_for_posts = '') { |
|
805 | 805 | // make sure page_for_posts is set |
806 | - $page_for_posts = ! empty( $page_for_posts ) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
806 | + $page_for_posts = ! empty($page_for_posts) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
807 | 807 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
808 | 808 | $critical_shortcodes = $this->core->get_critical_pages_shortcodes_array(); |
809 | 809 | // allow others to mess stuff up :D |
810 | - do_action( 'AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts ); |
|
810 | + do_action('AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts); |
|
811 | 811 | // verify that post_shortcodes is set |
812 | - $this->core->post_shortcodes = isset( $this->core->post_shortcodes ) && is_array( $this->core->post_shortcodes ) ? $this->core->post_shortcodes : array(); |
|
812 | + $this->core->post_shortcodes = isset($this->core->post_shortcodes) && is_array($this->core->post_shortcodes) ? $this->core->post_shortcodes : array(); |
|
813 | 813 | // cycle thru post_shortcodes |
814 | - foreach( $this->core->post_shortcodes as $post_name => $shortcodes ){ |
|
814 | + foreach ($this->core->post_shortcodes as $post_name => $shortcodes) { |
|
815 | 815 | // are there any shortcodes to track ? |
816 | - if ( ! empty( $shortcodes )) { |
|
816 | + if ( ! empty($shortcodes)) { |
|
817 | 817 | // loop thru list of tracked shortcodes |
818 | - foreach( $shortcodes as $shortcode => $post_id ) { |
|
818 | + foreach ($shortcodes as $shortcode => $post_id) { |
|
819 | 819 | // if shortcode is for a critical page, BUT this is NOT the corresponding critical page for that shortcode |
820 | - if ( isset( $critical_shortcodes[ $post_id ] ) && $post_name == $page_for_posts ) { |
|
820 | + if (isset($critical_shortcodes[$post_id]) && $post_name == $page_for_posts) { |
|
821 | 821 | // then remove this shortcode, because we don't want critical page shortcodes like ESPRESSO_TXN_PAGE running on the "Posts Page" (blog) |
822 | - unset( $this->core->post_shortcodes[ $post_name ][ $shortcode ] ); |
|
822 | + unset($this->core->post_shortcodes[$post_name][$shortcode]); |
|
823 | 823 | } |
824 | 824 | // skip the posts page, because we want all shortcodes registered for it |
825 | - if ( $post_name == $page_for_posts ) { |
|
825 | + if ($post_name == $page_for_posts) { |
|
826 | 826 | continue; |
827 | 827 | } |
828 | 828 | // make sure post still exists |
829 | - $post = get_post( $post_id ); |
|
830 | - if ( $post ) { |
|
829 | + $post = get_post($post_id); |
|
830 | + if ($post) { |
|
831 | 831 | // check that the post name matches what we have saved |
832 | - if ( $post->post_name == $post_name ) { |
|
832 | + if ($post->post_name == $post_name) { |
|
833 | 833 | // if so, then break before hitting the unset below |
834 | 834 | continue; |
835 | 835 | } |
836 | 836 | } |
837 | 837 | // we don't like missing posts around here >:( |
838 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
838 | + unset($this->core->post_shortcodes[$post_name]); |
|
839 | 839 | } |
840 | 840 | } else { |
841 | 841 | // you got no shortcodes to keep track of ! |
842 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
842 | + unset($this->core->post_shortcodes[$post_name]); |
|
843 | 843 | } |
844 | 844 | } |
845 | 845 | //only show errors |
@@ -858,14 +858,14 @@ discard block |
||
858 | 858 | * @return string |
859 | 859 | */ |
860 | 860 | public static function get_page_for_posts() { |
861 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
862 | - if ( ! $page_for_posts ) { |
|
861 | + $page_for_posts = get_option('page_for_posts'); |
|
862 | + if ( ! $page_for_posts) { |
|
863 | 863 | return 'posts'; |
864 | 864 | } |
865 | 865 | /** @type WPDB $wpdb */ |
866 | 866 | global $wpdb; |
867 | 867 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
868 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts )); |
|
868 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
869 | 869 | } |
870 | 870 | |
871 | 871 | |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | */ |
883 | 883 | public function register_shortcodes_and_modules() { |
884 | 884 | // allow shortcodes to register with WP and to set hooks for the rest of the system |
885 | - EE_Registry::instance()->shortcodes =$this->_register_shortcodes(); |
|
885 | + EE_Registry::instance()->shortcodes = $this->_register_shortcodes(); |
|
886 | 886 | // allow modules to set hooks for the rest of the system |
887 | 887 | EE_Registry::instance()->modules = $this->_register_modules(); |
888 | 888 | } |
@@ -914,21 +914,21 @@ discard block |
||
914 | 914 | public function widgets_init() { |
915 | 915 | //only init widgets on admin pages when not in complete maintenance, and |
916 | 916 | //on frontend when not in any maintenance mode |
917 | - if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level() ) { |
|
917 | + if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) { |
|
918 | 918 | // grab list of installed widgets |
919 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
919 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
920 | 920 | // filter list of modules to register |
921 | - $widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register ); |
|
921 | + $widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register); |
|
922 | 922 | |
923 | - if ( ! empty( $widgets_to_register ) ) { |
|
923 | + if ( ! empty($widgets_to_register)) { |
|
924 | 924 | // cycle thru widget folders |
925 | - foreach ( $widgets_to_register as $widget_path ) { |
|
925 | + foreach ($widgets_to_register as $widget_path) { |
|
926 | 926 | // add to list of installed widget modules |
927 | - EE_Config::register_ee_widget( $widget_path ); |
|
927 | + EE_Config::register_ee_widget($widget_path); |
|
928 | 928 | } |
929 | 929 | } |
930 | 930 | // filter list of installed modules |
931 | - EE_Registry::instance()->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets ); |
|
931 | + EE_Registry::instance()->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets); |
|
932 | 932 | } |
933 | 933 | } |
934 | 934 | |
@@ -941,54 +941,54 @@ discard block |
||
941 | 941 | * @param string $widget_path - full path up to and including widget folder |
942 | 942 | * @return void |
943 | 943 | */ |
944 | - public static function register_ee_widget( $widget_path = NULL ) { |
|
945 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
944 | + public static function register_ee_widget($widget_path = NULL) { |
|
945 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
946 | 946 | $widget_ext = '.widget.php'; |
947 | 947 | // make all separators match |
948 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
948 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
949 | 949 | // does the file path INCLUDE the actual file name as part of the path ? |
950 | - if ( strpos( $widget_path, $widget_ext ) !== FALSE ) { |
|
950 | + if (strpos($widget_path, $widget_ext) !== FALSE) { |
|
951 | 951 | // grab and shortcode file name from directory name and break apart at dots |
952 | - $file_name = explode( '.', basename( $widget_path )); |
|
952 | + $file_name = explode('.', basename($widget_path)); |
|
953 | 953 | // take first segment from file name pieces and remove class prefix if it exists |
954 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
954 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
955 | 955 | // sanitize shortcode directory name |
956 | - $widget = sanitize_key( $widget ); |
|
956 | + $widget = sanitize_key($widget); |
|
957 | 957 | // now we need to rebuild the shortcode path |
958 | - $widget_path = explode( DS, $widget_path ); |
|
958 | + $widget_path = explode(DS, $widget_path); |
|
959 | 959 | // remove last segment |
960 | - array_pop( $widget_path ); |
|
960 | + array_pop($widget_path); |
|
961 | 961 | // glue it back together |
962 | - $widget_path = implode( DS, $widget_path ); |
|
962 | + $widget_path = implode(DS, $widget_path); |
|
963 | 963 | } else { |
964 | 964 | // grab and sanitize widget directory name |
965 | - $widget = sanitize_key( basename( $widget_path )); |
|
965 | + $widget = sanitize_key(basename($widget_path)); |
|
966 | 966 | } |
967 | 967 | // create classname from widget directory name |
968 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ))); |
|
968 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
969 | 969 | // add class prefix |
970 | - $widget_class = 'EEW_' . $widget; |
|
970 | + $widget_class = 'EEW_'.$widget; |
|
971 | 971 | // does the widget exist ? |
972 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) { |
|
972 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
973 | 973 | $msg = sprintf( |
974 | - __( 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso' ), |
|
974 | + __('The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'), |
|
975 | 975 | $widget_class, |
976 | - $widget_path . DS . $widget_class . $widget_ext |
|
976 | + $widget_path.DS.$widget_class.$widget_ext |
|
977 | 977 | ); |
978 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
978 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
979 | 979 | return; |
980 | 980 | } |
981 | 981 | // load the widget class file |
982 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
982 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
983 | 983 | // verify that class exists |
984 | - if ( ! class_exists( $widget_class )) { |
|
985 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
986 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
984 | + if ( ! class_exists($widget_class)) { |
|
985 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
986 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
987 | 987 | return; |
988 | 988 | } |
989 | - register_widget( $widget_class ); |
|
989 | + register_widget($widget_class); |
|
990 | 990 | // add to array of registered widgets |
991 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
991 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
992 | 992 | } |
993 | 993 | |
994 | 994 | |
@@ -1001,18 +1001,18 @@ discard block |
||
1001 | 1001 | */ |
1002 | 1002 | private function _register_shortcodes() { |
1003 | 1003 | // grab list of installed shortcodes |
1004 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1004 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1005 | 1005 | // filter list of modules to register |
1006 | - $shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register ); |
|
1007 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1006 | + $shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register); |
|
1007 | + if ( ! empty($shortcodes_to_register)) { |
|
1008 | 1008 | // cycle thru shortcode folders |
1009 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1009 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1010 | 1010 | // add to list of installed shortcode modules |
1011 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1011 | + EE_Config::register_shortcode($shortcode_path); |
|
1012 | 1012 | } |
1013 | 1013 | } |
1014 | 1014 | // filter list of installed modules |
1015 | - return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes ); |
|
1015 | + return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes); |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | |
@@ -1024,56 +1024,56 @@ discard block |
||
1024 | 1024 | * @param string $shortcode_path - full path up to and including shortcode folder |
1025 | 1025 | * @return bool |
1026 | 1026 | */ |
1027 | - public static function register_shortcode( $shortcode_path = NULL ) { |
|
1028 | - do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path ); |
|
1027 | + public static function register_shortcode($shortcode_path = NULL) { |
|
1028 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1029 | 1029 | $shortcode_ext = '.shortcode.php'; |
1030 | 1030 | // make all separators match |
1031 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1031 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1032 | 1032 | // does the file path INCLUDE the actual file name as part of the path ? |
1033 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) { |
|
1033 | + if (strpos($shortcode_path, $shortcode_ext) !== FALSE) { |
|
1034 | 1034 | // grab shortcode file name from directory name and break apart at dots |
1035 | - $shortcode_file = explode( '.', basename( $shortcode_path )); |
|
1035 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1036 | 1036 | // take first segment from file name pieces and remove class prefix if it exists |
1037 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0]; |
|
1037 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0]; |
|
1038 | 1038 | // sanitize shortcode directory name |
1039 | - $shortcode = sanitize_key( $shortcode ); |
|
1039 | + $shortcode = sanitize_key($shortcode); |
|
1040 | 1040 | // now we need to rebuild the shortcode path |
1041 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1041 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1042 | 1042 | // remove last segment |
1043 | - array_pop( $shortcode_path ); |
|
1043 | + array_pop($shortcode_path); |
|
1044 | 1044 | // glue it back together |
1045 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1045 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1046 | 1046 | } else { |
1047 | 1047 | // we need to generate the filename based off of the folder name |
1048 | 1048 | // grab and sanitize shortcode directory name |
1049 | - $shortcode = sanitize_key( basename( $shortcode_path )); |
|
1050 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1049 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1050 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1051 | 1051 | } |
1052 | 1052 | // create classname from shortcode directory or file name |
1053 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ))); |
|
1053 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1054 | 1054 | // add class prefix |
1055 | - $shortcode_class = 'EES_' . $shortcode; |
|
1055 | + $shortcode_class = 'EES_'.$shortcode; |
|
1056 | 1056 | // does the shortcode exist ? |
1057 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) { |
|
1057 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1058 | 1058 | $msg = sprintf( |
1059 | - __( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ), |
|
1059 | + __('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'), |
|
1060 | 1060 | $shortcode_class, |
1061 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1061 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1062 | 1062 | ); |
1063 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1063 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1064 | 1064 | return FALSE; |
1065 | 1065 | } |
1066 | 1066 | // load the shortcode class file |
1067 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1067 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1068 | 1068 | // verify that class exists |
1069 | - if ( ! class_exists( $shortcode_class )) { |
|
1070 | - $msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class ); |
|
1071 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1069 | + if ( ! class_exists($shortcode_class)) { |
|
1070 | + $msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class); |
|
1071 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1072 | 1072 | return FALSE; |
1073 | 1073 | } |
1074 | - $shortcode = strtoupper( $shortcode ); |
|
1074 | + $shortcode = strtoupper($shortcode); |
|
1075 | 1075 | // add to array of registered shortcodes |
1076 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1076 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1077 | 1077 | return TRUE; |
1078 | 1078 | } |
1079 | 1079 | |
@@ -1088,23 +1088,23 @@ discard block |
||
1088 | 1088 | */ |
1089 | 1089 | private function _register_modules() { |
1090 | 1090 | // grab list of installed modules |
1091 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1091 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1092 | 1092 | // filter list of modules to register |
1093 | - $modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register ); |
|
1093 | + $modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register); |
|
1094 | 1094 | |
1095 | 1095 | |
1096 | - if ( ! empty( $modules_to_register ) ) { |
|
1096 | + if ( ! empty($modules_to_register)) { |
|
1097 | 1097 | // loop through folders |
1098 | - foreach ( $modules_to_register as $module_path ) { |
|
1098 | + foreach ($modules_to_register as $module_path) { |
|
1099 | 1099 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1100 | - if ( $module_path != EE_MODULES . 'zzz-copy-this-module-template' && $module_path != EE_MODULES . 'gateways' ) { |
|
1100 | + if ($module_path != EE_MODULES.'zzz-copy-this-module-template' && $module_path != EE_MODULES.'gateways') { |
|
1101 | 1101 | // add to list of installed modules |
1102 | - EE_Config::register_module( $module_path ); |
|
1102 | + EE_Config::register_module($module_path); |
|
1103 | 1103 | } |
1104 | 1104 | } |
1105 | 1105 | } |
1106 | 1106 | // filter list of installed modules |
1107 | - return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules ); |
|
1107 | + return apply_filters('FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules); |
|
1108 | 1108 | } |
1109 | 1109 | |
1110 | 1110 | |
@@ -1117,54 +1117,54 @@ discard block |
||
1117 | 1117 | * @param string $module_path - full path up to and including module folder |
1118 | 1118 | * @return bool |
1119 | 1119 | */ |
1120 | - public static function register_module( $module_path = NULL ) { |
|
1121 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1120 | + public static function register_module($module_path = NULL) { |
|
1121 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1122 | 1122 | $module_ext = '.module.php'; |
1123 | 1123 | // make all separators match |
1124 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1124 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1125 | 1125 | // does the file path INCLUDE the actual file name as part of the path ? |
1126 | - if ( strpos( $module_path, $module_ext ) !== FALSE ) { |
|
1126 | + if (strpos($module_path, $module_ext) !== FALSE) { |
|
1127 | 1127 | // grab and shortcode file name from directory name and break apart at dots |
1128 | - $module_file = explode( '.', basename( $module_path )); |
|
1128 | + $module_file = explode('.', basename($module_path)); |
|
1129 | 1129 | // now we need to rebuild the shortcode path |
1130 | - $module_path = explode( DS, $module_path ); |
|
1130 | + $module_path = explode(DS, $module_path); |
|
1131 | 1131 | // remove last segment |
1132 | - array_pop( $module_path ); |
|
1132 | + array_pop($module_path); |
|
1133 | 1133 | // glue it back together |
1134 | - $module_path = implode( DS, $module_path ) . DS; |
|
1134 | + $module_path = implode(DS, $module_path).DS; |
|
1135 | 1135 | // take first segment from file name pieces and sanitize it |
1136 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1136 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1137 | 1137 | // ensure class prefix is added |
1138 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1138 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1139 | 1139 | } else { |
1140 | 1140 | // we need to generate the filename based off of the folder name |
1141 | 1141 | // grab and sanitize module name |
1142 | - $module = strtolower( basename( $module_path )); |
|
1143 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module); |
|
1142 | + $module = strtolower(basename($module_path)); |
|
1143 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1144 | 1144 | // like trailingslashit() |
1145 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1145 | + $module_path = rtrim($module_path, DS).DS; |
|
1146 | 1146 | // create classname from module directory name |
1147 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ))); |
|
1147 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1148 | 1148 | // add class prefix |
1149 | - $module_class = 'EED_' . $module; |
|
1149 | + $module_class = 'EED_'.$module; |
|
1150 | 1150 | } |
1151 | 1151 | // does the module exist ? |
1152 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) { |
|
1153 | - $msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module ); |
|
1154 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1152 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1153 | + $msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module); |
|
1154 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1155 | 1155 | return FALSE; |
1156 | 1156 | } |
1157 | 1157 | // load the module class file |
1158 | - require_once( $module_path . $module_class . $module_ext ); |
|
1158 | + require_once($module_path.$module_class.$module_ext); |
|
1159 | 1159 | // verify that class exists |
1160 | - if ( ! class_exists( $module_class )) { |
|
1161 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1162 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1160 | + if ( ! class_exists($module_class)) { |
|
1161 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1162 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1163 | 1163 | return FALSE; |
1164 | 1164 | } |
1165 | 1165 | // add to array of registered modules |
1166 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1167 | - do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->{$module_class} ); |
|
1166 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1167 | + do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->{$module_class} ); |
|
1168 | 1168 | return TRUE; |
1169 | 1169 | } |
1170 | 1170 | |
@@ -1178,23 +1178,23 @@ discard block |
||
1178 | 1178 | */ |
1179 | 1179 | private function _initialize_shortcodes() { |
1180 | 1180 | // cycle thru shortcode folders |
1181 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1181 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1182 | 1182 | // add class prefix |
1183 | - $shortcode_class = 'EES_' . $shortcode; |
|
1183 | + $shortcode_class = 'EES_'.$shortcode; |
|
1184 | 1184 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1185 | 1185 | // which set hooks ? |
1186 | - if ( is_admin() ) { |
|
1186 | + if (is_admin()) { |
|
1187 | 1187 | // fire immediately |
1188 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' )); |
|
1188 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1189 | 1189 | } else { |
1190 | 1190 | // delay until other systems are online |
1191 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' )); |
|
1191 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks')); |
|
1192 | 1192 | // convert classname to UPPERCASE and create WP shortcode. |
1193 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1193 | + $shortcode_tag = strtoupper($shortcode); |
|
1194 | 1194 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1195 | - if ( ! shortcode_exists( $shortcode_tag )) { |
|
1195 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1196 | 1196 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1197 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' )); |
|
1197 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1198 | 1198 | } |
1199 | 1199 | } |
1200 | 1200 | } |
@@ -1211,15 +1211,15 @@ discard block |
||
1211 | 1211 | */ |
1212 | 1212 | private function _initialize_modules() { |
1213 | 1213 | // cycle thru shortcode folders |
1214 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1214 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1215 | 1215 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1216 | 1216 | // which set hooks ? |
1217 | - if ( is_admin() ) { |
|
1217 | + if (is_admin()) { |
|
1218 | 1218 | // fire immediately |
1219 | - call_user_func( array( $module_class, 'set_hooks_admin' )); |
|
1219 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1220 | 1220 | } else { |
1221 | 1221 | // delay until other systems are online |
1222 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' )); |
|
1222 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks')); |
|
1223 | 1223 | } |
1224 | 1224 | } |
1225 | 1225 | } |
@@ -1237,26 +1237,26 @@ discard block |
||
1237 | 1237 | * @param string $key - url param key indicating a route is being called |
1238 | 1238 | * @return bool |
1239 | 1239 | */ |
1240 | - public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) { |
|
1241 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1242 | - $module = str_replace( 'EED_', '', $module ); |
|
1243 | - $module_class = 'EED_' . $module; |
|
1244 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} )) { |
|
1245 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1246 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1240 | + public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') { |
|
1241 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1242 | + $module = str_replace('EED_', '', $module); |
|
1243 | + $module_class = 'EED_'.$module; |
|
1244 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1245 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1246 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1247 | 1247 | return FALSE; |
1248 | 1248 | } |
1249 | - if ( empty( $route )) { |
|
1250 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1251 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1249 | + if (empty($route)) { |
|
1250 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1251 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1252 | 1252 | return FALSE; |
1253 | 1253 | } |
1254 | - if ( ! method_exists ( 'EED_' . $module, $method_name )) { |
|
1255 | - $msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route ); |
|
1256 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1254 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1255 | + $msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route); |
|
1256 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1257 | 1257 | return FALSE; |
1258 | 1258 | } |
1259 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1259 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1260 | 1260 | return TRUE; |
1261 | 1261 | } |
1262 | 1262 | |
@@ -1270,11 +1270,11 @@ discard block |
||
1270 | 1270 | * @param string $key - url param key indicating a route is being called |
1271 | 1271 | * @return string |
1272 | 1272 | */ |
1273 | - public static function get_route( $route = NULL, $key = 'ee' ) { |
|
1274 | - do_action( 'AHEE__EE_Config__get_route__begin',$route ); |
|
1275 | - $route = apply_filters( 'FHEE__EE_Config__get_route',$route ); |
|
1276 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) { |
|
1277 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1273 | + public static function get_route($route = NULL, $key = 'ee') { |
|
1274 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1275 | + $route = apply_filters('FHEE__EE_Config__get_route', $route); |
|
1276 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1277 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1278 | 1278 | } |
1279 | 1279 | return NULL; |
1280 | 1280 | } |
@@ -1303,35 +1303,35 @@ discard block |
||
1303 | 1303 | * @param string $key - url param key indicating a route is being called |
1304 | 1304 | * @return bool |
1305 | 1305 | */ |
1306 | - public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) { |
|
1307 | - do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward ); |
|
1308 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1309 | - $msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route ); |
|
1310 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1306 | + public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') { |
|
1307 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1308 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1309 | + $msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route); |
|
1310 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1311 | 1311 | return FALSE; |
1312 | 1312 | } |
1313 | - if ( empty( $forward )) { |
|
1314 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1315 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1313 | + if (empty($forward)) { |
|
1314 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1315 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1316 | 1316 | return FALSE; |
1317 | 1317 | } |
1318 | - if ( is_array( $forward )) { |
|
1319 | - if ( ! isset( $forward[1] )) { |
|
1320 | - $msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route ); |
|
1321 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1318 | + if (is_array($forward)) { |
|
1319 | + if ( ! isset($forward[1])) { |
|
1320 | + $msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route); |
|
1321 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1322 | 1322 | return FALSE; |
1323 | 1323 | } |
1324 | - if ( ! method_exists( $forward[0], $forward[1] )) { |
|
1325 | - $msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route ); |
|
1326 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1324 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1325 | + $msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route); |
|
1326 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1327 | 1327 | return FALSE; |
1328 | 1328 | } |
1329 | - } else if ( ! function_exists( $forward )) { |
|
1330 | - $msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route ); |
|
1331 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1329 | + } else if ( ! function_exists($forward)) { |
|
1330 | + $msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route); |
|
1331 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1332 | 1332 | return FALSE; |
1333 | 1333 | } |
1334 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1334 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1335 | 1335 | return TRUE; |
1336 | 1336 | } |
1337 | 1337 | |
@@ -1346,10 +1346,10 @@ discard block |
||
1346 | 1346 | * @param string $key - url param key indicating a route is being called |
1347 | 1347 | * @return string |
1348 | 1348 | */ |
1349 | - public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1350 | - do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status ); |
|
1351 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) { |
|
1352 | - return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1349 | + public static function get_forward($route = NULL, $status = 0, $key = 'ee') { |
|
1350 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1351 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1352 | + return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status); |
|
1353 | 1353 | } |
1354 | 1354 | return NULL; |
1355 | 1355 | } |
@@ -1366,19 +1366,19 @@ discard block |
||
1366 | 1366 | * @param string $key - url param key indicating a route is being called |
1367 | 1367 | * @return bool |
1368 | 1368 | */ |
1369 | - public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) { |
|
1370 | - do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view ); |
|
1371 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1372 | - $msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route ); |
|
1373 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1369 | + public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') { |
|
1370 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1371 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1372 | + $msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route); |
|
1373 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1374 | 1374 | return FALSE; |
1375 | 1375 | } |
1376 | - if ( ! is_readable( $view )) { |
|
1377 | - $msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view ); |
|
1378 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1376 | + if ( ! is_readable($view)) { |
|
1377 | + $msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view); |
|
1378 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1379 | 1379 | return FALSE; |
1380 | 1380 | } |
1381 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1381 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1382 | 1382 | return TRUE; |
1383 | 1383 | } |
1384 | 1384 | |
@@ -1395,10 +1395,10 @@ discard block |
||
1395 | 1395 | * @param string $key - url param key indicating a route is being called |
1396 | 1396 | * @return string |
1397 | 1397 | */ |
1398 | - public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1399 | - do_action( 'AHEE__EE_Config__get_view__begin',$route,$status ); |
|
1400 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) { |
|
1401 | - return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1398 | + public static function get_view($route = NULL, $status = 0, $key = 'ee') { |
|
1399 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1400 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1401 | + return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status); |
|
1402 | 1402 | } |
1403 | 1403 | return NULL; |
1404 | 1404 | } |
@@ -1406,7 +1406,7 @@ discard block |
||
1406 | 1406 | |
1407 | 1407 | |
1408 | 1408 | public function shutdown() { |
1409 | - update_option( 'ee_config_option_names', $this->_config_option_names ); |
|
1409 | + update_option('ee_config_option_names', $this->_config_option_names); |
|
1410 | 1410 | } |
1411 | 1411 | |
1412 | 1412 | |
@@ -1422,7 +1422,7 @@ discard block |
||
1422 | 1422 | * magic functions in use, except we'll allow them to magically set and get stuff... |
1423 | 1423 | * basically, they should just be well-defined stdClasses |
1424 | 1424 | */ |
1425 | -class EE_Config_Base{ |
|
1425 | +class EE_Config_Base { |
|
1426 | 1426 | |
1427 | 1427 | /** |
1428 | 1428 | * Utility function for escaping the value of a property and returning. |
@@ -1431,13 +1431,13 @@ discard block |
||
1431 | 1431 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1432 | 1432 | * @throws \EE_Error |
1433 | 1433 | */ |
1434 | - public function get_pretty( $property ) { |
|
1435 | - if ( ! property_exists( $this, $property ) ) { |
|
1436 | - throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) ); |
|
1434 | + public function get_pretty($property) { |
|
1435 | + if ( ! property_exists($this, $property)) { |
|
1436 | + throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property)); |
|
1437 | 1437 | } |
1438 | 1438 | //just handling escaping of strings for now. |
1439 | - if ( is_string( $this->{$property} ) ) { |
|
1440 | - return stripslashes( $this->{$property} ); |
|
1439 | + if (is_string($this->{$property} )) { |
|
1440 | + return stripslashes($this->{$property} ); |
|
1441 | 1441 | } |
1442 | 1442 | return $this->{$property}; |
1443 | 1443 | } |
@@ -1446,19 +1446,19 @@ discard block |
||
1446 | 1446 | |
1447 | 1447 | public function populate() { |
1448 | 1448 | //grab defaults via a new instance of this class. |
1449 | - $class_name = get_class( $this ); |
|
1449 | + $class_name = get_class($this); |
|
1450 | 1450 | $defaults = new $class_name; |
1451 | 1451 | |
1452 | 1452 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1453 | 1453 | //default from our $defaults object. |
1454 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1455 | - if ( is_null( $this->{$property} ) ) { |
|
1454 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1455 | + if (is_null($this->{$property} )) { |
|
1456 | 1456 | $this->{$property} = $value; |
1457 | 1457 | } |
1458 | 1458 | } |
1459 | 1459 | |
1460 | 1460 | //cleanup |
1461 | - unset( $defaults ); |
|
1461 | + unset($defaults); |
|
1462 | 1462 | } |
1463 | 1463 | |
1464 | 1464 | |
@@ -1550,12 +1550,12 @@ discard block |
||
1550 | 1550 | */ |
1551 | 1551 | public function __construct() { |
1552 | 1552 | $current_network_main_site = is_multisite() ? get_current_site() : NULL; |
1553 | - $current_main_site_id = !empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1553 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1554 | 1554 | // set default organization settings |
1555 | 1555 | $this->current_blog_id = get_current_blog_id(); |
1556 | 1556 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1557 | - $this->ee_ueip_optin = is_main_site() ? get_option( 'ee_ueip_optin', TRUE ) : get_blog_option( $current_main_site_id, 'ee_ueip_optin', TRUE ); |
|
1558 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', FALSE ) : TRUE; |
|
1557 | + $this->ee_ueip_optin = is_main_site() ? get_option('ee_ueip_optin', TRUE) : get_blog_option($current_main_site_id, 'ee_ueip_optin', TRUE); |
|
1558 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', FALSE) : TRUE; |
|
1559 | 1559 | $this->post_shortcodes = array(); |
1560 | 1560 | $this->module_route_map = array(); |
1561 | 1561 | $this->module_forward_map = array(); |
@@ -1574,7 +1574,7 @@ discard block |
||
1574 | 1574 | $this->event_cpt_slug = __('events', 'event_espresso'); |
1575 | 1575 | |
1576 | 1576 | //ueip constant check |
1577 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1577 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1578 | 1578 | $this->ee_ueip_optin = FALSE; |
1579 | 1579 | $this->ee_ueip_has_notified = TRUE; |
1580 | 1580 | } |
@@ -1614,8 +1614,8 @@ discard block |
||
1614 | 1614 | * @return string |
1615 | 1615 | */ |
1616 | 1616 | public function reg_page_url() { |
1617 | - if ( ! $this->reg_page_url ) { |
|
1618 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
1617 | + if ( ! $this->reg_page_url) { |
|
1618 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
1619 | 1619 | } |
1620 | 1620 | return $this->reg_page_url; |
1621 | 1621 | } |
@@ -1628,12 +1628,12 @@ discard block |
||
1628 | 1628 | * @return string |
1629 | 1629 | */ |
1630 | 1630 | public function txn_page_url($query_args = array()) { |
1631 | - if ( ! $this->txn_page_url ) { |
|
1632 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1631 | + if ( ! $this->txn_page_url) { |
|
1632 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1633 | 1633 | } |
1634 | - if($query_args){ |
|
1635 | - return add_query_arg($query_args,$this->txn_page_url); |
|
1636 | - }else{ |
|
1634 | + if ($query_args) { |
|
1635 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1636 | + } else { |
|
1637 | 1637 | return $this->txn_page_url; |
1638 | 1638 | } |
1639 | 1639 | } |
@@ -1645,12 +1645,12 @@ discard block |
||
1645 | 1645 | * @return string |
1646 | 1646 | */ |
1647 | 1647 | public function thank_you_page_url($query_args = array()) { |
1648 | - if ( ! $this->thank_you_page_url ) { |
|
1649 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1648 | + if ( ! $this->thank_you_page_url) { |
|
1649 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1650 | 1650 | } |
1651 | - if($query_args){ |
|
1652 | - return add_query_arg($query_args,$this->thank_you_page_url); |
|
1653 | - }else{ |
|
1651 | + if ($query_args) { |
|
1652 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1653 | + } else { |
|
1654 | 1654 | return $this->thank_you_page_url; |
1655 | 1655 | } |
1656 | 1656 | } |
@@ -1661,8 +1661,8 @@ discard block |
||
1661 | 1661 | * @return string |
1662 | 1662 | */ |
1663 | 1663 | public function cancel_page_url() { |
1664 | - if ( ! $this->cancel_page_url ) { |
|
1665 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1664 | + if ( ! $this->cancel_page_url) { |
|
1665 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1666 | 1666 | } |
1667 | 1667 | return $this->cancel_page_url; |
1668 | 1668 | } |
@@ -1690,7 +1690,7 @@ discard block |
||
1690 | 1690 | //reset all url properties |
1691 | 1691 | $this->_reset_urls(); |
1692 | 1692 | //return what to save to db |
1693 | - return array_keys( get_object_vars( $this ) ); |
|
1693 | + return array_keys(get_object_vars($this)); |
|
1694 | 1694 | } |
1695 | 1695 | |
1696 | 1696 | } |
@@ -1922,39 +1922,39 @@ discard block |
||
1922 | 1922 | * @param null $CNT_ISO |
1923 | 1923 | * @return \EE_Currency_Config |
1924 | 1924 | */ |
1925 | - public function __construct( $CNT_ISO = NULL ) { |
|
1925 | + public function __construct($CNT_ISO = NULL) { |
|
1926 | 1926 | |
1927 | 1927 | // get country code from organization settings or use default |
1928 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
1928 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
1929 | 1929 | // but override if requested |
1930 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
1931 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
1930 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
1931 | + EE_Registry::instance()->load_helper('Activation'); |
|
1932 | 1932 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
1933 | - if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) { |
|
1933 | + if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) { |
|
1934 | 1934 | // retrieve the country settings from the db, just in case they have been customized |
1935 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
1936 | - if ( $country instanceof EE_Country ) { |
|
1937 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1938 | - $this->name = $country->currency_name_single(); // Dollar |
|
1939 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
1940 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
1941 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1942 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1943 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1944 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1935 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
1936 | + if ($country instanceof EE_Country) { |
|
1937 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1938 | + $this->name = $country->currency_name_single(); // Dollar |
|
1939 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
1940 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
1941 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1942 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1943 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1944 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1945 | 1945 | } |
1946 | 1946 | } |
1947 | 1947 | // fallback to hardcoded defaults, in case the above failed |
1948 | - if ( empty( $this->code )) { |
|
1948 | + if (empty($this->code)) { |
|
1949 | 1949 | // set default currency settings |
1950 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1951 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
1952 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
1953 | - $this->sign = '$'; // currency sign: $ |
|
1954 | - $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1955 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1956 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1957 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1950 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1951 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
1952 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
1953 | + $this->sign = '$'; // currency sign: $ |
|
1954 | + $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1955 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1956 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1957 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1958 | 1958 | } |
1959 | 1959 | } |
1960 | 1960 | } |
@@ -2094,7 +2094,7 @@ discard block |
||
2094 | 2094 | * @since 4.8.8.rc.019 |
2095 | 2095 | */ |
2096 | 2096 | public function do_hooks() { |
2097 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' )); |
|
2097 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2098 | 2098 | } |
2099 | 2099 | |
2100 | 2100 | |
@@ -2102,7 +2102,7 @@ discard block |
||
2102 | 2102 | * @return void |
2103 | 2103 | */ |
2104 | 2104 | public function set_default_reg_status_on_EEM_Event() { |
2105 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2105 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2106 | 2106 | } |
2107 | 2107 | |
2108 | 2108 | |
@@ -2207,10 +2207,10 @@ discard block |
||
2207 | 2207 | * @param bool $reset |
2208 | 2208 | * @return string |
2209 | 2209 | */ |
2210 | - public function log_file_name( $reset = FALSE ) { |
|
2211 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2212 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2213 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2210 | + public function log_file_name($reset = FALSE) { |
|
2211 | + if (empty($this->log_file_name) || $reset) { |
|
2212 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt'; |
|
2213 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2214 | 2214 | } |
2215 | 2215 | return $this->log_file_name; |
2216 | 2216 | } |
@@ -2222,10 +2222,10 @@ discard block |
||
2222 | 2222 | * @param bool $reset |
2223 | 2223 | * @return string |
2224 | 2224 | */ |
2225 | - public function debug_file_name( $reset = FALSE ) { |
|
2226 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2227 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2228 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2225 | + public function debug_file_name($reset = FALSE) { |
|
2226 | + if (empty($this->debug_file_name) || $reset) { |
|
2227 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt'; |
|
2228 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2229 | 2229 | } |
2230 | 2230 | return $this->debug_file_name; |
2231 | 2231 | } |
@@ -2398,21 +2398,21 @@ discard block |
||
2398 | 2398 | // set default map settings |
2399 | 2399 | $this->use_google_maps = TRUE; |
2400 | 2400 | // for event details pages (reg page) |
2401 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2402 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2403 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2404 | - $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2405 | - $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2406 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2407 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2401 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2402 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2403 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2404 | + $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2405 | + $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2406 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2407 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2408 | 2408 | // for event list pages |
2409 | - $this->event_list_map_width = 300; // ee_map_width |
|
2410 | - $this->event_list_map_height = 185; // ee_map_height |
|
2411 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2412 | - $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2413 | - $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2414 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2415 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2409 | + $this->event_list_map_width = 300; // ee_map_width |
|
2410 | + $this->event_list_map_height = 185; // ee_map_height |
|
2411 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2412 | + $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2413 | + $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2414 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2415 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2416 | 2416 | } |
2417 | 2417 | |
2418 | 2418 | } |
@@ -2423,7 +2423,7 @@ discard block |
||
2423 | 2423 | /** |
2424 | 2424 | * stores Events_Archive settings |
2425 | 2425 | */ |
2426 | -class EE_Events_Archive_Config extends EE_Config_Base{ |
|
2426 | +class EE_Events_Archive_Config extends EE_Config_Base { |
|
2427 | 2427 | |
2428 | 2428 | public $display_status_banner; |
2429 | 2429 | public $display_description; |
@@ -2442,7 +2442,7 @@ discard block |
||
2442 | 2442 | /** |
2443 | 2443 | * class constructor |
2444 | 2444 | */ |
2445 | - public function __construct(){ |
|
2445 | + public function __construct() { |
|
2446 | 2446 | $this->display_status_banner = 0; |
2447 | 2447 | $this->display_description = 1; |
2448 | 2448 | $this->display_ticket_selector = 0; |
@@ -2462,7 +2462,7 @@ discard block |
||
2462 | 2462 | /** |
2463 | 2463 | * Stores Event_Single_Config settings |
2464 | 2464 | */ |
2465 | -class EE_Event_Single_Config extends EE_Config_Base{ |
|
2465 | +class EE_Event_Single_Config extends EE_Config_Base { |
|
2466 | 2466 | |
2467 | 2467 | public $display_status_banner_single; |
2468 | 2468 | public $display_venue; |
@@ -2491,7 +2491,7 @@ discard block |
||
2491 | 2491 | /** |
2492 | 2492 | * Stores Ticket_Selector_Config settings |
2493 | 2493 | */ |
2494 | -class EE_Ticket_Selector_Config extends EE_Config_Base{ |
|
2494 | +class EE_Ticket_Selector_Config extends EE_Config_Base { |
|
2495 | 2495 | public $show_ticket_sale_columns; |
2496 | 2496 | public $show_ticket_details; |
2497 | 2497 | public $show_expired_tickets; |
@@ -2545,7 +2545,7 @@ discard block |
||
2545 | 2545 | * @return void |
2546 | 2546 | */ |
2547 | 2547 | protected function _set_php_values() { |
2548 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2548 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2549 | 2549 | $this->php->version = phpversion(); |
2550 | 2550 | } |
2551 | 2551 | |
@@ -2564,8 +2564,8 @@ discard block |
||
2564 | 2564 | * @type string $msg Any message to be displayed. |
2565 | 2565 | * } |
2566 | 2566 | */ |
2567 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2568 | - if ( ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) { |
|
2567 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2568 | + if (($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) { |
|
2569 | 2569 | 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'); |
2570 | 2570 | } else { |
2571 | 2571 | return ''; |
@@ -2601,7 +2601,7 @@ discard block |
||
2601 | 2601 | * stores payment gateway info |
2602 | 2602 | * @deprecated |
2603 | 2603 | */ |
2604 | -class EE_Gateway_Config extends EE_Config_Base{ |
|
2604 | +class EE_Gateway_Config extends EE_Config_Base { |
|
2605 | 2605 | |
2606 | 2606 | /** |
2607 | 2607 | * Array with keys that are payment gateways slugs, and values are arrays |
@@ -2623,9 +2623,9 @@ discard block |
||
2623 | 2623 | * class constructor |
2624 | 2624 | * @deprecated |
2625 | 2625 | */ |
2626 | - public function __construct(){ |
|
2626 | + public function __construct() { |
|
2627 | 2627 | $this->payment_settings = array(); |
2628 | - $this->active_gateways = array( 'Invoice' => FALSE ); |
|
2628 | + $this->active_gateways = array('Invoice' => FALSE); |
|
2629 | 2629 | } |
2630 | 2630 | } |
2631 | 2631 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public static function instance() { |
80 | 80 | // check if class object is instantiated |
81 | - if ( ! self::$_instance instanceof EE_CPT_Strategy ) { |
|
81 | + if ( ! self::$_instance instanceof EE_CPT_Strategy) { |
|
82 | 82 | self::$_instance = new self(); |
83 | 83 | } |
84 | 84 | return self::$_instance; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | // d( $this->_CPT_endpoints ); |
102 | 102 | // d( $this->_CPT_taxonomies ); |
103 | 103 | |
104 | - add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 5 ); |
|
104 | + add_action('pre_get_posts', array($this, 'pre_get_posts'), 5); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | */ |
115 | 115 | private function _set_CPT_endpoints() { |
116 | 116 | $_CPT_endpoints = array(); |
117 | - if ( is_array( $this->_CPTs )) { |
|
118 | - foreach ( $this->_CPTs as $CPT_type => $CPT ) { |
|
119 | - $_CPT_endpoints [ $CPT['plural_slug'] ] = $CPT_type; |
|
117 | + if (is_array($this->_CPTs)) { |
|
118 | + foreach ($this->_CPTs as $CPT_type => $CPT) { |
|
119 | + $_CPT_endpoints [$CPT['plural_slug']] = $CPT_type; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | return $_CPT_endpoints; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param WP_Query $WP_Query |
132 | 132 | * @return void |
133 | 133 | */ |
134 | - private function _set_EE_tags_on_WP_Query( WP_Query $WP_Query) { |
|
134 | + private function _set_EE_tags_on_WP_Query(WP_Query $WP_Query) { |
|
135 | 135 | $WP_Query->is_espresso_event_single = FALSE; |
136 | 136 | $WP_Query->is_espresso_event_archive = FALSE; |
137 | 137 | $WP_Query->is_espresso_event_taxonomy = FALSE; |
@@ -158,16 +158,16 @@ discard block |
||
158 | 158 | */ |
159 | 159 | private function _set_CPT_taxonomies() { |
160 | 160 | // check if taxonomies have already been set |
161 | - if ( empty( $this->_CPT_taxonomies )) { |
|
161 | + if (empty($this->_CPT_taxonomies)) { |
|
162 | 162 | // and that this CPT has taxonomies registered for it |
163 | - if ( isset( $this->CPT['args'] ) && isset( $this->CPT['args']['taxonomies'] )) { |
|
163 | + if (isset($this->CPT['args']) && isset($this->CPT['args']['taxonomies'])) { |
|
164 | 164 | // if so then grab them, but we want the taxonomy name as the key |
165 | - $taxonomies = array_flip( $this->CPT['args']['taxonomies'] ); |
|
165 | + $taxonomies = array_flip($this->CPT['args']['taxonomies']); |
|
166 | 166 | // then grab the list of ALL taxonomies |
167 | 167 | $all_taxonomies = EE_Register_CPTs::get_taxonomies(); |
168 | - foreach ( $taxonomies as $taxonomy => $details ) { |
|
168 | + foreach ($taxonomies as $taxonomy => $details) { |
|
169 | 169 | // add details to our taxonomies if they exist |
170 | - $taxonomies[ $taxonomy ] = isset( $all_taxonomies[ $taxonomy ] ) ? $all_taxonomies[ $taxonomy ] : NULL; |
|
170 | + $taxonomies[$taxonomy] = isset($all_taxonomies[$taxonomy]) ? $all_taxonomies[$taxonomy] : NULL; |
|
171 | 171 | } |
172 | 172 | $this->_CPT_taxonomies = $taxonomies; |
173 | 173 | } |
@@ -192,11 +192,11 @@ 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 | - if ( $term instanceof EE_Term ) { |
|
199 | - $this->_CPT_terms[ $term->slug() ] = $term; |
|
197 | + foreach ($terms as $term) { |
|
198 | + if ($term instanceof EE_Term) { |
|
199 | + $this->_CPT_terms[$term->slug()] = $term; |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | } |
@@ -211,24 +211,24 @@ discard block |
||
211 | 211 | * @param $WP_Query |
212 | 212 | * @return void |
213 | 213 | */ |
214 | - private function _set_post_type_for_terms( WP_Query $WP_Query ) { |
|
214 | + private function _set_post_type_for_terms(WP_Query $WP_Query) { |
|
215 | 215 | // is a tag set ? |
216 | - if ( isset( $WP_Query->query['tag'] )) { |
|
216 | + if (isset($WP_Query->query['tag'])) { |
|
217 | 217 | // set post_tags |
218 | 218 | $this->_set_CPT_terms(); |
219 | 219 | // is this tag archive term in the list of terms used by our CPTs ? |
220 | - $term = isset ( $this->_CPT_terms[ $WP_Query->query['tag'] ] ) ? $this->_CPT_terms[ $WP_Query->query['tag'] ] : NULL; |
|
220 | + $term = isset ($this->_CPT_terms[$WP_Query->query['tag']]) ? $this->_CPT_terms[$WP_Query->query['tag']] : NULL; |
|
221 | 221 | // verify the term |
222 | - if ( $term instanceof EE_Term ) { |
|
223 | - $term->post_type = array_merge( array( 'post', 'page' ), (array)$term->post_type ); |
|
224 | - $term->post_type = apply_filters( 'FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term ); |
|
222 | + if ($term instanceof EE_Term) { |
|
223 | + $term->post_type = array_merge(array('post', 'page'), (array) $term->post_type); |
|
224 | + $term->post_type = apply_filters('FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term); |
|
225 | 225 | // if a post type is already set |
226 | - if ( isset( $WP_Query->query_vars['post_type'] )) { |
|
226 | + if (isset($WP_Query->query_vars['post_type'])) { |
|
227 | 227 | // add to existing array |
228 | - $term->post_type = array_merge ( (array)$WP_Query->query_vars['post_type'], $term->post_type ); |
|
228 | + $term->post_type = array_merge((array) $WP_Query->query_vars['post_type'], $term->post_type); |
|
229 | 229 | } |
230 | 230 | // just set post_type to our CPT |
231 | - $WP_Query->set( 'post_type', $term->post_type ); |
|
231 | + $WP_Query->set('post_type', $term->post_type); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | } |
@@ -243,17 +243,17 @@ discard block |
||
243 | 243 | * in order for is_archive() and is_single() methods to work properly. |
244 | 244 | * @return void |
245 | 245 | */ |
246 | - public function _possibly_set_ee_request_var(){ |
|
246 | + public function _possibly_set_ee_request_var() { |
|
247 | 247 | // check if ee action var has been set |
248 | - if ( ! EE_Registry::instance()->REQ->is_set( 'ee' )) { |
|
248 | + if ( ! EE_Registry::instance()->REQ->is_set('ee')) { |
|
249 | 249 | // check that route exists for CPT archive slug |
250 | - if ( is_archive() && EE_Config::get_route( $this->CPT['plural_slug'] )) { |
|
250 | + if (is_archive() && EE_Config::get_route($this->CPT['plural_slug'])) { |
|
251 | 251 | // ie: set "ee" to "events" |
252 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['plural_slug'] ); |
|
252 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['plural_slug']); |
|
253 | 253 | // or does it match a single page CPT like /event/ |
254 | - } else if ( is_single() && EE_Config::get_route( $this->CPT['singular_slug'] )) { |
|
254 | + } else if (is_single() && EE_Config::get_route($this->CPT['singular_slug'])) { |
|
255 | 255 | // ie: set "ee" to "event" |
256 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] ); |
|
256 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']); |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | } |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | * @param WP_Query $WP_Query |
268 | 268 | * @return void |
269 | 269 | */ |
270 | - public function _set_paging( $WP_Query ) { |
|
271 | - if ( $WP_Query->is_main_query() && apply_filters( 'FHEE__EE_CPT_Strategy___set_paging', TRUE )) { |
|
272 | - $page = ( get_query_var('page') ) ? get_query_var('page') : NULL; |
|
273 | - $paged = ( get_query_var('paged') ) ? get_query_var('paged') : $page; |
|
274 | - $WP_Query->set( 'paged', $paged ); |
|
270 | + public function _set_paging($WP_Query) { |
|
271 | + if ($WP_Query->is_main_query() && apply_filters('FHEE__EE_CPT_Strategy___set_paging', TRUE)) { |
|
272 | + $page = (get_query_var('page')) ? get_query_var('page') : NULL; |
|
273 | + $paged = (get_query_var('paged')) ? get_query_var('paged') : $page; |
|
274 | + $WP_Query->set('paged', $paged); |
|
275 | 275 | } |
276 | 276 | } |
277 | 277 | |
@@ -288,35 +288,35 @@ discard block |
||
288 | 288 | * @param WP_Query $WP_Query |
289 | 289 | * @return void |
290 | 290 | */ |
291 | - public function pre_get_posts( $WP_Query ) { |
|
291 | + public function pre_get_posts($WP_Query) { |
|
292 | 292 | // check that post-type is set |
293 | - if ( ! $WP_Query instanceof WP_Query ) { |
|
293 | + if ( ! $WP_Query instanceof WP_Query) { |
|
294 | 294 | return; |
295 | 295 | } |
296 | 296 | |
297 | 297 | // add our conditionals |
298 | - $this->_set_EE_tags_on_WP_Query( $WP_Query ); |
|
298 | + $this->_set_EE_tags_on_WP_Query($WP_Query); |
|
299 | 299 | // check for terms |
300 | - $this->_set_post_type_for_terms( $WP_Query ); |
|
300 | + $this->_set_post_type_for_terms($WP_Query); |
|
301 | 301 | // make sure paging is always set |
302 | - $this->_set_paging( $WP_Query ); |
|
302 | + $this->_set_paging($WP_Query); |
|
303 | 303 | |
304 | 304 | // is a taxonomy set ? |
305 | - if ( $WP_Query->is_tax ) { |
|
305 | + if ($WP_Query->is_tax) { |
|
306 | 306 | // loop thru our taxonomies |
307 | - foreach ( $this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details ) { |
|
307 | + foreach ($this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details) { |
|
308 | 308 | // check if one of our taxonomies is set as a query var |
309 | - if ( isset( $WP_Query->query[ $CPT_taxonomy ] )) { |
|
309 | + if (isset($WP_Query->query[$CPT_taxonomy])) { |
|
310 | 310 | // but which CPT does that correspond to??? hmmm... guess we gotta go looping |
311 | - foreach ( $this->_CPTs as $post_type => $CPT ) { |
|
311 | + foreach ($this->_CPTs as $post_type => $CPT) { |
|
312 | 312 | // verify our CPT has args, is public and has taxonomies set |
313 | - if ( isset( $CPT['args'] ) && $CPT['args']['public'] && ! empty( $CPT['args']['taxonomies'] )) { |
|
313 | + if (isset($CPT['args']) && $CPT['args']['public'] && ! empty($CPT['args']['taxonomies'])) { |
|
314 | 314 | // does the captured taxonomy belong to this CPT ? |
315 | - if ( in_array( $CPT_taxonomy, $CPT['args']['taxonomies'] )) { |
|
315 | + if (in_array($CPT_taxonomy, $CPT['args']['taxonomies'])) { |
|
316 | 316 | // if so, then add this CPT post_type to the current query's array of post_types' |
317 | - $WP_Query->query_vars['post_type'] = isset( $WP_Query->query_vars['post_type'] ) ? (array)$WP_Query->query_vars['post_type'] : array(); |
|
317 | + $WP_Query->query_vars['post_type'] = isset($WP_Query->query_vars['post_type']) ? (array) $WP_Query->query_vars['post_type'] : array(); |
|
318 | 318 | $WP_Query->query_vars['post_type'][] = $post_type; |
319 | - switch( $post_type ) { |
|
319 | + switch ($post_type) { |
|
320 | 320 | case 'espresso_events' : |
321 | 321 | $WP_Query->is_espresso_event_taxonomy = TRUE; |
322 | 322 | break; |
@@ -337,27 +337,27 @@ discard block |
||
337 | 337 | // d( $CPT_taxonomy ); |
338 | 338 | // d( $WP_Query ); |
339 | 339 | |
340 | - if ( isset( $WP_Query->query_vars['post_type'] )) { |
|
340 | + if (isset($WP_Query->query_vars['post_type'])) { |
|
341 | 341 | // loop thru post_types as array |
342 | - foreach ( (array)$WP_Query->query_vars['post_type'] as $post_type ) { |
|
342 | + foreach ((array) $WP_Query->query_vars['post_type'] as $post_type) { |
|
343 | 343 | |
344 | 344 | // is current query for an EE CPT ? |
345 | - if ( isset( $this->_CPTs[ $post_type ] )) { |
|
345 | + if (isset($this->_CPTs[$post_type])) { |
|
346 | 346 | // is EE on or off ? |
347 | - if ( EE_Maintenance_Mode::instance()->level() ) { |
|
347 | + if (EE_Maintenance_Mode::instance()->level()) { |
|
348 | 348 | // reroute CPT template view to maintenance_mode.template.php |
349 | - if( ! has_filter( 'template_include',array( 'EE_Maintenance_Mode', 'template_include' ))){ |
|
350 | - add_filter( 'template_include', array( 'EE_Maintenance_Mode', 'template_include' ), 99999 ); |
|
349 | + if ( ! has_filter('template_include', array('EE_Maintenance_Mode', 'template_include'))) { |
|
350 | + add_filter('template_include', array('EE_Maintenance_Mode', 'template_include'), 99999); |
|
351 | 351 | } |
352 | - if( has_filter( 'the_content',array( EE_Maintenance_Mode::instance(), 'the_content' ) ) ) { |
|
353 | - add_filter( 'the_content', array( $this, 'inject_EE_shortcode_placeholder' ), 1 ); |
|
352 | + if (has_filter('the_content', array(EE_Maintenance_Mode::instance(), 'the_content'))) { |
|
353 | + add_filter('the_content', array($this, 'inject_EE_shortcode_placeholder'), 1); |
|
354 | 354 | } |
355 | 355 | return; |
356 | 356 | } |
357 | 357 | // load EE_Request_Handler (this was added as a result of https://events.codebasehq.com/projects/event-espresso/tickets/9037 |
358 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
358 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
359 | 359 | // grab details for the CPT the current query is for |
360 | - $this->CPT = $this->_CPTs[ $post_type ]; |
|
360 | + $this->CPT = $this->_CPTs[$post_type]; |
|
361 | 361 | // set post type |
362 | 362 | $this->CPT['post_type'] = $post_type; |
363 | 363 | // set taxonomies |
@@ -365,27 +365,27 @@ discard block |
||
365 | 365 | // the post or category or term that is triggering EE |
366 | 366 | $this->CPT['espresso_page'] = EE_Registry::instance()->REQ->is_espresso_page(); |
367 | 367 | // requested post name |
368 | - $this->CPT['post_name'] = EE_Registry::instance()->REQ->get( 'post_name' ); |
|
368 | + $this->CPT['post_name'] = EE_Registry::instance()->REQ->get('post_name'); |
|
369 | 369 | //d( $this->CPT ); |
370 | 370 | // add support for viewing 'private', 'draft', or 'pending' posts |
371 | - 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'] )) { |
|
371 | + 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'])) { |
|
372 | 372 | // we can just inject directly into the WP_Query object |
373 | - $WP_Query->query['post_status'] = array( 'publish', 'private', 'draft', 'pending' ); |
|
373 | + $WP_Query->query['post_status'] = array('publish', 'private', 'draft', 'pending'); |
|
374 | 374 | // now set the main 'ee' request var so that the appropriate module can load the appropriate template(s) |
375 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] ); |
|
375 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']); |
|
376 | 376 | } |
377 | 377 | $this->_possibly_set_ee_request_var(); |
378 | 378 | // convert post_type to model name |
379 | - $model_name = str_replace( 'EE_', '', $this->CPT['class_name'] ); |
|
379 | + $model_name = str_replace('EE_', '', $this->CPT['class_name']); |
|
380 | 380 | // get CPT table data via CPT Model |
381 | - $this->CPT_model = EE_Registry::instance()->load_model( $model_name ); |
|
381 | + $this->CPT_model = EE_Registry::instance()->load_model($model_name); |
|
382 | 382 | $this->CPT['tables'] = $this->CPT_model->get_tables(); |
383 | 383 | // is there a Meta Table for this CPT? |
384 | - $this->CPT['meta_table'] = isset( $this->CPT['tables'][ $model_name . '_Meta' ] ) ? $this->CPT['tables'][ $model_name . '_Meta' ] : FALSE; |
|
384 | + $this->CPT['meta_table'] = isset($this->CPT['tables'][$model_name.'_Meta']) ? $this->CPT['tables'][$model_name.'_Meta'] : FALSE; |
|
385 | 385 | // creates classname like: CPT_Event_Strategy |
386 | - $CPT_Strategy_class_name = 'CPT_' . $model_name . '_Strategy'; |
|
386 | + $CPT_Strategy_class_name = 'CPT_'.$model_name.'_Strategy'; |
|
387 | 387 | // load and instantiate |
388 | - $CPT_Strategy = EE_Registry::instance()->load_core ( $CPT_Strategy_class_name, array( 'WP_Query' => $WP_Query, 'CPT' => $this->CPT )); |
|
388 | + $CPT_Strategy = EE_Registry::instance()->load_core($CPT_Strategy_class_name, array('WP_Query' => $WP_Query, 'CPT' => $this->CPT)); |
|
389 | 389 | |
390 | 390 | // !!!!!!!!!! IMPORTANT !!!!!!!!!!!! |
391 | 391 | // here's the list of available filters in the WP_Query object |
@@ -397,13 +397,13 @@ discard block |
||
397 | 397 | // 'post_limits' |
398 | 398 | // 'posts_fields' |
399 | 399 | // 'posts_join' |
400 | - add_filter( 'posts_fields', array( $this, 'posts_fields' )); |
|
401 | - add_filter( 'posts_join', array( $this, 'posts_join' )); |
|
402 | - add_filter( 'get_' . $this->CPT['post_type'] . '_metadata', array( $CPT_Strategy, 'get_EE_post_type_metadata' ), 1, 4 ); |
|
403 | - add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 1 ); |
|
404 | - add_filter( 'get_edit_post_link', array( $this, 'get_edit_post_link' ), 10, 2 ); |
|
400 | + add_filter('posts_fields', array($this, 'posts_fields')); |
|
401 | + add_filter('posts_join', array($this, 'posts_join')); |
|
402 | + add_filter('get_'.$this->CPT['post_type'].'_metadata', array($CPT_Strategy, 'get_EE_post_type_metadata'), 1, 4); |
|
403 | + add_filter('the_posts', array($this, 'the_posts'), 1, 1); |
|
404 | + add_filter('get_edit_post_link', array($this, 'get_edit_post_link'), 10, 2); |
|
405 | 405 | |
406 | - $this->_do_template_filters( $WP_Query ); |
|
406 | + $this->_do_template_filters($WP_Query); |
|
407 | 407 | } |
408 | 408 | } |
409 | 409 | } |
@@ -418,13 +418,13 @@ discard block |
||
418 | 418 | * @param $SQL |
419 | 419 | * @return string |
420 | 420 | */ |
421 | - public function posts_fields( $SQL ) { |
|
421 | + public function posts_fields($SQL) { |
|
422 | 422 | // does this CPT have a meta table ? |
423 | - if ( ! empty( $this->CPT['meta_table'] )) { |
|
423 | + if ( ! empty($this->CPT['meta_table'])) { |
|
424 | 424 | // adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement |
425 | - $SQL .= ', ' . $this->CPT['meta_table']->get_table_name() . '.* ' ; |
|
425 | + $SQL .= ', '.$this->CPT['meta_table']->get_table_name().'.* '; |
|
426 | 426 | } |
427 | - remove_filter( 'posts_fields', array( $this, 'posts_fields' )); |
|
427 | + remove_filter('posts_fields', array($this, 'posts_fields')); |
|
428 | 428 | return $SQL; |
429 | 429 | } |
430 | 430 | |
@@ -452,14 +452,14 @@ discard block |
||
452 | 452 | * @param $SQL |
453 | 453 | * @return string |
454 | 454 | */ |
455 | - public function posts_join( $SQL ) { |
|
455 | + public function posts_join($SQL) { |
|
456 | 456 | // does this CPT have a meta table ? |
457 | - if ( ! empty( $this->CPT['meta_table'] )) { |
|
457 | + if ( ! empty($this->CPT['meta_table'])) { |
|
458 | 458 | global $wpdb; |
459 | 459 | // adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement |
460 | - $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 ) '; |
|
460 | + $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 ) '; |
|
461 | 461 | } |
462 | - remove_filter( 'posts_join', array( $this, 'posts_join' )); |
|
462 | + remove_filter('posts_join', array($this, 'posts_join')); |
|
463 | 463 | return $SQL; |
464 | 464 | } |
465 | 465 | |
@@ -472,18 +472,18 @@ discard block |
||
472 | 472 | * @param \WP_Post[] $posts |
473 | 473 | * @return \WP_Post[] |
474 | 474 | */ |
475 | - public function the_posts( $posts ) { |
|
475 | + public function the_posts($posts) { |
|
476 | 476 | // d( $posts ); |
477 | 477 | $CPT_class = $this->CPT['class_name']; |
478 | 478 | // loop thru posts |
479 | - if ( is_array( $posts )) { |
|
480 | - foreach( $posts as $key => $post ) { |
|
481 | - if ( isset( $this->_CPTs[ $post->post_type ] )) { |
|
482 | - $post->{$CPT_class} = $this->CPT_model->instantiate_class_from_post_object( $post ); |
|
479 | + if (is_array($posts)) { |
|
480 | + foreach ($posts as $key => $post) { |
|
481 | + if (isset($this->_CPTs[$post->post_type])) { |
|
482 | + $post->{$CPT_class} = $this->CPT_model->instantiate_class_from_post_object($post); |
|
483 | 483 | } |
484 | 484 | } |
485 | 485 | } |
486 | - remove_filter( 'the_posts', array( $this, 'the_posts' ), 1 ); |
|
486 | + remove_filter('the_posts', array($this, 'the_posts'), 1); |
|
487 | 487 | return $posts; |
488 | 488 | } |
489 | 489 | |
@@ -494,17 +494,17 @@ discard block |
||
494 | 494 | * @param $ID |
495 | 495 | * @return string |
496 | 496 | */ |
497 | - function get_edit_post_link( $url, $ID ) { |
|
497 | + function get_edit_post_link($url, $ID) { |
|
498 | 498 | //need to make sure we only edit links if our cpt |
499 | 499 | global $post; |
500 | - if ( ! isset( $this->_CPTs[ $post->post_type ] )) { |
|
500 | + if ( ! isset($this->_CPTs[$post->post_type])) { |
|
501 | 501 | return $url; |
502 | 502 | } |
503 | 503 | //k made it here so all is good. |
504 | 504 | $scheme = is_ssl() ? 'https' : 'http'; |
505 | - $url = get_admin_url( EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme ); |
|
505 | + $url = get_admin_url(EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme); |
|
506 | 506 | // http://example.com/wp-admin/admin.php?page=espresso_events&action=edit&post=205&edit_nonce=0d403530d6 |
507 | - return wp_nonce_url( add_query_arg( array( 'page' => $this->CPT['post_type'], 'post' =>$ID, 'action' =>'edit' ), $url ), 'edit', 'edit_nonce' ); |
|
507 | + return wp_nonce_url(add_query_arg(array('page' => $this->CPT['post_type'], 'post' =>$ID, 'action' =>'edit'), $url), 'edit', 'edit_nonce'); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
@@ -518,11 +518,11 @@ discard block |
||
518 | 518 | * @param WP_Query $WP_Query |
519 | 519 | * @return void |
520 | 520 | */ |
521 | - protected function _do_template_filters( WP_Query $WP_Query ) { |
|
521 | + protected function _do_template_filters(WP_Query $WP_Query) { |
|
522 | 522 | // if it's the main query and requested cpt supports page_templates, |
523 | - if ( $WP_Query->is_main_query() && ! empty( $this->CPT['args']['page_templates'] ) ) { |
|
523 | + if ($WP_Query->is_main_query() && ! empty($this->CPT['args']['page_templates'])) { |
|
524 | 524 | // then let's hook into the appropriate query_template hook |
525 | - add_filter( 'single_template', array( $this, 'single_cpt_template' ) ); |
|
525 | + add_filter('single_template', array($this, 'single_cpt_template')); |
|
526 | 526 | } |
527 | 527 | } |
528 | 528 | |
@@ -536,17 +536,17 @@ discard block |
||
536 | 536 | * @param string $current_template Existing default template path derived for this page call. |
537 | 537 | * @return string the path to the full template file. |
538 | 538 | */ |
539 | - public function single_cpt_template( $current_template ) { |
|
539 | + public function single_cpt_template($current_template) { |
|
540 | 540 | $object = get_queried_object(); |
541 | 541 | //does this called object HAVE a page template set that is something other than the default. |
542 | - $template = get_post_meta( $object->ID, '_wp_page_template', true ); |
|
542 | + $template = get_post_meta($object->ID, '_wp_page_template', true); |
|
543 | 543 | |
544 | 544 | //exit early if default or not set or invalid path (accounts for theme changes) |
545 | - if ( $template == 'default' || empty( $template ) || ! is_readable( get_stylesheet_directory() . '/' . $template ) ) { |
|
545 | + if ($template == 'default' || empty($template) || ! is_readable(get_stylesheet_directory().'/'.$template)) { |
|
546 | 546 | return $current_template; |
547 | 547 | } |
548 | 548 | //made it here so we SHOULD be able to just locate the template and then return it. |
549 | - $template = locate_template( array($template) ); |
|
549 | + $template = locate_template(array($template)); |
|
550 | 550 | |
551 | 551 | return $template; |
552 | 552 | } |
@@ -594,9 +594,9 @@ discard block |
||
594 | 594 | * @param array $arguments |
595 | 595 | * @return \EE_CPT_Default_Strategy |
596 | 596 | */ |
597 | - public function __construct( $arguments = array() ) { |
|
598 | - $this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL; |
|
599 | - $WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL; |
|
597 | + public function __construct($arguments = array()) { |
|
598 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL; |
|
599 | + $WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL; |
|
600 | 600 | //EEH_Debug_Tools::printr( $this->CPT, '$this->CPT <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
601 | 601 | // add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ), 999 ); |
602 | 602 | // add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 ); |
@@ -611,9 +611,9 @@ discard block |
||
611 | 611 | * @param \WP_Query $WP_Query |
612 | 612 | * @return \WP_Query |
613 | 613 | */ |
614 | - public function pre_get_posts( WP_Query $WP_Query ) { |
|
614 | + public function pre_get_posts(WP_Query $WP_Query) { |
|
615 | 615 | //EEH_Debug_Tools::printr( $WP_Query, '$WP_Query <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
616 | - if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive() ) { |
|
616 | + if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) { |
|
617 | 617 | return $WP_Query; |
618 | 618 | } |
619 | 619 | // $WP_Query->set( 'post_type', array( $this->CPT['post_type'] )); |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | * @param \WP_Query $WP_Query |
632 | 632 | * @return \WP_Post[] |
633 | 633 | */ |
634 | - public function the_posts( $posts, WP_Query $WP_Query ) { |
|
634 | + public function the_posts($posts, WP_Query $WP_Query) { |
|
635 | 635 | return $posts; |
636 | 636 | } |
637 | 637 | |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | * @param string $single |
648 | 648 | * @return mixed |
649 | 649 | */ |
650 | - public function get_EE_post_type_metadata( $meta_value = NULL, $post_id, $meta_key, $single ) { |
|
650 | + public function get_EE_post_type_metadata($meta_value = NULL, $post_id, $meta_key, $single) { |
|
651 | 651 | return $meta_value; |
652 | 652 | } |
653 | 653 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param WP $WP |
43 | 43 | * @return void |
44 | 44 | */ |
45 | - public abstract function run( WP $WP ); |
|
45 | + public abstract function run(WP $WP); |
|
46 | 46 | |
47 | 47 | |
48 | 48 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param array $attributes |
55 | 55 | * @return mixed |
56 | 56 | */ |
57 | - public abstract function process_shortcode( $attributes = array() ); |
|
57 | + public abstract function process_shortcode($attributes = array()); |
|
58 | 58 | |
59 | 59 | |
60 | 60 | |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | * @param string $shortcode_class |
66 | 66 | * @return \EES_Shortcode |
67 | 67 | */ |
68 | - final public static function instance( $shortcode_class = NULL ) { |
|
69 | - $shortcode_class = ! empty( $shortcode_class ) ? $shortcode_class : get_called_class(); |
|
70 | - if ( $shortcode_class == 'EES_Shortcode' || empty( $shortcode_class )) { |
|
68 | + final public static function instance($shortcode_class = NULL) { |
|
69 | + $shortcode_class = ! empty($shortcode_class) ? $shortcode_class : get_called_class(); |
|
70 | + if ($shortcode_class == 'EES_Shortcode' || empty($shortcode_class)) { |
|
71 | 71 | return NULL; |
72 | 72 | } |
73 | - $shortcode = str_replace( 'EES_', '', strtoupper( $shortcode_class )); |
|
74 | - $shortcode_obj = isset( EE_Registry::instance()->shortcodes->{$shortcode} ) ? EE_Registry::instance()->shortcodes->{$shortcode} : NULL; |
|
73 | + $shortcode = str_replace('EES_', '', strtoupper($shortcode_class)); |
|
74 | + $shortcode_obj = isset(EE_Registry::instance()->shortcodes->{$shortcode} ) ? EE_Registry::instance()->shortcodes->{$shortcode} : NULL; |
|
75 | 75 | return $shortcode_obj instanceof $shortcode_class || $shortcode_class == 'self' ? $shortcode_obj : new $shortcode_class(); |
76 | 76 | } |
77 | 77 | |
@@ -86,23 +86,23 @@ discard block |
||
86 | 86 | * @param $attributes |
87 | 87 | * @return mixed |
88 | 88 | */ |
89 | - final public static function fallback_shortcode_processor( $attributes ) { |
|
90 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
89 | + final public static function fallback_shortcode_processor($attributes) { |
|
90 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
91 | 91 | return null; |
92 | 92 | } |
93 | 93 | // what shortcode was actually parsed ? |
94 | 94 | $shortcode_class = get_called_class(); |
95 | 95 | // notify rest of system that fallback processor was triggered |
96 | - add_filter( 'FHEE__fallback_shortcode_processor__' . $shortcode_class, '__return_true' ); |
|
96 | + add_filter('FHEE__fallback_shortcode_processor__'.$shortcode_class, '__return_true'); |
|
97 | 97 | // get instance of actual shortcode |
98 | - $shortcode_obj = self::instance( $shortcode_class ); |
|
98 | + $shortcode_obj = self::instance($shortcode_class); |
|
99 | 99 | // verify class |
100 | - if ( $shortcode_obj instanceof EES_Shortcode ) { |
|
100 | + if ($shortcode_obj instanceof EES_Shortcode) { |
|
101 | 101 | global $wp; |
102 | - $shortcode_obj->run( $wp ); |
|
102 | + $shortcode_obj->run($wp); |
|
103 | 103 | // set attributes and run the shortcode |
104 | - $shortcode_obj->_attributes = (array)$attributes; |
|
105 | - return $shortcode_obj->process_shortcode( $shortcode_obj->_attributes ); |
|
104 | + $shortcode_obj->_attributes = (array) $attributes; |
|
105 | + return $shortcode_obj->process_shortcode($shortcode_obj->_attributes); |
|
106 | 106 | } else { |
107 | 107 | return NULL; |
108 | 108 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @param $attributes |
119 | 119 | * @return string |
120 | 120 | */ |
121 | - final public static function invalid_shortcode_processor( $attributes ) { |
|
121 | + final public static function invalid_shortcode_processor($attributes) { |
|
122 | 122 | return ''; |
123 | 123 | } |
124 | 124 | |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | */ |
133 | 133 | final public function __construct() { |
134 | 134 | // get classname, remove EES_prefix, and convert to UPPERCASE |
135 | - $shortcode = strtoupper( str_replace( 'EES_', '', get_class( $this ))); |
|
135 | + $shortcode = strtoupper(str_replace('EES_', '', get_class($this))); |
|
136 | 136 | // assign shortcode to the preferred callback, which overwrites the "fallback shortcode processor" assigned earlier |
137 | - add_shortcode( $shortcode, array( $this, 'process_shortcode' )); |
|
137 | + add_shortcode($shortcode, array($this, 'process_shortcode')); |
|
138 | 138 | // make sure system knows this is an EE page |
139 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
139 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | -if ( ! function_exists( 'espresso_get_template_part' )) { |
|
18 | +if ( ! function_exists('espresso_get_template_part')) { |
|
19 | 19 | /** |
20 | 20 | * espresso_get_template_part |
21 | 21 | * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @param string $name The name of the specialised template. |
26 | 26 | * @return string the html output for the formatted money value |
27 | 27 | */ |
28 | - function espresso_get_template_part( $slug = NULL, $name = NULL ) { |
|
29 | - EEH_Template::get_template_part( $slug, $name ); |
|
28 | + function espresso_get_template_part($slug = NULL, $name = NULL) { |
|
29 | + EEH_Template::get_template_part($slug, $name); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | -if ( ! function_exists( 'espresso_get_object_css_class' )) { |
|
35 | +if ( ! function_exists('espresso_get_object_css_class')) { |
|
36 | 36 | /** |
37 | 37 | * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed |
38 | 38 | * |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $suffix added to the end of the generated class |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
46 | - return EEH_Template::get_object_css_class( $object, $prefix, $suffix ); |
|
45 | + function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
46 | + return EEH_Template::get_object_css_class($object, $prefix, $suffix); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return boolean |
71 | 71 | */ |
72 | 72 | public static function is_espresso_theme() { |
73 | - return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE; |
|
73 | + return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | public static function load_espresso_theme_functions() { |
82 | - if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) { |
|
83 | - if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) { |
|
84 | - require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' ); |
|
82 | + if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) { |
|
83 | + if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) { |
|
84 | + require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | * @return array |
94 | 94 | */ |
95 | 95 | public static function get_espresso_themes() { |
96 | - if ( empty( EEH_Template::$_espresso_themes )) { |
|
97 | - $espresso_themes = glob( EE_PUBLIC . '*', GLOB_ONLYDIR ); |
|
98 | - if ( empty( $espresso_themes ) ) { |
|
96 | + if (empty(EEH_Template::$_espresso_themes)) { |
|
97 | + $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR); |
|
98 | + if (empty($espresso_themes)) { |
|
99 | 99 | return array(); |
100 | 100 | } |
101 | - if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
|
102 | - unset( $espresso_themes[ $key ] ); |
|
101 | + if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) { |
|
102 | + unset($espresso_themes[$key]); |
|
103 | 103 | } |
104 | 104 | EEH_Template::$_espresso_themes = array(); |
105 | - foreach ( $espresso_themes as $espresso_theme ) { |
|
106 | - EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme; |
|
105 | + foreach ($espresso_themes as $espresso_theme) { |
|
106 | + EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | return EEH_Template::$_espresso_themes; |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @param bool $return_string |
123 | 123 | * @return string the html output for the formatted money value |
124 | 124 | */ |
125 | - public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE ) { |
|
126 | - do_action( "get_template_part_{$slug}-{$name}", $slug, $name ); |
|
125 | + public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) { |
|
126 | + do_action("get_template_part_{$slug}-{$name}", $slug, $name); |
|
127 | 127 | $templates = array(); |
128 | 128 | $name = (string) $name; |
129 | - if ( $name != '' ) { |
|
129 | + if ($name != '') { |
|
130 | 130 | $templates[] = "{$slug}-{$name}.php"; |
131 | 131 | } |
132 | 132 | // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' ); |
133 | - if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) { |
|
134 | - EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string ); |
|
133 | + if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) { |
|
134 | + EEH_Template::locate_template($templates, $template_args, TRUE, $return_string); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -182,26 +182,26 @@ discard block |
||
182 | 182 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
183 | 183 | * @return mixed |
184 | 184 | */ |
185 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
185 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
186 | 186 | // first use WP locate_template to check for template in the current theme folder |
187 | - $template_path = locate_template( $templates ); |
|
187 | + $template_path = locate_template($templates); |
|
188 | 188 | |
189 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
189 | + if ($check_if_custom && ! empty($template_path)) |
|
190 | 190 | return TRUE; |
191 | 191 | |
192 | 192 | // not in the theme |
193 | - if ( empty( $template_path )) { |
|
193 | + if (empty($template_path)) { |
|
194 | 194 | // not even a template to look for ? |
195 | - if ( empty( $templates )) { |
|
195 | + if (empty($templates)) { |
|
196 | 196 | // get post_type |
197 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
197 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
198 | 198 | // get array of EE Custom Post Types |
199 | 199 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
200 | 200 | // build template name based on request |
201 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
202 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
201 | + if (isset($EE_CPTs[$post_type])) { |
|
202 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | // currently active EE template theme |
@@ -210,80 +210,80 @@ discard block |
||
210 | 210 | // array of paths to folders that may contain templates |
211 | 211 | $template_folder_paths = array( |
212 | 212 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
213 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
213 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
214 | 214 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
215 | 215 | EVENT_ESPRESSO_TEMPLATE_DIR |
216 | 216 | ); |
217 | 217 | |
218 | 218 | //add core plugin folders for checking only if we're not $check_if_custom |
219 | - if ( ! $check_if_custom ) { |
|
219 | + if ( ! $check_if_custom) { |
|
220 | 220 | $core_paths = array( |
221 | 221 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
222 | - EE_PUBLIC . $current_theme, |
|
222 | + EE_PUBLIC.$current_theme, |
|
223 | 223 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
224 | - EE_TEMPLATES . $current_theme, |
|
224 | + EE_TEMPLATES.$current_theme, |
|
225 | 225 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
226 | 226 | EE_PLUGIN_DIR_PATH |
227 | 227 | ); |
228 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
228 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // now filter that array |
232 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
233 | - $templates = is_array( $templates ) ? $templates : array( $templates ); |
|
234 | - $template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths ); |
|
232 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
233 | + $templates = is_array($templates) ? $templates : array($templates); |
|
234 | + $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths); |
|
235 | 235 | // array to hold all possible template paths |
236 | 236 | $full_template_paths = array(); |
237 | 237 | |
238 | 238 | EE_Registry::instance()->load_helper('File'); |
239 | 239 | // loop through $templates |
240 | - foreach ( $templates as $template ) { |
|
240 | + foreach ($templates as $template) { |
|
241 | 241 | // normalize directory separators |
242 | - $template = EEH_File::standardise_directory_separators( $template ); |
|
243 | - $file_name = basename( $template ); |
|
244 | - $template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) ); |
|
242 | + $template = EEH_File::standardise_directory_separators($template); |
|
243 | + $file_name = basename($template); |
|
244 | + $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1)); |
|
245 | 245 | // while looping through all template folder paths |
246 | - foreach ( $template_folder_paths as $template_folder_path ) { |
|
246 | + foreach ($template_folder_paths as $template_folder_path) { |
|
247 | 247 | // normalize directory separators |
248 | - $template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path ); |
|
248 | + $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path); |
|
249 | 249 | // determine if any common base path exists between the two paths |
250 | 250 | $common_base_path = EEH_Template::_find_common_base_path( |
251 | - array( $template_folder_path, $template_path_minus_file_name ) |
|
251 | + array($template_folder_path, $template_path_minus_file_name) |
|
252 | 252 | ); |
253 | - if ( $common_base_path !== '' ) { |
|
253 | + if ($common_base_path !== '') { |
|
254 | 254 | // both paths have a common base, so just tack the filename onto our search path |
255 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name; |
|
255 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name; |
|
256 | 256 | } else { |
257 | 257 | // no common base path, so let's just concatenate |
258 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template; |
|
258 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template; |
|
259 | 259 | } |
260 | 260 | // build up our template locations array by adding our resolved paths |
261 | 261 | $full_template_paths[] = $resolved_path; |
262 | 262 | } |
263 | 263 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
264 | - array_unshift( $full_template_paths, $template ); |
|
264 | + array_unshift($full_template_paths, $template); |
|
265 | 265 | // path to the directory of the current theme: /wp-content/themes/(current WP theme)/ |
266 | - array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name ); |
|
266 | + array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name); |
|
267 | 267 | } |
268 | 268 | // filter final array of full template paths |
269 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name ); |
|
269 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name); |
|
270 | 270 | // now loop through our final array of template location paths and check each location |
271 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
272 | - if ( is_readable( $full_template_path )) { |
|
273 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
271 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
272 | + if (is_readable($full_template_path)) { |
|
273 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
274 | 274 | break; |
275 | 275 | } |
276 | 276 | } |
277 | 277 | } |
278 | 278 | // if we got it and you want to see it... |
279 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
280 | - if ( $return_string ) { |
|
281 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
279 | + if ($template_path && $load && ! $check_if_custom) { |
|
280 | + if ($return_string) { |
|
281 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
282 | 282 | } else { |
283 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
283 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
284 | 284 | } |
285 | 285 | } |
286 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
286 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | |
@@ -296,21 +296,21 @@ discard block |
||
296 | 296 | * @param array $paths |
297 | 297 | * @return string |
298 | 298 | */ |
299 | - protected static function _find_common_base_path( $paths ) { |
|
299 | + protected static function _find_common_base_path($paths) { |
|
300 | 300 | $last_offset = 0; |
301 | 301 | $common_base_path = ''; |
302 | - while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) { |
|
302 | + while (($index = strpos($paths[0], DS, $last_offset)) !== false) { |
|
303 | 303 | $dir_length = $index - $last_offset + 1; |
304 | - $directory = substr( $paths[ 0 ], $last_offset, $dir_length ); |
|
305 | - foreach ( $paths as $path ) { |
|
306 | - if ( substr( $path, $last_offset, $dir_length ) != $directory ) { |
|
304 | + $directory = substr($paths[0], $last_offset, $dir_length); |
|
305 | + foreach ($paths as $path) { |
|
306 | + if (substr($path, $last_offset, $dir_length) != $directory) { |
|
307 | 307 | return $common_base_path; |
308 | 308 | } |
309 | 309 | } |
310 | 310 | $common_base_path .= $directory; |
311 | 311 | $last_offset = $index + 1; |
312 | 312 | } |
313 | - return substr( $common_base_path, 0, -1 ); |
|
313 | + return substr($common_base_path, 0, -1); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | |
@@ -322,9 +322,9 @@ discard block |
||
322 | 322 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
323 | 323 | * @return mixed string |
324 | 324 | */ |
325 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
325 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
326 | 326 | //require the template validator for verifying variables are set according to how the template requires |
327 | - EE_Registry::instance()->load_helper( 'Template_Validator' ); |
|
327 | + EE_Registry::instance()->load_helper('Template_Validator'); |
|
328 | 328 | |
329 | 329 | /** |
330 | 330 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -335,26 +335,26 @@ discard block |
||
335 | 335 | * |
336 | 336 | * @since 4.6.0 |
337 | 337 | */ |
338 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
339 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
338 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
339 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
340 | 340 | |
341 | 341 | // you gimme nuttin - YOU GET NUTTIN !! |
342 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
342 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
343 | 343 | return ''; |
344 | 344 | } |
345 | 345 | // if $template_args are not in an array, then make it so |
346 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
347 | - $template_args = array( $template_args ); |
|
346 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
347 | + $template_args = array($template_args); |
|
348 | 348 | } |
349 | - extract( (array) $template_args); |
|
349 | + extract((array) $template_args); |
|
350 | 350 | |
351 | - if ( $return_string ) { |
|
351 | + if ($return_string) { |
|
352 | 352 | // because we want to return a string, we are going to capture the output |
353 | 353 | ob_start(); |
354 | - include( $template_path ); |
|
354 | + include($template_path); |
|
355 | 355 | return ob_get_clean(); |
356 | 356 | } else { |
357 | - include( $template_path ); |
|
357 | + include($template_path); |
|
358 | 358 | } |
359 | 359 | return ''; |
360 | 360 | } |
@@ -372,27 +372,27 @@ discard block |
||
372 | 372 | * @param string $suffix added to the end of the generated class |
373 | 373 | * @return string |
374 | 374 | */ |
375 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
375 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
376 | 376 | // in the beginning... |
377 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
377 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
378 | 378 | // da muddle |
379 | 379 | $class = ''; |
380 | 380 | // the end |
381 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
381 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
382 | 382 | // is the passed object an EE object ? |
383 | - if ( $object instanceof EE_Base_Class ) { |
|
383 | + if ($object instanceof EE_Base_Class) { |
|
384 | 384 | // grab the exact type of object |
385 | - $obj_class = get_class( $object ); |
|
385 | + $obj_class = get_class($object); |
|
386 | 386 | // depending on the type of object... |
387 | - switch ( $obj_class ) { |
|
387 | + switch ($obj_class) { |
|
388 | 388 | // no specifics just yet... |
389 | 389 | default : |
390 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
391 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
390 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
391 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
392 | 392 | |
393 | 393 | } |
394 | 394 | } |
395 | - return $prefix . $class . $suffix; |
|
395 | + return $prefix.$class.$suffix; |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | |
@@ -408,50 +408,50 @@ discard block |
||
408 | 408 | * @param string $cur_code_span_class |
409 | 409 | * @return string the html output for the formatted money value |
410 | 410 | */ |
411 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
411 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
412 | 412 | // ensure amount was received |
413 | - if ( is_null( $amount ) ) { |
|
414 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
415 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
413 | + if (is_null($amount)) { |
|
414 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
415 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
416 | 416 | return ''; |
417 | 417 | } |
418 | 418 | //ensure amount is float |
419 | 419 | $amount = (float) $amount; |
420 | 420 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
421 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
421 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
422 | 422 | // still a number or was amount converted to a string like "free" ? |
423 | - if ( is_float( $amount_formatted )) { |
|
423 | + if (is_float($amount_formatted)) { |
|
424 | 424 | // was a country ISO code passed ? if so generate currency config object for that country |
425 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
425 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
426 | 426 | // verify results |
427 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
427 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
428 | 428 | // set default config country currency settings |
429 | 429 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
430 | 430 | } |
431 | 431 | // format float |
432 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
432 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
433 | 433 | // add formatting ? |
434 | - if ( ! $return_raw ) { |
|
434 | + if ( ! $return_raw) { |
|
435 | 435 | // add currency sign |
436 | - if( $mny->sign_b4 ){ |
|
437 | - if( $amount >= 0 ){ |
|
438 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
439 | - }else{ |
|
440 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
436 | + if ($mny->sign_b4) { |
|
437 | + if ($amount >= 0) { |
|
438 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
439 | + } else { |
|
440 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
441 | 441 | } |
442 | 442 | |
443 | - }else{ |
|
444 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
443 | + } else { |
|
444 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | // add currency code ? |
448 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
448 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
449 | 449 | } |
450 | 450 | // filter results |
451 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
451 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
452 | 452 | } |
453 | 453 | // clean up vars |
454 | - unset( $mny ); |
|
454 | + unset($mny); |
|
455 | 455 | // return formatted currency amount |
456 | 456 | return $amount_formatted; |
457 | 457 | } |
@@ -466,11 +466,11 @@ discard block |
||
466 | 466 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
467 | 467 | * @return string The localized label for the status id. |
468 | 468 | */ |
469 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
469 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
470 | 470 | /** @type EEM_Status $EEM_Status */ |
471 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
472 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
473 | - return $status[ $status_id ]; |
|
471 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
472 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
473 | + return $status[$status_id]; |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | |
@@ -483,9 +483,9 @@ discard block |
||
483 | 483 | * @param string $icon |
484 | 484 | * @return string the html output for the button |
485 | 485 | */ |
486 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) { |
|
487 | - $label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label; |
|
488 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>'; |
|
486 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') { |
|
487 | + $label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label; |
|
488 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>'; |
|
489 | 489 | return $button; |
490 | 490 | } |
491 | 491 | |
@@ -502,21 +502,21 @@ discard block |
||
502 | 502 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
503 | 503 | * @return string generated link |
504 | 504 | */ |
505 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
505 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
506 | 506 | |
507 | - if ( ! $page ) |
|
508 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
507 | + if ( ! $page) |
|
508 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
509 | 509 | |
510 | - if ( ! $action ) |
|
511 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
510 | + if ( ! $action) |
|
511 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
512 | 512 | |
513 | 513 | $action = empty($action) ? 'default' : $action; |
514 | 514 | |
515 | 515 | |
516 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
517 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
518 | - $help_text = !$help_text ? '' : $help_text; |
|
519 | - return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>'; |
|
516 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
517 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
518 | + $help_text = ! $help_text ? '' : $help_text; |
|
519 | + return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>'; |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | |
@@ -528,31 +528,31 @@ discard block |
||
528 | 528 | * @param EE_Help_Tour |
529 | 529 | * @return string html |
530 | 530 | */ |
531 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
531 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
532 | 532 | $id = $tour->get_slug(); |
533 | 533 | $stops = $tour->get_stops(); |
534 | 534 | |
535 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
535 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
536 | 536 | |
537 | - foreach ( $stops as $stop ) { |
|
538 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
539 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
537 | + foreach ($stops as $stop) { |
|
538 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
539 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
540 | 540 | |
541 | 541 | //if container is set to modal then let's make sure we set the options accordingly |
542 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
542 | + if (empty($data_id) && empty($data_class)) { |
|
543 | 543 | $stop['options']['modal'] = true; |
544 | 544 | $stop['options']['expose'] = true; |
545 | 545 | } |
546 | 546 | |
547 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
548 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
547 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
548 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
549 | 549 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
550 | 550 | |
551 | 551 | //options |
552 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
552 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
553 | 553 | $options = ' data-options="'; |
554 | - foreach ( $stop['options'] as $option => $value ) { |
|
555 | - $options .= $option . ':' . $value . ';'; |
|
554 | + foreach ($stop['options'] as $option => $value) { |
|
555 | + $options .= $option.':'.$value.';'; |
|
556 | 556 | } |
557 | 557 | $options .= '"'; |
558 | 558 | } else { |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | } |
561 | 561 | |
562 | 562 | //let's put all together |
563 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
563 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | $content .= '</ol>'; |
@@ -581,31 +581,31 @@ discard block |
||
581 | 581 | * @throws EE_Error |
582 | 582 | * @return string html structure for status. |
583 | 583 | */ |
584 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
585 | - if ( !is_array( $status_array ) ) |
|
586 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
584 | + public static function status_legend($status_array, $active_status = '') { |
|
585 | + if ( ! is_array($status_array)) |
|
586 | + throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
587 | 587 | |
588 | 588 | $setup_array = array(); |
589 | - foreach ( $status_array as $item => $status ) { |
|
589 | + foreach ($status_array as $item => $status) { |
|
590 | 590 | $setup_array[$item] = array( |
591 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
592 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
591 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
592 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
593 | 593 | 'status' => $status |
594 | 594 | ); |
595 | 595 | } |
596 | 596 | |
597 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
598 | - $content .= '<h3>' . __('Status Legend', 'event_espresso') . '</h3>' . "\n"; |
|
599 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
600 | - foreach ( $setup_array as $item => $details ) { |
|
597 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
598 | + $content .= '<h3>'.__('Status Legend', 'event_espresso').'</h3>'."\n"; |
|
599 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
600 | + foreach ($setup_array as $item => $details) { |
|
601 | 601 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
602 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
603 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
604 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
605 | - $content .= '</dt>' . "\n"; |
|
602 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
603 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
604 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
605 | + $content .= '</dt>'."\n"; |
|
606 | 606 | } |
607 | - $content .= '</dl>' . "\n"; |
|
608 | - $content .= '</div>' . "\n"; |
|
607 | + $content .= '</dl>'."\n"; |
|
608 | + $content .= '</div>'."\n"; |
|
609 | 609 | return $content; |
610 | 610 | } |
611 | 611 | |
@@ -618,8 +618,8 @@ discard block |
||
618 | 618 | * @return string |
619 | 619 | */ |
620 | 620 | public static function layout_array_as_table($data) { |
621 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
622 | - $data = (array)$data; |
|
621 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
622 | + $data = (array) $data; |
|
623 | 623 | } |
624 | 624 | EE_Registry::instance()->load_helper('Array'); |
625 | 625 | ob_start(); |
@@ -633,10 +633,10 @@ discard block |
||
633 | 633 | ?> |
634 | 634 | <tr> |
635 | 635 | <td> |
636 | - <?php echo $data_key;?> |
|
636 | + <?php echo $data_key; ?> |
|
637 | 637 | </td> |
638 | 638 | <td> |
639 | - <?php echo self::layout_array_as_table($data_values);?> |
|
639 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
640 | 640 | </td> |
641 | 641 | </tr> |
642 | 642 | <?php |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | <ul> |
651 | 651 | <?php |
652 | 652 | foreach ($data as $datum) { |
653 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
653 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
654 | 654 | }?> |
655 | 655 | </ul> |
656 | 656 | <?php |
@@ -680,8 +680,8 @@ discard block |
||
680 | 680 | * |
681 | 681 | * @return string |
682 | 682 | */ |
683 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
684 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
683 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
684 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | |
@@ -705,13 +705,13 @@ discard block |
||
705 | 705 | * ) |
706 | 706 | * @return string |
707 | 707 | */ |
708 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
708 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
709 | 709 | $page_links = array(); |
710 | 710 | $disable_first = $disable_last = ''; |
711 | 711 | $total_items = (int) $total_items; |
712 | 712 | $per_page = (int) $per_page; |
713 | 713 | $current = (int) $current; |
714 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
714 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
715 | 715 | |
716 | 716 | //filter items_label |
717 | 717 | $items_label = apply_filters( |
@@ -719,68 +719,68 @@ discard block |
||
719 | 719 | $items_label |
720 | 720 | ); |
721 | 721 | |
722 | - if ( empty( $items_label ) |
|
723 | - || ! is_array( $items_label ) |
|
724 | - || ! isset( $items_label['single'] ) |
|
725 | - || ! isset( $items_label['plural'] ) ) { |
|
722 | + if (empty($items_label) |
|
723 | + || ! is_array($items_label) |
|
724 | + || ! isset($items_label['single']) |
|
725 | + || ! isset($items_label['plural'])) { |
|
726 | 726 | $items_label = array( |
727 | - 'single' => __( '1 item', 'event_espresso' ), |
|
728 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
727 | + 'single' => __('1 item', 'event_espresso'), |
|
728 | + 'plural' => __('%s items', 'event_espresso') |
|
729 | 729 | ); |
730 | 730 | } else { |
731 | 731 | $items_label = array( |
732 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
733 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
732 | + 'single' => '1 '.esc_html($items_label['single']), |
|
733 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
734 | 734 | ); |
735 | 735 | } |
736 | 736 | |
737 | - $total_pages = ceil( $total_items / $per_page ); |
|
737 | + $total_pages = ceil($total_items / $per_page); |
|
738 | 738 | |
739 | - if ( $total_pages <= 1 ) |
|
739 | + if ($total_pages <= 1) |
|
740 | 740 | return ''; |
741 | 741 | |
742 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
742 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
743 | 743 | |
744 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
744 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
745 | 745 | |
746 | - if ( $current === 1 ) { |
|
746 | + if ($current === 1) { |
|
747 | 747 | $disable_first = ' disabled'; |
748 | 748 | } |
749 | - if ( $current == $total_pages ) { |
|
749 | + if ($current == $total_pages) { |
|
750 | 750 | $disable_last = ' disabled'; |
751 | 751 | } |
752 | 752 | |
753 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
754 | - 'first-page' . $disable_first, |
|
755 | - esc_attr__( 'Go to the first page' ), |
|
756 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
753 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
754 | + 'first-page'.$disable_first, |
|
755 | + esc_attr__('Go to the first page'), |
|
756 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
757 | 757 | '«' |
758 | 758 | ); |
759 | 759 | |
760 | 760 | $page_links[] = sprintf( |
761 | 761 | '<a class="%s" title="%s" href="%s">%s</a>', |
762 | - 'prev-page' . $disable_first, |
|
763 | - esc_attr__( 'Go to the previous page' ), |
|
764 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
762 | + 'prev-page'.$disable_first, |
|
763 | + esc_attr__('Go to the previous page'), |
|
764 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
765 | 765 | '‹' |
766 | 766 | ); |
767 | 767 | |
768 | - if ( ! $show_num_field ) { |
|
768 | + if ( ! $show_num_field) { |
|
769 | 769 | $html_current_page = $current; |
770 | 770 | } else { |
771 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
772 | - esc_attr__( 'Current page' ), |
|
771 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
772 | + esc_attr__('Current page'), |
|
773 | 773 | $current, |
774 | - strlen( $total_pages ) |
|
774 | + strlen($total_pages) |
|
775 | 775 | ); |
776 | 776 | } |
777 | 777 | |
778 | 778 | $html_total_pages = sprintf( |
779 | 779 | '<span class="total-pages">%s</span>', |
780 | - number_format_i18n( $total_pages ) |
|
780 | + number_format_i18n($total_pages) |
|
781 | 781 | ); |
782 | 782 | $page_links[] = sprintf( |
783 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
783 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
784 | 784 | $html_current_page, |
785 | 785 | $html_total_pages, |
786 | 786 | '<span class="paging-input">', |
@@ -789,29 +789,29 @@ discard block |
||
789 | 789 | |
790 | 790 | $page_links[] = sprintf( |
791 | 791 | '<a class="%s" title="%s" href="%s">%s</a>', |
792 | - 'next-page' . $disable_last, |
|
793 | - esc_attr__( 'Go to the next page' ), |
|
794 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
792 | + 'next-page'.$disable_last, |
|
793 | + esc_attr__('Go to the next page'), |
|
794 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
795 | 795 | '›' |
796 | 796 | ); |
797 | 797 | |
798 | 798 | $page_links[] = sprintf( |
799 | 799 | '<a class="%s" title="%s" href="%s">%s</a>', |
800 | - 'last-page' . $disable_last, |
|
801 | - esc_attr__( 'Go to the last page' ), |
|
802 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
800 | + 'last-page'.$disable_last, |
|
801 | + esc_attr__('Go to the last page'), |
|
802 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
803 | 803 | '»' |
804 | 804 | ); |
805 | 805 | |
806 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
806 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
807 | 807 | // set page class |
808 | - if ( $total_pages ) { |
|
808 | + if ($total_pages) { |
|
809 | 809 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
810 | 810 | } else { |
811 | 811 | $page_class = ' no-pages'; |
812 | 812 | } |
813 | 813 | |
814 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
814 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
815 | 815 | } |
816 | 816 | |
817 | 817 | |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 ); |
828 | 828 | |
829 | 829 | |
830 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
830 | +if ( ! function_exists('espresso_pagination')) { |
|
831 | 831 | /** |
832 | 832 | * espresso_pagination |
833 | 833 | * |
@@ -839,21 +839,21 @@ discard block |
||
839 | 839 | $big = 999999999; // need an unlikely integer |
840 | 840 | $pagination = paginate_links( |
841 | 841 | array( |
842 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
842 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
843 | 843 | 'format' => '?paged=%#%', |
844 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
844 | + 'current' => max(1, get_query_var('paged')), |
|
845 | 845 | 'total' => $wp_query->max_num_pages, |
846 | 846 | 'show_all' => true, |
847 | 847 | 'end_size' => 10, |
848 | 848 | 'mid_size' => 6, |
849 | 849 | 'prev_next' => true, |
850 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
851 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
850 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
851 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
852 | 852 | 'type' => 'plain', |
853 | 853 | 'add_args' => false, |
854 | 854 | 'add_fragment' => '' |
855 | 855 | ) |
856 | 856 | ); |
857 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
857 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
858 | 858 | } |
859 | 859 | } |
860 | 860 | \ No newline at end of file |