@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | -if ( ! function_exists( 'espresso_get_template_part' )) { |
|
18 | +if ( ! function_exists('espresso_get_template_part')) { |
|
19 | 19 | /** |
20 | 20 | * espresso_get_template_part |
21 | 21 | * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @param string $name The name of the specialised template. |
26 | 26 | * @return string the html output for the formatted money value |
27 | 27 | */ |
28 | - function espresso_get_template_part( $slug = NULL, $name = NULL ) { |
|
29 | - EEH_Template::get_template_part( $slug, $name ); |
|
28 | + function espresso_get_template_part($slug = NULL, $name = NULL) { |
|
29 | + EEH_Template::get_template_part($slug, $name); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | -if ( ! function_exists( 'espresso_get_object_css_class' )) { |
|
35 | +if ( ! function_exists('espresso_get_object_css_class')) { |
|
36 | 36 | /** |
37 | 37 | * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed |
38 | 38 | * |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $suffix added to the end of the generated class |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
46 | - return EEH_Template::get_object_css_class( $object, $prefix, $suffix ); |
|
45 | + function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
46 | + return EEH_Template::get_object_css_class($object, $prefix, $suffix); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return boolean |
71 | 71 | */ |
72 | 72 | public static function is_espresso_theme() { |
73 | - return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE; |
|
73 | + return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | public static function load_espresso_theme_functions() { |
82 | - if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) { |
|
83 | - if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) { |
|
84 | - require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' ); |
|
82 | + if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) { |
|
83 | + if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) { |
|
84 | + require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | * @return array |
94 | 94 | */ |
95 | 95 | public static function get_espresso_themes() { |
96 | - if ( empty( EEH_Template::$_espresso_themes )) { |
|
97 | - $espresso_themes = glob( EE_PUBLIC . '*', GLOB_ONLYDIR ); |
|
98 | - if ( empty( $espresso_themes ) ) { |
|
96 | + if (empty(EEH_Template::$_espresso_themes)) { |
|
97 | + $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR); |
|
98 | + if (empty($espresso_themes)) { |
|
99 | 99 | return array(); |
100 | 100 | } |
101 | - if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
|
102 | - unset( $espresso_themes[ $key ] ); |
|
101 | + if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) { |
|
102 | + unset($espresso_themes[$key]); |
|
103 | 103 | } |
104 | 104 | EEH_Template::$_espresso_themes = array(); |
105 | - foreach ( $espresso_themes as $espresso_theme ) { |
|
106 | - EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme; |
|
105 | + foreach ($espresso_themes as $espresso_theme) { |
|
106 | + EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | return EEH_Template::$_espresso_themes; |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @param bool $return_string |
123 | 123 | * @return string the html output for the formatted money value |
124 | 124 | */ |
125 | - public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE ) { |
|
126 | - do_action( "get_template_part_{$slug}-{$name}", $slug, $name ); |
|
125 | + public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) { |
|
126 | + do_action("get_template_part_{$slug}-{$name}", $slug, $name); |
|
127 | 127 | $templates = array(); |
128 | 128 | $name = (string) $name; |
129 | - if ( $name != '' ) { |
|
129 | + if ($name != '') { |
|
130 | 130 | $templates[] = "{$slug}-{$name}.php"; |
131 | 131 | } |
132 | 132 | // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' ); |
133 | - if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) { |
|
134 | - EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string ); |
|
133 | + if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) { |
|
134 | + EEH_Template::locate_template($templates, $template_args, TRUE, $return_string); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -182,26 +182,26 @@ discard block |
||
182 | 182 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
183 | 183 | * @return mixed |
184 | 184 | */ |
185 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
185 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
186 | 186 | // first use WP locate_template to check for template in the current theme folder |
187 | - $template_path = locate_template( $templates ); |
|
187 | + $template_path = locate_template($templates); |
|
188 | 188 | |
189 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
189 | + if ($check_if_custom && ! empty($template_path)) |
|
190 | 190 | return TRUE; |
191 | 191 | |
192 | 192 | // not in the theme |
193 | - if ( empty( $template_path )) { |
|
193 | + if (empty($template_path)) { |
|
194 | 194 | // not even a template to look for ? |
195 | - if ( empty( $templates )) { |
|
195 | + if (empty($templates)) { |
|
196 | 196 | // get post_type |
197 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
197 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
198 | 198 | // get array of EE Custom Post Types |
199 | 199 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
200 | 200 | // build template name based on request |
201 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
202 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
201 | + if (isset($EE_CPTs[$post_type])) { |
|
202 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | // currently active EE template theme |
@@ -210,81 +210,81 @@ discard block |
||
210 | 210 | // array of paths to folders that may contain templates |
211 | 211 | $template_folder_paths = array( |
212 | 212 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
213 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
213 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
214 | 214 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
215 | 215 | EVENT_ESPRESSO_TEMPLATE_DIR |
216 | 216 | ); |
217 | 217 | |
218 | 218 | //add core plugin folders for checking only if we're not $check_if_custom |
219 | - if ( ! $check_if_custom ) { |
|
219 | + if ( ! $check_if_custom) { |
|
220 | 220 | $core_paths = array( |
221 | 221 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
222 | - EE_PUBLIC . $current_theme, |
|
222 | + EE_PUBLIC.$current_theme, |
|
223 | 223 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
224 | - EE_TEMPLATES . $current_theme, |
|
224 | + EE_TEMPLATES.$current_theme, |
|
225 | 225 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
226 | 226 | EE_PLUGIN_DIR_PATH |
227 | 227 | ); |
228 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
228 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // now filter that array |
232 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
233 | - $templates = is_array( $templates ) ? $templates : array( $templates ); |
|
234 | - $template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths ); |
|
232 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
233 | + $templates = is_array($templates) ? $templates : array($templates); |
|
234 | + $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths); |
|
235 | 235 | // array to hold all possible template paths |
236 | 236 | $full_template_paths = array(); |
237 | 237 | |
238 | 238 | // loop through $templates |
239 | - foreach ( $templates as $template ) { |
|
239 | + foreach ($templates as $template) { |
|
240 | 240 | // normalize directory separators |
241 | - $template = EEH_File::standardise_directory_separators( $template ); |
|
242 | - $file_name = basename( $template ); |
|
243 | - $template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) ); |
|
241 | + $template = EEH_File::standardise_directory_separators($template); |
|
242 | + $file_name = basename($template); |
|
243 | + $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1)); |
|
244 | 244 | // while looping through all template folder paths |
245 | - foreach ( $template_folder_paths as $template_folder_path ) { |
|
245 | + foreach ($template_folder_paths as $template_folder_path) { |
|
246 | 246 | // normalize directory separators |
247 | - $template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path ); |
|
247 | + $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path); |
|
248 | 248 | // determine if any common base path exists between the two paths |
249 | 249 | $common_base_path = EEH_Template::_find_common_base_path( |
250 | - array( $template_folder_path, $template_path_minus_file_name ) |
|
250 | + array($template_folder_path, $template_path_minus_file_name) |
|
251 | 251 | ); |
252 | - if ( $common_base_path !== '' ) { |
|
252 | + if ($common_base_path !== '') { |
|
253 | 253 | // both paths have a common base, so just tack the filename onto our search path |
254 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name; |
|
254 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name; |
|
255 | 255 | } else { |
256 | 256 | // no common base path, so let's just concatenate |
257 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template; |
|
257 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template; |
|
258 | 258 | } |
259 | 259 | // build up our template locations array by adding our resolved paths |
260 | 260 | $full_template_paths[] = $resolved_path; |
261 | 261 | } |
262 | 262 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
263 | - array_unshift( $full_template_paths, $template ); |
|
263 | + array_unshift($full_template_paths, $template); |
|
264 | 264 | // path to the directory of the current theme: /wp-content/themes/(current WP theme)/ |
265 | - array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name ); |
|
265 | + array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name); |
|
266 | 266 | } |
267 | 267 | // filter final array of full template paths |
268 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name ); |
|
268 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name); |
|
269 | 269 | // now loop through our final array of template location paths and check each location |
270 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
271 | - if ( is_readable( $full_template_path )) { |
|
272 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
270 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
271 | + if (is_readable($full_template_path)) { |
|
272 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
273 | 273 | // hook that can be used to display the full template path that will be used |
274 | - do_action( 'AHEE__EEH_Template__locate_template__full_template_path', $template_path ); |
|
274 | + do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path); |
|
275 | 275 | break; |
276 | 276 | } |
277 | 277 | } |
278 | 278 | } |
279 | 279 | // if we got it and you want to see it... |
280 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
281 | - if ( $return_string ) { |
|
282 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
280 | + if ($template_path && $load && ! $check_if_custom) { |
|
281 | + if ($return_string) { |
|
282 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
283 | 283 | } else { |
284 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
284 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
285 | 285 | } |
286 | 286 | } |
287 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
287 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
@@ -297,21 +297,21 @@ discard block |
||
297 | 297 | * @param array $paths |
298 | 298 | * @return string |
299 | 299 | */ |
300 | - protected static function _find_common_base_path( $paths ) { |
|
300 | + protected static function _find_common_base_path($paths) { |
|
301 | 301 | $last_offset = 0; |
302 | 302 | $common_base_path = ''; |
303 | - while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) { |
|
303 | + while (($index = strpos($paths[0], DS, $last_offset)) !== false) { |
|
304 | 304 | $dir_length = $index - $last_offset + 1; |
305 | - $directory = substr( $paths[ 0 ], $last_offset, $dir_length ); |
|
306 | - foreach ( $paths as $path ) { |
|
307 | - if ( substr( $path, $last_offset, $dir_length ) != $directory ) { |
|
305 | + $directory = substr($paths[0], $last_offset, $dir_length); |
|
306 | + foreach ($paths as $path) { |
|
307 | + if (substr($path, $last_offset, $dir_length) != $directory) { |
|
308 | 308 | return $common_base_path; |
309 | 309 | } |
310 | 310 | } |
311 | 311 | $common_base_path .= $directory; |
312 | 312 | $last_offset = $index + 1; |
313 | 313 | } |
314 | - return substr( $common_base_path, 0, -1 ); |
|
314 | + return substr($common_base_path, 0, -1); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
324 | 324 | * @return mixed string |
325 | 325 | */ |
326 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
326 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
327 | 327 | |
328 | 328 | /** |
329 | 329 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -334,26 +334,26 @@ discard block |
||
334 | 334 | * |
335 | 335 | * @since 4.6.0 |
336 | 336 | */ |
337 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
338 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
337 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
338 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
339 | 339 | |
340 | 340 | // you gimme nuttin - YOU GET NUTTIN !! |
341 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
341 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
342 | 342 | return ''; |
343 | 343 | } |
344 | 344 | // if $template_args are not in an array, then make it so |
345 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
346 | - $template_args = array( $template_args ); |
|
345 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
346 | + $template_args = array($template_args); |
|
347 | 347 | } |
348 | - extract( (array) $template_args); |
|
348 | + extract((array) $template_args); |
|
349 | 349 | |
350 | - if ( $return_string ) { |
|
350 | + if ($return_string) { |
|
351 | 351 | // because we want to return a string, we are going to capture the output |
352 | 352 | ob_start(); |
353 | - include( $template_path ); |
|
353 | + include($template_path); |
|
354 | 354 | return ob_get_clean(); |
355 | 355 | } else { |
356 | - include( $template_path ); |
|
356 | + include($template_path); |
|
357 | 357 | } |
358 | 358 | return ''; |
359 | 359 | } |
@@ -371,27 +371,27 @@ discard block |
||
371 | 371 | * @param string $suffix added to the end of the generated class |
372 | 372 | * @return string |
373 | 373 | */ |
374 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
374 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
375 | 375 | // in the beginning... |
376 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
376 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
377 | 377 | // da muddle |
378 | 378 | $class = ''; |
379 | 379 | // the end |
380 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
380 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
381 | 381 | // is the passed object an EE object ? |
382 | - if ( $object instanceof EE_Base_Class ) { |
|
382 | + if ($object instanceof EE_Base_Class) { |
|
383 | 383 | // grab the exact type of object |
384 | - $obj_class = get_class( $object ); |
|
384 | + $obj_class = get_class($object); |
|
385 | 385 | // depending on the type of object... |
386 | - switch ( $obj_class ) { |
|
386 | + switch ($obj_class) { |
|
387 | 387 | // no specifics just yet... |
388 | 388 | default : |
389 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
390 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
389 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
390 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
391 | 391 | |
392 | 392 | } |
393 | 393 | } |
394 | - return $prefix . $class . $suffix; |
|
394 | + return $prefix.$class.$suffix; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | |
@@ -407,54 +407,54 @@ discard block |
||
407 | 407 | * @param string $cur_code_span_class |
408 | 408 | * @return string the html output for the formatted money value |
409 | 409 | */ |
410 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
410 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
411 | 411 | // ensure amount was received |
412 | - if ( is_null( $amount ) ) { |
|
413 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
414 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
412 | + if (is_null($amount)) { |
|
413 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
414 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
415 | 415 | return ''; |
416 | 416 | } |
417 | 417 | //ensure amount is float |
418 | - $amount = apply_filters( 'FHEE__EEH_Template__format_currency__raw_amount', (float) $amount ); |
|
419 | - $CNT_ISO = apply_filters( 'FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount ); |
|
418 | + $amount = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount); |
|
419 | + $CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount); |
|
420 | 420 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
421 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
421 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
422 | 422 | // still a number or was amount converted to a string like "free" ? |
423 | - if ( is_float( $amount_formatted )) { |
|
423 | + if (is_float($amount_formatted)) { |
|
424 | 424 | // was a country ISO code passed ? if so generate currency config object for that country |
425 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
425 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
426 | 426 | // verify results |
427 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
427 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
428 | 428 | // set default config country currency settings |
429 | 429 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
430 | 430 | } |
431 | 431 | // format float |
432 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
432 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
433 | 433 | // add formatting ? |
434 | - if ( ! $return_raw ) { |
|
434 | + if ( ! $return_raw) { |
|
435 | 435 | // add currency sign |
436 | - if( $mny->sign_b4 ){ |
|
437 | - if( $amount >= 0 ){ |
|
438 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
439 | - }else{ |
|
440 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
436 | + if ($mny->sign_b4) { |
|
437 | + if ($amount >= 0) { |
|
438 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
439 | + } else { |
|
440 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
441 | 441 | } |
442 | 442 | |
443 | - }else{ |
|
444 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
443 | + } else { |
|
444 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | // filter to allow global setting of display_code |
448 | - $display_code = apply_filters( 'FHEE__EEH_Template__format_currency__display_code', $display_code ); |
|
448 | + $display_code = apply_filters('FHEE__EEH_Template__format_currency__display_code', $display_code); |
|
449 | 449 | |
450 | 450 | // add currency code ? |
451 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
451 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
452 | 452 | } |
453 | 453 | // filter results |
454 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
454 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
455 | 455 | } |
456 | 456 | // clean up vars |
457 | - unset( $mny ); |
|
457 | + unset($mny); |
|
458 | 458 | // return formatted currency amount |
459 | 459 | return $amount_formatted; |
460 | 460 | } |
@@ -469,11 +469,11 @@ discard block |
||
469 | 469 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
470 | 470 | * @return string The localized label for the status id. |
471 | 471 | */ |
472 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
472 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
473 | 473 | /** @type EEM_Status $EEM_Status */ |
474 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
475 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
476 | - return $status[ $status_id ]; |
|
474 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
475 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
476 | + return $status[$status_id]; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | |
@@ -488,21 +488,21 @@ discard block |
||
488 | 488 | * @param string $title |
489 | 489 | * @return string the html output for the button |
490 | 490 | */ |
491 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '', $title = '' ) { |
|
491 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '', $title = '') { |
|
492 | 492 | $icon_html = ''; |
493 | - if ( ! empty( $icon ) ) { |
|
494 | - $dashicons = preg_split( "(ee-icon |dashicons )", $icon ); |
|
495 | - $dashicons = array_filter( $dashicons ); |
|
496 | - $count = count( $dashicons ); |
|
493 | + if ( ! empty($icon)) { |
|
494 | + $dashicons = preg_split("(ee-icon |dashicons )", $icon); |
|
495 | + $dashicons = array_filter($dashicons); |
|
496 | + $count = count($dashicons); |
|
497 | 497 | $icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : ''; |
498 | - foreach ( $dashicons as $dashicon ) { |
|
499 | - $type = strpos( $dashicon, 'ee-icon' ) !== false ? 'ee-icon ' : 'dashicons '; |
|
500 | - $icon_html .= '<span class="' . $type . $dashicon . '"></span>'; |
|
498 | + foreach ($dashicons as $dashicon) { |
|
499 | + $type = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons '; |
|
500 | + $icon_html .= '<span class="'.$type.$dashicon.'"></span>'; |
|
501 | 501 | } |
502 | 502 | $icon_html .= $count > 1 ? '</span>' : ''; |
503 | 503 | } |
504 | - $label = ! empty( $icon ) ? $icon_html . $label : $label; |
|
505 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '" title="' . $title . '">' . $label . '</a>'; |
|
504 | + $label = ! empty($icon) ? $icon_html.$label : $label; |
|
505 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'" title="'.$title.'">'.$label.'</a>'; |
|
506 | 506 | return $button; |
507 | 507 | } |
508 | 508 | |
@@ -519,21 +519,21 @@ discard block |
||
519 | 519 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
520 | 520 | * @return string generated link |
521 | 521 | */ |
522 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
522 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
523 | 523 | |
524 | - if ( ! $page ) |
|
525 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
524 | + if ( ! $page) |
|
525 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
526 | 526 | |
527 | - if ( ! $action ) |
|
528 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
527 | + if ( ! $action) |
|
528 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
529 | 529 | |
530 | 530 | $action = empty($action) ? 'default' : $action; |
531 | 531 | |
532 | 532 | |
533 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
534 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
535 | - $help_text = !$help_text ? '' : $help_text; |
|
536 | - return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>'; |
|
533 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
534 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
535 | + $help_text = ! $help_text ? '' : $help_text; |
|
536 | + return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>'; |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | |
@@ -545,31 +545,31 @@ discard block |
||
545 | 545 | * @param EE_Help_Tour |
546 | 546 | * @return string html |
547 | 547 | */ |
548 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
548 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
549 | 549 | $id = $tour->get_slug(); |
550 | 550 | $stops = $tour->get_stops(); |
551 | 551 | |
552 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
552 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
553 | 553 | |
554 | - foreach ( $stops as $stop ) { |
|
555 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
556 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
554 | + foreach ($stops as $stop) { |
|
555 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
556 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
557 | 557 | |
558 | 558 | //if container is set to modal then let's make sure we set the options accordingly |
559 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
559 | + if (empty($data_id) && empty($data_class)) { |
|
560 | 560 | $stop['options']['modal'] = true; |
561 | 561 | $stop['options']['expose'] = true; |
562 | 562 | } |
563 | 563 | |
564 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
565 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
564 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
565 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
566 | 566 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
567 | 567 | |
568 | 568 | //options |
569 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
569 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
570 | 570 | $options = ' data-options="'; |
571 | - foreach ( $stop['options'] as $option => $value ) { |
|
572 | - $options .= $option . ':' . $value . ';'; |
|
571 | + foreach ($stop['options'] as $option => $value) { |
|
572 | + $options .= $option.':'.$value.';'; |
|
573 | 573 | } |
574 | 574 | $options .= '"'; |
575 | 575 | } else { |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | } |
578 | 578 | |
579 | 579 | //let's put all together |
580 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
580 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | $content .= '</ol>'; |
@@ -598,31 +598,31 @@ discard block |
||
598 | 598 | * @throws EE_Error |
599 | 599 | * @return string html structure for status. |
600 | 600 | */ |
601 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
602 | - if ( !is_array( $status_array ) ) |
|
603 | - throw new EE_Error( esc_html__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
601 | + public static function status_legend($status_array, $active_status = '') { |
|
602 | + if ( ! is_array($status_array)) |
|
603 | + throw new EE_Error(esc_html__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
604 | 604 | |
605 | 605 | $setup_array = array(); |
606 | - foreach ( $status_array as $item => $status ) { |
|
606 | + foreach ($status_array as $item => $status) { |
|
607 | 607 | $setup_array[$item] = array( |
608 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
609 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
608 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
609 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
610 | 610 | 'status' => $status |
611 | 611 | ); |
612 | 612 | } |
613 | 613 | |
614 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
615 | - $content .= '<h4 class="status-legend-title">' . esc_html__('Status Legend', 'event_espresso') . '</h4>' . "\n"; |
|
616 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
617 | - foreach ( $setup_array as $item => $details ) { |
|
614 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
615 | + $content .= '<h4 class="status-legend-title">'.esc_html__('Status Legend', 'event_espresso').'</h4>'."\n"; |
|
616 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
617 | + foreach ($setup_array as $item => $details) { |
|
618 | 618 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
619 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
620 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
621 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
622 | - $content .= '</dt>' . "\n"; |
|
619 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
620 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
621 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
622 | + $content .= '</dt>'."\n"; |
|
623 | 623 | } |
624 | - $content .= '</dl>' . "\n"; |
|
625 | - $content .= '</div>' . "\n"; |
|
624 | + $content .= '</dl>'."\n"; |
|
625 | + $content .= '</div>'."\n"; |
|
626 | 626 | return $content; |
627 | 627 | } |
628 | 628 | |
@@ -635,8 +635,8 @@ discard block |
||
635 | 635 | * @return string |
636 | 636 | */ |
637 | 637 | public static function layout_array_as_table($data) { |
638 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
639 | - $data = (array)$data; |
|
638 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
639 | + $data = (array) $data; |
|
640 | 640 | } |
641 | 641 | ob_start(); |
642 | 642 | if (is_array($data)) { |
@@ -649,10 +649,10 @@ discard block |
||
649 | 649 | ?> |
650 | 650 | <tr> |
651 | 651 | <td> |
652 | - <?php echo $data_key;?> |
|
652 | + <?php echo $data_key; ?> |
|
653 | 653 | </td> |
654 | 654 | <td> |
655 | - <?php echo self::layout_array_as_table($data_values);?> |
|
655 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
656 | 656 | </td> |
657 | 657 | </tr> |
658 | 658 | <?php |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | <ul> |
667 | 667 | <?php |
668 | 668 | foreach ($data as $datum) { |
669 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
669 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
670 | 670 | }?> |
671 | 671 | </ul> |
672 | 672 | <?php |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | } |
675 | 675 | else { |
676 | 676 | //simple value |
677 | - echo esc_html( $data ); |
|
677 | + echo esc_html($data); |
|
678 | 678 | } |
679 | 679 | return ob_get_clean(); |
680 | 680 | } |
@@ -696,8 +696,8 @@ discard block |
||
696 | 696 | * |
697 | 697 | * @return string |
698 | 698 | */ |
699 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
700 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
699 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
700 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
701 | 701 | } |
702 | 702 | |
703 | 703 | |
@@ -721,13 +721,13 @@ discard block |
||
721 | 721 | * ) |
722 | 722 | * @return string |
723 | 723 | */ |
724 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
724 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
725 | 725 | $page_links = array(); |
726 | 726 | $disable_first = $disable_last = ''; |
727 | 727 | $total_items = (int) $total_items; |
728 | 728 | $per_page = (int) $per_page; |
729 | 729 | $current = (int) $current; |
730 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
730 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
731 | 731 | |
732 | 732 | //filter items_label |
733 | 733 | $items_label = apply_filters( |
@@ -735,68 +735,68 @@ discard block |
||
735 | 735 | $items_label |
736 | 736 | ); |
737 | 737 | |
738 | - if ( empty( $items_label ) |
|
739 | - || ! is_array( $items_label ) |
|
740 | - || ! isset( $items_label['single'] ) |
|
741 | - || ! isset( $items_label['plural'] ) ) { |
|
738 | + if (empty($items_label) |
|
739 | + || ! is_array($items_label) |
|
740 | + || ! isset($items_label['single']) |
|
741 | + || ! isset($items_label['plural'])) { |
|
742 | 742 | $items_label = array( |
743 | - 'single' => __( '1 item', 'event_espresso' ), |
|
744 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
743 | + 'single' => __('1 item', 'event_espresso'), |
|
744 | + 'plural' => __('%s items', 'event_espresso') |
|
745 | 745 | ); |
746 | 746 | } else { |
747 | 747 | $items_label = array( |
748 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
749 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
748 | + 'single' => '1 '.esc_html($items_label['single']), |
|
749 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
750 | 750 | ); |
751 | 751 | } |
752 | 752 | |
753 | - $total_pages = ceil( $total_items / $per_page ); |
|
753 | + $total_pages = ceil($total_items / $per_page); |
|
754 | 754 | |
755 | - if ( $total_pages <= 1 ) |
|
755 | + if ($total_pages <= 1) |
|
756 | 756 | return ''; |
757 | 757 | |
758 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
758 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
759 | 759 | |
760 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
760 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
761 | 761 | |
762 | - if ( $current === 1 ) { |
|
762 | + if ($current === 1) { |
|
763 | 763 | $disable_first = ' disabled'; |
764 | 764 | } |
765 | - if ( $current == $total_pages ) { |
|
765 | + if ($current == $total_pages) { |
|
766 | 766 | $disable_last = ' disabled'; |
767 | 767 | } |
768 | 768 | |
769 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
770 | - 'first-page' . $disable_first, |
|
771 | - esc_attr__( 'Go to the first page' ), |
|
772 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
769 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
770 | + 'first-page'.$disable_first, |
|
771 | + esc_attr__('Go to the first page'), |
|
772 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
773 | 773 | '«' |
774 | 774 | ); |
775 | 775 | |
776 | 776 | $page_links[] = sprintf( |
777 | 777 | '<a class="%s" title="%s" href="%s">%s</a>', |
778 | - 'prev-page' . $disable_first, |
|
779 | - esc_attr__( 'Go to the previous page' ), |
|
780 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
778 | + 'prev-page'.$disable_first, |
|
779 | + esc_attr__('Go to the previous page'), |
|
780 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
781 | 781 | '‹' |
782 | 782 | ); |
783 | 783 | |
784 | - if ( ! $show_num_field ) { |
|
784 | + if ( ! $show_num_field) { |
|
785 | 785 | $html_current_page = $current; |
786 | 786 | } else { |
787 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
788 | - esc_attr__( 'Current page' ), |
|
787 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
788 | + esc_attr__('Current page'), |
|
789 | 789 | $current, |
790 | - strlen( $total_pages ) |
|
790 | + strlen($total_pages) |
|
791 | 791 | ); |
792 | 792 | } |
793 | 793 | |
794 | 794 | $html_total_pages = sprintf( |
795 | 795 | '<span class="total-pages">%s</span>', |
796 | - number_format_i18n( $total_pages ) |
|
796 | + number_format_i18n($total_pages) |
|
797 | 797 | ); |
798 | 798 | $page_links[] = sprintf( |
799 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
799 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
800 | 800 | $html_current_page, |
801 | 801 | $html_total_pages, |
802 | 802 | '<span class="paging-input">', |
@@ -805,29 +805,29 @@ discard block |
||
805 | 805 | |
806 | 806 | $page_links[] = sprintf( |
807 | 807 | '<a class="%s" title="%s" href="%s">%s</a>', |
808 | - 'next-page' . $disable_last, |
|
809 | - esc_attr__( 'Go to the next page' ), |
|
810 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
808 | + 'next-page'.$disable_last, |
|
809 | + esc_attr__('Go to the next page'), |
|
810 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
811 | 811 | '›' |
812 | 812 | ); |
813 | 813 | |
814 | 814 | $page_links[] = sprintf( |
815 | 815 | '<a class="%s" title="%s" href="%s">%s</a>', |
816 | - 'last-page' . $disable_last, |
|
817 | - esc_attr__( 'Go to the last page' ), |
|
818 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
816 | + 'last-page'.$disable_last, |
|
817 | + esc_attr__('Go to the last page'), |
|
818 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
819 | 819 | '»' |
820 | 820 | ); |
821 | 821 | |
822 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
822 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
823 | 823 | // set page class |
824 | - if ( $total_pages ) { |
|
824 | + if ($total_pages) { |
|
825 | 825 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
826 | 826 | } else { |
827 | 827 | $page_class = ' no-pages'; |
828 | 828 | } |
829 | 829 | |
830 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
830 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
831 | 831 | } |
832 | 832 | |
833 | 833 | |
@@ -837,8 +837,8 @@ discard block |
||
837 | 837 | * @param string $wrap_id |
838 | 838 | * @return string |
839 | 839 | */ |
840 | - public static function powered_by_event_espresso( $wrap_class = '', $wrap_id = '', array $query_args = array() ) { |
|
841 | - $admin = is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
840 | + public static function powered_by_event_espresso($wrap_class = '', $wrap_id = '', array $query_args = array()) { |
|
841 | + $admin = is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX); |
|
842 | 842 | if ( |
843 | 843 | ! $admin && |
844 | 844 | ! apply_filters( |
@@ -849,9 +849,9 @@ discard block |
||
849 | 849 | return ''; |
850 | 850 | } |
851 | 851 | $tag = $admin ? 'span' : 'div'; |
852 | - $attributes = ! empty( $wrap_id ) ? " id=\"{$wrap_id}\"" : ''; |
|
852 | + $attributes = ! empty($wrap_id) ? " id=\"{$wrap_id}\"" : ''; |
|
853 | 853 | $wrap_class = $admin ? "{$wrap_class} float-left" : $wrap_class; |
854 | - $attributes .= ! empty( $wrap_class ) |
|
854 | + $attributes .= ! empty($wrap_class) |
|
855 | 855 | ? " class=\"{$wrap_class} powered-by-event-espresso-credit\"" |
856 | 856 | : ' class="powered-by-event-espresso-credit"'; |
857 | 857 | $query_args = array_merge( |
@@ -863,9 +863,9 @@ discard block |
||
863 | 863 | ), |
864 | 864 | $query_args |
865 | 865 | ); |
866 | - $powered_by = apply_filters( 'FHEE__EEH_Template__powered_by_event_espresso_text', $admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso' ); |
|
867 | - $url = add_query_arg( $query_args, 'https://eventespresso.com/' ); |
|
868 | - $url = apply_filters( 'FHEE__EEH_Template__powered_by_event_espresso__url', $url ); |
|
866 | + $powered_by = apply_filters('FHEE__EEH_Template__powered_by_event_espresso_text', $admin ? 'Event Espresso - '.EVENT_ESPRESSO_VERSION : 'Event Espresso'); |
|
867 | + $url = add_query_arg($query_args, 'https://eventespresso.com/'); |
|
868 | + $url = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url); |
|
869 | 869 | return (string) apply_filters( |
870 | 870 | 'FHEE__EEH_Template__powered_by_event_espresso__html', |
871 | 871 | sprintf( |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 ); |
898 | 898 | |
899 | 899 | |
900 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
900 | +if ( ! function_exists('espresso_pagination')) { |
|
901 | 901 | /** |
902 | 902 | * espresso_pagination |
903 | 903 | * |
@@ -909,21 +909,21 @@ discard block |
||
909 | 909 | $big = 999999999; // need an unlikely integer |
910 | 910 | $pagination = paginate_links( |
911 | 911 | array( |
912 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
912 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
913 | 913 | 'format' => '?paged=%#%', |
914 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
914 | + 'current' => max(1, get_query_var('paged')), |
|
915 | 915 | 'total' => $wp_query->max_num_pages, |
916 | 916 | 'show_all' => true, |
917 | 917 | 'end_size' => 10, |
918 | 918 | 'mid_size' => 6, |
919 | 919 | 'prev_next' => true, |
920 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
921 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
920 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
921 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
922 | 922 | 'type' => 'plain', |
923 | 923 | 'add_args' => false, |
924 | 924 | 'add_fragment' => '' |
925 | 925 | ) |
926 | 926 | ); |
927 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
927 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
928 | 928 | } |
929 | 929 | } |
930 | 930 | \ No newline at end of file |
@@ -146,7 +146,7 @@ |
||
146 | 146 | } |
147 | 147 | } |
148 | 148 | global $wpdb; |
149 | - $wpdb->query('DROP TABLE ' . implode(', ', $tables_to_delete)); |
|
149 | + $wpdb->query('DROP TABLE '.implode(', ', $tables_to_delete)); |
|
150 | 150 | return $tables_to_delete; |
151 | 151 | } |
152 | 152 |
@@ -17,211 +17,211 @@ |
||
17 | 17 | class TableManager extends \EE_Base |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @var TableAnalysis $table_analysis |
|
22 | - */ |
|
23 | - private $table_analysis; |
|
24 | - |
|
25 | - |
|
26 | - |
|
27 | - /** |
|
28 | - * TableManager constructor. |
|
29 | - * |
|
30 | - * @param TableAnalysis $TableAnalysis |
|
31 | - */ |
|
32 | - public function __construct(TableAnalysis $TableAnalysis) |
|
33 | - { |
|
34 | - $this->table_analysis = $TableAnalysis; |
|
35 | - } |
|
36 | - |
|
37 | - |
|
38 | - |
|
39 | - /** |
|
40 | - * Gets the injected table analyzer, or throws an exception |
|
41 | - * |
|
42 | - * @return TableAnalysis |
|
43 | - * @throws \EE_Error |
|
44 | - */ |
|
45 | - protected function getTableAnalysis() |
|
46 | - { |
|
47 | - if ($this->table_analysis instanceof TableAnalysis) { |
|
48 | - return $this->table_analysis; |
|
49 | - } else { |
|
50 | - throw new \EE_Error( |
|
51 | - sprintf( |
|
52 | - __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
53 | - get_class($this) |
|
54 | - ) |
|
55 | - ); |
|
56 | - } |
|
57 | - } |
|
58 | - |
|
59 | - |
|
60 | - |
|
61 | - /** |
|
62 | - * @param string $table_name which can optionally start with $wpdb->prefix or not |
|
63 | - * @param string $column_name |
|
64 | - * @param string $column_info |
|
65 | - * @return bool|false|int |
|
66 | - */ |
|
67 | - public function addColumn($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') |
|
68 | - { |
|
69 | - if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', false)) { |
|
70 | - return false; |
|
71 | - } |
|
72 | - global $wpdb; |
|
73 | - $full_table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix($table_name); |
|
74 | - $columns = $this->getTableColumns($table_name); |
|
75 | - if ( ! in_array($column_name, $columns)) { |
|
76 | - $alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
77 | - return $wpdb->query($alter_query); |
|
78 | - } |
|
79 | - return true; |
|
80 | - } |
|
81 | - |
|
82 | - |
|
83 | - |
|
84 | - /** |
|
85 | - * Gets the name of all columns on the table. $table_name can |
|
86 | - * optionally start with $wpdb->prefix or not |
|
87 | - * |
|
88 | - * @global \wpdb $wpdb |
|
89 | - * @param string $table_name |
|
90 | - * @return array |
|
91 | - */ |
|
92 | - public function getTableColumns($table_name) |
|
93 | - { |
|
94 | - global $wpdb; |
|
95 | - $table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix($table_name); |
|
96 | - $fieldArray = array(); |
|
97 | - if ( ! empty($table_name)) { |
|
98 | - $columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name "); |
|
99 | - if ($columns !== false) { |
|
100 | - foreach ($columns as $column) { |
|
101 | - $fieldArray[] = $column->Field; |
|
102 | - } |
|
103 | - } |
|
104 | - } |
|
105 | - return $fieldArray; |
|
106 | - } |
|
107 | - |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * Drops the specified table from the database. $table_name can |
|
112 | - * optionally start with $wpdb->prefix or not |
|
113 | - * |
|
114 | - * @global \wpdb $wpdb |
|
115 | - * @param string $table_name |
|
116 | - * @return int |
|
117 | - */ |
|
118 | - public function dropTable($table_name) |
|
119 | - { |
|
120 | - global $wpdb; |
|
121 | - if ($this->getTableAnalysis()->tableExists($table_name)) { |
|
122 | - $table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix($table_name); |
|
123 | - return $wpdb->query("DROP TABLE IF EXISTS $table_name"); |
|
124 | - } |
|
125 | - return 0; |
|
126 | - } |
|
127 | - |
|
128 | - |
|
129 | - |
|
130 | - /** |
|
131 | - * Drops all the tables mentioned in a single MYSQL query. Double-checks |
|
132 | - * each table name provided has a wpdb prefix attached, and that it exists. |
|
133 | - * Returns the list actually deleted |
|
134 | - * |
|
135 | - * @global WPDB $wpdb |
|
136 | - * @param array $table_names |
|
137 | - * @return array of table names which we deleted |
|
138 | - */ |
|
139 | - public function dropTables($table_names) |
|
140 | - { |
|
141 | - $tables_to_delete = array(); |
|
142 | - foreach ($table_names as $table_name) { |
|
143 | - $table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix($table_name); |
|
144 | - if ($this->getTableAnalysis()->tableExists($table_name)) { |
|
145 | - $tables_to_delete[] = $table_name; |
|
146 | - } |
|
147 | - } |
|
148 | - global $wpdb; |
|
149 | - $wpdb->query('DROP TABLE ' . implode(', ', $tables_to_delete)); |
|
150 | - return $tables_to_delete; |
|
151 | - } |
|
152 | - |
|
153 | - |
|
154 | - |
|
155 | - /** |
|
156 | - * Drops the specified index from the specified table. $table_name can |
|
157 | - * optionally start with $wpdb->prefix or not |
|
158 | - * |
|
159 | - * @global \wpdb $wpdb |
|
160 | - * @param string $table_name |
|
161 | - * @param string $indexName |
|
162 | - * @return int |
|
163 | - */ |
|
164 | - public function dropIndex($table_name, $indexName) |
|
165 | - { |
|
166 | - if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', false)) { |
|
167 | - return false; |
|
168 | - } |
|
169 | - global $wpdb; |
|
170 | - $table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix($table_name); |
|
171 | - $index_exists_query = "SHOW INDEX FROM $table_name WHERE Key_name = '$indexName'"; |
|
172 | - if ( |
|
173 | - $this->getTableAnalysis()->tableExists($table_name) |
|
174 | - && $wpdb->get_var($index_exists_query) |
|
175 | - === $table_name //using get_var with the $index_exists_query returns the table's name |
|
176 | - ) { |
|
177 | - return $wpdb->query("ALTER TABLE $table_name DROP INDEX $indexName"); |
|
178 | - } |
|
179 | - return 0; |
|
180 | - } |
|
181 | - |
|
182 | - |
|
183 | - |
|
184 | - /** |
|
185 | - * Just creates the requested table. $table_name can |
|
186 | - * optionally start with $wpdb->prefix or not |
|
187 | - * |
|
188 | - * @param string $table_name |
|
189 | - * @param string $createSql defining the table's columns and indexes |
|
190 | - * @param string $engine (no need to specify "ENGINE=", that's implied) |
|
191 | - * @return void |
|
192 | - * @throws \EE_Error |
|
193 | - */ |
|
194 | - public function createTable($table_name, $createSql, $engine = 'MyISAM') |
|
195 | - { |
|
196 | - // does $sql contain valid column information? ( LPT: https://regex101.com/ is great for working out regex patterns ) |
|
197 | - if (preg_match('((((.*?))(,\s))+)', $createSql, $valid_column_data)) { |
|
198 | - $table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix($table_name); |
|
199 | - $SQL = "CREATE TABLE $table_name ( $createSql ) ENGINE=$engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"; |
|
200 | - /** @var \wpdb $wpdb */ |
|
201 | - global $wpdb; |
|
202 | - //get $wpdb to echo errors, but buffer them. This way at least WE know an error |
|
203 | - //happened. And then we can choose to tell the end user |
|
204 | - $old_show_errors_policy = $wpdb->show_errors(true); |
|
205 | - $old_error_suppression_policy = $wpdb->suppress_errors(false); |
|
206 | - ob_start(); |
|
207 | - dbDelta($SQL); |
|
208 | - $output = ob_get_contents(); |
|
209 | - ob_end_clean(); |
|
210 | - $wpdb->show_errors($old_show_errors_policy); |
|
211 | - $wpdb->suppress_errors($old_error_suppression_policy); |
|
212 | - if ( ! empty($output)) { |
|
213 | - throw new \EE_Error($output); |
|
214 | - } |
|
215 | - } else { |
|
216 | - throw new \EE_Error( |
|
217 | - sprintf( |
|
218 | - __('The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', |
|
219 | - 'event_espresso'), |
|
220 | - '<br />', |
|
221 | - $createSql |
|
222 | - ) |
|
223 | - ); |
|
224 | - } |
|
225 | - } |
|
20 | + /** |
|
21 | + * @var TableAnalysis $table_analysis |
|
22 | + */ |
|
23 | + private $table_analysis; |
|
24 | + |
|
25 | + |
|
26 | + |
|
27 | + /** |
|
28 | + * TableManager constructor. |
|
29 | + * |
|
30 | + * @param TableAnalysis $TableAnalysis |
|
31 | + */ |
|
32 | + public function __construct(TableAnalysis $TableAnalysis) |
|
33 | + { |
|
34 | + $this->table_analysis = $TableAnalysis; |
|
35 | + } |
|
36 | + |
|
37 | + |
|
38 | + |
|
39 | + /** |
|
40 | + * Gets the injected table analyzer, or throws an exception |
|
41 | + * |
|
42 | + * @return TableAnalysis |
|
43 | + * @throws \EE_Error |
|
44 | + */ |
|
45 | + protected function getTableAnalysis() |
|
46 | + { |
|
47 | + if ($this->table_analysis instanceof TableAnalysis) { |
|
48 | + return $this->table_analysis; |
|
49 | + } else { |
|
50 | + throw new \EE_Error( |
|
51 | + sprintf( |
|
52 | + __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
53 | + get_class($this) |
|
54 | + ) |
|
55 | + ); |
|
56 | + } |
|
57 | + } |
|
58 | + |
|
59 | + |
|
60 | + |
|
61 | + /** |
|
62 | + * @param string $table_name which can optionally start with $wpdb->prefix or not |
|
63 | + * @param string $column_name |
|
64 | + * @param string $column_info |
|
65 | + * @return bool|false|int |
|
66 | + */ |
|
67 | + public function addColumn($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') |
|
68 | + { |
|
69 | + if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', false)) { |
|
70 | + return false; |
|
71 | + } |
|
72 | + global $wpdb; |
|
73 | + $full_table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix($table_name); |
|
74 | + $columns = $this->getTableColumns($table_name); |
|
75 | + if ( ! in_array($column_name, $columns)) { |
|
76 | + $alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
77 | + return $wpdb->query($alter_query); |
|
78 | + } |
|
79 | + return true; |
|
80 | + } |
|
81 | + |
|
82 | + |
|
83 | + |
|
84 | + /** |
|
85 | + * Gets the name of all columns on the table. $table_name can |
|
86 | + * optionally start with $wpdb->prefix or not |
|
87 | + * |
|
88 | + * @global \wpdb $wpdb |
|
89 | + * @param string $table_name |
|
90 | + * @return array |
|
91 | + */ |
|
92 | + public function getTableColumns($table_name) |
|
93 | + { |
|
94 | + global $wpdb; |
|
95 | + $table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix($table_name); |
|
96 | + $fieldArray = array(); |
|
97 | + if ( ! empty($table_name)) { |
|
98 | + $columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name "); |
|
99 | + if ($columns !== false) { |
|
100 | + foreach ($columns as $column) { |
|
101 | + $fieldArray[] = $column->Field; |
|
102 | + } |
|
103 | + } |
|
104 | + } |
|
105 | + return $fieldArray; |
|
106 | + } |
|
107 | + |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * Drops the specified table from the database. $table_name can |
|
112 | + * optionally start with $wpdb->prefix or not |
|
113 | + * |
|
114 | + * @global \wpdb $wpdb |
|
115 | + * @param string $table_name |
|
116 | + * @return int |
|
117 | + */ |
|
118 | + public function dropTable($table_name) |
|
119 | + { |
|
120 | + global $wpdb; |
|
121 | + if ($this->getTableAnalysis()->tableExists($table_name)) { |
|
122 | + $table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix($table_name); |
|
123 | + return $wpdb->query("DROP TABLE IF EXISTS $table_name"); |
|
124 | + } |
|
125 | + return 0; |
|
126 | + } |
|
127 | + |
|
128 | + |
|
129 | + |
|
130 | + /** |
|
131 | + * Drops all the tables mentioned in a single MYSQL query. Double-checks |
|
132 | + * each table name provided has a wpdb prefix attached, and that it exists. |
|
133 | + * Returns the list actually deleted |
|
134 | + * |
|
135 | + * @global WPDB $wpdb |
|
136 | + * @param array $table_names |
|
137 | + * @return array of table names which we deleted |
|
138 | + */ |
|
139 | + public function dropTables($table_names) |
|
140 | + { |
|
141 | + $tables_to_delete = array(); |
|
142 | + foreach ($table_names as $table_name) { |
|
143 | + $table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix($table_name); |
|
144 | + if ($this->getTableAnalysis()->tableExists($table_name)) { |
|
145 | + $tables_to_delete[] = $table_name; |
|
146 | + } |
|
147 | + } |
|
148 | + global $wpdb; |
|
149 | + $wpdb->query('DROP TABLE ' . implode(', ', $tables_to_delete)); |
|
150 | + return $tables_to_delete; |
|
151 | + } |
|
152 | + |
|
153 | + |
|
154 | + |
|
155 | + /** |
|
156 | + * Drops the specified index from the specified table. $table_name can |
|
157 | + * optionally start with $wpdb->prefix or not |
|
158 | + * |
|
159 | + * @global \wpdb $wpdb |
|
160 | + * @param string $table_name |
|
161 | + * @param string $indexName |
|
162 | + * @return int |
|
163 | + */ |
|
164 | + public function dropIndex($table_name, $indexName) |
|
165 | + { |
|
166 | + if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', false)) { |
|
167 | + return false; |
|
168 | + } |
|
169 | + global $wpdb; |
|
170 | + $table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix($table_name); |
|
171 | + $index_exists_query = "SHOW INDEX FROM $table_name WHERE Key_name = '$indexName'"; |
|
172 | + if ( |
|
173 | + $this->getTableAnalysis()->tableExists($table_name) |
|
174 | + && $wpdb->get_var($index_exists_query) |
|
175 | + === $table_name //using get_var with the $index_exists_query returns the table's name |
|
176 | + ) { |
|
177 | + return $wpdb->query("ALTER TABLE $table_name DROP INDEX $indexName"); |
|
178 | + } |
|
179 | + return 0; |
|
180 | + } |
|
181 | + |
|
182 | + |
|
183 | + |
|
184 | + /** |
|
185 | + * Just creates the requested table. $table_name can |
|
186 | + * optionally start with $wpdb->prefix or not |
|
187 | + * |
|
188 | + * @param string $table_name |
|
189 | + * @param string $createSql defining the table's columns and indexes |
|
190 | + * @param string $engine (no need to specify "ENGINE=", that's implied) |
|
191 | + * @return void |
|
192 | + * @throws \EE_Error |
|
193 | + */ |
|
194 | + public function createTable($table_name, $createSql, $engine = 'MyISAM') |
|
195 | + { |
|
196 | + // does $sql contain valid column information? ( LPT: https://regex101.com/ is great for working out regex patterns ) |
|
197 | + if (preg_match('((((.*?))(,\s))+)', $createSql, $valid_column_data)) { |
|
198 | + $table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix($table_name); |
|
199 | + $SQL = "CREATE TABLE $table_name ( $createSql ) ENGINE=$engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"; |
|
200 | + /** @var \wpdb $wpdb */ |
|
201 | + global $wpdb; |
|
202 | + //get $wpdb to echo errors, but buffer them. This way at least WE know an error |
|
203 | + //happened. And then we can choose to tell the end user |
|
204 | + $old_show_errors_policy = $wpdb->show_errors(true); |
|
205 | + $old_error_suppression_policy = $wpdb->suppress_errors(false); |
|
206 | + ob_start(); |
|
207 | + dbDelta($SQL); |
|
208 | + $output = ob_get_contents(); |
|
209 | + ob_end_clean(); |
|
210 | + $wpdb->show_errors($old_show_errors_policy); |
|
211 | + $wpdb->suppress_errors($old_error_suppression_policy); |
|
212 | + if ( ! empty($output)) { |
|
213 | + throw new \EE_Error($output); |
|
214 | + } |
|
215 | + } else { |
|
216 | + throw new \EE_Error( |
|
217 | + sprintf( |
|
218 | + __('The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', |
|
219 | + 'event_espresso'), |
|
220 | + '<br />', |
|
221 | + $createSql |
|
222 | + ) |
|
223 | + ); |
|
224 | + } |
|
225 | + } |
|
226 | 226 | |
227 | 227 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | //unfortunately, this needs to be done upon INCLUSION of this file, |
10 | 10 | //instead of construction, because it only gets constructed on first page load |
11 | 11 | //(all other times it gets resurrected from a wordpress option) |
12 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_9_0_stages/*'); |
|
12 | +$stages = glob(EE_CORE.'data_migration_scripts/4_9_0_stages/*'); |
|
13 | 13 | $class_to_filepath = array(); |
14 | 14 | foreach ($stages as $filepath) { |
15 | 15 | $matches = array(); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } elseif ( ! $version_string) { |
68 | 68 | // echo "no version string provided: $version_string"; |
69 | 69 | //no version string provided... this must be pre 4.3 |
70 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
70 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
71 | 71 | } else { |
72 | 72 | // echo "$version_string doesnt apply"; |
73 | 73 | return false; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function schema_changes_before_migration() |
93 | 93 | { |
94 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
94 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
95 | 95 | $now_in_mysql = current_time('mysql', true); |
96 | 96 | $table_name = 'esp_answer'; |
97 | 97 | $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | $stages = glob(EE_CORE . 'data_migration_scripts/4_9_0_stages/*'); |
13 | 13 | $class_to_filepath = array(); |
14 | 14 | foreach ($stages as $filepath) { |
15 | - $matches = array(); |
|
16 | - preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
17 | - $class_to_filepath[$matches[1]] = $filepath; |
|
15 | + $matches = array(); |
|
16 | + preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
17 | + $class_to_filepath[$matches[1]] = $filepath; |
|
18 | 18 | } |
19 | 19 | //give addons a chance to autoload their stages too |
20 | 20 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages', $class_to_filepath); |
@@ -33,77 +33,77 @@ discard block |
||
33 | 33 | class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base |
34 | 34 | { |
35 | 35 | |
36 | - /** |
|
37 | - * return EE_DMS_Core_4_9_0 |
|
38 | - * |
|
39 | - * @param TableManager $table_manager |
|
40 | - * @param TableAnalysis $table_analysis |
|
41 | - */ |
|
42 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
43 | - { |
|
44 | - $this->_pretty_name = __("Data Migration to Event Espresso 4.9.0.P", "event_espresso"); |
|
45 | - $this->_priority = 10; |
|
46 | - $this->_migration_stages = array( |
|
47 | - new EE_DMS_4_9_0_Email_System_Question(), |
|
48 | - new EE_DMS_4_9_0_Answers_With_No_Registration(), |
|
49 | - ); |
|
50 | - parent::__construct($table_manager, $table_analysis); |
|
51 | - } |
|
36 | + /** |
|
37 | + * return EE_DMS_Core_4_9_0 |
|
38 | + * |
|
39 | + * @param TableManager $table_manager |
|
40 | + * @param TableAnalysis $table_analysis |
|
41 | + */ |
|
42 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
43 | + { |
|
44 | + $this->_pretty_name = __("Data Migration to Event Espresso 4.9.0.P", "event_espresso"); |
|
45 | + $this->_priority = 10; |
|
46 | + $this->_migration_stages = array( |
|
47 | + new EE_DMS_4_9_0_Email_System_Question(), |
|
48 | + new EE_DMS_4_9_0_Answers_With_No_Registration(), |
|
49 | + ); |
|
50 | + parent::__construct($table_manager, $table_analysis); |
|
51 | + } |
|
52 | 52 | |
53 | 53 | |
54 | 54 | |
55 | - /** |
|
56 | - * Whether to migrate or not. |
|
57 | - * |
|
58 | - * @param array $version_array |
|
59 | - * @return bool |
|
60 | - */ |
|
61 | - public function can_migrate_from_version($version_array) |
|
62 | - { |
|
63 | - $version_string = $version_array['Core']; |
|
64 | - if (version_compare($version_string, '4.9.0', '<=') && version_compare($version_string, '4.8.0', '>=')) { |
|
55 | + /** |
|
56 | + * Whether to migrate or not. |
|
57 | + * |
|
58 | + * @param array $version_array |
|
59 | + * @return bool |
|
60 | + */ |
|
61 | + public function can_migrate_from_version($version_array) |
|
62 | + { |
|
63 | + $version_string = $version_array['Core']; |
|
64 | + if (version_compare($version_string, '4.9.0', '<=') && version_compare($version_string, '4.8.0', '>=')) { |
|
65 | 65 | // echo "$version_string can be migrated from"; |
66 | - return true; |
|
67 | - } elseif ( ! $version_string) { |
|
66 | + return true; |
|
67 | + } elseif ( ! $version_string) { |
|
68 | 68 | // echo "no version string provided: $version_string"; |
69 | - //no version string provided... this must be pre 4.3 |
|
70 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
71 | - } else { |
|
69 | + //no version string provided... this must be pre 4.3 |
|
70 | + return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
71 | + } else { |
|
72 | 72 | // echo "$version_string doesnt apply"; |
73 | - return false; |
|
74 | - } |
|
75 | - } |
|
73 | + return false; |
|
74 | + } |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | 78 | |
79 | - /** |
|
80 | - * @return string|void |
|
81 | - */ |
|
82 | - public function pretty_name() |
|
83 | - { |
|
84 | - return __("Core Data Migration to version 4.9.0", "event_espresso"); |
|
85 | - } |
|
79 | + /** |
|
80 | + * @return string|void |
|
81 | + */ |
|
82 | + public function pretty_name() |
|
83 | + { |
|
84 | + return __("Core Data Migration to version 4.9.0", "event_espresso"); |
|
85 | + } |
|
86 | 86 | |
87 | 87 | |
88 | 88 | |
89 | - /** |
|
90 | - * @return bool |
|
91 | - */ |
|
92 | - public function schema_changes_before_migration() |
|
93 | - { |
|
94 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
95 | - $now_in_mysql = current_time('mysql', true); |
|
96 | - $table_name = 'esp_answer'; |
|
97 | - $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
89 | + /** |
|
90 | + * @return bool |
|
91 | + */ |
|
92 | + public function schema_changes_before_migration() |
|
93 | + { |
|
94 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
95 | + $now_in_mysql = current_time('mysql', true); |
|
96 | + $table_name = 'esp_answer'; |
|
97 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
98 | 98 | REG_ID int(10) unsigned NOT NULL, |
99 | 99 | QST_ID int(10) unsigned NOT NULL, |
100 | 100 | ANS_value text NOT NULL, |
101 | 101 | PRIMARY KEY (ANS_ID), |
102 | 102 | KEY REG_ID (REG_ID), |
103 | 103 | KEY QST_ID (QST_ID)"; |
104 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
105 | - $table_name = 'esp_attendee_meta'; |
|
106 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
104 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
105 | + $table_name = 'esp_attendee_meta'; |
|
106 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
107 | 107 | ATT_ID bigint(20) unsigned NOT NULL, |
108 | 108 | ATT_fname varchar(45) NOT NULL, |
109 | 109 | ATT_lname varchar(45) NOT NULL, |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | KEY ATT_email (ATT_email), |
121 | 121 | KEY ATT_lname (ATT_lname), |
122 | 122 | KEY ATT_fname (ATT_fname)"; |
123 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
124 | - $table_name = 'esp_checkin'; |
|
125 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
123 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
124 | + $table_name = 'esp_checkin'; |
|
125 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
126 | 126 | REG_ID int(10) unsigned NOT NULL, |
127 | 127 | DTT_ID int(10) unsigned NOT NULL, |
128 | 128 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | PRIMARY KEY (CHK_ID), |
131 | 131 | KEY REG_ID (REG_ID), |
132 | 132 | KEY DTT_ID (DTT_ID)"; |
133 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
134 | - $table_name = 'esp_country'; |
|
135 | - $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
|
133 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
134 | + $table_name = 'esp_country'; |
|
135 | + $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
|
136 | 136 | CNT_ISO3 varchar(3) collate utf8_bin NOT NULL, |
137 | 137 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
138 | 138 | CNT_name varchar(45) collate utf8_bin NOT NULL, |
@@ -148,25 +148,25 @@ discard block |
||
148 | 148 | CNT_is_EU tinyint(1) DEFAULT '0', |
149 | 149 | CNT_active tinyint(1) DEFAULT '0', |
150 | 150 | PRIMARY KEY (CNT_ISO)"; |
151 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
152 | - $table_name = 'esp_currency'; |
|
153 | - $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
|
151 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
152 | + $table_name = 'esp_currency'; |
|
153 | + $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
|
154 | 154 | CUR_single varchar(45) collate utf8_bin DEFAULT 'dollar', |
155 | 155 | CUR_plural varchar(45) collate utf8_bin DEFAULT 'dollars', |
156 | 156 | CUR_sign varchar(45) collate utf8_bin DEFAULT '$', |
157 | 157 | CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2', |
158 | 158 | CUR_active tinyint(1) DEFAULT '0', |
159 | 159 | PRIMARY KEY (CUR_code)"; |
160 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
161 | - $table_name = 'esp_currency_payment_method'; |
|
162 | - $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
160 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
161 | + $table_name = 'esp_currency_payment_method'; |
|
162 | + $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
163 | 163 | CUR_code varchar(6) collate utf8_bin NOT NULL, |
164 | 164 | PMD_ID int(11) NOT NULL, |
165 | 165 | PRIMARY KEY (CPM_ID), |
166 | 166 | KEY PMD_ID (PMD_ID)"; |
167 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
168 | - $table_name = 'esp_datetime'; |
|
169 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
167 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
168 | + $table_name = 'esp_datetime'; |
|
169 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
170 | 170 | EVT_ID bigint(20) unsigned NOT NULL, |
171 | 171 | DTT_name varchar(255) NOT NULL DEFAULT '', |
172 | 172 | DTT_description text NOT NULL, |
@@ -182,25 +182,25 @@ discard block |
||
182 | 182 | KEY DTT_EVT_start (DTT_EVT_start), |
183 | 183 | KEY EVT_ID (EVT_ID), |
184 | 184 | KEY DTT_is_primary (DTT_is_primary)"; |
185 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
186 | - $table_name = "esp_datetime_ticket"; |
|
187 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
185 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
186 | + $table_name = "esp_datetime_ticket"; |
|
187 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
188 | 188 | DTT_ID int(10) unsigned NOT NULL, |
189 | 189 | TKT_ID int(10) unsigned NOT NULL, |
190 | 190 | PRIMARY KEY (DTK_ID), |
191 | 191 | KEY DTT_ID (DTT_ID), |
192 | 192 | KEY TKT_ID (TKT_ID)"; |
193 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
194 | - $table_name = 'esp_event_message_template'; |
|
195 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
193 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
194 | + $table_name = 'esp_event_message_template'; |
|
195 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
196 | 196 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
197 | 197 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
198 | 198 | PRIMARY KEY (EMT_ID), |
199 | 199 | KEY EVT_ID (EVT_ID), |
200 | 200 | KEY GRP_ID (GRP_ID)"; |
201 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
202 | - $table_name = 'esp_event_meta'; |
|
203 | - $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
|
201 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
202 | + $table_name = 'esp_event_meta'; |
|
203 | + $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
|
204 | 204 | EVT_ID bigint(20) unsigned NOT NULL, |
205 | 205 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
206 | 206 | EVT_display_ticket_selector tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -215,34 +215,34 @@ discard block |
||
215 | 215 | EVT_donations tinyint(1) NULL, |
216 | 216 | PRIMARY KEY (EVTM_ID), |
217 | 217 | KEY EVT_ID (EVT_ID)"; |
218 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
219 | - $table_name = 'esp_event_question_group'; |
|
220 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
218 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
219 | + $table_name = 'esp_event_question_group'; |
|
220 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
221 | 221 | EVT_ID bigint(20) unsigned NOT NULL, |
222 | 222 | QSG_ID int(10) unsigned NOT NULL, |
223 | 223 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
224 | 224 | PRIMARY KEY (EQG_ID), |
225 | 225 | KEY EVT_ID (EVT_ID), |
226 | 226 | KEY QSG_ID (QSG_ID)"; |
227 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
228 | - $table_name = 'esp_event_venue'; |
|
229 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
227 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
228 | + $table_name = 'esp_event_venue'; |
|
229 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
230 | 230 | EVT_ID bigint(20) unsigned NOT NULL, |
231 | 231 | VNU_ID bigint(20) unsigned NOT NULL, |
232 | 232 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
233 | 233 | PRIMARY KEY (EVV_ID)"; |
234 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
235 | - $table_name = 'esp_extra_meta'; |
|
236 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
234 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
235 | + $table_name = 'esp_extra_meta'; |
|
236 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
237 | 237 | OBJ_ID int(11) DEFAULT NULL, |
238 | 238 | EXM_type varchar(45) DEFAULT NULL, |
239 | 239 | EXM_key varchar(45) DEFAULT NULL, |
240 | 240 | EXM_value text, |
241 | 241 | PRIMARY KEY (EXM_ID), |
242 | 242 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
243 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
244 | - $table_name = 'esp_extra_join'; |
|
245 | - $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
243 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
244 | + $table_name = 'esp_extra_join'; |
|
245 | + $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
246 | 246 | EXJ_first_model_id varchar(6) NOT NULL, |
247 | 247 | EXJ_first_model_name varchar(20) NOT NULL, |
248 | 248 | EXJ_second_model_id varchar(6) NOT NULL, |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | PRIMARY KEY (EXJ_ID), |
251 | 251 | KEY first_model (EXJ_first_model_name,EXJ_first_model_id), |
252 | 252 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
253 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
254 | - $table_name = 'esp_line_item'; |
|
255 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
253 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
254 | + $table_name = 'esp_line_item'; |
|
255 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
256 | 256 | LIN_code varchar(245) NOT NULL DEFAULT '', |
257 | 257 | TXN_ID int(11) DEFAULT NULL, |
258 | 258 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | PRIMARY KEY (LIN_ID), |
272 | 272 | KEY LIN_code (LIN_code(191)), |
273 | 273 | KEY TXN_ID (TXN_ID)"; |
274 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
275 | - $table_name = 'esp_log'; |
|
276 | - $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
274 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
275 | + $table_name = 'esp_log'; |
|
276 | + $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
277 | 277 | LOG_time datetime DEFAULT NULL, |
278 | 278 | OBJ_ID varchar(45) DEFAULT NULL, |
279 | 279 | OBJ_type varchar(45) DEFAULT NULL, |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | KEY LOG_time (LOG_time), |
285 | 285 | KEY OBJ (OBJ_type,OBJ_ID), |
286 | 286 | KEY LOG_type (LOG_type)"; |
287 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
288 | - $table_name = 'esp_message'; |
|
289 | - $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
287 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
288 | + $table_name = 'esp_message'; |
|
289 | + $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
290 | 290 | GRP_ID int(10) unsigned NULL, |
291 | 291 | MSG_token varchar(255) NULL, |
292 | 292 | TXN_ID int(10) unsigned NULL, |
@@ -318,18 +318,18 @@ discard block |
||
318 | 318 | KEY STS_ID (STS_ID), |
319 | 319 | KEY MSG_created (MSG_created), |
320 | 320 | KEY MSG_modified (MSG_modified)"; |
321 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
322 | - $table_name = 'esp_message_template'; |
|
323 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
321 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
322 | + $table_name = 'esp_message_template'; |
|
323 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
324 | 324 | GRP_ID int(10) unsigned NOT NULL, |
325 | 325 | MTP_context varchar(50) NOT NULL, |
326 | 326 | MTP_template_field varchar(30) NOT NULL, |
327 | 327 | MTP_content text NOT NULL, |
328 | 328 | PRIMARY KEY (MTP_ID), |
329 | 329 | KEY GRP_ID (GRP_ID)"; |
330 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
331 | - $table_name = 'esp_message_template_group'; |
|
332 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
330 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
331 | + $table_name = 'esp_message_template_group'; |
|
332 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
333 | 333 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
334 | 334 | MTP_name varchar(245) NOT NULL DEFAULT '', |
335 | 335 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -341,9 +341,9 @@ discard block |
||
341 | 341 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
342 | 342 | PRIMARY KEY (GRP_ID), |
343 | 343 | KEY MTP_user_id (MTP_user_id)"; |
344 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
345 | - $table_name = 'esp_payment'; |
|
346 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
344 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
345 | + $table_name = 'esp_payment'; |
|
346 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
347 | 347 | TXN_ID int(10) unsigned DEFAULT NULL, |
348 | 348 | STS_ID varchar(3) collate utf8_bin DEFAULT NULL, |
349 | 349 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -360,9 +360,9 @@ discard block |
||
360 | 360 | PRIMARY KEY (PAY_ID), |
361 | 361 | KEY PAY_timestamp (PAY_timestamp), |
362 | 362 | KEY TXN_ID (TXN_ID)"; |
363 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
364 | - $table_name = 'esp_payment_method'; |
|
365 | - $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
363 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
364 | + $table_name = 'esp_payment_method'; |
|
365 | + $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
366 | 366 | PMD_type varchar(124) DEFAULT NULL, |
367 | 367 | PMD_name varchar(255) DEFAULT NULL, |
368 | 368 | PMD_desc text, |
@@ -378,24 +378,24 @@ discard block |
||
378 | 378 | PRIMARY KEY (PMD_ID), |
379 | 379 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug), |
380 | 380 | KEY PMD_type (PMD_type)"; |
381 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
382 | - $table_name = "esp_ticket_price"; |
|
383 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
381 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
382 | + $table_name = "esp_ticket_price"; |
|
383 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
384 | 384 | TKT_ID int(10) unsigned NOT NULL, |
385 | 385 | PRC_ID int(10) unsigned NOT NULL, |
386 | 386 | PRIMARY KEY (TKP_ID), |
387 | 387 | KEY TKT_ID (TKT_ID), |
388 | 388 | KEY PRC_ID (PRC_ID)"; |
389 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
390 | - $table_name = "esp_ticket_template"; |
|
391 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
389 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
390 | + $table_name = "esp_ticket_template"; |
|
391 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
392 | 392 | TTM_name varchar(45) NOT NULL, |
393 | 393 | TTM_description text, |
394 | 394 | TTM_file varchar(45), |
395 | 395 | PRIMARY KEY (TTM_ID)"; |
396 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
397 | - $table_name = 'esp_question'; |
|
398 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
396 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
397 | + $table_name = 'esp_question'; |
|
398 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
399 | 399 | QST_display_text text NOT NULL, |
400 | 400 | QST_admin_label varchar(255) NOT NULL, |
401 | 401 | QST_system varchar(25) DEFAULT NULL, |
@@ -409,18 +409,18 @@ discard block |
||
409 | 409 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
410 | 410 | PRIMARY KEY (QST_ID), |
411 | 411 | KEY QST_order (QST_order)'; |
412 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
413 | - $table_name = 'esp_question_group_question'; |
|
414 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
412 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
413 | + $table_name = 'esp_question_group_question'; |
|
414 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
415 | 415 | QSG_ID int(10) unsigned NOT NULL, |
416 | 416 | QST_ID int(10) unsigned NOT NULL, |
417 | 417 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
418 | 418 | PRIMARY KEY (QGQ_ID), |
419 | 419 | KEY QST_ID (QST_ID), |
420 | 420 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
421 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
422 | - $table_name = 'esp_question_option'; |
|
423 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
421 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
422 | + $table_name = 'esp_question_option'; |
|
423 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
424 | 424 | QSO_value varchar(255) NOT NULL, |
425 | 425 | QSO_desc text NOT NULL, |
426 | 426 | QST_ID int(10) unsigned NOT NULL, |
@@ -430,9 +430,9 @@ discard block |
||
430 | 430 | PRIMARY KEY (QSO_ID), |
431 | 431 | KEY QST_ID (QST_ID), |
432 | 432 | KEY QSO_order (QSO_order)"; |
433 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
434 | - $table_name = 'esp_registration'; |
|
435 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
433 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
434 | + $table_name = 'esp_registration'; |
|
435 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
436 | 436 | EVT_ID bigint(20) unsigned NOT NULL, |
437 | 437 | ATT_ID bigint(20) unsigned NOT NULL, |
438 | 438 | TXN_ID int(10) unsigned NOT NULL, |
@@ -456,18 +456,18 @@ discard block |
||
456 | 456 | KEY TKT_ID (TKT_ID), |
457 | 457 | KEY EVT_ID (EVT_ID), |
458 | 458 | KEY STS_ID (STS_ID)"; |
459 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
460 | - $table_name = 'esp_registration_payment'; |
|
461 | - $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
459 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
460 | + $table_name = 'esp_registration_payment'; |
|
461 | + $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
462 | 462 | REG_ID int(10) unsigned NOT NULL, |
463 | 463 | PAY_ID int(10) unsigned NULL, |
464 | 464 | RPY_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
465 | 465 | PRIMARY KEY (RPY_ID), |
466 | 466 | KEY REG_ID (REG_ID), |
467 | 467 | KEY PAY_ID (PAY_ID)"; |
468 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
469 | - $table_name = 'esp_state'; |
|
470 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
468 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
469 | + $table_name = 'esp_state'; |
|
470 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
471 | 471 | CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
472 | 472 | STA_abbrev varchar(24) collate utf8_bin NOT NULL, |
473 | 473 | STA_name varchar(100) collate utf8_bin NOT NULL, |
@@ -475,9 +475,9 @@ discard block |
||
475 | 475 | PRIMARY KEY (STA_ID), |
476 | 476 | KEY STA_abbrev (STA_abbrev), |
477 | 477 | KEY CNT_ISO (CNT_ISO)"; |
478 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
479 | - $table_name = 'esp_status'; |
|
480 | - $sql = "STS_ID varchar(3) NOT NULL, |
|
478 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
479 | + $table_name = 'esp_status'; |
|
480 | + $sql = "STS_ID varchar(3) NOT NULL, |
|
481 | 481 | STS_code varchar(45) NOT NULL, |
482 | 482 | STS_type varchar(45) NOT NULL, |
483 | 483 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -485,9 +485,9 @@ discard block |
||
485 | 485 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
486 | 486 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
487 | 487 | KEY STS_type (STS_type)"; |
488 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
489 | - $table_name = 'esp_transaction'; |
|
490 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
488 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
489 | + $table_name = 'esp_transaction'; |
|
490 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
491 | 491 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
492 | 492 | TXN_total decimal(10,3) DEFAULT '0.00', |
493 | 493 | TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00', |
@@ -499,9 +499,9 @@ discard block |
||
499 | 499 | PRIMARY KEY (TXN_ID), |
500 | 500 | KEY TXN_timestamp (TXN_timestamp), |
501 | 501 | KEY STS_ID (STS_ID)"; |
502 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
503 | - $table_name = 'esp_venue_meta'; |
|
504 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
502 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
503 | + $table_name = 'esp_venue_meta'; |
|
504 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
505 | 505 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
506 | 506 | VNU_address varchar(255) DEFAULT NULL, |
507 | 507 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -520,10 +520,10 @@ discard block |
||
520 | 520 | KEY VNU_ID (VNU_ID), |
521 | 521 | KEY STA_ID (STA_ID), |
522 | 522 | KEY CNT_ISO (CNT_ISO)"; |
523 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
524 | - //modified tables |
|
525 | - $table_name = "esp_price"; |
|
526 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
523 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
524 | + //modified tables |
|
525 | + $table_name = "esp_price"; |
|
526 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
527 | 527 | PRT_ID tinyint(3) unsigned NOT NULL, |
528 | 528 | PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
529 | 529 | PRC_name varchar(245) NOT NULL, |
@@ -536,9 +536,9 @@ discard block |
||
536 | 536 | PRC_parent int(10) unsigned DEFAULT 0, |
537 | 537 | PRIMARY KEY (PRC_ID), |
538 | 538 | KEY PRT_ID (PRT_ID)"; |
539 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
540 | - $table_name = "esp_price_type"; |
|
541 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
539 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
540 | + $table_name = "esp_price_type"; |
|
541 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
542 | 542 | PRT_name varchar(45) NOT NULL, |
543 | 543 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
544 | 544 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -547,9 +547,9 @@ discard block |
||
547 | 547 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
548 | 548 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
549 | 549 | PRIMARY KEY (PRT_ID)"; |
550 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
551 | - $table_name = "esp_ticket"; |
|
552 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
550 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
551 | + $table_name = "esp_ticket"; |
|
552 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
553 | 553 | TTM_ID int(10) unsigned NOT NULL, |
554 | 554 | TKT_name varchar(245) NOT NULL DEFAULT '', |
555 | 555 | TKT_description text NOT NULL, |
@@ -571,9 +571,9 @@ discard block |
||
571 | 571 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
572 | 572 | PRIMARY KEY (TKT_ID), |
573 | 573 | KEY TKT_start_date (TKT_start_date)"; |
574 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
575 | - $table_name = 'esp_question_group'; |
|
576 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
574 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
575 | + $table_name = 'esp_question_group'; |
|
576 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
577 | 577 | QSG_name varchar(255) NOT NULL, |
578 | 578 | QSG_identifier varchar(100) NOT NULL, |
579 | 579 | QSG_desc text NULL, |
@@ -586,41 +586,41 @@ discard block |
||
586 | 586 | PRIMARY KEY (QSG_ID), |
587 | 587 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
588 | 588 | KEY QSG_order (QSG_order)'; |
589 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
590 | - /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
591 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
592 | - //(because many need to convert old string states to foreign keys into the states table) |
|
593 | - $script_4_1_defaults->insert_default_states(); |
|
594 | - $script_4_1_defaults->insert_default_countries(); |
|
595 | - /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
596 | - $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
597 | - $script_4_5_defaults->insert_default_price_types(); |
|
598 | - $script_4_5_defaults->insert_default_prices(); |
|
599 | - $script_4_5_defaults->insert_default_tickets(); |
|
600 | - /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
601 | - $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
602 | - $script_4_6_defaults->add_default_admin_only_payments(); |
|
603 | - $script_4_6_defaults->insert_default_currencies(); |
|
604 | - /** @var EE_DMS_Core_4_8_0 $script_4_8_defaults */ |
|
605 | - $script_4_8_defaults = EE_Registry::instance()->load_dms('Core_4_8_0'); |
|
606 | - $script_4_8_defaults->verify_new_countries(); |
|
607 | - $script_4_8_defaults->verify_new_currencies(); |
|
608 | - return true; |
|
609 | - } |
|
589 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
590 | + /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
591 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
592 | + //(because many need to convert old string states to foreign keys into the states table) |
|
593 | + $script_4_1_defaults->insert_default_states(); |
|
594 | + $script_4_1_defaults->insert_default_countries(); |
|
595 | + /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
596 | + $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
597 | + $script_4_5_defaults->insert_default_price_types(); |
|
598 | + $script_4_5_defaults->insert_default_prices(); |
|
599 | + $script_4_5_defaults->insert_default_tickets(); |
|
600 | + /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
601 | + $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
602 | + $script_4_6_defaults->add_default_admin_only_payments(); |
|
603 | + $script_4_6_defaults->insert_default_currencies(); |
|
604 | + /** @var EE_DMS_Core_4_8_0 $script_4_8_defaults */ |
|
605 | + $script_4_8_defaults = EE_Registry::instance()->load_dms('Core_4_8_0'); |
|
606 | + $script_4_8_defaults->verify_new_countries(); |
|
607 | + $script_4_8_defaults->verify_new_currencies(); |
|
608 | + return true; |
|
609 | + } |
|
610 | 610 | |
611 | 611 | |
612 | 612 | |
613 | - /** |
|
614 | - * @return boolean |
|
615 | - */ |
|
616 | - public function schema_changes_after_migration() |
|
617 | - { |
|
618 | - return true; |
|
619 | - } |
|
613 | + /** |
|
614 | + * @return boolean |
|
615 | + */ |
|
616 | + public function schema_changes_after_migration() |
|
617 | + { |
|
618 | + return true; |
|
619 | + } |
|
620 | 620 | |
621 | 621 | |
622 | 622 | |
623 | - public function migration_page_hooks() |
|
624 | - { |
|
625 | - } |
|
623 | + public function migration_page_hooks() |
|
624 | + { |
|
625 | + } |
|
626 | 626 | } |
627 | 627 | \ No newline at end of file |
@@ -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.008' ); |
|
106 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.18.rc.008'); |
|
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 | } |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | } |
415 | 415 | } |
416 | 416 | // decode the data ? |
417 | - $session_data = $this->valid_base_64($session_data) ? base64_decode($session_data) : $session_data; |
|
417 | + $session_data = $this->valid_base_64($session_data) ? base64_decode($session_data) : $session_data; |
|
418 | 418 | // un-encrypt the data ? |
419 | 419 | $session_data = $this->_use_encryption ? $this->encryption->decrypt( $session_data ) : $session_data; |
420 | 420 | if ( ! is_array( $session_data ) ) { |
@@ -684,12 +684,12 @@ discard block |
||
684 | 684 | ) { |
685 | 685 | return false; |
686 | 686 | } |
687 | - // then serialize all of our session data |
|
688 | - $session_data = serialize($this->_session_data); |
|
689 | - // do we need to also encode it to avoid corrupted data when saved to the db? |
|
690 | - if (EE_Registry::instance()->CFG->admin->encode_session_data()) { |
|
691 | - $session_data = base64_encode($session_data); |
|
692 | - } |
|
687 | + // then serialize all of our session data |
|
688 | + $session_data = serialize($this->_session_data); |
|
689 | + // do we need to also encode it to avoid corrupted data when saved to the db? |
|
690 | + if (EE_Registry::instance()->CFG->admin->encode_session_data()) { |
|
691 | + $session_data = base64_encode($session_data); |
|
692 | + } |
|
693 | 693 | // encrypt it if we are using encryption |
694 | 694 | $session_data = $this->_use_encryption ? $this->encryption->encrypt( $session_data ) : $session_data; |
695 | 695 | // maybe save hash check |