@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'ABSPATH' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('ABSPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @link {@link http://www.eventespresso.com} |
40 | 40 | * @since 4.0 |
41 | 41 | */ |
42 | -if ( function_exists( 'espresso_version' ) ) { |
|
42 | +if (function_exists('espresso_version')) { |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * espresso_duplicate_plugin_error |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | 60 | } |
61 | - add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 ); |
|
61 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
62 | 62 | |
63 | 63 | } else { |
64 | 64 | |
65 | - define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' ); |
|
65 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.0'); |
|
66 | 66 | |
67 | - if ( ! version_compare( PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=' ) ) { |
|
67 | + if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * espresso_minimum_php_version_error |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | </p> |
91 | 91 | </div> |
92 | 92 | <?php |
93 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
93 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
94 | 94 | } |
95 | - add_action( 'admin_notices', 'espresso_minimum_php_version_error', 1 ); |
|
95 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
96 | 96 | |
97 | 97 | } else { |
98 | 98 | |
@@ -103,99 +103,99 @@ discard block |
||
103 | 103 | * @return string |
104 | 104 | */ |
105 | 105 | function espresso_version() { |
106 | - return apply_filters( 'FHEE__espresso__espresso_version', '4.9.18.rc.000' ); |
|
106 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.18.rc.000'); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | // define versions |
110 | - define( 'EVENT_ESPRESSO_VERSION', espresso_version() ); |
|
111 | - define( 'EE_MIN_WP_VER_REQUIRED', '4.1' ); |
|
112 | - define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' ); |
|
113 | - define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' ); |
|
114 | - define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ ); |
|
110 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
111 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
112 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
113 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
114 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
115 | 115 | |
116 | 116 | //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
117 | - if ( ! defined( 'DS' ) ) { |
|
118 | - define( 'DS', '/' ); |
|
117 | + if ( ! defined('DS')) { |
|
118 | + define('DS', '/'); |
|
119 | 119 | } |
120 | - if ( ! defined( 'PS' ) ) { |
|
121 | - define( 'PS', PATH_SEPARATOR ); |
|
120 | + if ( ! defined('PS')) { |
|
121 | + define('PS', PATH_SEPARATOR); |
|
122 | 122 | } |
123 | - if ( ! defined( 'SP' ) ) { |
|
124 | - define( 'SP', ' ' ); |
|
123 | + if ( ! defined('SP')) { |
|
124 | + define('SP', ' '); |
|
125 | 125 | } |
126 | - if ( ! defined( 'EENL' ) ) { |
|
127 | - define( 'EENL', "\n" ); |
|
126 | + if ( ! defined('EENL')) { |
|
127 | + define('EENL', "\n"); |
|
128 | 128 | } |
129 | - define( 'EE_SUPPORT_EMAIL', '[email protected]' ); |
|
129 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
130 | 130 | // define the plugin directory and URL |
131 | - define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
132 | - define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
133 | - define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
131 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
132 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
133 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
134 | 134 | // main root folder paths |
135 | - define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS ); |
|
136 | - define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS ); |
|
137 | - define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS ); |
|
138 | - define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS ); |
|
139 | - define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS ); |
|
140 | - define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS ); |
|
141 | - define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS ); |
|
142 | - define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS ); |
|
135 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
136 | + define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
137 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
138 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
139 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
140 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
141 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
142 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
143 | 143 | // core system paths |
144 | - define( 'EE_ADMIN', EE_CORE . 'admin' . DS ); |
|
145 | - define( 'EE_CPTS', EE_CORE . 'CPTs' . DS ); |
|
146 | - define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS ); |
|
147 | - define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS ); |
|
148 | - define( 'EE_BUSINESS', EE_CORE . 'business' . DS ); |
|
149 | - define( 'EE_MODELS', EE_CORE . 'db_models' . DS ); |
|
150 | - define( 'EE_HELPERS', EE_CORE . 'helpers' . DS ); |
|
151 | - define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS ); |
|
152 | - define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS ); |
|
153 | - define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS ); |
|
154 | - define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS ); |
|
155 | - define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS ); |
|
144 | + define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
145 | + define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
146 | + define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
147 | + define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
148 | + define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
149 | + define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
150 | + define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
151 | + define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
152 | + define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
153 | + define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
154 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
155 | + define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
156 | 156 | // gateways |
157 | - define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS ); |
|
158 | - define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS ); |
|
157 | + define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
158 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
159 | 159 | // asset URL paths |
160 | - define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS ); |
|
161 | - define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS ); |
|
162 | - define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS ); |
|
163 | - define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS ); |
|
164 | - define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' ); |
|
165 | - define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' ); |
|
160 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
161 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
162 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
163 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
164 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
165 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
166 | 166 | // define upload paths |
167 | 167 | $uploads = wp_upload_dir(); |
168 | 168 | // define the uploads directory and URL |
169 | - define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS ); |
|
170 | - define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS ); |
|
169 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
170 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
171 | 171 | // define the templates directory and URL |
172 | - define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS ); |
|
173 | - define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS ); |
|
172 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
173 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
174 | 174 | // define the gateway directory and URL |
175 | - define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
176 | - define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
175 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
176 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
177 | 177 | // languages folder/path |
178 | - define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS ); |
|
179 | - define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS ); |
|
178 | + define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
179 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
180 | 180 | //check for dompdf fonts in uploads |
181 | - if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) { |
|
182 | - define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ); |
|
181 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
182 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
183 | 183 | } |
184 | 184 | //ajax constants |
185 | 185 | define( |
186 | 186 | 'EE_FRONT_AJAX', |
187 | - isset( $_REQUEST['ee_front_ajax'] ) || isset( $_REQUEST['data']['ee_front_ajax'] ) ? true : false |
|
187 | + isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false |
|
188 | 188 | ); |
189 | 189 | define( |
190 | 190 | 'EE_ADMIN_AJAX', |
191 | - isset( $_REQUEST['ee_admin_ajax'] ) || isset( $_REQUEST['data']['ee_admin_ajax'] ) ? true : false |
|
191 | + isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false |
|
192 | 192 | ); |
193 | 193 | //just a handy constant occasionally needed for finding values representing infinity in the DB |
194 | 194 | //you're better to use this than its straight value (currently -1) in case you ever |
195 | 195 | //want to change its default value! or find when -1 means infinity |
196 | - define( 'EE_INF_IN_DB', -1 ); |
|
197 | - define( 'EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX ); |
|
198 | - define( 'EE_DEBUG', false ); |
|
196 | + define('EE_INF_IN_DB', -1); |
|
197 | + define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
198 | + define('EE_DEBUG', false); |
|
199 | 199 | |
200 | 200 | |
201 | 201 | /** |
@@ -203,9 +203,9 @@ discard block |
||
203 | 203 | * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
204 | 204 | */ |
205 | 205 | function espresso_plugin_activation() { |
206 | - update_option( 'ee_espresso_activation', true ); |
|
206 | + update_option('ee_espresso_activation', true); |
|
207 | 207 | } |
208 | - register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' ); |
|
208 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
209 | 209 | |
210 | 210 | |
211 | 211 | |
@@ -215,15 +215,15 @@ discard block |
||
215 | 215 | */ |
216 | 216 | function espresso_load_error_handling() { |
217 | 217 | // load debugging tools |
218 | - if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) { |
|
219 | - require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ); |
|
218 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
219 | + require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php'); |
|
220 | 220 | EEH_Debug_Tools::instance(); |
221 | 221 | } |
222 | 222 | // load error handling |
223 | - if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) { |
|
224 | - require_once( EE_CORE . 'EE_Error.core.php' ); |
|
223 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
224 | + require_once(EE_CORE.'EE_Error.core.php'); |
|
225 | 225 | } else { |
226 | - wp_die( esc_html__( 'The EE_Error core class could not be loaded.', 'event_espresso' ) ); |
|
226 | + wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
@@ -237,16 +237,16 @@ discard block |
||
237 | 237 | * @param string $full_path_to_file |
238 | 238 | * @throws EE_Error |
239 | 239 | */ |
240 | - function espresso_load_required( $classname, $full_path_to_file ) { |
|
240 | + function espresso_load_required($classname, $full_path_to_file) { |
|
241 | 241 | static $error_handling_loaded = false; |
242 | - if ( ! $error_handling_loaded ) { |
|
242 | + if ( ! $error_handling_loaded) { |
|
243 | 243 | espresso_load_error_handling(); |
244 | 244 | $error_handling_loaded = true; |
245 | 245 | } |
246 | - if ( is_readable( $full_path_to_file ) ) { |
|
247 | - require_once( $full_path_to_file ); |
|
246 | + if (is_readable($full_path_to_file)) { |
|
247 | + require_once($full_path_to_file); |
|
248 | 248 | } else { |
249 | - throw new EE_Error ( |
|
249 | + throw new EE_Error( |
|
250 | 250 | sprintf( |
251 | 251 | esc_html__( |
252 | 252 | 'The %s class file could not be located or is not readable due to file permissions.', |
@@ -258,15 +258,15 @@ discard block |
||
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
261 | - espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' ); |
|
262 | - espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' ); |
|
263 | - espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' ); |
|
261 | + espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php'); |
|
262 | + espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php'); |
|
263 | + espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php'); |
|
264 | 264 | new EE_Bootstrap(); |
265 | 265 | |
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
269 | -if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
|
269 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
270 | 270 | |
271 | 271 | /** |
272 | 272 | * deactivate_plugin |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
277 | 277 | * @return void |
278 | 278 | */ |
279 | - function espresso_deactivate_plugin( $plugin_basename = '' ) { |
|
280 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
281 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
279 | + function espresso_deactivate_plugin($plugin_basename = '') { |
|
280 | + if ( ! function_exists('deactivate_plugins')) { |
|
281 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
282 | 282 | } |
283 | - unset( $_GET['activate'], $_REQUEST['activate'] ); |
|
284 | - deactivate_plugins( $plugin_basename ); |
|
283 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
284 | + deactivate_plugins($plugin_basename); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public static function instance() { |
135 | 135 | // check if class object is instantiated, and instantiated properly |
136 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
136 | + if ( ! self::$_instance instanceof EE_Config) { |
|
137 | 137 | self::$_instance = new self(); |
138 | 138 | } |
139 | 139 | return self::$_instance; |
@@ -153,20 +153,20 @@ discard block |
||
153 | 153 | * site was put into maintenance mode) |
154 | 154 | * @return EE_Config |
155 | 155 | */ |
156 | - public static function reset( $hard_reset = false, $reinstantiate = true ) { |
|
157 | - if ( $hard_reset ) { |
|
156 | + public static function reset($hard_reset = false, $reinstantiate = true) { |
|
157 | + if ($hard_reset) { |
|
158 | 158 | self::$_instance->_addon_option_names = array(); |
159 | 159 | self::$_instance->_initialize_config(); |
160 | 160 | self::$_instance->update_espresso_config(); |
161 | 161 | } |
162 | - if ( self::$_instance instanceof EE_Config ) { |
|
162 | + if (self::$_instance instanceof EE_Config) { |
|
163 | 163 | self::$_instance->update_addon_option_names(); |
164 | 164 | } |
165 | 165 | self::$_instance = null; |
166 | 166 | //we don't need to reset the static properties imo because those should |
167 | 167 | //only change when a module is added or removed. Currently we don't |
168 | 168 | //support removing a module during a request when it previously existed |
169 | - if ( $reinstantiate ) { |
|
169 | + if ($reinstantiate) { |
|
170 | 170 | return self::instance(); |
171 | 171 | } else { |
172 | 172 | return null; |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | * @access private |
182 | 182 | */ |
183 | 183 | private function __construct() { |
184 | - do_action( 'AHEE__EE_Config__construct__begin', $this ); |
|
185 | - EE_Config::$_logging_enabled = apply_filters( 'FHEE__EE_Config___construct__logging_enabled', false ); |
|
184 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
185 | + EE_Config::$_logging_enabled = apply_filters('FHEE__EE_Config___construct__logging_enabled', false); |
|
186 | 186 | // setup empty config classes |
187 | 187 | $this->_initialize_config(); |
188 | 188 | // load existing EE site settings |
@@ -192,17 +192,17 @@ discard block |
||
192 | 192 | // register shortcodes and modules |
193 | 193 | add_action( |
194 | 194 | 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
195 | - array( $this, 'register_shortcodes_and_modules' ), |
|
195 | + array($this, 'register_shortcodes_and_modules'), |
|
196 | 196 | 999 |
197 | 197 | ); |
198 | 198 | // initialize shortcodes and modules |
199 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) ); |
|
199 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
200 | 200 | // register widgets |
201 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
201 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
202 | 202 | // shutdown |
203 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
203 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
204 | 204 | // construct__end hook |
205 | - do_action( 'AHEE__EE_Config__construct__end', $this ); |
|
205 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
206 | 206 | // hardcoded hack |
207 | 207 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
208 | 208 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * @return string current theme set. |
225 | 225 | */ |
226 | 226 | public static function get_current_theme() { |
227 | - return isset( self::$_instance->template_settings->current_espresso_theme ) |
|
227 | + return isset(self::$_instance->template_settings->current_espresso_theme) |
|
228 | 228 | ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
229 | 229 | } |
230 | 230 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | private function _initialize_config() { |
240 | 240 | EE_Config::trim_log(); |
241 | 241 | //set defaults |
242 | - $this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() ); |
|
242 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
243 | 243 | $this->addons = new stdClass(); |
244 | 244 | // set _module_route_map |
245 | 245 | EE_Config::$_module_route_map = array(); |
@@ -259,9 +259,9 @@ discard block |
||
259 | 259 | */ |
260 | 260 | private function _load_core_config() { |
261 | 261 | // load_core_config__start hook |
262 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
262 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
263 | 263 | $espresso_config = $this->get_espresso_config(); |
264 | - foreach ( $espresso_config as $config => $settings ) { |
|
264 | + foreach ($espresso_config as $config => $settings) { |
|
265 | 265 | // load_core_config__start hook |
266 | 266 | $settings = apply_filters( |
267 | 267 | 'FHEE__EE_Config___load_core_config__config_settings', |
@@ -269,22 +269,22 @@ discard block |
||
269 | 269 | $config, |
270 | 270 | $this |
271 | 271 | ); |
272 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
273 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
272 | + if (is_object($settings) && property_exists($this, $config)) { |
|
273 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
274 | 274 | //call configs populate method to ensure any defaults are set for empty values. |
275 | - if ( method_exists( $settings, 'populate' ) ) { |
|
275 | + if (method_exists($settings, 'populate')) { |
|
276 | 276 | $this->{$config}->populate(); |
277 | 277 | } |
278 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
278 | + if (method_exists($settings, 'do_hooks')) { |
|
279 | 279 | $this->{$config}->do_hooks(); |
280 | 280 | } |
281 | 281 | } |
282 | 282 | } |
283 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) { |
|
283 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
284 | 284 | $this->update_espresso_config(); |
285 | 285 | } |
286 | 286 | // load_core_config__end hook |
287 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
287 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
@@ -299,23 +299,23 @@ discard block |
||
299 | 299 | $this->core = $this->core instanceof EE_Core_Config |
300 | 300 | ? $this->core |
301 | 301 | : new EE_Core_Config(); |
302 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
302 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
303 | 303 | $this->organization = $this->organization instanceof EE_Organization_Config |
304 | 304 | ? $this->organization |
305 | 305 | : new EE_Organization_Config(); |
306 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
306 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
307 | 307 | $this->currency = $this->currency instanceof EE_Currency_Config |
308 | 308 | ? $this->currency |
309 | 309 | : new EE_Currency_Config(); |
310 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
310 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
311 | 311 | $this->registration = $this->registration instanceof EE_Registration_Config |
312 | 312 | ? $this->registration |
313 | 313 | : new EE_Registration_Config(); |
314 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
314 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
315 | 315 | $this->admin = $this->admin instanceof EE_Admin_Config |
316 | 316 | ? $this->admin |
317 | 317 | : new EE_Admin_Config(); |
318 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
318 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
319 | 319 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
320 | 320 | ? $this->template_settings |
321 | 321 | : new EE_Template_Config(); |
@@ -326,19 +326,19 @@ discard block |
||
326 | 326 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
327 | 327 | ? $this->map_settings |
328 | 328 | : new EE_Map_Config(); |
329 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
329 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
330 | 330 | $this->environment = $this->environment instanceof EE_Environment_Config |
331 | 331 | ? $this->environment |
332 | 332 | : new EE_Environment_Config(); |
333 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
333 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
334 | 334 | $this->tax_settings = $this->tax_settings instanceof EE_Tax_Config |
335 | 335 | ? $this->tax_settings |
336 | 336 | : new EE_Tax_Config(); |
337 | - $this->tax_settings = apply_filters( 'FHEE__EE_Config___initialize_config__tax_settings', $this->tax_settings ); |
|
337 | + $this->tax_settings = apply_filters('FHEE__EE_Config___initialize_config__tax_settings', $this->tax_settings); |
|
338 | 338 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
339 | 339 | ? $this->gateway |
340 | 340 | : new EE_Gateway_Config(); |
341 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
341 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | // grab espresso configuration |
354 | 354 | return apply_filters( |
355 | 355 | 'FHEE__EE_Config__get_espresso_config__CFG', |
356 | - get_option( EE_Config::OPTION_NAME, array() ) |
|
356 | + get_option(EE_Config::OPTION_NAME, array()) |
|
357 | 357 | ); |
358 | 358 | } |
359 | 359 | |
@@ -367,12 +367,12 @@ discard block |
||
367 | 367 | * @param $old_value |
368 | 368 | * @param $value |
369 | 369 | */ |
370 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
370 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
371 | 371 | // make sure we're checking the ee config |
372 | - if ( $option === EE_Config::OPTION_NAME ) { |
|
372 | + if ($option === EE_Config::OPTION_NAME) { |
|
373 | 373 | // run a loose comparison of the old value against the new value for type and properties, |
374 | 374 | // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
375 | - if ( $value != $old_value ) { |
|
375 | + if ($value != $old_value) { |
|
376 | 376 | // if they are NOT the same, then remove the hook, |
377 | 377 | // which means the subsequent update results will be based solely on the update query results |
378 | 378 | // the reason we do this is because, as stated above, |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | // the string it sees in the db looks the same as the new one it has been passed!!! |
388 | 388 | // This results in the query returning an "affected rows" value of ZERO, |
389 | 389 | // which gets returned immediately by WP update_option and looks like an error. |
390 | - remove_action( 'update_option', array( $this, 'check_config_updated' ) ); |
|
390 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | } |
@@ -401,11 +401,11 @@ discard block |
||
401 | 401 | */ |
402 | 402 | protected function _reset_espresso_addon_config() { |
403 | 403 | $this->_addon_option_names = array(); |
404 | - foreach ( $this->addons as $addon_name => $addon_config_obj ) { |
|
405 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
406 | - $config_class = get_class( $addon_config_obj ); |
|
407 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
408 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, false ); |
|
404 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
405 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
406 | + $config_class = get_class($addon_config_obj); |
|
407 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
408 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
409 | 409 | } |
410 | 410 | $this->addons->{$addon_name} = null; |
411 | 411 | } |
@@ -421,22 +421,22 @@ discard block |
||
421 | 421 | * @param bool $add_error |
422 | 422 | * @return bool |
423 | 423 | */ |
424 | - public function update_espresso_config( $add_success = false, $add_error = true ) { |
|
424 | + public function update_espresso_config($add_success = false, $add_error = true) { |
|
425 | 425 | // don't allow config updates during WP heartbeats |
426 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
426 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
427 | 427 | return false; |
428 | 428 | } |
429 | 429 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
430 | 430 | //$clone = clone( self::$_instance ); |
431 | 431 | //self::$_instance = NULL; |
432 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this ); |
|
432 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
433 | 433 | $this->_reset_espresso_addon_config(); |
434 | 434 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
435 | 435 | // but BEFORE the actual update occurs |
436 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
436 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
437 | 437 | // now update "ee_config" |
438 | - $saved = update_option( EE_Config::OPTION_NAME, $this ); |
|
439 | - EE_Config::log( EE_Config::OPTION_NAME ); |
|
438 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
439 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
440 | 440 | // if not saved... check if the hook we just added still exists; |
441 | 441 | // if it does, it means one of two things: |
442 | 442 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -447,17 +447,17 @@ discard block |
||
447 | 447 | // but just means no update occurred, so don't display an error to the user. |
448 | 448 | // BUT... if update_option returns FALSE, AND the hook is missing, |
449 | 449 | // then it means that something truly went wrong |
450 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved; |
|
450 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
451 | 451 | // remove our action since we don't want it in the system anymore |
452 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
453 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
452 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
453 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
454 | 454 | //self::$_instance = $clone; |
455 | 455 | //unset( $clone ); |
456 | 456 | // if config remains the same or was updated successfully |
457 | - if ( $saved ) { |
|
458 | - if ( $add_success ) { |
|
457 | + if ($saved) { |
|
458 | + if ($add_success) { |
|
459 | 459 | EE_Error::add_success( |
460 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
460 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
461 | 461 | __FILE__, |
462 | 462 | __FUNCTION__, |
463 | 463 | __LINE__ |
@@ -465,9 +465,9 @@ discard block |
||
465 | 465 | } |
466 | 466 | return true; |
467 | 467 | } else { |
468 | - if ( $add_error ) { |
|
468 | + if ($add_error) { |
|
469 | 469 | EE_Error::add_error( |
470 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
470 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
471 | 471 | __FILE__, |
472 | 472 | __FUNCTION__, |
473 | 473 | __LINE__ |
@@ -496,16 +496,16 @@ discard block |
||
496 | 496 | $name = '', |
497 | 497 | $config_class = '', |
498 | 498 | $config_obj = null, |
499 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
499 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
500 | 500 | $display_errors = true |
501 | 501 | ) { |
502 | 502 | try { |
503 | - foreach ( $tests_to_run as $test ) { |
|
504 | - switch ( $test ) { |
|
503 | + foreach ($tests_to_run as $test) { |
|
504 | + switch ($test) { |
|
505 | 505 | // TEST #1 : check that section was set |
506 | 506 | case 1 : |
507 | - if ( empty( $section ) ) { |
|
508 | - if ( $display_errors ) { |
|
507 | + if (empty($section)) { |
|
508 | + if ($display_errors) { |
|
509 | 509 | throw new EE_Error( |
510 | 510 | sprintf( |
511 | 511 | __( |
@@ -521,11 +521,11 @@ discard block |
||
521 | 521 | break; |
522 | 522 | // TEST #2 : check that settings section exists |
523 | 523 | case 2 : |
524 | - if ( ! isset( $this->{$section} ) ) { |
|
525 | - if ( $display_errors ) { |
|
524 | + if ( ! isset($this->{$section} )) { |
|
525 | + if ($display_errors) { |
|
526 | 526 | throw new EE_Error( |
527 | 527 | sprintf( |
528 | - __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
528 | + __('The "%s" configuration section does not exist.', 'event_espresso'), |
|
529 | 529 | $section |
530 | 530 | ) |
531 | 531 | ); |
@@ -536,9 +536,9 @@ discard block |
||
536 | 536 | // TEST #3 : check that section is the proper format |
537 | 537 | case 3 : |
538 | 538 | if ( |
539 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
539 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
540 | 540 | ) { |
541 | - if ( $display_errors ) { |
|
541 | + if ($display_errors) { |
|
542 | 542 | throw new EE_Error( |
543 | 543 | sprintf( |
544 | 544 | __( |
@@ -554,8 +554,8 @@ discard block |
||
554 | 554 | break; |
555 | 555 | // TEST #4 : check that config section name has been set |
556 | 556 | case 4 : |
557 | - if ( empty( $name ) ) { |
|
558 | - if ( $display_errors ) { |
|
557 | + if (empty($name)) { |
|
558 | + if ($display_errors) { |
|
559 | 559 | throw new EE_Error( |
560 | 560 | __( |
561 | 561 | 'No name has been provided for the specific configuration section.', |
@@ -568,8 +568,8 @@ discard block |
||
568 | 568 | break; |
569 | 569 | // TEST #5 : check that a config class name has been set |
570 | 570 | case 5 : |
571 | - if ( empty( $config_class ) ) { |
|
572 | - if ( $display_errors ) { |
|
571 | + if (empty($config_class)) { |
|
572 | + if ($display_errors) { |
|
573 | 573 | throw new EE_Error( |
574 | 574 | __( |
575 | 575 | 'No class name has been provided for the specific configuration section.', |
@@ -582,8 +582,8 @@ discard block |
||
582 | 582 | break; |
583 | 583 | // TEST #6 : verify config class is accessible |
584 | 584 | case 6 : |
585 | - if ( ! class_exists( $config_class ) ) { |
|
586 | - if ( $display_errors ) { |
|
585 | + if ( ! class_exists($config_class)) { |
|
586 | + if ($display_errors) { |
|
587 | 587 | throw new EE_Error( |
588 | 588 | sprintf( |
589 | 589 | __( |
@@ -599,11 +599,11 @@ discard block |
||
599 | 599 | break; |
600 | 600 | // TEST #7 : check that config has even been set |
601 | 601 | case 7 : |
602 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
603 | - if ( $display_errors ) { |
|
602 | + if ( ! isset($this->{$section}->{$name} )) { |
|
603 | + if ($display_errors) { |
|
604 | 604 | throw new EE_Error( |
605 | 605 | sprintf( |
606 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
606 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
607 | 607 | $section, |
608 | 608 | $name |
609 | 609 | ) |
@@ -612,13 +612,13 @@ discard block |
||
612 | 612 | return false; |
613 | 613 | } else { |
614 | 614 | // and make sure it's not serialized |
615 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
615 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
616 | 616 | } |
617 | 617 | break; |
618 | 618 | // TEST #8 : check that config is the requested type |
619 | 619 | case 8 : |
620 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
621 | - if ( $display_errors ) { |
|
620 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
621 | + if ($display_errors) { |
|
622 | 622 | throw new EE_Error( |
623 | 623 | sprintf( |
624 | 624 | __( |
@@ -636,12 +636,12 @@ discard block |
||
636 | 636 | break; |
637 | 637 | // TEST #9 : verify config object |
638 | 638 | case 9 : |
639 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
640 | - if ( $display_errors ) { |
|
639 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
640 | + if ($display_errors) { |
|
641 | 641 | throw new EE_Error( |
642 | 642 | sprintf( |
643 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
644 | - print_r( $config_obj, true ) |
|
643 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
644 | + print_r($config_obj, true) |
|
645 | 645 | ) |
646 | 646 | ); |
647 | 647 | } |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | break; |
651 | 651 | } |
652 | 652 | } |
653 | - } catch ( EE_Error $e ) { |
|
653 | + } catch (EE_Error $e) { |
|
654 | 654 | $e->get_error(); |
655 | 655 | } |
656 | 656 | // you have successfully run the gauntlet |
@@ -667,8 +667,8 @@ discard block |
||
667 | 667 | * @param string $name |
668 | 668 | * @return string |
669 | 669 | */ |
670 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
671 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
670 | + private function _generate_config_option_name($section = '', $name = '') { |
|
671 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | |
@@ -682,10 +682,10 @@ discard block |
||
682 | 682 | * @param string $name |
683 | 683 | * @return string |
684 | 684 | */ |
685 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
686 | - return ! empty( $config_class ) |
|
685 | + private function _set_config_class($config_class = '', $name = '') { |
|
686 | + return ! empty($config_class) |
|
687 | 687 | ? $config_class |
688 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
688 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | |
@@ -700,36 +700,36 @@ discard block |
||
700 | 700 | * @param EE_Config_Base $config_obj |
701 | 701 | * @return EE_Config_Base |
702 | 702 | */ |
703 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
703 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
704 | 704 | // ensure config class is set to something |
705 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
705 | + $config_class = $this->_set_config_class($config_class, $name); |
|
706 | 706 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
707 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
707 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
708 | 708 | return null; |
709 | 709 | } |
710 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
710 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
711 | 711 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
712 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
713 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
712 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
713 | + $this->_addon_option_names[$config_option_name] = $config_class; |
|
714 | 714 | $this->update_addon_option_names(); |
715 | 715 | } |
716 | 716 | // verify the incoming config object but suppress errors |
717 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
717 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
718 | 718 | $config_obj = new $config_class(); |
719 | 719 | } |
720 | - if ( get_option( $config_option_name ) ) { |
|
721 | - EE_Config::log( $config_option_name ); |
|
722 | - update_option( $config_option_name, $config_obj ); |
|
720 | + if (get_option($config_option_name)) { |
|
721 | + EE_Config::log($config_option_name); |
|
722 | + update_option($config_option_name, $config_obj); |
|
723 | 723 | $this->{$section}->{$name} = $config_obj; |
724 | 724 | return $this->{$section}->{$name}; |
725 | 725 | } else { |
726 | 726 | // create a wp-option for this config |
727 | - if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) { |
|
728 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
727 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
728 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
729 | 729 | return $this->{$section}->{$name}; |
730 | 730 | } else { |
731 | 731 | EE_Error::add_error( |
732 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
732 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
733 | 733 | __FILE__, |
734 | 734 | __FUNCTION__, |
735 | 735 | __LINE__ |
@@ -752,46 +752,46 @@ discard block |
||
752 | 752 | * @param bool $throw_errors |
753 | 753 | * @return bool |
754 | 754 | */ |
755 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
755 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
756 | 756 | // don't allow config updates during WP heartbeats |
757 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
757 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
758 | 758 | return false; |
759 | 759 | } |
760 | - $config_obj = maybe_unserialize( $config_obj ); |
|
760 | + $config_obj = maybe_unserialize($config_obj); |
|
761 | 761 | // get class name of the incoming object |
762 | - $config_class = get_class( $config_obj ); |
|
762 | + $config_class = get_class($config_obj); |
|
763 | 763 | // run tests 1-5 and 9 to verify config |
764 | 764 | if ( ! $this->_verify_config_params( |
765 | 765 | $section, |
766 | 766 | $name, |
767 | 767 | $config_class, |
768 | 768 | $config_obj, |
769 | - array( 1, 2, 3, 4, 7, 9 ) |
|
769 | + array(1, 2, 3, 4, 7, 9) |
|
770 | 770 | ) |
771 | 771 | ) { |
772 | 772 | return false; |
773 | 773 | } |
774 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
774 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
775 | 775 | // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
776 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
776 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
777 | 777 | // save new config to db |
778 | - if( $this->set_config( $section, $name, $config_class, $config_obj ) ) { |
|
778 | + if ($this->set_config($section, $name, $config_class, $config_obj)) { |
|
779 | 779 | return true; |
780 | 780 | } |
781 | 781 | } else { |
782 | 782 | // first check if the record already exists |
783 | - $existing_config = get_option( $config_option_name ); |
|
784 | - $config_obj = serialize( $config_obj ); |
|
783 | + $existing_config = get_option($config_option_name); |
|
784 | + $config_obj = serialize($config_obj); |
|
785 | 785 | // just return if db record is already up to date (NOT type safe comparison) |
786 | - if ( $existing_config == $config_obj ) { |
|
786 | + if ($existing_config == $config_obj) { |
|
787 | 787 | $this->{$section}->{$name} = $config_obj; |
788 | 788 | return true; |
789 | - } else if ( update_option( $config_option_name, $config_obj ) ) { |
|
790 | - EE_Config::log( $config_option_name ); |
|
789 | + } else if (update_option($config_option_name, $config_obj)) { |
|
790 | + EE_Config::log($config_option_name); |
|
791 | 791 | // update wp-option for this config class |
792 | 792 | $this->{$section}->{$name} = $config_obj; |
793 | 793 | return true; |
794 | - } elseif ( $throw_errors ) { |
|
794 | + } elseif ($throw_errors) { |
|
795 | 795 | EE_Error::add_error( |
796 | 796 | sprintf( |
797 | 797 | __( |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | 'event_espresso' |
800 | 800 | ), |
801 | 801 | $config_class, |
802 | - 'EE_Config->' . $section . '->' . $name |
|
802 | + 'EE_Config->'.$section.'->'.$name |
|
803 | 803 | ), |
804 | 804 | __FILE__, |
805 | 805 | __FUNCTION__, |
@@ -821,34 +821,34 @@ discard block |
||
821 | 821 | * @param string $config_class |
822 | 822 | * @return mixed EE_Config_Base | NULL |
823 | 823 | */ |
824 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
824 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
825 | 825 | // ensure config class is set to something |
826 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
826 | + $config_class = $this->_set_config_class($config_class, $name); |
|
827 | 827 | // run tests 1-4, 6 and 7 to verify that all params have been set |
828 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
828 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
829 | 829 | return null; |
830 | 830 | } |
831 | 831 | // now test if the requested config object exists, but suppress errors |
832 | - if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) { |
|
832 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
833 | 833 | // config already exists, so pass it back |
834 | 834 | return $this->{$section}->{$name}; |
835 | 835 | } |
836 | 836 | // load config option from db if it exists |
837 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) ); |
|
837 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
838 | 838 | // verify the newly retrieved config object, but suppress errors |
839 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
839 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
840 | 840 | // config is good, so set it and pass it back |
841 | 841 | $this->{$section}->{$name} = $config_obj; |
842 | 842 | return $this->{$section}->{$name}; |
843 | 843 | } |
844 | 844 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
845 | - $config_obj = $this->set_config( $section, $name, $config_class ); |
|
845 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
846 | 846 | // verify the newly created config object |
847 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) { |
|
847 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
848 | 848 | return $this->{$section}->{$name}; |
849 | 849 | } else { |
850 | 850 | EE_Error::add_error( |
851 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
851 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
852 | 852 | __FILE__, |
853 | 853 | __FUNCTION__, |
854 | 854 | __LINE__ |
@@ -866,11 +866,11 @@ discard block |
||
866 | 866 | * @param string $config_option_name |
867 | 867 | * @return mixed EE_Config_Base | FALSE |
868 | 868 | */ |
869 | - public function get_config_option( $config_option_name = '' ) { |
|
869 | + public function get_config_option($config_option_name = '') { |
|
870 | 870 | // retrieve the wp-option for this config class. |
871 | - $config_option = maybe_unserialize( get_option( $config_option_name, array() ) ); |
|
872 | - if ( empty( $config_option ) ) { |
|
873 | - EE_Config::log( $config_option_name . '-NOT-FOUND' ); |
|
871 | + $config_option = maybe_unserialize(get_option($config_option_name, array())); |
|
872 | + if (empty($config_option)) { |
|
873 | + EE_Config::log($config_option_name.'-NOT-FOUND'); |
|
874 | 874 | } |
875 | 875 | return $config_option; |
876 | 876 | } |
@@ -882,17 +882,17 @@ discard block |
||
882 | 882 | * |
883 | 883 | * @param string $config_option_name |
884 | 884 | */ |
885 | - public static function log( $config_option_name = '' ) { |
|
886 | - if ( EE_Config::logging_enabled() && ! empty( $config_option_name ) ) { |
|
887 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
885 | + public static function log($config_option_name = '') { |
|
886 | + if (EE_Config::logging_enabled() && ! empty($config_option_name)) { |
|
887 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
888 | 888 | //copy incoming $_REQUEST and sanitize it so we can save it |
889 | 889 | $_request = $_REQUEST; |
890 | - array_walk_recursive( $_request, 'sanitize_text_field' ); |
|
891 | - $config_log[ (string) microtime( true ) ] = array( |
|
890 | + array_walk_recursive($_request, 'sanitize_text_field'); |
|
891 | + $config_log[(string) microtime(true)] = array( |
|
892 | 892 | 'config_name' => $config_option_name, |
893 | 893 | 'request' => $_request, |
894 | 894 | ); |
895 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
895 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
896 | 896 | } |
897 | 897 | } |
898 | 898 | |
@@ -903,15 +903,15 @@ discard block |
||
903 | 903 | * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
904 | 904 | */ |
905 | 905 | public static function trim_log() { |
906 | - if ( ! EE_Config::logging_enabled() ) { |
|
906 | + if ( ! EE_Config::logging_enabled()) { |
|
907 | 907 | return; |
908 | 908 | } |
909 | - $config_log = maybe_unserialize( get_option( EE_Config::LOG_NAME, array() ) ); |
|
910 | - $log_length = count( $config_log ); |
|
911 | - if ( $log_length > EE_Config::LOG_LENGTH ) { |
|
912 | - ksort( $config_log ); |
|
913 | - $config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true ); |
|
914 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
909 | + $config_log = maybe_unserialize(get_option(EE_Config::LOG_NAME, array())); |
|
910 | + $log_length = count($config_log); |
|
911 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
912 | + ksort($config_log); |
|
913 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
914 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
915 | 915 | } |
916 | 916 | } |
917 | 917 | |
@@ -926,14 +926,14 @@ discard block |
||
926 | 926 | * @return string |
927 | 927 | */ |
928 | 928 | public static function get_page_for_posts() { |
929 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
930 | - if ( ! $page_for_posts ) { |
|
929 | + $page_for_posts = get_option('page_for_posts'); |
|
930 | + if ( ! $page_for_posts) { |
|
931 | 931 | return 'posts'; |
932 | 932 | } |
933 | 933 | /** @type WPDB $wpdb */ |
934 | 934 | global $wpdb; |
935 | 935 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
936 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) ); |
|
936 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | |
@@ -989,17 +989,17 @@ discard block |
||
989 | 989 | ) |
990 | 990 | ) { |
991 | 991 | // grab list of installed widgets |
992 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
992 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
993 | 993 | // filter list of modules to register |
994 | 994 | $widgets_to_register = apply_filters( |
995 | 995 | 'FHEE__EE_Config__register_widgets__widgets_to_register', |
996 | 996 | $widgets_to_register |
997 | 997 | ); |
998 | - if ( ! empty( $widgets_to_register ) ) { |
|
998 | + if ( ! empty($widgets_to_register)) { |
|
999 | 999 | // cycle thru widget folders |
1000 | - foreach ( $widgets_to_register as $widget_path ) { |
|
1000 | + foreach ($widgets_to_register as $widget_path) { |
|
1001 | 1001 | // add to list of installed widget modules |
1002 | - EE_Config::register_ee_widget( $widget_path ); |
|
1002 | + EE_Config::register_ee_widget($widget_path); |
|
1003 | 1003 | } |
1004 | 1004 | } |
1005 | 1005 | // filter list of installed modules |
@@ -1019,57 +1019,57 @@ discard block |
||
1019 | 1019 | * @param string $widget_path - full path up to and including widget folder |
1020 | 1020 | * @return void |
1021 | 1021 | */ |
1022 | - public static function register_ee_widget( $widget_path = null ) { |
|
1023 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
1022 | + public static function register_ee_widget($widget_path = null) { |
|
1023 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
1024 | 1024 | $widget_ext = '.widget.php'; |
1025 | 1025 | // make all separators match |
1026 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
1026 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
1027 | 1027 | // does the file path INCLUDE the actual file name as part of the path ? |
1028 | - if ( strpos( $widget_path, $widget_ext ) !== false ) { |
|
1028 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
1029 | 1029 | // grab and shortcode file name from directory name and break apart at dots |
1030 | - $file_name = explode( '.', basename( $widget_path ) ); |
|
1030 | + $file_name = explode('.', basename($widget_path)); |
|
1031 | 1031 | // take first segment from file name pieces and remove class prefix if it exists |
1032 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
1032 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
1033 | 1033 | // sanitize shortcode directory name |
1034 | - $widget = sanitize_key( $widget ); |
|
1034 | + $widget = sanitize_key($widget); |
|
1035 | 1035 | // now we need to rebuild the shortcode path |
1036 | - $widget_path = explode( DS, $widget_path ); |
|
1036 | + $widget_path = explode(DS, $widget_path); |
|
1037 | 1037 | // remove last segment |
1038 | - array_pop( $widget_path ); |
|
1038 | + array_pop($widget_path); |
|
1039 | 1039 | // glue it back together |
1040 | - $widget_path = implode( DS, $widget_path ); |
|
1040 | + $widget_path = implode(DS, $widget_path); |
|
1041 | 1041 | } else { |
1042 | 1042 | // grab and sanitize widget directory name |
1043 | - $widget = sanitize_key( basename( $widget_path ) ); |
|
1043 | + $widget = sanitize_key(basename($widget_path)); |
|
1044 | 1044 | } |
1045 | 1045 | // create classname from widget directory name |
1046 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) ); |
|
1046 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1047 | 1047 | // add class prefix |
1048 | - $widget_class = 'EEW_' . $widget; |
|
1048 | + $widget_class = 'EEW_'.$widget; |
|
1049 | 1049 | // does the widget exist ? |
1050 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) { |
|
1050 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
1051 | 1051 | $msg = sprintf( |
1052 | 1052 | __( |
1053 | 1053 | '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', |
1054 | 1054 | 'event_espresso' |
1055 | 1055 | ), |
1056 | 1056 | $widget_class, |
1057 | - $widget_path . DS . $widget_class . $widget_ext |
|
1057 | + $widget_path.DS.$widget_class.$widget_ext |
|
1058 | 1058 | ); |
1059 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1059 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1060 | 1060 | return; |
1061 | 1061 | } |
1062 | 1062 | // load the widget class file |
1063 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
1063 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
1064 | 1064 | // verify that class exists |
1065 | - if ( ! class_exists( $widget_class ) ) { |
|
1066 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
1067 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1065 | + if ( ! class_exists($widget_class)) { |
|
1066 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1067 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1068 | 1068 | return; |
1069 | 1069 | } |
1070 | - register_widget( $widget_class ); |
|
1070 | + register_widget($widget_class); |
|
1071 | 1071 | // add to array of registered widgets |
1072 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
1072 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | |
@@ -1082,17 +1082,17 @@ discard block |
||
1082 | 1082 | */ |
1083 | 1083 | private function _register_shortcodes() { |
1084 | 1084 | // grab list of installed shortcodes |
1085 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1085 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1086 | 1086 | // filter list of modules to register |
1087 | 1087 | $shortcodes_to_register = apply_filters( |
1088 | 1088 | 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
1089 | 1089 | $shortcodes_to_register |
1090 | 1090 | ); |
1091 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1091 | + if ( ! empty($shortcodes_to_register)) { |
|
1092 | 1092 | // cycle thru shortcode folders |
1093 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1093 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1094 | 1094 | // add to list of installed shortcode modules |
1095 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1095 | + EE_Config::register_shortcode($shortcode_path); |
|
1096 | 1096 | } |
1097 | 1097 | } |
1098 | 1098 | // filter list of installed modules |
@@ -1111,64 +1111,64 @@ discard block |
||
1111 | 1111 | * @param string $shortcode_path - full path up to and including shortcode folder |
1112 | 1112 | * @return bool |
1113 | 1113 | */ |
1114 | - public static function register_shortcode( $shortcode_path = null ) { |
|
1115 | - do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path ); |
|
1114 | + public static function register_shortcode($shortcode_path = null) { |
|
1115 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1116 | 1116 | $shortcode_ext = '.shortcode.php'; |
1117 | 1117 | // make all separators match |
1118 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1118 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1119 | 1119 | // does the file path INCLUDE the actual file name as part of the path ? |
1120 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) { |
|
1120 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
1121 | 1121 | // grab shortcode file name from directory name and break apart at dots |
1122 | - $shortcode_file = explode( '.', basename( $shortcode_path ) ); |
|
1122 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1123 | 1123 | // take first segment from file name pieces and remove class prefix if it exists |
1124 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 |
|
1125 | - ? substr( $shortcode_file[0], 4 ) |
|
1124 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
1125 | + ? substr($shortcode_file[0], 4) |
|
1126 | 1126 | : $shortcode_file[0]; |
1127 | 1127 | // sanitize shortcode directory name |
1128 | - $shortcode = sanitize_key( $shortcode ); |
|
1128 | + $shortcode = sanitize_key($shortcode); |
|
1129 | 1129 | // now we need to rebuild the shortcode path |
1130 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1130 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1131 | 1131 | // remove last segment |
1132 | - array_pop( $shortcode_path ); |
|
1132 | + array_pop($shortcode_path); |
|
1133 | 1133 | // glue it back together |
1134 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1134 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1135 | 1135 | } else { |
1136 | 1136 | // we need to generate the filename based off of the folder name |
1137 | 1137 | // grab and sanitize shortcode directory name |
1138 | - $shortcode = sanitize_key( basename( $shortcode_path ) ); |
|
1139 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1138 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1139 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1140 | 1140 | } |
1141 | 1141 | // create classname from shortcode directory or file name |
1142 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) ); |
|
1142 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1143 | 1143 | // add class prefix |
1144 | - $shortcode_class = 'EES_' . $shortcode; |
|
1144 | + $shortcode_class = 'EES_'.$shortcode; |
|
1145 | 1145 | // does the shortcode exist ? |
1146 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) { |
|
1146 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1147 | 1147 | $msg = sprintf( |
1148 | 1148 | __( |
1149 | 1149 | 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', |
1150 | 1150 | 'event_espresso' |
1151 | 1151 | ), |
1152 | 1152 | $shortcode_class, |
1153 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1153 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1154 | 1154 | ); |
1155 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1155 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1156 | 1156 | return false; |
1157 | 1157 | } |
1158 | 1158 | // load the shortcode class file |
1159 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1159 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1160 | 1160 | // verify that class exists |
1161 | - if ( ! class_exists( $shortcode_class ) ) { |
|
1161 | + if ( ! class_exists($shortcode_class)) { |
|
1162 | 1162 | $msg = sprintf( |
1163 | - __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), |
|
1163 | + __('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
1164 | 1164 | $shortcode_class |
1165 | 1165 | ); |
1166 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1166 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1167 | 1167 | return false; |
1168 | 1168 | } |
1169 | - $shortcode = strtoupper( $shortcode ); |
|
1169 | + $shortcode = strtoupper($shortcode); |
|
1170 | 1170 | // add to array of registered shortcodes |
1171 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1171 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1172 | 1172 | return true; |
1173 | 1173 | } |
1174 | 1174 | |
@@ -1182,22 +1182,22 @@ discard block |
||
1182 | 1182 | */ |
1183 | 1183 | private function _register_modules() { |
1184 | 1184 | // grab list of installed modules |
1185 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1185 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1186 | 1186 | // filter list of modules to register |
1187 | 1187 | $modules_to_register = apply_filters( |
1188 | 1188 | 'FHEE__EE_Config__register_modules__modules_to_register', |
1189 | 1189 | $modules_to_register |
1190 | 1190 | ); |
1191 | - if ( ! empty( $modules_to_register ) ) { |
|
1191 | + if ( ! empty($modules_to_register)) { |
|
1192 | 1192 | // loop through folders |
1193 | - foreach ( $modules_to_register as $module_path ) { |
|
1193 | + foreach ($modules_to_register as $module_path) { |
|
1194 | 1194 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1195 | 1195 | if ( |
1196 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1197 | - && $module_path !== EE_MODULES . 'gateways' |
|
1196 | + $module_path !== EE_MODULES.'zzz-copy-this-module-template' |
|
1197 | + && $module_path !== EE_MODULES.'gateways' |
|
1198 | 1198 | ) { |
1199 | 1199 | // add to list of installed modules |
1200 | - EE_Config::register_module( $module_path ); |
|
1200 | + EE_Config::register_module($module_path); |
|
1201 | 1201 | } |
1202 | 1202 | } |
1203 | 1203 | } |
@@ -1217,39 +1217,39 @@ discard block |
||
1217 | 1217 | * @param string $module_path - full path up to and including module folder |
1218 | 1218 | * @return bool |
1219 | 1219 | */ |
1220 | - public static function register_module( $module_path = null ) { |
|
1221 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1220 | + public static function register_module($module_path = null) { |
|
1221 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1222 | 1222 | $module_ext = '.module.php'; |
1223 | 1223 | // make all separators match |
1224 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1224 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1225 | 1225 | // does the file path INCLUDE the actual file name as part of the path ? |
1226 | - if ( strpos( $module_path, $module_ext ) !== false ) { |
|
1226 | + if (strpos($module_path, $module_ext) !== false) { |
|
1227 | 1227 | // grab and shortcode file name from directory name and break apart at dots |
1228 | - $module_file = explode( '.', basename( $module_path ) ); |
|
1228 | + $module_file = explode('.', basename($module_path)); |
|
1229 | 1229 | // now we need to rebuild the shortcode path |
1230 | - $module_path = explode( DS, $module_path ); |
|
1230 | + $module_path = explode(DS, $module_path); |
|
1231 | 1231 | // remove last segment |
1232 | - array_pop( $module_path ); |
|
1232 | + array_pop($module_path); |
|
1233 | 1233 | // glue it back together |
1234 | - $module_path = implode( DS, $module_path ) . DS; |
|
1234 | + $module_path = implode(DS, $module_path).DS; |
|
1235 | 1235 | // take first segment from file name pieces and sanitize it |
1236 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1236 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1237 | 1237 | // ensure class prefix is added |
1238 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1238 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1239 | 1239 | } else { |
1240 | 1240 | // we need to generate the filename based off of the folder name |
1241 | 1241 | // grab and sanitize module name |
1242 | - $module = strtolower( basename( $module_path ) ); |
|
1243 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module ); |
|
1242 | + $module = strtolower(basename($module_path)); |
|
1243 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1244 | 1244 | // like trailingslashit() |
1245 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1245 | + $module_path = rtrim($module_path, DS).DS; |
|
1246 | 1246 | // create classname from module directory name |
1247 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) ); |
|
1247 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1248 | 1248 | // add class prefix |
1249 | - $module_class = 'EED_' . $module; |
|
1249 | + $module_class = 'EED_'.$module; |
|
1250 | 1250 | } |
1251 | 1251 | // does the module exist ? |
1252 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) { |
|
1252 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1253 | 1253 | $msg = sprintf( |
1254 | 1254 | __( |
1255 | 1255 | 'The requested %s module file could not be found or is not readable due to file permissions.', |
@@ -1257,19 +1257,19 @@ discard block |
||
1257 | 1257 | ), |
1258 | 1258 | $module |
1259 | 1259 | ); |
1260 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1260 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1261 | 1261 | return false; |
1262 | 1262 | } |
1263 | 1263 | // load the module class file |
1264 | - require_once( $module_path . $module_class . $module_ext ); |
|
1264 | + require_once($module_path.$module_class.$module_ext); |
|
1265 | 1265 | // verify that class exists |
1266 | - if ( ! class_exists( $module_class ) ) { |
|
1267 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1268 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1266 | + if ( ! class_exists($module_class)) { |
|
1267 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1268 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1269 | 1269 | return false; |
1270 | 1270 | } |
1271 | 1271 | // add to array of registered modules |
1272 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1272 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1273 | 1273 | do_action( |
1274 | 1274 | 'AHEE__EE_Config__register_module__complete', |
1275 | 1275 | $module_class, |
@@ -1289,26 +1289,26 @@ discard block |
||
1289 | 1289 | */ |
1290 | 1290 | private function _initialize_shortcodes() { |
1291 | 1291 | // cycle thru shortcode folders |
1292 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1292 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1293 | 1293 | // add class prefix |
1294 | - $shortcode_class = 'EES_' . $shortcode; |
|
1294 | + $shortcode_class = 'EES_'.$shortcode; |
|
1295 | 1295 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1296 | 1296 | // which set hooks ? |
1297 | - if ( is_admin() ) { |
|
1297 | + if (is_admin()) { |
|
1298 | 1298 | // fire immediately |
1299 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' ) ); |
|
1299 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1300 | 1300 | } else { |
1301 | 1301 | // delay until other systems are online |
1302 | 1302 | add_action( |
1303 | 1303 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1304 | - array( $shortcode_class, 'set_hooks' ) |
|
1304 | + array($shortcode_class, 'set_hooks') |
|
1305 | 1305 | ); |
1306 | 1306 | // convert classname to UPPERCASE and create WP shortcode. |
1307 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1307 | + $shortcode_tag = strtoupper($shortcode); |
|
1308 | 1308 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1309 | - if ( ! shortcode_exists( $shortcode_tag ) ) { |
|
1309 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1310 | 1310 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1311 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) ); |
|
1311 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1312 | 1312 | } |
1313 | 1313 | } |
1314 | 1314 | } |
@@ -1325,17 +1325,17 @@ discard block |
||
1325 | 1325 | */ |
1326 | 1326 | private function _initialize_modules() { |
1327 | 1327 | // cycle thru shortcode folders |
1328 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1328 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1329 | 1329 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1330 | 1330 | // which set hooks ? |
1331 | - if ( is_admin() ) { |
|
1331 | + if (is_admin()) { |
|
1332 | 1332 | // fire immediately |
1333 | - call_user_func( array( $module_class, 'set_hooks_admin' ) ); |
|
1333 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1334 | 1334 | } else { |
1335 | 1335 | // delay until other systems are online |
1336 | 1336 | add_action( |
1337 | 1337 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1338 | - array( $module_class, 'set_hooks' ) |
|
1338 | + array($module_class, 'set_hooks') |
|
1339 | 1339 | ); |
1340 | 1340 | } |
1341 | 1341 | } |
@@ -1353,29 +1353,29 @@ discard block |
||
1353 | 1353 | * @param string $key - url param key indicating a route is being called |
1354 | 1354 | * @return bool |
1355 | 1355 | */ |
1356 | - public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) { |
|
1357 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1358 | - $module = str_replace( 'EED_', '', $module ); |
|
1359 | - $module_class = 'EED_' . $module; |
|
1360 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) { |
|
1361 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1362 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1356 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') { |
|
1357 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1358 | + $module = str_replace('EED_', '', $module); |
|
1359 | + $module_class = 'EED_'.$module; |
|
1360 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1361 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1362 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1363 | 1363 | return false; |
1364 | 1364 | } |
1365 | - if ( empty( $route ) ) { |
|
1366 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1367 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1365 | + if (empty($route)) { |
|
1366 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1367 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1368 | 1368 | return false; |
1369 | 1369 | } |
1370 | - if ( ! method_exists( 'EED_' . $module, $method_name ) ) { |
|
1370 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1371 | 1371 | $msg = sprintf( |
1372 | - __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), |
|
1372 | + __('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1373 | 1373 | $route |
1374 | 1374 | ); |
1375 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1375 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1376 | 1376 | return false; |
1377 | 1377 | } |
1378 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1378 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1379 | 1379 | return true; |
1380 | 1380 | } |
1381 | 1381 | |
@@ -1389,11 +1389,11 @@ discard block |
||
1389 | 1389 | * @param string $key - url param key indicating a route is being called |
1390 | 1390 | * @return string |
1391 | 1391 | */ |
1392 | - public static function get_route( $route = null, $key = 'ee' ) { |
|
1393 | - do_action( 'AHEE__EE_Config__get_route__begin', $route ); |
|
1394 | - $route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route ); |
|
1395 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) { |
|
1396 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1392 | + public static function get_route($route = null, $key = 'ee') { |
|
1393 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1394 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1395 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1396 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1397 | 1397 | } |
1398 | 1398 | return null; |
1399 | 1399 | } |
@@ -1423,49 +1423,49 @@ discard block |
||
1423 | 1423 | * @param string $key - url param key indicating a route is being called |
1424 | 1424 | * @return bool |
1425 | 1425 | */ |
1426 | - public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) { |
|
1427 | - do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward ); |
|
1428 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1426 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') { |
|
1427 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1428 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1429 | 1429 | $msg = sprintf( |
1430 | - __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), |
|
1430 | + __('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1431 | 1431 | $route |
1432 | 1432 | ); |
1433 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1433 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1434 | 1434 | return false; |
1435 | 1435 | } |
1436 | - if ( empty( $forward ) ) { |
|
1437 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1438 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1436 | + if (empty($forward)) { |
|
1437 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1438 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1439 | 1439 | return false; |
1440 | 1440 | } |
1441 | - if ( is_array( $forward ) ) { |
|
1442 | - if ( ! isset( $forward[1] ) ) { |
|
1441 | + if (is_array($forward)) { |
|
1442 | + if ( ! isset($forward[1])) { |
|
1443 | 1443 | $msg = sprintf( |
1444 | - __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), |
|
1444 | + __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1445 | 1445 | $route |
1446 | 1446 | ); |
1447 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1447 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1448 | 1448 | return false; |
1449 | 1449 | } |
1450 | - if ( ! method_exists( $forward[0], $forward[1] ) ) { |
|
1450 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1451 | 1451 | $msg = sprintf( |
1452 | - __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1452 | + __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1453 | 1453 | $forward[1], |
1454 | 1454 | $route |
1455 | 1455 | ); |
1456 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1456 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1457 | 1457 | return false; |
1458 | 1458 | } |
1459 | - } else if ( ! function_exists( $forward ) ) { |
|
1459 | + } else if ( ! function_exists($forward)) { |
|
1460 | 1460 | $msg = sprintf( |
1461 | - __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1461 | + __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1462 | 1462 | $forward, |
1463 | 1463 | $route |
1464 | 1464 | ); |
1465 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1465 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1466 | 1466 | return false; |
1467 | 1467 | } |
1468 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1468 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1469 | 1469 | return true; |
1470 | 1470 | } |
1471 | 1471 | |
@@ -1481,12 +1481,12 @@ discard block |
||
1481 | 1481 | * @param string $key - url param key indicating a route is being called |
1482 | 1482 | * @return string |
1483 | 1483 | */ |
1484 | - public static function get_forward( $route = null, $status = 0, $key = 'ee' ) { |
|
1485 | - do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status ); |
|
1486 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) { |
|
1484 | + public static function get_forward($route = null, $status = 0, $key = 'ee') { |
|
1485 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1486 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1487 | 1487 | return apply_filters( |
1488 | 1488 | 'FHEE__EE_Config__get_forward', |
1489 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1489 | + EE_Config::$_module_forward_map[$key][$route][$status], |
|
1490 | 1490 | $route, |
1491 | 1491 | $status |
1492 | 1492 | ); |
@@ -1508,17 +1508,17 @@ discard block |
||
1508 | 1508 | * @param string $key - url param key indicating a route is being called |
1509 | 1509 | * @return bool |
1510 | 1510 | */ |
1511 | - public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) { |
|
1512 | - do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view ); |
|
1513 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1511 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') { |
|
1512 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1513 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1514 | 1514 | $msg = sprintf( |
1515 | - __( 'The module route %s for this view has not been registered.', 'event_espresso' ), |
|
1515 | + __('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1516 | 1516 | $route |
1517 | 1517 | ); |
1518 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1518 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1519 | 1519 | return false; |
1520 | 1520 | } |
1521 | - if ( ! is_readable( $view ) ) { |
|
1521 | + if ( ! is_readable($view)) { |
|
1522 | 1522 | $msg = sprintf( |
1523 | 1523 | __( |
1524 | 1524 | 'The %s view file could not be found or is not readable due to file permissions.', |
@@ -1526,10 +1526,10 @@ discard block |
||
1526 | 1526 | ), |
1527 | 1527 | $view |
1528 | 1528 | ); |
1529 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1529 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1530 | 1530 | return false; |
1531 | 1531 | } |
1532 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1532 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1533 | 1533 | return true; |
1534 | 1534 | } |
1535 | 1535 | |
@@ -1545,12 +1545,12 @@ discard block |
||
1545 | 1545 | * @param string $key - url param key indicating a route is being called |
1546 | 1546 | * @return string |
1547 | 1547 | */ |
1548 | - public static function get_view( $route = null, $status = 0, $key = 'ee' ) { |
|
1549 | - do_action( 'AHEE__EE_Config__get_view__begin', $route, $status ); |
|
1550 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) { |
|
1548 | + public static function get_view($route = null, $status = 0, $key = 'ee') { |
|
1549 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1550 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1551 | 1551 | return apply_filters( |
1552 | 1552 | 'FHEE__EE_Config__get_view', |
1553 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1553 | + EE_Config::$_module_view_map[$key][$route][$status], |
|
1554 | 1554 | $route, |
1555 | 1555 | $status |
1556 | 1556 | ); |
@@ -1561,7 +1561,7 @@ discard block |
||
1561 | 1561 | |
1562 | 1562 | |
1563 | 1563 | public function update_addon_option_names() { |
1564 | - update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names ); |
|
1564 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1565 | 1565 | } |
1566 | 1566 | |
1567 | 1567 | |
@@ -1589,22 +1589,22 @@ discard block |
||
1589 | 1589 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1590 | 1590 | * @throws \EE_Error |
1591 | 1591 | */ |
1592 | - public function get_pretty( $property ) { |
|
1593 | - if ( ! property_exists( $this, $property ) ) { |
|
1592 | + public function get_pretty($property) { |
|
1593 | + if ( ! property_exists($this, $property)) { |
|
1594 | 1594 | throw new EE_Error( |
1595 | 1595 | sprintf( |
1596 | 1596 | __( |
1597 | 1597 | '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
1598 | 1598 | 'event_espresso' |
1599 | 1599 | ), |
1600 | - get_class( $this ), |
|
1600 | + get_class($this), |
|
1601 | 1601 | $property |
1602 | 1602 | ) |
1603 | 1603 | ); |
1604 | 1604 | } |
1605 | 1605 | //just handling escaping of strings for now. |
1606 | - if ( is_string( $this->{$property} ) ) { |
|
1607 | - return stripslashes( $this->{$property} ); |
|
1606 | + if (is_string($this->{$property} )) { |
|
1607 | + return stripslashes($this->{$property} ); |
|
1608 | 1608 | } |
1609 | 1609 | return $this->{$property}; |
1610 | 1610 | } |
@@ -1613,17 +1613,17 @@ discard block |
||
1613 | 1613 | |
1614 | 1614 | public function populate() { |
1615 | 1615 | //grab defaults via a new instance of this class. |
1616 | - $class_name = get_class( $this ); |
|
1616 | + $class_name = get_class($this); |
|
1617 | 1617 | $defaults = new $class_name; |
1618 | 1618 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1619 | 1619 | //default from our $defaults object. |
1620 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1621 | - if ( $this->{$property} === null ) { |
|
1620 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1621 | + if ($this->{$property} === null) { |
|
1622 | 1622 | $this->{$property} = $value; |
1623 | 1623 | } |
1624 | 1624 | } |
1625 | 1625 | //cleanup |
1626 | - unset( $defaults ); |
|
1626 | + unset($defaults); |
|
1627 | 1627 | } |
1628 | 1628 | |
1629 | 1629 | |
@@ -1639,7 +1639,7 @@ discard block |
||
1639 | 1639 | * @param $a |
1640 | 1640 | * @return bool |
1641 | 1641 | */ |
1642 | - public function __isset( $a ) { |
|
1642 | + public function __isset($a) { |
|
1643 | 1643 | return false; |
1644 | 1644 | } |
1645 | 1645 | |
@@ -1651,7 +1651,7 @@ discard block |
||
1651 | 1651 | * @param $a |
1652 | 1652 | * @return bool |
1653 | 1653 | */ |
1654 | - public function __unset( $a ) { |
|
1654 | + public function __unset($a) { |
|
1655 | 1655 | return false; |
1656 | 1656 | } |
1657 | 1657 | |
@@ -1761,7 +1761,7 @@ discard block |
||
1761 | 1761 | $this->current_blog_id = get_current_blog_id(); |
1762 | 1762 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1763 | 1763 | $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin(); |
1764 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true; |
|
1764 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1765 | 1765 | $this->post_shortcodes = array(); |
1766 | 1766 | $this->module_route_map = array(); |
1767 | 1767 | $this->module_forward_map = array(); |
@@ -1777,9 +1777,9 @@ discard block |
||
1777 | 1777 | $this->thank_you_page_url = ''; |
1778 | 1778 | $this->cancel_page_url = ''; |
1779 | 1779 | //cpt slugs |
1780 | - $this->event_cpt_slug = __( 'events', 'event_espresso' ); |
|
1780 | + $this->event_cpt_slug = __('events', 'event_espresso'); |
|
1781 | 1781 | //ueip constant check |
1782 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1782 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1783 | 1783 | $this->ee_ueip_optin = false; |
1784 | 1784 | $this->ee_ueip_has_notified = true; |
1785 | 1785 | } |
@@ -1822,11 +1822,11 @@ discard block |
||
1822 | 1822 | * @return string |
1823 | 1823 | */ |
1824 | 1824 | public function reg_page_url() { |
1825 | - if ( ! $this->reg_page_url ) { |
|
1825 | + if ( ! $this->reg_page_url) { |
|
1826 | 1826 | $this->reg_page_url = add_query_arg( |
1827 | - array( 'uts' => time() ), |
|
1828 | - get_permalink( $this->reg_page_id ) |
|
1829 | - ) . '#checkout'; |
|
1827 | + array('uts' => time()), |
|
1828 | + get_permalink($this->reg_page_id) |
|
1829 | + ).'#checkout'; |
|
1830 | 1830 | } |
1831 | 1831 | return $this->reg_page_url; |
1832 | 1832 | } |
@@ -1841,12 +1841,12 @@ discard block |
||
1841 | 1841 | * @access public |
1842 | 1842 | * @return string |
1843 | 1843 | */ |
1844 | - public function txn_page_url( $query_args = array() ) { |
|
1845 | - if ( ! $this->txn_page_url ) { |
|
1846 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1844 | + public function txn_page_url($query_args = array()) { |
|
1845 | + if ( ! $this->txn_page_url) { |
|
1846 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1847 | 1847 | } |
1848 | - if ( $query_args ) { |
|
1849 | - return add_query_arg( $query_args, $this->txn_page_url ); |
|
1848 | + if ($query_args) { |
|
1849 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1850 | 1850 | } else { |
1851 | 1851 | return $this->txn_page_url; |
1852 | 1852 | } |
@@ -1862,12 +1862,12 @@ discard block |
||
1862 | 1862 | * @access public |
1863 | 1863 | * @return string |
1864 | 1864 | */ |
1865 | - public function thank_you_page_url( $query_args = array() ) { |
|
1866 | - if ( ! $this->thank_you_page_url ) { |
|
1867 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1865 | + public function thank_you_page_url($query_args = array()) { |
|
1866 | + if ( ! $this->thank_you_page_url) { |
|
1867 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1868 | 1868 | } |
1869 | - if ( $query_args ) { |
|
1870 | - return add_query_arg( $query_args, $this->thank_you_page_url ); |
|
1869 | + if ($query_args) { |
|
1870 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1871 | 1871 | } else { |
1872 | 1872 | return $this->thank_you_page_url; |
1873 | 1873 | } |
@@ -1882,8 +1882,8 @@ discard block |
||
1882 | 1882 | * @return string |
1883 | 1883 | */ |
1884 | 1884 | public function cancel_page_url() { |
1885 | - if ( ! $this->cancel_page_url ) { |
|
1886 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1885 | + if ( ! $this->cancel_page_url) { |
|
1886 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1887 | 1887 | } |
1888 | 1888 | return $this->cancel_page_url; |
1889 | 1889 | } |
@@ -1912,22 +1912,22 @@ discard block |
||
1912 | 1912 | */ |
1913 | 1913 | protected function _get_main_ee_ueip_optin() { |
1914 | 1914 | //if this is the main site then we can just bypass our direct query. |
1915 | - if ( is_main_site() ) { |
|
1916 | - return get_option( 'ee_ueip_optin', false ); |
|
1915 | + if (is_main_site()) { |
|
1916 | + return get_option('ee_ueip_optin', false); |
|
1917 | 1917 | } |
1918 | 1918 | |
1919 | 1919 | //is this already cached for this request? If so use it. |
1920 | - if ( ! empty( EE_Core_Config::$ee_ueip_option ) ) { |
|
1920 | + if ( ! empty(EE_Core_Config::$ee_ueip_option)) { |
|
1921 | 1921 | return EE_Core_Config::$ee_ueip_option; |
1922 | 1922 | } |
1923 | 1923 | |
1924 | 1924 | global $wpdb; |
1925 | 1925 | $current_network_main_site = is_multisite() ? get_current_site() : null; |
1926 | - $current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1926 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1927 | 1927 | $option = 'ee_ueip_optin'; |
1928 | 1928 | |
1929 | 1929 | //set correct table for query |
1930 | - $table_name = $wpdb->get_blog_prefix( $current_main_site_id ) . 'options'; |
|
1930 | + $table_name = $wpdb->get_blog_prefix($current_main_site_id).'options'; |
|
1931 | 1931 | |
1932 | 1932 | |
1933 | 1933 | //rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because |
@@ -1935,20 +1935,20 @@ discard block |
||
1935 | 1935 | //re-constructed on the blog switch. Note, we are still executing any core wp filters on this option retrieval. |
1936 | 1936 | //this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog |
1937 | 1937 | //for the purpose of caching. |
1938 | - $pre = apply_filters( 'pre_option_' . $option, false, $option ); |
|
1939 | - if ( false !== $pre ) { |
|
1938 | + $pre = apply_filters('pre_option_'.$option, false, $option); |
|
1939 | + if (false !== $pre) { |
|
1940 | 1940 | EE_Core_Config::$ee_ueip_option = $pre; |
1941 | 1941 | return EE_Core_Config::$ee_ueip_option; |
1942 | 1942 | } |
1943 | 1943 | |
1944 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option ) ); |
|
1945 | - if ( is_object( $row ) ) { |
|
1944 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option)); |
|
1945 | + if (is_object($row)) { |
|
1946 | 1946 | $value = $row->option_value; |
1947 | 1947 | } else { //option does not exist so use default. |
1948 | - return apply_filters( 'default_option_' . $option, false, $option ); |
|
1948 | + return apply_filters('default_option_'.$option, false, $option); |
|
1949 | 1949 | } |
1950 | 1950 | |
1951 | - EE_Core_Config::$ee_ueip_option = apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option ); |
|
1951 | + EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option); |
|
1952 | 1952 | return EE_Core_Config::$ee_ueip_option; |
1953 | 1953 | } |
1954 | 1954 | |
@@ -1964,7 +1964,7 @@ discard block |
||
1964 | 1964 | //reset all url properties |
1965 | 1965 | $this->_reset_urls(); |
1966 | 1966 | //return what to save to db |
1967 | - return array_keys( get_object_vars( $this ) ); |
|
1967 | + return array_keys(get_object_vars($this)); |
|
1968 | 1968 | } |
1969 | 1969 | |
1970 | 1970 | } |
@@ -2111,14 +2111,14 @@ discard block |
||
2111 | 2111 | */ |
2112 | 2112 | public function __construct() { |
2113 | 2113 | // set default organization settings |
2114 | - $this->name = get_bloginfo( 'name' ); |
|
2114 | + $this->name = get_bloginfo('name'); |
|
2115 | 2115 | $this->address_1 = '123 Onna Road'; |
2116 | 2116 | $this->address_2 = 'PO Box 123'; |
2117 | 2117 | $this->city = 'Inna City'; |
2118 | 2118 | $this->STA_ID = 4; |
2119 | 2119 | $this->CNT_ISO = 'US'; |
2120 | 2120 | $this->zip = '12345'; |
2121 | - $this->email = get_bloginfo( 'admin_email' ); |
|
2121 | + $this->email = get_bloginfo('admin_email'); |
|
2122 | 2122 | $this->phone = ''; |
2123 | 2123 | $this->vat = '123456789'; |
2124 | 2124 | $this->logo_url = ''; |
@@ -2206,46 +2206,46 @@ discard block |
||
2206 | 2206 | * @param string $CNT_ISO |
2207 | 2207 | * @throws \EE_Error |
2208 | 2208 | */ |
2209 | - public function __construct( $CNT_ISO = '' ) { |
|
2209 | + public function __construct($CNT_ISO = '') { |
|
2210 | 2210 | /** @var \EventEspresso\core\services\database\TableAnalysis $table_analysis */ |
2211 | - $table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
|
2211 | + $table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true); |
|
2212 | 2212 | // get country code from organization settings or use default |
2213 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
|
2213 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2214 | 2214 | && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
2215 | 2215 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2216 | 2216 | : ''; |
2217 | 2217 | // but override if requested |
2218 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
2218 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2219 | 2219 | // 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 |
2220 | 2220 | if ( |
2221 | - ! empty( $CNT_ISO ) |
|
2221 | + ! empty($CNT_ISO) |
|
2222 | 2222 | && EE_Maintenance_Mode::instance()->models_can_query() |
2223 | - && $table_analysis->tableExists( EE_Registry::instance()->load_model( 'Country' )->table() ) |
|
2223 | + && $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table()) |
|
2224 | 2224 | ) { |
2225 | 2225 | // retrieve the country settings from the db, just in case they have been customized |
2226 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
2227 | - if ( $country instanceof EE_Country ) { |
|
2228 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2229 | - $this->name = $country->currency_name_single(); // Dollar |
|
2230 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
2231 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
2232 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2233 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2234 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2235 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2226 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2227 | + if ($country instanceof EE_Country) { |
|
2228 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2229 | + $this->name = $country->currency_name_single(); // Dollar |
|
2230 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
2231 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
2232 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2233 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2234 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2235 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2236 | 2236 | } |
2237 | 2237 | } |
2238 | 2238 | // fallback to hardcoded defaults, in case the above failed |
2239 | - if ( empty( $this->code ) ) { |
|
2239 | + if (empty($this->code)) { |
|
2240 | 2240 | // set default currency settings |
2241 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2242 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
2243 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
2244 | - $this->sign = '$'; // currency sign: $ |
|
2245 | - $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2246 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2247 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2248 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2241 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2242 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
2243 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
2244 | + $this->sign = '$'; // currency sign: $ |
|
2245 | + $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2246 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2247 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2248 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2249 | 2249 | } |
2250 | 2250 | } |
2251 | 2251 | } |
@@ -2414,7 +2414,7 @@ discard block |
||
2414 | 2414 | * @since 4.8.8.rc.019 |
2415 | 2415 | */ |
2416 | 2416 | public function do_hooks() { |
2417 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) ); |
|
2417 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2418 | 2418 | } |
2419 | 2419 | |
2420 | 2420 | |
@@ -2423,7 +2423,7 @@ discard block |
||
2423 | 2423 | * @return void |
2424 | 2424 | */ |
2425 | 2425 | public function set_default_reg_status_on_EEM_Event() { |
2426 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2426 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2427 | 2427 | } |
2428 | 2428 | |
2429 | 2429 | |
@@ -2440,7 +2440,7 @@ discard block |
||
2440 | 2440 | /** |
2441 | 2441 | * @param boolean $track_invalid_checkout_access |
2442 | 2442 | */ |
2443 | - public function set_track_invalid_checkout_access( $track_invalid_checkout_access ) { |
|
2443 | + public function set_track_invalid_checkout_access($track_invalid_checkout_access) { |
|
2444 | 2444 | $this->track_invalid_checkout_access = filter_var( |
2445 | 2445 | $track_invalid_checkout_access, |
2446 | 2446 | FILTER_VALIDATE_BOOLEAN |
@@ -2558,10 +2558,10 @@ discard block |
||
2558 | 2558 | * @param bool $reset |
2559 | 2559 | * @return string |
2560 | 2560 | */ |
2561 | - public function log_file_name( $reset = false ) { |
|
2562 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2563 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2564 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2561 | + public function log_file_name($reset = false) { |
|
2562 | + if (empty($this->log_file_name) || $reset) { |
|
2563 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt'; |
|
2564 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2565 | 2565 | } |
2566 | 2566 | return $this->log_file_name; |
2567 | 2567 | } |
@@ -2572,10 +2572,10 @@ discard block |
||
2572 | 2572 | * @param bool $reset |
2573 | 2573 | * @return string |
2574 | 2574 | */ |
2575 | - public function debug_file_name( $reset = false ) { |
|
2576 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2577 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2578 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2575 | + public function debug_file_name($reset = false) { |
|
2576 | + if (empty($this->debug_file_name) || $reset) { |
|
2577 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt'; |
|
2578 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2579 | 2579 | } |
2580 | 2580 | return $this->debug_file_name; |
2581 | 2581 | } |
@@ -2586,7 +2586,7 @@ discard block |
||
2586 | 2586 | * @return string |
2587 | 2587 | */ |
2588 | 2588 | public function affiliate_id() { |
2589 | - return ! empty( $this->affiliate_id ) ? $this->affiliate_id : 'default'; |
|
2589 | + return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default'; |
|
2590 | 2590 | } |
2591 | 2591 | |
2592 | 2592 | |
@@ -2595,7 +2595,7 @@ discard block |
||
2595 | 2595 | * @return boolean |
2596 | 2596 | */ |
2597 | 2597 | public function encode_session_data() { |
2598 | - return filter_var( $this->encode_session_data, FILTER_VALIDATE_BOOLEAN ); |
|
2598 | + return filter_var($this->encode_session_data, FILTER_VALIDATE_BOOLEAN); |
|
2599 | 2599 | } |
2600 | 2600 | |
2601 | 2601 | |
@@ -2603,8 +2603,8 @@ discard block |
||
2603 | 2603 | /** |
2604 | 2604 | * @param boolean $encode_session_data |
2605 | 2605 | */ |
2606 | - public function set_encode_session_data( $encode_session_data ) { |
|
2607 | - $this->encode_session_data = filter_var( $encode_session_data, FILTER_VALIDATE_BOOLEAN ); |
|
2606 | + public function set_encode_session_data($encode_session_data) { |
|
2607 | + $this->encode_session_data = filter_var($encode_session_data, FILTER_VALIDATE_BOOLEAN); |
|
2608 | 2608 | } |
2609 | 2609 | |
2610 | 2610 | |
@@ -2784,21 +2784,21 @@ discard block |
||
2784 | 2784 | $this->use_google_maps = true; |
2785 | 2785 | $this->google_map_api_key = ''; |
2786 | 2786 | // for event details pages (reg page) |
2787 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2788 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2789 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2790 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2791 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2792 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2793 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2787 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2788 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2789 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2790 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2791 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2792 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2793 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2794 | 2794 | // for event list pages |
2795 | - $this->event_list_map_width = 300; // ee_map_width |
|
2796 | - $this->event_list_map_height = 185; // ee_map_height |
|
2797 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2798 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2799 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2800 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2801 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2795 | + $this->event_list_map_width = 300; // ee_map_width |
|
2796 | + $this->event_list_map_height = 185; // ee_map_height |
|
2797 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2798 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2799 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2800 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2801 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2802 | 2802 | } |
2803 | 2803 | |
2804 | 2804 | } |
@@ -2960,7 +2960,7 @@ discard block |
||
2960 | 2960 | * @return void |
2961 | 2961 | */ |
2962 | 2962 | protected function _set_php_values() { |
2963 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2963 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2964 | 2964 | $this->php->version = phpversion(); |
2965 | 2965 | } |
2966 | 2966 | |
@@ -2979,10 +2979,10 @@ discard block |
||
2979 | 2979 | * @type string $msg Any message to be displayed. |
2980 | 2980 | * } |
2981 | 2981 | */ |
2982 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2983 | - if ( ! empty( $this->php->max_input_vars ) |
|
2984 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2985 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2982 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2983 | + if ( ! empty($this->php->max_input_vars) |
|
2984 | + && ($input_count >= $this->php->max_input_vars) |
|
2985 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
2986 | 2986 | ) { |
2987 | 2987 | return sprintf( |
2988 | 2988 | __( |
@@ -3078,7 +3078,7 @@ discard block |
||
3078 | 3078 | */ |
3079 | 3079 | public function __construct() { |
3080 | 3080 | $this->payment_settings = array(); |
3081 | - $this->active_gateways = array( 'Invoice' => false ); |
|
3081 | + $this->active_gateways = array('Invoice' => false); |
|
3082 | 3082 | } |
3083 | 3083 | } |
3084 | 3084 |