@@ -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,50 +407,50 @@ 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 | 418 | $amount = (float) $amount; |
419 | 419 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
420 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
420 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
421 | 421 | // still a number or was amount converted to a string like "free" ? |
422 | - if ( is_float( $amount_formatted )) { |
|
422 | + if (is_float($amount_formatted)) { |
|
423 | 423 | // was a country ISO code passed ? if so generate currency config object for that country |
424 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
424 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
425 | 425 | // verify results |
426 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
426 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
427 | 427 | // set default config country currency settings |
428 | 428 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
429 | 429 | } |
430 | 430 | // format float |
431 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
431 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
432 | 432 | // add formatting ? |
433 | - if ( ! $return_raw ) { |
|
433 | + if ( ! $return_raw) { |
|
434 | 434 | // add currency sign |
435 | - if( $mny->sign_b4 ){ |
|
436 | - if( $amount >= 0 ){ |
|
437 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
438 | - }else{ |
|
439 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
435 | + if ($mny->sign_b4) { |
|
436 | + if ($amount >= 0) { |
|
437 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
438 | + } else { |
|
439 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
440 | 440 | } |
441 | 441 | |
442 | - }else{ |
|
443 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
442 | + } else { |
|
443 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | // add currency code ? |
447 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
447 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
448 | 448 | } |
449 | 449 | // filter results |
450 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
450 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
451 | 451 | } |
452 | 452 | // clean up vars |
453 | - unset( $mny ); |
|
453 | + unset($mny); |
|
454 | 454 | // return formatted currency amount |
455 | 455 | return $amount_formatted; |
456 | 456 | } |
@@ -465,11 +465,11 @@ discard block |
||
465 | 465 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
466 | 466 | * @return string The localized label for the status id. |
467 | 467 | */ |
468 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
468 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
469 | 469 | /** @type EEM_Status $EEM_Status */ |
470 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
471 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
472 | - return $status[ $status_id ]; |
|
470 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
471 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
472 | + return $status[$status_id]; |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | |
@@ -482,9 +482,9 @@ discard block |
||
482 | 482 | * @param string $icon |
483 | 483 | * @return string the html output for the button |
484 | 484 | */ |
485 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) { |
|
486 | - $label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label; |
|
487 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>'; |
|
485 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') { |
|
486 | + $label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label; |
|
487 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>'; |
|
488 | 488 | return $button; |
489 | 489 | } |
490 | 490 | |
@@ -501,21 +501,21 @@ discard block |
||
501 | 501 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
502 | 502 | * @return string generated link |
503 | 503 | */ |
504 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
504 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
505 | 505 | |
506 | - if ( ! $page ) |
|
507 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
506 | + if ( ! $page) |
|
507 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
508 | 508 | |
509 | - if ( ! $action ) |
|
510 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
509 | + if ( ! $action) |
|
510 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
511 | 511 | |
512 | 512 | $action = empty($action) ? 'default' : $action; |
513 | 513 | |
514 | 514 | |
515 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
516 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
517 | - $help_text = !$help_text ? '' : $help_text; |
|
518 | - 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>'; |
|
515 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
516 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
517 | + $help_text = ! $help_text ? '' : $help_text; |
|
518 | + 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>'; |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | |
@@ -527,31 +527,31 @@ discard block |
||
527 | 527 | * @param EE_Help_Tour |
528 | 528 | * @return string html |
529 | 529 | */ |
530 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
530 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
531 | 531 | $id = $tour->get_slug(); |
532 | 532 | $stops = $tour->get_stops(); |
533 | 533 | |
534 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
534 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
535 | 535 | |
536 | - foreach ( $stops as $stop ) { |
|
537 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
538 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
536 | + foreach ($stops as $stop) { |
|
537 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
538 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
539 | 539 | |
540 | 540 | //if container is set to modal then let's make sure we set the options accordingly |
541 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
541 | + if (empty($data_id) && empty($data_class)) { |
|
542 | 542 | $stop['options']['modal'] = true; |
543 | 543 | $stop['options']['expose'] = true; |
544 | 544 | } |
545 | 545 | |
546 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
547 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
546 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
547 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
548 | 548 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
549 | 549 | |
550 | 550 | //options |
551 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
551 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
552 | 552 | $options = ' data-options="'; |
553 | - foreach ( $stop['options'] as $option => $value ) { |
|
554 | - $options .= $option . ':' . $value . ';'; |
|
553 | + foreach ($stop['options'] as $option => $value) { |
|
554 | + $options .= $option.':'.$value.';'; |
|
555 | 555 | } |
556 | 556 | $options .= '"'; |
557 | 557 | } else { |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | } |
560 | 560 | |
561 | 561 | //let's put all together |
562 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
562 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | $content .= '</ol>'; |
@@ -580,31 +580,31 @@ discard block |
||
580 | 580 | * @throws EE_Error |
581 | 581 | * @return string html structure for status. |
582 | 582 | */ |
583 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
584 | - if ( !is_array( $status_array ) ) |
|
585 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
583 | + public static function status_legend($status_array, $active_status = '') { |
|
584 | + if ( ! is_array($status_array)) |
|
585 | + throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
586 | 586 | |
587 | 587 | $setup_array = array(); |
588 | - foreach ( $status_array as $item => $status ) { |
|
588 | + foreach ($status_array as $item => $status) { |
|
589 | 589 | $setup_array[$item] = array( |
590 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
591 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
590 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
591 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
592 | 592 | 'status' => $status |
593 | 593 | ); |
594 | 594 | } |
595 | 595 | |
596 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
597 | - $content .= '<h3>' . __('Status Legend', 'event_espresso') . '</h3>' . "\n"; |
|
598 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
599 | - foreach ( $setup_array as $item => $details ) { |
|
596 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
597 | + $content .= '<h3>'.__('Status Legend', 'event_espresso').'</h3>'."\n"; |
|
598 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
599 | + foreach ($setup_array as $item => $details) { |
|
600 | 600 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
601 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
602 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
603 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
604 | - $content .= '</dt>' . "\n"; |
|
601 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
602 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
603 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
604 | + $content .= '</dt>'."\n"; |
|
605 | 605 | } |
606 | - $content .= '</dl>' . "\n"; |
|
607 | - $content .= '</div>' . "\n"; |
|
606 | + $content .= '</dl>'."\n"; |
|
607 | + $content .= '</div>'."\n"; |
|
608 | 608 | return $content; |
609 | 609 | } |
610 | 610 | |
@@ -617,8 +617,8 @@ discard block |
||
617 | 617 | * @return string |
618 | 618 | */ |
619 | 619 | public static function layout_array_as_table($data) { |
620 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
621 | - $data = (array)$data; |
|
620 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
621 | + $data = (array) $data; |
|
622 | 622 | } |
623 | 623 | ob_start(); |
624 | 624 | if (is_array($data)) { |
@@ -631,10 +631,10 @@ discard block |
||
631 | 631 | ?> |
632 | 632 | <tr> |
633 | 633 | <td> |
634 | - <?php echo $data_key;?> |
|
634 | + <?php echo $data_key; ?> |
|
635 | 635 | </td> |
636 | 636 | <td> |
637 | - <?php echo self::layout_array_as_table($data_values);?> |
|
637 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
638 | 638 | </td> |
639 | 639 | </tr> |
640 | 640 | <?php |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | <ul> |
649 | 649 | <?php |
650 | 650 | foreach ($data as $datum) { |
651 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
651 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
652 | 652 | }?> |
653 | 653 | </ul> |
654 | 654 | <?php |
@@ -678,8 +678,8 @@ discard block |
||
678 | 678 | * |
679 | 679 | * @return string |
680 | 680 | */ |
681 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
682 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
681 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
682 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | |
@@ -703,13 +703,13 @@ discard block |
||
703 | 703 | * ) |
704 | 704 | * @return string |
705 | 705 | */ |
706 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
706 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
707 | 707 | $page_links = array(); |
708 | 708 | $disable_first = $disable_last = ''; |
709 | 709 | $total_items = (int) $total_items; |
710 | 710 | $per_page = (int) $per_page; |
711 | 711 | $current = (int) $current; |
712 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
712 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
713 | 713 | |
714 | 714 | //filter items_label |
715 | 715 | $items_label = apply_filters( |
@@ -717,68 +717,68 @@ discard block |
||
717 | 717 | $items_label |
718 | 718 | ); |
719 | 719 | |
720 | - if ( empty( $items_label ) |
|
721 | - || ! is_array( $items_label ) |
|
722 | - || ! isset( $items_label['single'] ) |
|
723 | - || ! isset( $items_label['plural'] ) ) { |
|
720 | + if (empty($items_label) |
|
721 | + || ! is_array($items_label) |
|
722 | + || ! isset($items_label['single']) |
|
723 | + || ! isset($items_label['plural'])) { |
|
724 | 724 | $items_label = array( |
725 | - 'single' => __( '1 item', 'event_espresso' ), |
|
726 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
725 | + 'single' => __('1 item', 'event_espresso'), |
|
726 | + 'plural' => __('%s items', 'event_espresso') |
|
727 | 727 | ); |
728 | 728 | } else { |
729 | 729 | $items_label = array( |
730 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
731 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
730 | + 'single' => '1 '.esc_html($items_label['single']), |
|
731 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
732 | 732 | ); |
733 | 733 | } |
734 | 734 | |
735 | - $total_pages = ceil( $total_items / $per_page ); |
|
735 | + $total_pages = ceil($total_items / $per_page); |
|
736 | 736 | |
737 | - if ( $total_pages <= 1 ) |
|
737 | + if ($total_pages <= 1) |
|
738 | 738 | return ''; |
739 | 739 | |
740 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
740 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
741 | 741 | |
742 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
742 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
743 | 743 | |
744 | - if ( $current === 1 ) { |
|
744 | + if ($current === 1) { |
|
745 | 745 | $disable_first = ' disabled'; |
746 | 746 | } |
747 | - if ( $current == $total_pages ) { |
|
747 | + if ($current == $total_pages) { |
|
748 | 748 | $disable_last = ' disabled'; |
749 | 749 | } |
750 | 750 | |
751 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
752 | - 'first-page' . $disable_first, |
|
753 | - esc_attr__( 'Go to the first page' ), |
|
754 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
751 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
752 | + 'first-page'.$disable_first, |
|
753 | + esc_attr__('Go to the first page'), |
|
754 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
755 | 755 | '«' |
756 | 756 | ); |
757 | 757 | |
758 | 758 | $page_links[] = sprintf( |
759 | 759 | '<a class="%s" title="%s" href="%s">%s</a>', |
760 | - 'prev-page' . $disable_first, |
|
761 | - esc_attr__( 'Go to the previous page' ), |
|
762 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
760 | + 'prev-page'.$disable_first, |
|
761 | + esc_attr__('Go to the previous page'), |
|
762 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
763 | 763 | '‹' |
764 | 764 | ); |
765 | 765 | |
766 | - if ( ! $show_num_field ) { |
|
766 | + if ( ! $show_num_field) { |
|
767 | 767 | $html_current_page = $current; |
768 | 768 | } else { |
769 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
770 | - esc_attr__( 'Current page' ), |
|
769 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
770 | + esc_attr__('Current page'), |
|
771 | 771 | $current, |
772 | - strlen( $total_pages ) |
|
772 | + strlen($total_pages) |
|
773 | 773 | ); |
774 | 774 | } |
775 | 775 | |
776 | 776 | $html_total_pages = sprintf( |
777 | 777 | '<span class="total-pages">%s</span>', |
778 | - number_format_i18n( $total_pages ) |
|
778 | + number_format_i18n($total_pages) |
|
779 | 779 | ); |
780 | 780 | $page_links[] = sprintf( |
781 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
781 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
782 | 782 | $html_current_page, |
783 | 783 | $html_total_pages, |
784 | 784 | '<span class="paging-input">', |
@@ -787,29 +787,29 @@ discard block |
||
787 | 787 | |
788 | 788 | $page_links[] = sprintf( |
789 | 789 | '<a class="%s" title="%s" href="%s">%s</a>', |
790 | - 'next-page' . $disable_last, |
|
791 | - esc_attr__( 'Go to the next page' ), |
|
792 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
790 | + 'next-page'.$disable_last, |
|
791 | + esc_attr__('Go to the next page'), |
|
792 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
793 | 793 | '›' |
794 | 794 | ); |
795 | 795 | |
796 | 796 | $page_links[] = sprintf( |
797 | 797 | '<a class="%s" title="%s" href="%s">%s</a>', |
798 | - 'last-page' . $disable_last, |
|
799 | - esc_attr__( 'Go to the last page' ), |
|
800 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
798 | + 'last-page'.$disable_last, |
|
799 | + esc_attr__('Go to the last page'), |
|
800 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
801 | 801 | '»' |
802 | 802 | ); |
803 | 803 | |
804 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
804 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
805 | 805 | // set page class |
806 | - if ( $total_pages ) { |
|
806 | + if ($total_pages) { |
|
807 | 807 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
808 | 808 | } else { |
809 | 809 | $page_class = ' no-pages'; |
810 | 810 | } |
811 | 811 | |
812 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
812 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
813 | 813 | } |
814 | 814 | |
815 | 815 | |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 ); |
826 | 826 | |
827 | 827 | |
828 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
828 | +if ( ! function_exists('espresso_pagination')) { |
|
829 | 829 | /** |
830 | 830 | * espresso_pagination |
831 | 831 | * |
@@ -837,21 +837,21 @@ discard block |
||
837 | 837 | $big = 999999999; // need an unlikely integer |
838 | 838 | $pagination = paginate_links( |
839 | 839 | array( |
840 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
840 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
841 | 841 | 'format' => '?paged=%#%', |
842 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
842 | + 'current' => max(1, get_query_var('paged')), |
|
843 | 843 | 'total' => $wp_query->max_num_pages, |
844 | 844 | 'show_all' => true, |
845 | 845 | 'end_size' => 10, |
846 | 846 | 'mid_size' => 6, |
847 | 847 | 'prev_next' => true, |
848 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
849 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
848 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
849 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
850 | 850 | 'type' => 'plain', |
851 | 851 | 'add_args' => false, |
852 | 852 | 'add_fragment' => '' |
853 | 853 | ) |
854 | 854 | ); |
855 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
855 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
856 | 856 | } |
857 | 857 | } |
858 | 858 | \ No newline at end of file |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
155 | 155 | * @access public |
156 | 156 | */ |
157 | - public function __construct( $routing = TRUE ) { |
|
157 | + public function __construct($routing = TRUE) { |
|
158 | 158 | |
159 | - if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) |
|
159 | + if (strpos($this->_get_dir(), 'caffeinated') !== false) |
|
160 | 160 | $this->_is_caf = TRUE; |
161 | 161 | |
162 | 162 | $this->_yes_no_values = array( |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | |
169 | 169 | //set the _req_data property. |
170 | - $this->_req_data = array_merge( $_GET, $_POST ); |
|
170 | + $this->_req_data = array_merge($_GET, $_POST); |
|
171 | 171 | |
172 | 172 | |
173 | 173 | //routing enabled? |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $this->_do_other_page_hooks(); |
189 | 189 | |
190 | 190 | //This just allows us to have extending clases do something specific before the parent constructor runs _page_setup. |
191 | - if ( method_exists( $this, '_before_page_setup' ) ) |
|
191 | + if (method_exists($this, '_before_page_setup')) |
|
192 | 192 | $this->_before_page_setup(); |
193 | 193 | |
194 | 194 | //set up page dependencies |
@@ -458,16 +458,16 @@ discard block |
||
458 | 458 | */ |
459 | 459 | protected function _global_ajax_hooks() { |
460 | 460 | //for lazy loading of metabox content |
461 | - add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 ); |
|
461 | + add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10); |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | |
465 | 465 | |
466 | 466 | public function ajax_metabox_content() { |
467 | - $contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : ''; |
|
468 | - $url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : ''; |
|
467 | + $contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : ''; |
|
468 | + $url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : ''; |
|
469 | 469 | |
470 | - self::cached_rss_display( $contentid, $url ); |
|
470 | + self::cached_rss_display($contentid, $url); |
|
471 | 471 | wp_die(); |
472 | 472 | } |
473 | 473 | |
@@ -486,87 +486,87 @@ discard block |
||
486 | 486 | //requires? |
487 | 487 | |
488 | 488 | //admin_init stuff - global - we're setting this REALLY early so if EE_Admin pages have to hook into other WP pages they can. But keep in mind, not everything is available from the EE_Admin Page object at this point. |
489 | - add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 ); |
|
489 | + add_action('admin_init', array($this, 'admin_init_global'), 5); |
|
490 | 490 | |
491 | 491 | |
492 | 492 | //next verify if we need to load anything... |
493 | - $this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : FALSE; |
|
494 | - $this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) ); |
|
493 | + $this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : FALSE; |
|
494 | + $this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this)))); |
|
495 | 495 | |
496 | 496 | global $ee_menu_slugs; |
497 | 497 | $ee_menu_slugs = (array) $ee_menu_slugs; |
498 | 498 | |
499 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
499 | + if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE; |
|
500 | 500 | |
501 | 501 | |
502 | 502 | // becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first |
503 | - if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) { |
|
504 | - $this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
503 | + if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) { |
|
504 | + $this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
505 | 505 | } |
506 | 506 | // then set blank or -1 action values to 'default' |
507 | - $this->_req_action = isset( $this->_req_data['action'] ) && ! empty( $this->_req_data['action'] ) && $this->_req_data['action'] != -1 ? sanitize_key( $this->_req_data['action'] ) : 'default'; |
|
507 | + $this->_req_action = isset($this->_req_data['action']) && ! empty($this->_req_data['action']) && $this->_req_data['action'] != -1 ? sanitize_key($this->_req_data['action']) : 'default'; |
|
508 | 508 | |
509 | 509 | //if action is 'default' after the above BUT we have 'route' var set, then let's use the route as the action. This covers cases where we're coming in from a list table that isn't on the default route. |
510 | - $this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action; |
|
510 | + $this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
|
511 | 511 | |
512 | 512 | //however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be |
513 | 513 | $this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
514 | 514 | |
515 | 515 | $this->_current_view = $this->_req_action; |
516 | - $this->_req_nonce = $this->_req_action . '_nonce'; |
|
516 | + $this->_req_nonce = $this->_req_action.'_nonce'; |
|
517 | 517 | $this->_define_page_props(); |
518 | 518 | |
519 | - $this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ), $this->_admin_base_url ); |
|
519 | + $this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url); |
|
520 | 520 | |
521 | 521 | //default things |
522 | - $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' ); |
|
522 | + $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box'); |
|
523 | 523 | |
524 | 524 | //set page configs |
525 | 525 | $this->_set_page_routes(); |
526 | 526 | $this->_set_page_config(); |
527 | 527 | |
528 | 528 | //let's include any referrer data in our default_query_args for this route for "stickiness". |
529 | - if ( isset( $this->_req_data['wp_referer'] ) ) { |
|
529 | + if (isset($this->_req_data['wp_referer'])) { |
|
530 | 530 | $this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer']; |
531 | 531 | } |
532 | 532 | |
533 | 533 | //for caffeinated and other extended functionality. If there is a _extend_page_config method then let's run that to modify the all the various page configuration arrays |
534 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
534 | + if (method_exists($this, '_extend_page_config')) |
|
535 | 535 | $this->_extend_page_config(); |
536 | 536 | |
537 | 537 | //for CPT and other extended functionality. If there is an _extend_page_config_for_cpt then let's run that to modify all the various page configuration arrays. |
538 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
538 | + if (method_exists($this, '_extend_page_config_for_cpt')) |
|
539 | 539 | $this->_extend_page_config_for_cpt(); |
540 | 540 | |
541 | 541 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
542 | - $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
|
543 | - $this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this ); |
|
542 | + $this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this); |
|
543 | + $this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this); |
|
544 | 544 | |
545 | 545 | |
546 | 546 | //if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action |
547 | - if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) { |
|
548 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 ); |
|
547 | + if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) { |
|
548 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | |
552 | 552 | //next route only if routing enabled |
553 | - if ( $this->_routing && !defined('DOING_AJAX') ) { |
|
553 | + if ($this->_routing && ! defined('DOING_AJAX')) { |
|
554 | 554 | |
555 | 555 | $this->_verify_routes(); |
556 | 556 | |
557 | 557 | //next let's just check user_access and kill if no access |
558 | 558 | $this->check_user_access(); |
559 | 559 | |
560 | - if ( $this->_is_UI_request ) { |
|
560 | + if ($this->_is_UI_request) { |
|
561 | 561 | //admin_init stuff - global, all views for this page class, specific view |
562 | - add_action( 'admin_init', array( $this, 'admin_init' ), 10 ); |
|
563 | - if ( method_exists( $this, 'admin_init_' . $this->_current_view )) { |
|
564 | - add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 ); |
|
562 | + add_action('admin_init', array($this, 'admin_init'), 10); |
|
563 | + if (method_exists($this, 'admin_init_'.$this->_current_view)) { |
|
564 | + add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15); |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | } else { |
568 | 568 | //hijack regular WP loading and route admin request immediately |
569 | - @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); |
|
569 | + @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT)); |
|
570 | 570 | $this->route_admin_request(); |
571 | 571 | } |
572 | 572 | } |
@@ -583,18 +583,18 @@ discard block |
||
583 | 583 | * @return void |
584 | 584 | */ |
585 | 585 | private function _do_other_page_hooks() { |
586 | - $registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() ); |
|
586 | + $registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array()); |
|
587 | 587 | |
588 | - foreach ( $registered_pages as $page ) { |
|
588 | + foreach ($registered_pages as $page) { |
|
589 | 589 | |
590 | 590 | //now let's setup the file name and class that should be present |
591 | 591 | $classname = str_replace('.class.php', '', $page); |
592 | 592 | |
593 | 593 | //autoloaders should take care of loading file |
594 | - if ( !class_exists( $classname ) ) { |
|
595 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page); |
|
596 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname ); |
|
597 | - throw new EE_Error( implode( '||', $error_msg )); |
|
594 | + if ( ! class_exists($classname)) { |
|
595 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page); |
|
596 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname); |
|
597 | + throw new EE_Error(implode('||', $error_msg)); |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | $a = new ReflectionClass($classname); |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | public function load_page_dependencies() { |
610 | 610 | try { |
611 | 611 | $this->_load_page_dependencies(); |
612 | - } catch ( EE_Error $e ) { |
|
612 | + } catch (EE_Error $e) { |
|
613 | 613 | $e->get_error(); |
614 | 614 | } |
615 | 615 | } |
@@ -627,16 +627,16 @@ discard block |
||
627 | 627 | $this->_current_screen = get_current_screen(); |
628 | 628 | |
629 | 629 | //load admin_notices - global, page class, and view specific |
630 | - add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 ); |
|
631 | - add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 ); |
|
632 | - if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) { |
|
633 | - add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 ); |
|
630 | + add_action('admin_notices', array($this, 'admin_notices_global'), 5); |
|
631 | + add_action('admin_notices', array($this, 'admin_notices'), 10); |
|
632 | + if (method_exists($this, 'admin_notices_'.$this->_current_view)) { |
|
633 | + add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15); |
|
634 | 634 | } |
635 | 635 | |
636 | 636 | //load network admin_notices - global, page class, and view specific |
637 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 ); |
|
638 | - if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) { |
|
639 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) ); |
|
637 | + add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5); |
|
638 | + if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) { |
|
639 | + add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view)); |
|
640 | 640 | } |
641 | 641 | |
642 | 642 | //this will save any per_page screen options if they are present |
@@ -652,8 +652,8 @@ discard block |
||
652 | 652 | //add screen options - global, page child class, and view specific |
653 | 653 | $this->_add_global_screen_options(); |
654 | 654 | $this->_add_screen_options(); |
655 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
656 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
655 | + if (method_exists($this, '_add_screen_options_'.$this->_current_view)) |
|
656 | + call_user_func(array($this, '_add_screen_options_'.$this->_current_view)); |
|
657 | 657 | |
658 | 658 | |
659 | 659 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -664,33 +664,33 @@ discard block |
||
664 | 664 | //add feature_pointers - global, page child class, and view specific |
665 | 665 | $this->_add_feature_pointers(); |
666 | 666 | $this->_add_global_feature_pointers(); |
667 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
668 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
667 | + if (method_exists($this, '_add_feature_pointer_'.$this->_current_view)) |
|
668 | + call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view)); |
|
669 | 669 | |
670 | 670 | //enqueue scripts/styles - global, page class, and view specific |
671 | - add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
|
672 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
|
673 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
674 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
671 | + add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5); |
|
672 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10); |
|
673 | + if (method_exists($this, 'load_scripts_styles_'.$this->_current_view)) |
|
674 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15); |
|
675 | 675 | |
676 | - add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
|
676 | + add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100); |
|
677 | 677 | |
678 | 678 | //admin_print_footer_scripts - global, page child class, and view specific. NOTE, despite the name, whenever possible, scripts should NOT be loaded using this. In most cases that's doing_it_wrong(). But adding hidden container elements etc. is a good use case. Notice the late priority we're giving these |
679 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
|
680 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
|
681 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
682 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
679 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99); |
|
680 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100); |
|
681 | + if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view)) |
|
682 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101); |
|
683 | 683 | |
684 | 684 | //admin footer scripts |
685 | - add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
|
686 | - add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
|
687 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
688 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
685 | + add_action('admin_footer', array($this, 'admin_footer_global'), 99); |
|
686 | + add_action('admin_footer', array($this, 'admin_footer'), 100); |
|
687 | + if (method_exists($this, 'admin_footer_'.$this->_current_view)) |
|
688 | + add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101); |
|
689 | 689 | |
690 | 690 | |
691 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
|
691 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug); |
|
692 | 692 | //targeted hook |
693 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action ); |
|
693 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action); |
|
694 | 694 | |
695 | 695 | } |
696 | 696 | |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | private function _set_defaults() { |
706 | 706 | $this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL; |
707 | 707 | |
708 | - $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
708 | + $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
709 | 709 | |
710 | 710 | $this->default_nav_tab_name = 'overview'; |
711 | 711 | |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | public function route_admin_request() { |
733 | 733 | try { |
734 | 734 | $this->_route_admin_request(); |
735 | - } catch ( EE_Error $e ) { |
|
735 | + } catch (EE_Error $e) { |
|
736 | 736 | $e->get_error(); |
737 | 737 | } |
738 | 738 | } |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | $this->_wp_page_slug = $wp_page_slug; |
744 | 744 | |
745 | 745 | //if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls... |
746 | - if ( is_network_admin() ) { |
|
746 | + if (is_network_admin()) { |
|
747 | 747 | $this->_wp_page_slug .= '-network'; |
748 | 748 | } |
749 | 749 | } |
@@ -756,53 +756,53 @@ discard block |
||
756 | 756 | * @return void |
757 | 757 | */ |
758 | 758 | protected function _verify_routes() { |
759 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
759 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
760 | 760 | |
761 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE; |
|
761 | + if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE; |
|
762 | 762 | |
763 | 763 | $this->_route = FALSE; |
764 | 764 | $func = FALSE; |
765 | 765 | $args = array(); |
766 | 766 | |
767 | 767 | // check that the page_routes array is not empty |
768 | - if ( empty( $this->_page_routes )) { |
|
768 | + if (empty($this->_page_routes)) { |
|
769 | 769 | // user error msg |
770 | - $error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title ); |
|
770 | + $error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
771 | 771 | // developer error msg |
772 | - $error_msg .= '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' ); |
|
773 | - throw new EE_Error( $error_msg ); |
|
772 | + $error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso'); |
|
773 | + throw new EE_Error($error_msg); |
|
774 | 774 | } |
775 | 775 | |
776 | 776 | // and that the requested page route exists |
777 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
778 | - $this->_route = $this->_page_routes[ $this->_req_action ]; |
|
777 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
778 | + $this->_route = $this->_page_routes[$this->_req_action]; |
|
779 | 779 | $this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array(); |
780 | 780 | } else { |
781 | 781 | // user error msg |
782 | - $error_msg = sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
782 | + $error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
783 | 783 | // developer error msg |
784 | - $error_msg .= '||' . $error_msg . sprintf( __( ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso' ), $this->_req_action ); |
|
785 | - throw new EE_Error( $error_msg ); |
|
784 | + $error_msg .= '||'.$error_msg.sprintf(__(' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso'), $this->_req_action); |
|
785 | + throw new EE_Error($error_msg); |
|
786 | 786 | } |
787 | 787 | |
788 | 788 | // and that a default route exists |
789 | - if ( ! array_key_exists( 'default', $this->_page_routes )) { |
|
789 | + if ( ! array_key_exists('default', $this->_page_routes)) { |
|
790 | 790 | // user error msg |
791 | - $error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
791 | + $error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title); |
|
792 | 792 | // developer error msg |
793 | - $error_msg .= '||' . $error_msg . __( ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso' ); |
|
794 | - throw new EE_Error( $error_msg ); |
|
793 | + $error_msg .= '||'.$error_msg.__(' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso'); |
|
794 | + throw new EE_Error($error_msg); |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | |
798 | 798 | //first lets' catch if the UI request has EVER been set. |
799 | - if ( $this->_is_UI_request === NULL ) { |
|
799 | + if ($this->_is_UI_request === NULL) { |
|
800 | 800 | //lets set if this is a UI request or not. |
801 | - $this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE; |
|
801 | + $this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE; |
|
802 | 802 | |
803 | 803 | |
804 | 804 | //wait a minute... we might have a noheader in the route array |
805 | - $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
805 | + $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
806 | 806 | } |
807 | 807 | |
808 | 808 | $this->_set_current_labels(); |
@@ -817,15 +817,15 @@ discard block |
||
817 | 817 | * @param string $route the route name we're verifying |
818 | 818 | * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
819 | 819 | */ |
820 | - protected function _verify_route( $route ) { |
|
821 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
820 | + protected function _verify_route($route) { |
|
821 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
822 | 822 | return true; |
823 | 823 | } else { |
824 | 824 | // user error msg |
825 | - $error_msg = sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
825 | + $error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
826 | 826 | // developer error msg |
827 | - $error_msg .= '||' . $error_msg . sprintf( __( ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso' ), $route ); |
|
828 | - throw new EE_Error( $error_msg ); |
|
827 | + $error_msg .= '||'.$error_msg.sprintf(__(' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso'), $route); |
|
828 | + throw new EE_Error($error_msg); |
|
829 | 829 | } |
830 | 830 | } |
831 | 831 | |
@@ -839,18 +839,18 @@ discard block |
||
839 | 839 | * @param string $nonce_ref The nonce reference string (name0) |
840 | 840 | * @return mixed (bool|die) |
841 | 841 | */ |
842 | - protected function _verify_nonce( $nonce, $nonce_ref ) { |
|
842 | + protected function _verify_nonce($nonce, $nonce_ref) { |
|
843 | 843 | // verify nonce against expected value |
844 | - if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) { |
|
844 | + if ( ! wp_verify_nonce($nonce, $nonce_ref)) { |
|
845 | 845 | // these are not the droids you are looking for !!! |
846 | - $msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' ); |
|
847 | - if ( WP_DEBUG ) { |
|
848 | - $msg .= "\n " . sprintf( __('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso' ), __CLASS__ ); |
|
846 | + $msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>'); |
|
847 | + if (WP_DEBUG) { |
|
848 | + $msg .= "\n ".sprintf(__('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso'), __CLASS__); |
|
849 | 849 | } |
850 | - if ( ! defined( 'DOING_AJAX' )) { |
|
851 | - wp_die( $msg ); |
|
850 | + if ( ! defined('DOING_AJAX')) { |
|
851 | + wp_die($msg); |
|
852 | 852 | } else { |
853 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
853 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
854 | 854 | $this->_return_json(); |
855 | 855 | } |
856 | 856 | } |
@@ -868,63 +868,63 @@ discard block |
||
868 | 868 | * @return void |
869 | 869 | */ |
870 | 870 | protected function _route_admin_request() { |
871 | - if ( ! $this->_is_UI_request ) |
|
871 | + if ( ! $this->_is_UI_request) |
|
872 | 872 | $this->_verify_routes(); |
873 | 873 | |
874 | - $nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE; |
|
874 | + $nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE; |
|
875 | 875 | |
876 | - if ( $this->_req_action != 'default' && $nonce_check ) { |
|
876 | + if ($this->_req_action != 'default' && $nonce_check) { |
|
877 | 877 | // set nonce from post data |
878 | - $nonce = isset($this->_req_data[ $this->_req_nonce ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce ] ) : ''; |
|
879 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
878 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
879 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
880 | 880 | } |
881 | 881 | //set the nav_tabs array but ONLY if this is UI_request |
882 | - if ( $this->_is_UI_request ) |
|
882 | + if ($this->_is_UI_request) |
|
883 | 883 | $this->_set_nav_tabs(); |
884 | 884 | |
885 | 885 | // grab callback function |
886 | - $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
|
886 | + $func = is_array($this->_route) ? $this->_route['func'] : $this->_route; |
|
887 | 887 | |
888 | 888 | // check if callback has args |
889 | - $args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array(); |
|
889 | + $args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array(); |
|
890 | 890 | |
891 | 891 | $error_msg = ''; |
892 | 892 | |
893 | 893 | //action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request') |
894 | - if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
895 | - do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this ); |
|
894 | + if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
895 | + do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this); |
|
896 | 896 | } |
897 | 897 | |
898 | 898 | //right before calling the route, let's remove _wp_http_referer from the $_SERVER[REQUEST_URI] global (its now in _req_data for route processing). |
899 | - $_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
899 | + $_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI'])); |
|
900 | 900 | |
901 | - if ( ! empty( $func )) { |
|
901 | + if ( ! empty($func)) { |
|
902 | 902 | $base_call = $addon_call = FALSE; |
903 | 903 | //try to access page route via this class |
904 | - if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func ), $args ) ) === FALSE ) { |
|
904 | + if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) { |
|
905 | 905 | // user error msg |
906 | - $error_msg = __( 'An error occurred. The requested page route could not be found.', 'event_espresso' ); |
|
906 | + $error_msg = __('An error occurred. The requested page route could not be found.', 'event_espresso'); |
|
907 | 907 | // developer error msg |
908 | - $error_msg .= '||' . sprintf( __( 'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso' ), $func ); |
|
908 | + $error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso'), $func); |
|
909 | 909 | } |
910 | 910 | |
911 | 911 | //for pluggability by addons first let's see if just the function exists (this will also work in the case where $func is an array indicating class/method) |
912 | 912 | $args['admin_page_object'] = $this; //send along this admin page object for access by addons. |
913 | 913 | |
914 | - if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) { |
|
915 | - $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' ); |
|
916 | - $error_msg .= '||' . sprintf( __('Page route "%s" could not be called. Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func ); |
|
914 | + if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) { |
|
915 | + $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso'); |
|
916 | + $error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func); |
|
917 | 917 | } |
918 | 918 | |
919 | 919 | |
920 | - if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) |
|
921 | - throw new EE_Error( $error_msg ); |
|
920 | + if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE) |
|
921 | + throw new EE_Error($error_msg); |
|
922 | 922 | } |
923 | 923 | |
924 | 924 | //if we've routed and this route has a no headers route AND a sent_headers_route, then we need to reset the routing properties to the new route. |
925 | 925 | //now if UI request is FALSE and noheader is true AND we have a headers_sent_route in the route array then let's set UI_request to true because the no header route has a second func after headers have been sent. |
926 | - if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) { |
|
927 | - $this->_reset_routing_properties( $this->_route['headers_sent_route'] ); |
|
926 | + if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) { |
|
927 | + $this->_reset_routing_properties($this->_route['headers_sent_route']); |
|
928 | 928 | } |
929 | 929 | } |
930 | 930 | |
@@ -940,7 +940,7 @@ discard block |
||
940 | 940 | * @param string $new_route New (non header) route to redirect to. |
941 | 941 | * @return void |
942 | 942 | */ |
943 | - protected function _reset_routing_properties( $new_route ) { |
|
943 | + protected function _reset_routing_properties($new_route) { |
|
944 | 944 | $this->_is_UI_request = TRUE; |
945 | 945 | //now we set the current route to whatever the headers_sent_route is set at |
946 | 946 | $this->_req_data['action'] = $new_route; |
@@ -986,23 +986,23 @@ discard block |
||
986 | 986 | * @param bool $exclude_nonce If true, the the nonce will be excluded from the generated nonce. |
987 | 987 | * @return string |
988 | 988 | */ |
989 | - public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) { |
|
989 | + public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) { |
|
990 | 990 | |
991 | 991 | //if there is a _wp_http_referer include the values from the request but only if sticky = true |
992 | - if ( $sticky ) { |
|
992 | + if ($sticky) { |
|
993 | 993 | $request = $_REQUEST; |
994 | - unset( $request['_wp_http_referer'] ); |
|
995 | - unset( $request['wp_referer'] ); |
|
996 | - foreach ( $request as $key => $value ) { |
|
994 | + unset($request['_wp_http_referer']); |
|
995 | + unset($request['wp_referer']); |
|
996 | + foreach ($request as $key => $value) { |
|
997 | 997 | //do not add nonces |
998 | - if ( strpos( $key, 'nonce' ) !== false ) { |
|
998 | + if (strpos($key, 'nonce') !== false) { |
|
999 | 999 | continue; |
1000 | 1000 | } |
1001 | - $args['wp_referer[' . $key . ']'] = $value; |
|
1001 | + $args['wp_referer['.$key.']'] = $value; |
|
1002 | 1002 | } |
1003 | 1003 | } |
1004 | 1004 | |
1005 | - return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce ); |
|
1005 | + return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce); |
|
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | |
@@ -1018,8 +1018,8 @@ discard block |
||
1018 | 1018 | * @uses EEH_Template::get_help_tab_link() |
1019 | 1019 | * @return string generated link |
1020 | 1020 | */ |
1021 | - protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) { |
|
1022 | - return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text ); |
|
1021 | + protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) { |
|
1022 | + return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text); |
|
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | |
@@ -1036,30 +1036,30 @@ discard block |
||
1036 | 1036 | */ |
1037 | 1037 | protected function _add_help_tabs() { |
1038 | 1038 | $tour_buttons = ''; |
1039 | - if ( isset( $this->_page_config[$this->_req_action] ) ) { |
|
1039 | + if (isset($this->_page_config[$this->_req_action])) { |
|
1040 | 1040 | $config = $this->_page_config[$this->_req_action]; |
1041 | 1041 | |
1042 | 1042 | //is there a help tour for the current route? if there is let's setup the tour buttons |
1043 | - if ( isset( $this->_help_tour[$this->_req_action]) ) { |
|
1043 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1044 | 1044 | $tb = array(); |
1045 | 1045 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1046 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1046 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1047 | 1047 | //if this is the end tour then we don't need to setup a button |
1048 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1048 | + if ($tour instanceof EE_Help_Tour_final_stop) |
|
1049 | 1049 | continue; |
1050 | - $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
|
1050 | + $tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>'; |
|
1051 | 1051 | } |
1052 | 1052 | $tour_buttons .= implode('<br />', $tb); |
1053 | 1053 | $tour_buttons .= '</div></div>'; |
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1057 | - if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
|
1057 | + if (is_array($config) && isset($config['help_sidebar'])) { |
|
1058 | 1058 | //check that the callback given is valid |
1059 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1060 | - throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option. However the callback given (%s) is not a valid callback. Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) ); |
|
1059 | + if ( ! method_exists($this, $config['help_sidebar'])) |
|
1060 | + throw new EE_Error(sprintf(__('The _page_config array has a callback set for the "help_sidebar" option. However the callback given (%s) is not a valid callback. Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this))); |
|
1061 | 1061 | |
1062 | - $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
|
1062 | + $content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar']))); |
|
1063 | 1063 | |
1064 | 1064 | $content .= $tour_buttons; //add help tour buttons. |
1065 | 1065 | |
@@ -1068,49 +1068,49 @@ discard block |
||
1068 | 1068 | } |
1069 | 1069 | |
1070 | 1070 | //if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar. |
1071 | - if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) { |
|
1071 | + if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) { |
|
1072 | 1072 | $this->_current_screen->set_help_sidebar($tour_buttons); |
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | //handle if no help_tabs are set so the sidebar will still show for the help tour buttons |
1076 | - if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) { |
|
1076 | + if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) { |
|
1077 | 1077 | $_ht['id'] = $this->page_slug; |
1078 | 1078 | $_ht['title'] = __('Help Tours', 'event_espresso'); |
1079 | - $_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>'; |
|
1079 | + $_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>'; |
|
1080 | 1080 | $this->_current_screen->add_help_tab($_ht); |
1081 | 1081 | }/**/ |
1082 | 1082 | |
1083 | 1083 | |
1084 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1084 | + if ( ! isset($config['help_tabs'])) return; //no help tabs for this route |
|
1085 | 1085 | |
1086 | - foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
|
1086 | + foreach ((array) $config['help_tabs'] as $tab_id => $cfg) { |
|
1087 | 1087 | //we're here so there ARE help tabs! |
1088 | 1088 | |
1089 | 1089 | //make sure we've got what we need |
1090 | - if ( !isset( $cfg['title'] ) ) |
|
1091 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1090 | + if ( ! isset($cfg['title'])) |
|
1091 | + throw new EE_Error(__('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso')); |
|
1092 | 1092 | |
1093 | 1093 | |
1094 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1095 | - throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') ); |
|
1094 | + if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) |
|
1095 | + throw new EE_Error(__('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso')); |
|
1096 | 1096 | |
1097 | 1097 | |
1098 | 1098 | |
1099 | 1099 | //first priority goes to content. |
1100 | - if ( !empty($cfg['content'] ) ) { |
|
1101 | - $content = !empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1100 | + if ( ! empty($cfg['content'])) { |
|
1101 | + $content = ! empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1102 | 1102 | |
1103 | 1103 | //second priority goes to filename |
1104 | - } else if ( !empty($cfg['filename'] ) ) { |
|
1105 | - $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php'; |
|
1104 | + } else if ( ! empty($cfg['filename'])) { |
|
1105 | + $file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php'; |
|
1106 | 1106 | |
1107 | 1107 | |
1108 | 1108 | //it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too) |
1109 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path; |
|
1109 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path; |
|
1110 | 1110 | |
1111 | 1111 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1112 | - if ( !is_readable($file_path) && !isset($cfg['callback']) ) { |
|
1113 | - EE_Error::add_error( sprintf( __('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content. Please check that the string you set for the help tab on this route (%s) is the correct spelling. The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1112 | + if ( ! is_readable($file_path) && ! isset($cfg['callback'])) { |
|
1113 | + EE_Error::add_error(sprintf(__('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content. Please check that the string you set for the help tab on this route (%s) is the correct spelling. The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path), __FILE__, __FUNCTION__, __LINE__); |
|
1114 | 1114 | return; |
1115 | 1115 | } |
1116 | 1116 | $template_args['admin_page_obj'] = $this; |
@@ -1121,21 +1121,21 @@ discard block |
||
1121 | 1121 | |
1122 | 1122 | |
1123 | 1123 | //check if callback is valid |
1124 | - if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) { |
|
1125 | - EE_Error::add_error( sprintf( __('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content. Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title'] ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1124 | + if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) { |
|
1125 | + EE_Error::add_error(sprintf(__('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content. Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title']), __FILE__, __FUNCTION__, __LINE__); |
|
1126 | 1126 | return; |
1127 | 1127 | } |
1128 | 1128 | |
1129 | 1129 | //setup config array for help tab method |
1130 | - $id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id; |
|
1130 | + $id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id; |
|
1131 | 1131 | $_ht = array( |
1132 | 1132 | 'id' => $id, |
1133 | 1133 | 'title' => $cfg['title'], |
1134 | - 'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL, |
|
1134 | + 'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL, |
|
1135 | 1135 | 'content' => $content |
1136 | 1136 | ); |
1137 | 1137 | |
1138 | - $this->_current_screen->add_help_tab( $_ht ); |
|
1138 | + $this->_current_screen->add_help_tab($_ht); |
|
1139 | 1139 | } |
1140 | 1140 | } |
1141 | 1141 | } |
@@ -1155,49 +1155,49 @@ discard block |
||
1155 | 1155 | $this->_help_tour = array(); |
1156 | 1156 | |
1157 | 1157 | //exit early if help tours are turned off globally |
1158 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1158 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)) |
|
1159 | 1159 | return; |
1160 | 1160 | |
1161 | 1161 | //loop through _page_config to find any help_tour defined |
1162 | - foreach ( $this->_page_config as $route => $config ) { |
|
1162 | + foreach ($this->_page_config as $route => $config) { |
|
1163 | 1163 | //we're only going to set things up for this route |
1164 | - if ( $route !== $this->_req_action ) |
|
1164 | + if ($route !== $this->_req_action) |
|
1165 | 1165 | continue; |
1166 | 1166 | |
1167 | - if ( isset( $config['help_tour'] ) ) { |
|
1167 | + if (isset($config['help_tour'])) { |
|
1168 | 1168 | |
1169 | - foreach( $config['help_tour'] as $tour ) { |
|
1170 | - $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php'; |
|
1169 | + foreach ($config['help_tour'] as $tour) { |
|
1170 | + $file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php'; |
|
1171 | 1171 | //let's see if we can get that file... if not its possible this is a decaf route not set in caffienated so lets try and get the caffeinated equivalent |
1172 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path; |
|
1172 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path; |
|
1173 | 1173 | |
1174 | 1174 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1175 | - if ( !is_readable($file_path) ) { |
|
1176 | - EE_Error::add_error( sprintf( __('The file path given for the help tour (%s) is not a valid path. Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1175 | + if ( ! is_readable($file_path)) { |
|
1176 | + EE_Error::add_error(sprintf(__('The file path given for the help tour (%s) is not a valid path. Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour), __FILE__, __FUNCTION__, __LINE__); |
|
1177 | 1177 | return; |
1178 | 1178 | } |
1179 | 1179 | |
1180 | 1180 | require_once $file_path; |
1181 | - if ( !class_exists( $tour ) ) { |
|
1182 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour); |
|
1183 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this) ); |
|
1184 | - throw new EE_Error( implode( '||', $error_msg )); |
|
1181 | + if ( ! class_exists($tour)) { |
|
1182 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour); |
|
1183 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this)); |
|
1184 | + throw new EE_Error(implode('||', $error_msg)); |
|
1185 | 1185 | } |
1186 | 1186 | $a = new ReflectionClass($tour); |
1187 | 1187 | $tour_obj = $a->newInstance($this->_is_caf); |
1188 | 1188 | |
1189 | 1189 | $tours[] = $tour_obj; |
1190 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj ); |
|
1190 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj); |
|
1191 | 1191 | } |
1192 | 1192 | |
1193 | 1193 | //let's inject the end tour stop element common to all pages... this will only get seen once per machine. |
1194 | 1194 | $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf); |
1195 | 1195 | $tours[] = $end_stop_tour; |
1196 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour ); |
|
1196 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour); |
|
1197 | 1197 | } |
1198 | 1198 | } |
1199 | 1199 | |
1200 | - if ( !empty( $tours ) ) |
|
1200 | + if ( ! empty($tours)) |
|
1201 | 1201 | $this->_help_tour['tours'] = $tours; |
1202 | 1202 | |
1203 | 1203 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
@@ -1213,12 +1213,12 @@ discard block |
||
1213 | 1213 | * @return void |
1214 | 1214 | */ |
1215 | 1215 | protected function _add_qtips() { |
1216 | - if ( isset( $this->_route_config['qtips'] ) ) { |
|
1216 | + if (isset($this->_route_config['qtips'])) { |
|
1217 | 1217 | $qtips = (array) $this->_route_config['qtips']; |
1218 | 1218 | //load qtip loader |
1219 | 1219 | $path = array( |
1220 | - $this->_get_dir() . '/qtips/', |
|
1221 | - EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/' |
|
1220 | + $this->_get_dir().'/qtips/', |
|
1221 | + EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/' |
|
1222 | 1222 | ); |
1223 | 1223 | EEH_Qtip_Loader::instance()->register($qtips, $path); |
1224 | 1224 | } |
@@ -1235,41 +1235,41 @@ discard block |
||
1235 | 1235 | * @return void |
1236 | 1236 | */ |
1237 | 1237 | protected function _set_nav_tabs() { |
1238 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1238 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1239 | 1239 | $i = 0; |
1240 | - foreach ( $this->_page_config as $slug => $config ) { |
|
1241 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1240 | + foreach ($this->_page_config as $slug => $config) { |
|
1241 | + if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav']))) |
|
1242 | 1242 | continue; //no nav tab for this config |
1243 | 1243 | |
1244 | 1244 | //check for persistent flag |
1245 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1245 | + if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action) |
|
1246 | 1246 | continue; //nav tab is only to appear when route requested. |
1247 | 1247 | |
1248 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1248 | + if ( ! $this->check_user_access($slug, TRUE)) |
|
1249 | 1249 | continue; //no nav tab becasue current user does not have access. |
1250 | 1250 | |
1251 | - $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
|
1251 | + $css_class = isset($config['css_class']) ? $config['css_class'].' ' : ''; |
|
1252 | 1252 | $this->_nav_tabs[$slug] = array( |
1253 | - 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ), |
|
1254 | - 'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ), |
|
1255 | - 'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class, |
|
1256 | - 'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i |
|
1253 | + 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url), |
|
1254 | + 'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)), |
|
1255 | + 'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class, |
|
1256 | + 'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i |
|
1257 | 1257 | ); |
1258 | 1258 | $i++; |
1259 | 1259 | } |
1260 | 1260 | |
1261 | 1261 | //if $this->_nav_tabs is empty then lets set the default |
1262 | - if ( empty( $this->_nav_tabs ) ) { |
|
1262 | + if (empty($this->_nav_tabs)) { |
|
1263 | 1263 | $this->_nav_tabs[$this->default_nav_tab_name] = array( |
1264 | 1264 | 'url' => $this->admin_base_url, |
1265 | - 'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ), |
|
1265 | + 'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)), |
|
1266 | 1266 | 'css_class' => 'nav-tab-active', |
1267 | 1267 | 'order' => 10 |
1268 | 1268 | ); |
1269 | 1269 | } |
1270 | 1270 | |
1271 | 1271 | //now let's sort the tabs according to order |
1272 | - usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' )); |
|
1272 | + usort($this->_nav_tabs, array($this, '_sort_nav_tabs')); |
|
1273 | 1273 | |
1274 | 1274 | } |
1275 | 1275 | |
@@ -1285,10 +1285,10 @@ discard block |
||
1285 | 1285 | * @return void |
1286 | 1286 | */ |
1287 | 1287 | private function _set_current_labels() { |
1288 | - if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) { |
|
1289 | - foreach ( $this->_route_config['labels'] as $label => $text ) { |
|
1290 | - if ( is_array($text) ) { |
|
1291 | - foreach ( $text as $sublabel => $subtext ) { |
|
1288 | + if (is_array($this->_route_config) && isset($this->_route_config['labels'])) { |
|
1289 | + foreach ($this->_route_config['labels'] as $label => $text) { |
|
1290 | + if (is_array($text)) { |
|
1291 | + foreach ($text as $sublabel => $subtext) { |
|
1292 | 1292 | $this->_labels[$label][$sublabel] = $subtext; |
1293 | 1293 | } |
1294 | 1294 | } else { |
@@ -1309,24 +1309,24 @@ discard block |
||
1309 | 1309 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1310 | 1310 | * @return BOOL|wp_die() |
1311 | 1311 | */ |
1312 | - public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
|
1313 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1314 | - $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
|
1315 | - $capability = ! empty( $route_to_check ) && isset( $this->_page_routes[$route_to_check] ) && is_array( $this->_page_routes[$route_to_check] ) && ! empty( $this->_page_routes[$route_to_check]['capability'] ) ? $this->_page_routes[$route_to_check]['capability'] : NULL; |
|
1312 | + public function check_user_access($route_to_check = '', $verify_only = FALSE) { |
|
1313 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1314 | + $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check; |
|
1315 | + $capability = ! empty($route_to_check) && isset($this->_page_routes[$route_to_check]) && is_array($this->_page_routes[$route_to_check]) && ! empty($this->_page_routes[$route_to_check]['capability']) ? $this->_page_routes[$route_to_check]['capability'] : NULL; |
|
1316 | 1316 | |
1317 | - if ( empty( $capability ) && empty( $route_to_check ) ) { |
|
1318 | - $capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability']; |
|
1317 | + if (empty($capability) && empty($route_to_check)) { |
|
1318 | + $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability']; |
|
1319 | 1319 | } else { |
1320 | - $capability = empty( $capability ) ? 'manage_options' : $capability; |
|
1320 | + $capability = empty($capability) ? 'manage_options' : $capability; |
|
1321 | 1321 | } |
1322 | 1322 | |
1323 | - $id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0; |
|
1323 | + $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0; |
|
1324 | 1324 | |
1325 | - if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) { |
|
1326 | - if ( $verify_only ) { |
|
1325 | + if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) { |
|
1326 | + if ($verify_only) { |
|
1327 | 1327 | return FALSE; |
1328 | 1328 | } else { |
1329 | - wp_die( __('You do not have access to this route.', 'event_espresso' ) ); |
|
1329 | + wp_die(__('You do not have access to this route.', 'event_espresso')); |
|
1330 | 1330 | } |
1331 | 1331 | } |
1332 | 1332 | return TRUE; |
@@ -1403,7 +1403,7 @@ discard block |
||
1403 | 1403 | $this->_add_admin_page_overlay(); |
1404 | 1404 | |
1405 | 1405 | //if metaboxes are present we need to add the nonce field |
1406 | - if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) { |
|
1406 | + if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) { |
|
1407 | 1407 | wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
1408 | 1408 | wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); |
1409 | 1409 | } |
@@ -1422,19 +1422,19 @@ discard block |
||
1422 | 1422 | */ |
1423 | 1423 | public function admin_footer_global() { |
1424 | 1424 | //dialog container for dialog helper |
1425 | - $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n"; |
|
1425 | + $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n"; |
|
1426 | 1426 | $d_cont .= '<div class="ee-notices"></div>'; |
1427 | 1427 | $d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>'; |
1428 | 1428 | $d_cont .= '</div>'; |
1429 | 1429 | echo $d_cont; |
1430 | 1430 | |
1431 | 1431 | //help tour stuff? |
1432 | - if ( isset( $this->_help_tour[$this->_req_action] ) ) { |
|
1432 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1433 | 1433 | echo implode('<br />', $this->_help_tour[$this->_req_action]); |
1434 | 1434 | } |
1435 | 1435 | |
1436 | 1436 | //current set timezone for timezone js |
1437 | - echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>'; |
|
1437 | + echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>'; |
|
1438 | 1438 | } |
1439 | 1439 | |
1440 | 1440 | |
@@ -1458,18 +1458,18 @@ discard block |
||
1458 | 1458 | * @access protected |
1459 | 1459 | * @return string content |
1460 | 1460 | */ |
1461 | - protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) { |
|
1461 | + protected function _set_help_popup_content($help_array = array(), $display = FALSE) { |
|
1462 | 1462 | $content = ''; |
1463 | 1463 | |
1464 | - $help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array; |
|
1465 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php'; |
|
1464 | + $help_array = empty($help_array) ? $this->_get_help_content() : $help_array; |
|
1465 | + $template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php'; |
|
1466 | 1466 | |
1467 | 1467 | |
1468 | 1468 | //loop through the array and setup content |
1469 | - foreach ( $help_array as $trigger => $help ) { |
|
1469 | + foreach ($help_array as $trigger => $help) { |
|
1470 | 1470 | //make sure the array is setup properly |
1471 | - if ( !isset($help['title']) || !isset($help['content'] ) ) { |
|
1472 | - throw new EE_Error( __('Does not look like the popup content array has been setup correctly. Might want to double check that. Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso') ); |
|
1471 | + if ( ! isset($help['title']) || ! isset($help['content'])) { |
|
1472 | + throw new EE_Error(__('Does not look like the popup content array has been setup correctly. Might want to double check that. Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso')); |
|
1473 | 1473 | } |
1474 | 1474 | |
1475 | 1475 | //we're good so let'd setup the template vars and then assign parsed template content to our content. |
@@ -1479,10 +1479,10 @@ discard block |
||
1479 | 1479 | 'help_popup_content' => $help['content'] |
1480 | 1480 | ); |
1481 | 1481 | |
1482 | - $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
1482 | + $content .= EEH_Template::display_template($template_path, $template_args, TRUE); |
|
1483 | 1483 | } |
1484 | 1484 | |
1485 | - if ( $display ) |
|
1485 | + if ($display) |
|
1486 | 1486 | echo $content; |
1487 | 1487 | else |
1488 | 1488 | return $content; |
@@ -1499,18 +1499,18 @@ discard block |
||
1499 | 1499 | */ |
1500 | 1500 | private function _get_help_content() { |
1501 | 1501 | //what is the method we're looking for? |
1502 | - $method_name = '_help_popup_content_' . $this->_req_action; |
|
1502 | + $method_name = '_help_popup_content_'.$this->_req_action; |
|
1503 | 1503 | |
1504 | 1504 | //if method doesn't exist let's get out. |
1505 | - if ( !method_exists( $this, $method_name ) ) |
|
1505 | + if ( ! method_exists($this, $method_name)) |
|
1506 | 1506 | return array(); |
1507 | 1507 | |
1508 | 1508 | //k we're good to go let's retrieve the help array |
1509 | - $help_array = call_user_func( array( $this, $method_name ) ); |
|
1509 | + $help_array = call_user_func(array($this, $method_name)); |
|
1510 | 1510 | |
1511 | 1511 | //make sure we've got an array! |
1512 | - if ( !is_array($help_array) ) { |
|
1513 | - throw new EE_Error( __('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso' ) ); |
|
1512 | + if ( ! is_array($help_array)) { |
|
1513 | + throw new EE_Error(__('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso')); |
|
1514 | 1514 | } |
1515 | 1515 | |
1516 | 1516 | return $help_array; |
@@ -1532,27 +1532,27 @@ discard block |
||
1532 | 1532 | * @param array $dimensions an array of dimensions for the box (array(h,w)) |
1533 | 1533 | * @return string |
1534 | 1534 | */ |
1535 | - protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
|
1535 | + protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) { |
|
1536 | 1536 | |
1537 | - if ( defined('DOING_AJAX') ) return; |
|
1537 | + if (defined('DOING_AJAX')) return; |
|
1538 | 1538 | |
1539 | 1539 | //let's check and see if there is any content set for this popup. If there isn't then we'll include a default title and content so that developers know something needs to be corrected |
1540 | 1540 | $help_array = $this->_get_help_content(); |
1541 | 1541 | $help_content = ''; |
1542 | 1542 | |
1543 | - if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) { |
|
1543 | + if (empty($help_array) || ! isset($help_array[$trigger_id])) { |
|
1544 | 1544 | $help_array[$trigger_id] = array( |
1545 | 1545 | 'title' => __('Missing Content', 'event_espresso'), |
1546 | 1546 | 'content' => __('A trigger has been set that doesn\'t have any corresponding content. Make sure you have set the help content. (see the "_set_help_popup_content" method in the EE_Admin_Page for instructions.)', 'event_espresso') |
1547 | 1547 | ); |
1548 | - $help_content = $this->_set_help_popup_content( $help_array, FALSE ); |
|
1548 | + $help_content = $this->_set_help_popup_content($help_array, FALSE); |
|
1549 | 1549 | } |
1550 | 1550 | |
1551 | 1551 | //let's setup the trigger |
1552 | - $content = '<a class="ee-dialog" href="?height='. $dimensions[0] . '&width=' . $dimensions[1] . '&inlineId=' . $trigger_id . '" target="_blank"><span class="question ee-help-popup-question"></span></a>'; |
|
1553 | - $content = $content . $help_content; |
|
1552 | + $content = '<a class="ee-dialog" href="?height='.$dimensions[0].'&width='.$dimensions[1].'&inlineId='.$trigger_id.'" target="_blank"><span class="question ee-help-popup-question"></span></a>'; |
|
1553 | + $content = $content.$help_content; |
|
1554 | 1554 | |
1555 | - if ( $display ) |
|
1555 | + if ($display) |
|
1556 | 1556 | echo $content; |
1557 | 1557 | else |
1558 | 1558 | return $content; |
@@ -1609,15 +1609,15 @@ discard block |
||
1609 | 1609 | public function load_global_scripts_styles() { |
1610 | 1610 | /** STYLES **/ |
1611 | 1611 | // add debugging styles |
1612 | - if ( WP_DEBUG ) { |
|
1613 | - add_action('admin_head', array( $this, 'add_xdebug_style' )); |
|
1612 | + if (WP_DEBUG) { |
|
1613 | + add_action('admin_head', array($this, 'add_xdebug_style')); |
|
1614 | 1614 | } |
1615 | 1615 | |
1616 | 1616 | //register all styles |
1617 | - wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(),EVENT_ESPRESSO_VERSION ); |
|
1618 | - wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1617 | + wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION); |
|
1618 | + wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1619 | 1619 | //helpers styles |
1620 | - wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1620 | + wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION); |
|
1621 | 1621 | //enqueue global styles |
1622 | 1622 | wp_enqueue_style('ee-admin-css'); |
1623 | 1623 | |
@@ -1625,66 +1625,66 @@ discard block |
||
1625 | 1625 | /** SCRIPTS **/ |
1626 | 1626 | |
1627 | 1627 | //register all scripts |
1628 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1629 | - wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1630 | - wp_register_script('ee_admin_js', EE_ADMIN_URL . 'assets/ee-admin-page.js', array( 'espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true ); |
|
1628 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1629 | + wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1630 | + wp_register_script('ee_admin_js', EE_ADMIN_URL.'assets/ee-admin-page.js', array('espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
1631 | 1631 | |
1632 | - wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true ); |
|
1632 | + wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL.'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true); |
|
1633 | 1633 | // register jQuery Validate - see /includes/functions/wp_hooks.php |
1634 | - add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
|
1634 | + add_filter('FHEE_load_jquery_validate', '__return_true'); |
|
1635 | 1635 | add_filter('FHEE_load_joyride', '__return_true'); |
1636 | 1636 | |
1637 | 1637 | //script for sorting tables |
1638 | - wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL . "assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1638 | + wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL."assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1639 | 1639 | //script for parsing uri's |
1640 | - wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1640 | + wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1641 | 1641 | //and parsing associative serialized form elements |
1642 | - wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1642 | + wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1643 | 1643 | //helpers scripts |
1644 | - wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1645 | - wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1646 | - wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1647 | - wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1644 | + wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1645 | + wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1646 | + wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1647 | + wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1648 | 1648 | |
1649 | 1649 | //google charts |
1650 | - wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false ); |
|
1650 | + wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false); |
|
1651 | 1651 | |
1652 | 1652 | //enqueue global scripts |
1653 | 1653 | |
1654 | 1654 | //taking care of metaboxes |
1655 | - if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) { |
|
1655 | + if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) { |
|
1656 | 1656 | wp_enqueue_script('dashboard'); |
1657 | 1657 | } |
1658 | 1658 | |
1659 | 1659 | //enqueue thickbox for ee help popups. default is to enqueue unless its explicitly set to false since we're assuming all EE pages will have popups |
1660 | - if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) { |
|
1660 | + if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) { |
|
1661 | 1661 | wp_enqueue_script('ee_admin_js'); |
1662 | 1662 | wp_enqueue_style('ee-admin-css'); |
1663 | 1663 | } |
1664 | 1664 | |
1665 | 1665 | |
1666 | 1666 | //localize script for ajax lazy loading |
1667 | - $lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') ); |
|
1668 | - wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1667 | + $lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content')); |
|
1668 | + wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1669 | 1669 | |
1670 | 1670 | |
1671 | 1671 | /** |
1672 | 1672 | * help tour stuff |
1673 | 1673 | */ |
1674 | - if ( !empty( $this->_help_tour ) ) { |
|
1674 | + if ( ! empty($this->_help_tour)) { |
|
1675 | 1675 | |
1676 | 1676 | //register the js for kicking things off |
1677 | - wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1677 | + wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1678 | 1678 | |
1679 | 1679 | //setup tours for the js tour object |
1680 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1680 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1681 | 1681 | $tours[] = array( |
1682 | 1682 | 'id' => $tour->get_slug(), |
1683 | 1683 | 'options' => $tour->get_options() |
1684 | 1684 | ); |
1685 | 1685 | } |
1686 | 1686 | |
1687 | - wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) ); |
|
1687 | + wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours)); |
|
1688 | 1688 | |
1689 | 1689 | //admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour |
1690 | 1690 | } |
@@ -1702,52 +1702,52 @@ discard block |
||
1702 | 1702 | public function admin_footer_scripts_eei18n_js_strings() { |
1703 | 1703 | |
1704 | 1704 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
1705 | - EE_Registry::$i18n_js_strings['confirm_delete'] = __( 'Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso' ); |
|
1706 | - |
|
1707 | - EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' ); |
|
1708 | - EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' ); |
|
1709 | - EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' ); |
|
1710 | - EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' ); |
|
1711 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1712 | - EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' ); |
|
1713 | - EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' ); |
|
1714 | - EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' ); |
|
1715 | - EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' ); |
|
1716 | - EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' ); |
|
1717 | - EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' ); |
|
1718 | - EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' ); |
|
1719 | - EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' ); |
|
1720 | - EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' ); |
|
1721 | - EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' ); |
|
1722 | - EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' ); |
|
1723 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1724 | - EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' ); |
|
1725 | - EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' ); |
|
1726 | - EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' ); |
|
1727 | - EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' ); |
|
1728 | - EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' ); |
|
1729 | - EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' ); |
|
1730 | - EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' ); |
|
1731 | - |
|
1732 | - EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' ); |
|
1733 | - EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' ); |
|
1734 | - EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' ); |
|
1735 | - EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' ); |
|
1736 | - EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' ); |
|
1737 | - EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' ); |
|
1738 | - EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' ); |
|
1739 | - EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' ); |
|
1740 | - EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' ); |
|
1741 | - EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' ); |
|
1742 | - EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' ); |
|
1743 | - EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' ); |
|
1744 | - EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' ); |
|
1745 | - EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' ); |
|
1705 | + EE_Registry::$i18n_js_strings['confirm_delete'] = __('Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso'); |
|
1706 | + |
|
1707 | + EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso'); |
|
1708 | + EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso'); |
|
1709 | + EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso'); |
|
1710 | + EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso'); |
|
1711 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1712 | + EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso'); |
|
1713 | + EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso'); |
|
1714 | + EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso'); |
|
1715 | + EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso'); |
|
1716 | + EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso'); |
|
1717 | + EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso'); |
|
1718 | + EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso'); |
|
1719 | + EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso'); |
|
1720 | + EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso'); |
|
1721 | + EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso'); |
|
1722 | + EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso'); |
|
1723 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1724 | + EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso'); |
|
1725 | + EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso'); |
|
1726 | + EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso'); |
|
1727 | + EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso'); |
|
1728 | + EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso'); |
|
1729 | + EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso'); |
|
1730 | + EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso'); |
|
1731 | + |
|
1732 | + EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso'); |
|
1733 | + EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso'); |
|
1734 | + EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso'); |
|
1735 | + EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso'); |
|
1736 | + EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso'); |
|
1737 | + EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso'); |
|
1738 | + EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso'); |
|
1739 | + EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso'); |
|
1740 | + EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso'); |
|
1741 | + EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso'); |
|
1742 | + EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso'); |
|
1743 | + EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso'); |
|
1744 | + EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso'); |
|
1745 | + EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso'); |
|
1746 | 1746 | |
1747 | 1747 | //setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance |
1748 | 1748 | //admin page when in maintenance mode and ee_admin_js is not loaded then. This works everywhere else because |
1749 | 1749 | //espresso_core is listed as a dependency of ee_admin_js. |
1750 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
1750 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
1751 | 1751 | |
1752 | 1752 | } |
1753 | 1753 | |
@@ -1781,23 +1781,23 @@ discard block |
||
1781 | 1781 | protected function _set_list_table() { |
1782 | 1782 | |
1783 | 1783 | //first is this a list_table view? |
1784 | - if ( !isset($this->_route_config['list_table']) ) |
|
1784 | + if ( ! isset($this->_route_config['list_table'])) |
|
1785 | 1785 | return; //not a list_table view so get out. |
1786 | 1786 | |
1787 | 1787 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1788 | 1788 | |
1789 | - if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) { |
|
1789 | + if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) { |
|
1790 | 1790 | //user error msg |
1791 | - $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' ); |
|
1791 | + $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso'); |
|
1792 | 1792 | //developer error msg |
1793 | - $error_msg .= '||' . sprintf( __('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso' ), $this->_req_action, '_set_list_table_views_' . $this->_req_action ); |
|
1794 | - throw new EE_Error( $error_msg ); |
|
1793 | + $error_msg .= '||'.sprintf(__('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso'), $this->_req_action, '_set_list_table_views_'.$this->_req_action); |
|
1794 | + throw new EE_Error($error_msg); |
|
1795 | 1795 | } |
1796 | 1796 | |
1797 | 1797 | //let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally |
1798 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views ); |
|
1799 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views ); |
|
1800 | - $this->_views = apply_filters( 'FHEE_list_table_views', $this->_views ); |
|
1798 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views); |
|
1799 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views); |
|
1800 | + $this->_views = apply_filters('FHEE_list_table_views', $this->_views); |
|
1801 | 1801 | |
1802 | 1802 | $this->_set_list_table_view(); |
1803 | 1803 | $this->_set_list_table_object(); |
@@ -1819,14 +1819,14 @@ discard block |
||
1819 | 1819 | * @return array |
1820 | 1820 | */ |
1821 | 1821 | protected function _set_list_table_view() { |
1822 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1822 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1823 | 1823 | |
1824 | 1824 | |
1825 | 1825 | // looking at active items or dumpster diving ? |
1826 | - if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) { |
|
1827 | - $this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all'; |
|
1826 | + if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) { |
|
1827 | + $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all'; |
|
1828 | 1828 | } else { |
1829 | - $this->_view = sanitize_key( $this->_req_data['status'] ); |
|
1829 | + $this->_view = sanitize_key($this->_req_data['status']); |
|
1830 | 1830 | } |
1831 | 1831 | } |
1832 | 1832 | |
@@ -1837,9 +1837,9 @@ discard block |
||
1837 | 1837 | * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of. |
1838 | 1838 | */ |
1839 | 1839 | protected function _set_list_table_object() { |
1840 | - if ( isset($this->_route_config['list_table'] ) ) { |
|
1841 | - if ( !class_exists( $this->_route_config['list_table'] ) ) |
|
1842 | - throw new EE_Error( sprintf( __('The %s class defined for the list table does not exist. Please check the spelling of the class ref in the $_page_config property on %s.', 'event_espresso'), $this->_route_config['list_table'], get_class($this) ) ); |
|
1840 | + if (isset($this->_route_config['list_table'])) { |
|
1841 | + if ( ! class_exists($this->_route_config['list_table'])) |
|
1842 | + throw new EE_Error(sprintf(__('The %s class defined for the list table does not exist. Please check the spelling of the class ref in the $_page_config property on %s.', 'event_espresso'), $this->_route_config['list_table'], get_class($this))); |
|
1843 | 1843 | $a = new ReflectionClass($this->_route_config['list_table']); |
1844 | 1844 | $this->_list_table_object = $a->newInstance($this); |
1845 | 1845 | } |
@@ -1858,27 +1858,27 @@ discard block |
||
1858 | 1858 | * |
1859 | 1859 | * @return array |
1860 | 1860 | */ |
1861 | - public function get_list_table_view_RLs( $extra_query_args = array() ) { |
|
1861 | + public function get_list_table_view_RLs($extra_query_args = array()) { |
|
1862 | 1862 | |
1863 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1863 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1864 | 1864 | |
1865 | - if ( empty( $this->_views )) { |
|
1865 | + if (empty($this->_views)) { |
|
1866 | 1866 | $this->_views = array(); |
1867 | 1867 | } |
1868 | 1868 | |
1869 | 1869 | // cycle thru views |
1870 | - foreach ( $this->_views as $key => $view ) { |
|
1870 | + foreach ($this->_views as $key => $view) { |
|
1871 | 1871 | $query_args = array(); |
1872 | 1872 | // check for current view |
1873 | - $this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1873 | + $this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1874 | 1874 | $query_args['action'] = $this->_req_action; |
1875 | - $query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
1875 | + $query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
1876 | 1876 | $query_args['status'] = $view['slug']; |
1877 | 1877 | //merge any other arguments sent in. |
1878 | - if ( isset( $extra_query_args[$view['slug']] ) ) { |
|
1879 | - $query_args = array_merge( $query_args, $extra_query_args[$view['slug']] ); |
|
1878 | + if (isset($extra_query_args[$view['slug']])) { |
|
1879 | + $query_args = array_merge($query_args, $extra_query_args[$view['slug']]); |
|
1880 | 1880 | } |
1881 | - $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1881 | + $this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1882 | 1882 | } |
1883 | 1883 | |
1884 | 1884 | return $this->_views; |
@@ -1895,15 +1895,15 @@ discard block |
||
1895 | 1895 | * @param int $max_entries total number of rows in the table |
1896 | 1896 | * @return string |
1897 | 1897 | */ |
1898 | - protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
|
1898 | + protected function _entries_per_page_dropdown($max_entries = FALSE) { |
|
1899 | 1899 | |
1900 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1901 | - $values = array( 10, 25, 50, 100 ); |
|
1902 | - $per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10; |
|
1900 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1901 | + $values = array(10, 25, 50, 100); |
|
1902 | + $per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10; |
|
1903 | 1903 | |
1904 | - if ( $max_entries ) { |
|
1904 | + if ($max_entries) { |
|
1905 | 1905 | $values[] = $max_entries; |
1906 | - sort( $values ); |
|
1906 | + sort($values); |
|
1907 | 1907 | } |
1908 | 1908 | |
1909 | 1909 | $entries_per_page_dropdown = ' |
@@ -1912,15 +1912,15 @@ discard block |
||
1912 | 1912 | Show |
1913 | 1913 | <select id="entries-per-page-slct" name="entries-per-page-slct">'; |
1914 | 1914 | |
1915 | - foreach ( $values as $value ) { |
|
1916 | - if ( $value < $max_entries ) { |
|
1917 | - $selected = $value == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1915 | + foreach ($values as $value) { |
|
1916 | + if ($value < $max_entries) { |
|
1917 | + $selected = $value == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1918 | 1918 | $entries_per_page_dropdown .= ' |
1919 | 1919 | <option value="'.$value.'"'.$selected.'>'.$value.' </option>'; |
1920 | 1920 | } |
1921 | 1921 | } |
1922 | 1922 | |
1923 | - $selected = $max_entries == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1923 | + $selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1924 | 1924 | $entries_per_page_dropdown .= ' |
1925 | 1925 | <option value="'.$max_entries.'"'.$selected.'>All </option>'; |
1926 | 1926 | |
@@ -1943,8 +1943,8 @@ discard block |
||
1943 | 1943 | * @return void |
1944 | 1944 | */ |
1945 | 1945 | public function _set_search_attributes() { |
1946 | - $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
|
1947 | - $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
|
1946 | + $this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label); |
|
1947 | + $this->_template_args['search']['callback'] = 'search_'.$this->page_slug; |
|
1948 | 1948 | } |
1949 | 1949 | |
1950 | 1950 | /*** END LIST TABLE METHODS **/ |
@@ -1963,20 +1963,20 @@ discard block |
||
1963 | 1963 | * @return void |
1964 | 1964 | */ |
1965 | 1965 | private function _add_registered_meta_boxes() { |
1966 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1966 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1967 | 1967 | |
1968 | 1968 | //we only add meta boxes if the page_route calls for it |
1969 | - if ( is_array($this->_route_config) && isset( $this->_route_config['metaboxes'] ) && is_array($this->_route_config['metaboxes']) ) { |
|
1969 | + if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) && is_array($this->_route_config['metaboxes'])) { |
|
1970 | 1970 | |
1971 | 1971 | |
1972 | 1972 | //this simply loops through the callbacks provided and checks if there is a corresponding callback registered by the child - if there is then we go ahead and process the metabox loader. |
1973 | - foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) { |
|
1974 | - if ( call_user_func( array($this, &$metabox_callback) ) === FALSE ) { |
|
1973 | + foreach ($this->_route_config['metaboxes'] as $metabox_callback) { |
|
1974 | + if (call_user_func(array($this, &$metabox_callback)) === FALSE) { |
|
1975 | 1975 | // user error msg |
1976 | - $error_msg = __( 'An error occurred. The requested metabox could not be found.', 'event_espresso' ); |
|
1976 | + $error_msg = __('An error occurred. The requested metabox could not be found.', 'event_espresso'); |
|
1977 | 1977 | // developer error msg |
1978 | - $error_msg .= '||' . sprintf( __( 'The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', 'event_espresso' ), $metabox_callback ); |
|
1979 | - throw new EE_Error( $error_msg ); |
|
1978 | + $error_msg .= '||'.sprintf(__('The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', 'event_espresso'), $metabox_callback); |
|
1979 | + throw new EE_Error($error_msg); |
|
1980 | 1980 | } |
1981 | 1981 | } |
1982 | 1982 | } |
@@ -1993,17 +1993,17 @@ discard block |
||
1993 | 1993 | * @return void |
1994 | 1994 | */ |
1995 | 1995 | private function _add_screen_columns() { |
1996 | - if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) { |
|
1996 | + if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) { |
|
1997 | 1997 | |
1998 | - add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
1998 | + add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1])); |
|
1999 | 1999 | $this->_template_args['num_columns'] = $this->_route_config['columns'][0]; |
2000 | 2000 | $screen_id = $this->_current_screen->id; |
2001 | 2001 | $screen_columns = (int) get_user_option("screen_layout_$screen_id"); |
2002 | - $total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2003 | - $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns; |
|
2002 | + $total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2003 | + $this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns; |
|
2004 | 2004 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2005 | 2005 | $this->_template_args['screen'] = $this->_current_screen; |
2006 | - $this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php'; |
|
2006 | + $this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php'; |
|
2007 | 2007 | |
2008 | 2008 | //finally if we don't have has_metaboxes set in the route config let's make sure it IS set other wise the necessary hidden fields for this won't be loaded. |
2009 | 2009 | $this->_route_config['has_metaboxes'] = TRUE; |
@@ -2020,11 +2020,11 @@ discard block |
||
2020 | 2020 | */ |
2021 | 2021 | |
2022 | 2022 | private function _espresso_news_post_box() { |
2023 | - $news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) ); |
|
2024 | - add_meta_box( 'espresso_news_post_box', $news_box_title, array( |
|
2023 | + $news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso')); |
|
2024 | + add_meta_box('espresso_news_post_box', $news_box_title, array( |
|
2025 | 2025 | $this, |
2026 | 2026 | 'espresso_news_post_box' |
2027 | - ), $this->_wp_page_slug, 'side' ); |
|
2027 | + ), $this->_wp_page_slug, 'side'); |
|
2028 | 2028 | } |
2029 | 2029 | |
2030 | 2030 | |
@@ -2032,14 +2032,14 @@ discard block |
||
2032 | 2032 | * Code for setting up espresso ratings request metabox. |
2033 | 2033 | */ |
2034 | 2034 | protected function _espresso_ratings_request() { |
2035 | - if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) { |
|
2035 | + if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) { |
|
2036 | 2036 | return ''; |
2037 | 2037 | } |
2038 | - $ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') ); |
|
2039 | - add_meta_box( 'espresso_ratings_request', $ratings_box_title, array( |
|
2038 | + $ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso')); |
|
2039 | + add_meta_box('espresso_ratings_request', $ratings_box_title, array( |
|
2040 | 2040 | $this, |
2041 | 2041 | 'espresso_ratings_request' |
2042 | - ), $this->_wp_page_slug, 'side' ); |
|
2042 | + ), $this->_wp_page_slug, 'side'); |
|
2043 | 2043 | } |
2044 | 2044 | |
2045 | 2045 | |
@@ -2047,34 +2047,34 @@ discard block |
||
2047 | 2047 | * Code for setting up espresso ratings request metabox content. |
2048 | 2048 | */ |
2049 | 2049 | public function espresso_ratings_request() { |
2050 | - $template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php'; |
|
2051 | - EEH_Template::display_template( $template_path, array() ); |
|
2050 | + $template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php'; |
|
2051 | + EEH_Template::display_template($template_path, array()); |
|
2052 | 2052 | } |
2053 | 2053 | |
2054 | 2054 | |
2055 | 2055 | |
2056 | 2056 | |
2057 | - public static function cached_rss_display( $rss_id, $url ) { |
|
2058 | - $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>'; |
|
2059 | - $doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
2060 | - $pre = '<div class="espresso-rss-display">' . "\n\t"; |
|
2061 | - $pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>'; |
|
2062 | - $post = '</div>' . "\n"; |
|
2057 | + public static function cached_rss_display($rss_id, $url) { |
|
2058 | + $loading = '<p class="widget-loading hide-if-no-js">'.__('Loading…').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>'; |
|
2059 | + $doing_ajax = (defined('DOING_AJAX') && DOING_AJAX); |
|
2060 | + $pre = '<div class="espresso-rss-display">'."\n\t"; |
|
2061 | + $pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>'; |
|
2062 | + $post = '</div>'."\n"; |
|
2063 | 2063 | |
2064 | - $cache_key = 'ee_rss_' . md5( $rss_id ); |
|
2065 | - if ( FALSE != ( $output = get_transient( $cache_key ) ) ) { |
|
2066 | - echo $pre . $output . $post; |
|
2064 | + $cache_key = 'ee_rss_'.md5($rss_id); |
|
2065 | + if (FALSE != ($output = get_transient($cache_key))) { |
|
2066 | + echo $pre.$output.$post; |
|
2067 | 2067 | return TRUE; |
2068 | 2068 | } |
2069 | 2069 | |
2070 | - if ( ! $doing_ajax ) { |
|
2071 | - echo $pre . $loading . $post; |
|
2070 | + if ( ! $doing_ajax) { |
|
2071 | + echo $pre.$loading.$post; |
|
2072 | 2072 | return FALSE; |
2073 | 2073 | } |
2074 | 2074 | |
2075 | 2075 | ob_start(); |
2076 | - wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) ); |
|
2077 | - set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); |
|
2076 | + wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5)); |
|
2077 | + set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS); |
|
2078 | 2078 | return TRUE; |
2079 | 2079 | |
2080 | 2080 | } |
@@ -2086,13 +2086,13 @@ discard block |
||
2086 | 2086 | <div id="espresso_news_post_box_content" class="infolinks"> |
2087 | 2087 | <?php |
2088 | 2088 | // Get RSS Feed(s) |
2089 | - $feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' ); |
|
2089 | + $feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/'); |
|
2090 | 2090 | $url = urlencode($feed_url); |
2091 | - self::cached_rss_display( 'espresso_news_post_box_content', $url ); |
|
2091 | + self::cached_rss_display('espresso_news_post_box_content', $url); |
|
2092 | 2092 | |
2093 | 2093 | ?> |
2094 | 2094 | </div> |
2095 | - <?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2095 | + <?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2096 | 2096 | </div> |
2097 | 2097 | <?php |
2098 | 2098 | } |
@@ -2113,32 +2113,32 @@ discard block |
||
2113 | 2113 | |
2114 | 2114 | protected function _espresso_sponsors_post_box() { |
2115 | 2115 | |
2116 | - $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
|
2117 | - if ( $show_sponsors ) |
|
2118 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2116 | + $show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE); |
|
2117 | + if ($show_sponsors) |
|
2118 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2119 | 2119 | } |
2120 | 2120 | |
2121 | 2121 | |
2122 | 2122 | public function espresso_sponsors_post_box() { |
2123 | - $templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2124 | - EEH_Template::display_template( $templatepath ); |
|
2123 | + $templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2124 | + EEH_Template::display_template($templatepath); |
|
2125 | 2125 | } |
2126 | 2126 | |
2127 | 2127 | |
2128 | 2128 | |
2129 | 2129 | private function _publish_post_box() { |
2130 | - $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview'; |
|
2130 | + $meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview'; |
|
2131 | 2131 | |
2132 | 2132 | //if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array then we'll use that for the metabox label. Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes) |
2133 | - if ( !empty( $this->_labels['publishbox'] ) ) { |
|
2134 | - $box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2133 | + if ( ! empty($this->_labels['publishbox'])) { |
|
2134 | + $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2135 | 2135 | } else { |
2136 | 2136 | $box_label = __('Publish', 'event_espresso'); |
2137 | 2137 | } |
2138 | 2138 | |
2139 | - $box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this ); |
|
2139 | + $box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this); |
|
2140 | 2140 | |
2141 | - add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' ); |
|
2141 | + add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high'); |
|
2142 | 2142 | |
2143 | 2143 | } |
2144 | 2144 | |
@@ -2146,9 +2146,9 @@ discard block |
||
2146 | 2146 | |
2147 | 2147 | public function editor_overview() { |
2148 | 2148 | //if we have extra content set let's add it in if not make sure its empty |
2149 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2150 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php'; |
|
2151 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2149 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2150 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php'; |
|
2151 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2152 | 2152 | } |
2153 | 2153 | |
2154 | 2154 | |
@@ -2164,8 +2164,8 @@ discard block |
||
2164 | 2164 | * @see $this->_set_publish_post_box_vars for param details |
2165 | 2165 | * @since 4.6.0 |
2166 | 2166 | */ |
2167 | - public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) { |
|
2168 | - $this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns ); |
|
2167 | + public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) { |
|
2168 | + $this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns); |
|
2169 | 2169 | } |
2170 | 2170 | |
2171 | 2171 | |
@@ -2184,24 +2184,24 @@ discard block |
||
2184 | 2184 | * @param string $post_save_redirect_URL custom URL to redirect to after Save & Close has been completed |
2185 | 2185 | * @param boolean $both_btns whether to display BOTH the "Save & Close" and "Save" buttons or just the Save button |
2186 | 2186 | */ |
2187 | - protected function _set_publish_post_box_vars( $name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE ) { |
|
2187 | + protected function _set_publish_post_box_vars($name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE) { |
|
2188 | 2188 | |
2189 | 2189 | // if Save & Close, use a custom redirect URL or default to the main page? |
2190 | - $save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2190 | + $save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2191 | 2191 | // create the Save & Close and Save buttons |
2192 | - $this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL ); |
|
2192 | + $this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL); |
|
2193 | 2193 | //if we have extra content set let's add it in if not make sure its empty |
2194 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2194 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2195 | 2195 | |
2196 | 2196 | |
2197 | - if ( $delete && ! empty( $id ) ) { |
|
2197 | + if ($delete && ! empty($id)) { |
|
2198 | 2198 | $delete = is_bool($delete) ? 'delete' : $delete; //make sure we have a default if just true is sent. |
2199 | - $delete_link_args = array( $name => $id ); |
|
2200 | - $delete = $this->get_action_link_or_button( $delete, $delete, $delete_link_args, 'submitdelete deletion'); |
|
2199 | + $delete_link_args = array($name => $id); |
|
2200 | + $delete = $this->get_action_link_or_button($delete, $delete, $delete_link_args, 'submitdelete deletion'); |
|
2201 | 2201 | } |
2202 | 2202 | |
2203 | - $this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : ''; |
|
2204 | - if ( ! empty( $name ) && ! empty( $id ) ) { |
|
2203 | + $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : ''; |
|
2204 | + if ( ! empty($name) && ! empty($id)) { |
|
2205 | 2205 | $hidden_field_arr[$name] = array( |
2206 | 2206 | 'type' => 'hidden', |
2207 | 2207 | 'value' => $id |
@@ -2211,7 +2211,7 @@ discard block |
||
2211 | 2211 | $hf = ''; |
2212 | 2212 | } |
2213 | 2213 | // add hidden field |
2214 | - $this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf; |
|
2214 | + $this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf; |
|
2215 | 2215 | |
2216 | 2216 | } |
2217 | 2217 | |
@@ -2228,8 +2228,8 @@ discard block |
||
2228 | 2228 | <noscript> |
2229 | 2229 | <div id="no-js-message" class="error"> |
2230 | 2230 | <p style="font-size:1.3em;"> |
2231 | - <span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span> |
|
2232 | - <?php _e( 'Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso' ); ?> |
|
2231 | + <span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span> |
|
2232 | + <?php _e('Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso'); ?> |
|
2233 | 2233 | </p> |
2234 | 2234 | </div> |
2235 | 2235 | </noscript> |
@@ -2249,7 +2249,7 @@ discard block |
||
2249 | 2249 | * @return string |
2250 | 2250 | */ |
2251 | 2251 | private function _display_espresso_notices() { |
2252 | - $notices = $this->_get_transient( TRUE ); |
|
2252 | + $notices = $this->_get_transient(TRUE); |
|
2253 | 2253 | echo stripslashes($notices); |
2254 | 2254 | } |
2255 | 2255 | |
@@ -2301,11 +2301,11 @@ discard block |
||
2301 | 2301 | * @param string $priority give this metabox a priority (using accepted priorities for wp meta boxes) |
2302 | 2302 | * @param boolean $create_func default is true. Basically we can say we don't WANT to have the runtime function created but just set our own callback for wp's add_meta_box. |
2303 | 2303 | */ |
2304 | - public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) { |
|
2305 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback ); |
|
2304 | + public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) { |
|
2305 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $callback); |
|
2306 | 2306 | |
2307 | 2307 | //if we have empty callback args and we want to automatically create the metabox callback then we need to make sure the callback args are generated. |
2308 | - if ( empty( $callback_args ) && $create_func ) { |
|
2308 | + if (empty($callback_args) && $create_func) { |
|
2309 | 2309 | $callback_args = array( |
2310 | 2310 | 'template_path' => $this->_template_path, |
2311 | 2311 | 'template_args' => $this->_template_args, |
@@ -2315,7 +2315,7 @@ discard block |
||
2315 | 2315 | //if $create_func is true (default) then we automatically create the function for displaying the actual meta box. If false then we take the $callback reference passed through and use it instead (so callers can define their own callback function/method if they wish) |
2316 | 2316 | $call_back_func = $create_func ? create_function('$post, $metabox', 'do_action( "AHEE_log", __FILE__, __FUNCTION__, ""); echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );') : $callback; |
2317 | 2317 | |
2318 | - add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args ); |
|
2318 | + add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args); |
|
2319 | 2319 | } |
2320 | 2320 | |
2321 | 2321 | |
@@ -2328,7 +2328,7 @@ discard block |
||
2328 | 2328 | */ |
2329 | 2329 | public function display_admin_page_with_metabox_columns() { |
2330 | 2330 | $this->_template_args['post_body_content'] = $this->_template_args['admin_page_content']; |
2331 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE); |
|
2331 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE); |
|
2332 | 2332 | |
2333 | 2333 | //the final wrapper |
2334 | 2334 | $this->admin_page_wrapper(); |
@@ -2371,7 +2371,7 @@ discard block |
||
2371 | 2371 | * @return void |
2372 | 2372 | */ |
2373 | 2373 | public function display_about_admin_page() { |
2374 | - $this->_display_admin_page( FALSE, TRUE ); |
|
2374 | + $this->_display_admin_page(FALSE, TRUE); |
|
2375 | 2375 | } |
2376 | 2376 | |
2377 | 2377 | |
@@ -2387,26 +2387,26 @@ discard block |
||
2387 | 2387 | * @return html admin_page |
2388 | 2388 | */ |
2389 | 2389 | private function _display_admin_page($sidebar = false, $about = FALSE) { |
2390 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2390 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2391 | 2391 | |
2392 | 2392 | //custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages. |
2393 | - do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' ); |
|
2393 | + do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes'); |
|
2394 | 2394 | |
2395 | 2395 | // set current wp page slug - looks like: event-espresso_page_event_categories |
2396 | 2396 | // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated. |
2397 | 2397 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2398 | 2398 | |
2399 | - $template_path = $sidebar ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2399 | + $template_path = $sidebar ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php'; |
|
2400 | 2400 | |
2401 | - if ( defined('DOING_AJAX' ) ) |
|
2402 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2401 | + if (defined('DOING_AJAX')) |
|
2402 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2403 | 2403 | |
2404 | - $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2404 | + $template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2405 | 2405 | |
2406 | - $this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : ''; |
|
2406 | + $this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : ''; |
|
2407 | 2407 | $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''; |
2408 | 2408 | $this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''; |
2409 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2409 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2410 | 2410 | |
2411 | 2411 | |
2412 | 2412 | // the final template wrapper |
@@ -2426,7 +2426,7 @@ discard block |
||
2426 | 2426 | * @param bool $display_sidebar whether to use the sidebar template or the full template for the page. TRUE = SHOW sidebar, FALSE = no sidebar. Default no sidebar. |
2427 | 2427 | * @return void |
2428 | 2428 | */ |
2429 | - public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) { |
|
2429 | + public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) { |
|
2430 | 2430 | //let's generate a default preview action button if there isn't one already present. |
2431 | 2431 | $this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso'); |
2432 | 2432 | $buy_now_url = add_query_arg( |
@@ -2439,10 +2439,10 @@ discard block |
||
2439 | 2439 | ), |
2440 | 2440 | 'http://eventespresso.com/pricing/' |
2441 | 2441 | ); |
2442 | - $this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] ) ? $this->get_action_link_or_button( '', 'buy_now', array(), 'button-primary button-large', $buy_now_url, true ) : $this->_template_args['preview_action_button']; |
|
2443 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php'; |
|
2444 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2445 | - $this->_display_admin_page( $display_sidebar ); |
|
2442 | + $this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button']) ? $this->get_action_link_or_button('', 'buy_now', array(), 'button-primary button-large', $buy_now_url, true) : $this->_template_args['preview_action_button']; |
|
2443 | + $template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php'; |
|
2444 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2445 | + $this->_display_admin_page($display_sidebar); |
|
2446 | 2446 | } |
2447 | 2447 | |
2448 | 2448 | |
@@ -2476,41 +2476,41 @@ discard block |
||
2476 | 2476 | * @param boolean $sidebar whether to display with sidebar or not. |
2477 | 2477 | * @return html |
2478 | 2478 | */ |
2479 | - private function _display_admin_list_table_page( $sidebar = false ) { |
|
2479 | + private function _display_admin_list_table_page($sidebar = false) { |
|
2480 | 2480 | //setup search attributes |
2481 | 2481 | $this->_set_search_attributes(); |
2482 | 2482 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2483 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php'; |
|
2483 | + $template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php'; |
|
2484 | 2484 | |
2485 | - $this->_template_args['table_url'] = defined( 'DOING_AJAX') ? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url ) : add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url); |
|
2485 | + $this->_template_args['table_url'] = defined('DOING_AJAX') ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url) : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url); |
|
2486 | 2486 | $this->_template_args['list_table'] = $this->_list_table_object; |
2487 | 2487 | $this->_template_args['current_route'] = $this->_req_action; |
2488 | - $this->_template_args['list_table_class'] = get_class( $this->_list_table_object ); |
|
2488 | + $this->_template_args['list_table_class'] = get_class($this->_list_table_object); |
|
2489 | 2489 | |
2490 | 2490 | $ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback(); |
2491 | - if( ! empty( $ajax_sorting_callback )) { |
|
2492 | - $sortable_list_table_form_fields = wp_nonce_field( $ajax_sorting_callback . '_nonce', $ajax_sorting_callback . '_nonce', FALSE, FALSE ); |
|
2491 | + if ( ! empty($ajax_sorting_callback)) { |
|
2492 | + $sortable_list_table_form_fields = wp_nonce_field($ajax_sorting_callback.'_nonce', $ajax_sorting_callback.'_nonce', FALSE, FALSE); |
|
2493 | 2493 | // $reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce'; |
2494 | 2494 | // $sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE ); |
2495 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />'; |
|
2496 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />'; |
|
2495 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />'; |
|
2496 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />'; |
|
2497 | 2497 | } else { |
2498 | 2498 | $sortable_list_table_form_fields = ''; |
2499 | 2499 | } |
2500 | 2500 | |
2501 | 2501 | $this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields; |
2502 | - $hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2503 | - $nonce_ref = $this->_req_action . '_nonce'; |
|
2504 | - $hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">'; |
|
2502 | + $hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2503 | + $nonce_ref = $this->_req_action.'_nonce'; |
|
2504 | + $hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">'; |
|
2505 | 2505 | $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields; |
2506 | 2506 | |
2507 | 2507 | //display message about search results? |
2508 | - $this->_template_args['before_list_table'] .= apply_filters( 'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', !empty( $this->_req_data['s'] ) ? '<p class="ee-search-results">' . sprintf( __('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), trim($this->_req_data['s'], '%') ) . '</p>' : '', $this->page_slug, $this->_req_data, $this->_req_action ); |
|
2508 | + $this->_template_args['before_list_table'] .= apply_filters('FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', ! empty($this->_req_data['s']) ? '<p class="ee-search-results">'.sprintf(__('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), trim($this->_req_data['s'], '%')).'</p>' : '', $this->page_slug, $this->_req_data, $this->_req_action); |
|
2509 | 2509 | |
2510 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2510 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2511 | 2511 | |
2512 | 2512 | // the final template wrapper |
2513 | - if ( $sidebar ) |
|
2513 | + if ($sidebar) |
|
2514 | 2514 | $this->display_admin_page_with_sidebar(); |
2515 | 2515 | else |
2516 | 2516 | $this->display_admin_page_with_no_sidebar(); |
@@ -2533,9 +2533,9 @@ discard block |
||
2533 | 2533 | * @param array $items see above for format of array |
2534 | 2534 | * @return string html string of legend |
2535 | 2535 | */ |
2536 | - protected function _display_legend( $items ) { |
|
2537 | - $this->_template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this ); |
|
2538 | - $legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php'; |
|
2536 | + protected function _display_legend($items) { |
|
2537 | + $this->_template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this); |
|
2538 | + $legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php'; |
|
2539 | 2539 | return EEH_Template::display_template($legend_template, $this->_template_args, TRUE); |
2540 | 2540 | } |
2541 | 2541 | |
@@ -2560,33 +2560,33 @@ discard block |
||
2560 | 2560 | * |
2561 | 2561 | * @return string json object |
2562 | 2562 | */ |
2563 | - protected function _return_json( $sticky_notices = false ) { |
|
2563 | + protected function _return_json($sticky_notices = false) { |
|
2564 | 2564 | |
2565 | 2565 | //make sure any EE_Error notices have been handled. |
2566 | - $this->_process_notices( array(), true, $sticky_notices ); |
|
2566 | + $this->_process_notices(array(), true, $sticky_notices); |
|
2567 | 2567 | |
2568 | 2568 | |
2569 | - $data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array(); |
|
2569 | + $data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array(); |
|
2570 | 2570 | unset($this->_template_args['data']); |
2571 | 2571 | $json = array( |
2572 | - 'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : false, |
|
2573 | - 'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : false, |
|
2574 | - 'errors' => isset( $this->_template_args['errors'] ) ? $this->_template_args['errors'] : false, |
|
2575 | - 'attention' => isset( $this->_template_args['attention'] ) ? $this->_template_args['attention'] : false, |
|
2572 | + 'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : false, |
|
2573 | + 'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : false, |
|
2574 | + 'errors' => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false, |
|
2575 | + 'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false, |
|
2576 | 2576 | 'notices' => EE_Error::get_notices(), |
2577 | - 'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '', |
|
2578 | - 'data' => array_merge( $data, array('template_args' => $this->_template_args ) ), |
|
2577 | + 'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '', |
|
2578 | + 'data' => array_merge($data, array('template_args' => $this->_template_args)), |
|
2579 | 2579 | 'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package. |
2580 | 2580 | ); |
2581 | 2581 | |
2582 | 2582 | |
2583 | 2583 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2584 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2584 | + if (NULL === error_get_last() || ! headers_sent()) |
|
2585 | 2585 | header('Content-Type: application/json; charset=UTF-8'); |
2586 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2587 | - echo wp_json_encode( $json ); |
|
2586 | + if (function_exists('wp_json_encode')) { |
|
2587 | + echo wp_json_encode($json); |
|
2588 | 2588 | } else { |
2589 | - echo json_encode( $json ); |
|
2589 | + echo json_encode($json); |
|
2590 | 2590 | } |
2591 | 2591 | exit(); |
2592 | 2592 | } |
@@ -2598,11 +2598,11 @@ discard block |
||
2598 | 2598 | * @return json_obj|EE_Error |
2599 | 2599 | */ |
2600 | 2600 | public function return_json() { |
2601 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2601 | + if (defined('DOING_AJAX') && DOING_AJAX) |
|
2602 | 2602 | $this->_return_json(); |
2603 | 2603 | |
2604 | 2604 | else { |
2605 | - throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
|
2605 | + throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__)); |
|
2606 | 2606 | } |
2607 | 2607 | } |
2608 | 2608 | |
@@ -2617,7 +2617,7 @@ discard block |
||
2617 | 2617 | * @access public |
2618 | 2618 | * @return void |
2619 | 2619 | */ |
2620 | - public function set_hook_object( EE_Admin_Hooks $hook_obj ) { |
|
2620 | + public function set_hook_object(EE_Admin_Hooks $hook_obj) { |
|
2621 | 2621 | $this->_hook_obj = $hook_obj; |
2622 | 2622 | } |
2623 | 2623 | |
@@ -2633,33 +2633,33 @@ discard block |
||
2633 | 2633 | */ |
2634 | 2634 | public function admin_page_wrapper($about = FALSE) { |
2635 | 2635 | |
2636 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2636 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2637 | 2637 | |
2638 | 2638 | $this->_nav_tabs = $this->_get_main_nav_tabs(); |
2639 | 2639 | |
2640 | 2640 | $this->_template_args['nav_tabs'] = $this->_nav_tabs; |
2641 | 2641 | $this->_template_args['admin_page_title'] = $this->_admin_page_title; |
2642 | 2642 | |
2643 | - $this->_template_args['before_admin_page_content'] = apply_filters( 'FHEE_before_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['before_admin_page_content'] ) ? $this->_template_args['before_admin_page_content'] : ''); |
|
2644 | - $this->_template_args['after_admin_page_content'] = apply_filters( 'FHEE_after_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['after_admin_page_content'] ) ? $this->_template_args['after_admin_page_content'] : ''); |
|
2643 | + $this->_template_args['before_admin_page_content'] = apply_filters('FHEE_before_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''); |
|
2644 | + $this->_template_args['after_admin_page_content'] = apply_filters('FHEE_after_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''); |
|
2645 | 2645 | |
2646 | 2646 | $this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content(); |
2647 | 2647 | |
2648 | 2648 | |
2649 | 2649 | |
2650 | 2650 | // load settings page wrapper template |
2651 | - $template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php'; |
|
2651 | + $template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php'; |
|
2652 | 2652 | |
2653 | 2653 | //about page? |
2654 | - $template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path; |
|
2654 | + $template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path; |
|
2655 | 2655 | |
2656 | 2656 | |
2657 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2658 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2657 | + if (defined('DOING_AJAX')) { |
|
2658 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2659 | 2659 | |
2660 | 2660 | $this->_return_json(); |
2661 | 2661 | } else { |
2662 | - EEH_Template::display_template( $template_path, $this->_template_args ); |
|
2662 | + EEH_Template::display_template($template_path, $this->_template_args); |
|
2663 | 2663 | } |
2664 | 2664 | |
2665 | 2665 | } |
@@ -2687,7 +2687,7 @@ discard block |
||
2687 | 2687 | * @access public |
2688 | 2688 | * @return void |
2689 | 2689 | */ |
2690 | - private function _sort_nav_tabs( $a, $b ) { |
|
2690 | + private function _sort_nav_tabs($a, $b) { |
|
2691 | 2691 | if ($a['order'] == $b['order']) { |
2692 | 2692 | return 0; |
2693 | 2693 | } |
@@ -2708,7 +2708,7 @@ discard block |
||
2708 | 2708 | * @uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php) |
2709 | 2709 | * @uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php) |
2710 | 2710 | */ |
2711 | - protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) { |
|
2711 | + protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) { |
|
2712 | 2712 | $content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars); |
2713 | 2713 | return $content; |
2714 | 2714 | } |
@@ -2730,25 +2730,25 @@ discard block |
||
2730 | 2730 | * @param array $actions if included allows us to set the actions that each button will carry out (i.e. via the "name" value in the button). We can also use this to just dump default actions by submitting some other value. |
2731 | 2731 | * @param bool|string|null $referrer if false then we just do the default action on save and close. Other wise it will use the $referrer string. IF null, then we don't do ANYTHING on save and close (normal form handling). |
2732 | 2732 | */ |
2733 | - protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) { |
|
2733 | + protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) { |
|
2734 | 2734 | //make sure $text and $actions are in an array |
2735 | 2735 | $text = (array) $text; |
2736 | 2736 | $actions = (array) $actions; |
2737 | 2737 | $referrer_url = empty($referrer) ? '' : $referrer; |
2738 | - $referrer_url = !$referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $_SERVER['REQUEST_URI'] .'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $referrer .'" />'; |
|
2738 | + $referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$_SERVER['REQUEST_URI'].'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$referrer.'" />'; |
|
2739 | 2739 | |
2740 | - $button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') ); |
|
2741 | - $default_names = array( 'save', 'save_and_close' ); |
|
2740 | + $button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso')); |
|
2741 | + $default_names = array('save', 'save_and_close'); |
|
2742 | 2742 | |
2743 | 2743 | //add in a hidden index for the current page (so save and close redirects properly) |
2744 | 2744 | $this->_template_args['save_buttons'] = $referrer_url; |
2745 | 2745 | |
2746 | - foreach ( $button_text as $key => $button ) { |
|
2746 | + foreach ($button_text as $key => $button) { |
|
2747 | 2747 | $ref = $default_names[$key]; |
2748 | - $id = $this->_current_view . '_' . $ref; |
|
2749 | - $name = !empty($actions) ? $actions[$key] : $ref; |
|
2750 | - $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
|
2751 | - if ( !$both ) break; |
|
2748 | + $id = $this->_current_view.'_'.$ref; |
|
2749 | + $name = ! empty($actions) ? $actions[$key] : $ref; |
|
2750 | + $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />'; |
|
2751 | + if ( ! $both) break; |
|
2752 | 2752 | } |
2753 | 2753 | |
2754 | 2754 | } |
@@ -2761,8 +2761,8 @@ discard block |
||
2761 | 2761 | * @since 4.6.0 |
2762 | 2762 | * |
2763 | 2763 | */ |
2764 | - public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2765 | - $this->_set_add_edit_form_tags( $route, $additional_hidden_fields ); |
|
2764 | + public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2765 | + $this->_set_add_edit_form_tags($route, $additional_hidden_fields); |
|
2766 | 2766 | } |
2767 | 2767 | |
2768 | 2768 | |
@@ -2775,30 +2775,30 @@ discard block |
||
2775 | 2775 | * @param array $additional_hidden_fields any additional hidden fields required in the form header |
2776 | 2776 | * @return void |
2777 | 2777 | */ |
2778 | - protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2778 | + protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2779 | 2779 | |
2780 | - if ( empty( $route )) { |
|
2780 | + if (empty($route)) { |
|
2781 | 2781 | $user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso'); |
2782 | - $dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ ); |
|
2783 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2782 | + $dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__); |
|
2783 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
2784 | 2784 | } |
2785 | 2785 | // open form |
2786 | - $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >'; |
|
2786 | + $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >'; |
|
2787 | 2787 | // add nonce |
2788 | - $nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE ); |
|
2788 | + $nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE); |
|
2789 | 2789 | // $nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE ); |
2790 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce; |
|
2790 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$nonce; |
|
2791 | 2791 | // add REQUIRED form action |
2792 | 2792 | $hidden_fields = array( |
2793 | - 'action' => array( 'type' => 'hidden', 'value' => $route ), |
|
2793 | + 'action' => array('type' => 'hidden', 'value' => $route), |
|
2794 | 2794 | ); |
2795 | 2795 | // merge arrays |
2796 | - $hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields; |
|
2796 | + $hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields; |
|
2797 | 2797 | // generate form fields |
2798 | - $form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' ); |
|
2798 | + $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array'); |
|
2799 | 2799 | // add fields to form |
2800 | - foreach ( $form_fields as $field_name => $form_field ) { |
|
2801 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field']; |
|
2800 | + foreach ($form_fields as $field_name => $form_field) { |
|
2801 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field']; |
|
2802 | 2802 | } |
2803 | 2803 | |
2804 | 2804 | // close form |
@@ -2815,8 +2815,8 @@ discard block |
||
2815 | 2815 | * @see EE_Admin_Page::_redirect_after_action() for params. |
2816 | 2816 | * @since 4.5.0 |
2817 | 2817 | */ |
2818 | - public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2819 | - $this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite ); |
|
2818 | + public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2819 | + $this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite); |
|
2820 | 2820 | } |
2821 | 2821 | |
2822 | 2822 | |
@@ -2832,32 +2832,32 @@ discard block |
||
2832 | 2832 | * @access protected |
2833 | 2833 | * @return void |
2834 | 2834 | */ |
2835 | - protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2835 | + protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2836 | 2836 | |
2837 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2837 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2838 | 2838 | |
2839 | 2839 | //class name for actions/filters. |
2840 | 2840 | $classname = get_class($this); |
2841 | 2841 | |
2842 | 2842 | //set redirect url. Note if there is a "page" index in the $query_args then we go with vanilla admin.php route, otherwise we go with whatever is set as the _admin_base_url |
2843 | - $redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2844 | - $notices = EE_Error::get_notices( FALSE ); |
|
2843 | + $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2844 | + $notices = EE_Error::get_notices(FALSE); |
|
2845 | 2845 | |
2846 | 2846 | // overwrite default success messages //BUT ONLY if overwrite not overridden |
2847 | - if ( ! $override_overwrite || ! empty( $notices['errors'] )) { |
|
2847 | + if ( ! $override_overwrite || ! empty($notices['errors'])) { |
|
2848 | 2848 | EE_Error::overwrite_success(); |
2849 | 2849 | } |
2850 | 2850 | // how many records affected ? more than one record ? or just one ? |
2851 | - if ( $success > 1 && empty( $notices['errors'] )) { |
|
2851 | + if ($success > 1 && empty($notices['errors'])) { |
|
2852 | 2852 | // set plural msg |
2853 | - EE_Error::add_success( sprintf( __('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc ), __FILE__, __FUNCTION__, __LINE__); |
|
2854 | - } else if ( $success == 1 && empty( $notices['errors'] )) { |
|
2853 | + EE_Error::add_success(sprintf(__('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__); |
|
2854 | + } else if ($success == 1 && empty($notices['errors'])) { |
|
2855 | 2855 | // set singular msg |
2856 | - EE_Error::add_success( sprintf( __('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__ ); |
|
2856 | + EE_Error::add_success(sprintf(__('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__); |
|
2857 | 2857 | } |
2858 | 2858 | |
2859 | 2859 | // check that $query_args isn't something crazy |
2860 | - if ( ! is_array( $query_args )) { |
|
2860 | + if ( ! is_array($query_args)) { |
|
2861 | 2861 | $query_args = array(); |
2862 | 2862 | } |
2863 | 2863 | |
@@ -2870,36 +2870,36 @@ discard block |
||
2870 | 2870 | * @param array $query_args The original query_args array coming into the |
2871 | 2871 | * method. |
2872 | 2872 | */ |
2873 | - do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args ); |
|
2873 | + do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args); |
|
2874 | 2874 | |
2875 | 2875 | //calculate where we're going (if we have a "save and close" button pushed) |
2876 | - if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) { |
|
2876 | + if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) { |
|
2877 | 2877 | // even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce |
2878 | - $parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] ); |
|
2878 | + $parsed_url = parse_url($this->_req_data['save_and_close_referrer']); |
|
2879 | 2879 | // regenerate query args array from refferer URL |
2880 | - parse_str( $parsed_url['query'], $query_args ); |
|
2880 | + parse_str($parsed_url['query'], $query_args); |
|
2881 | 2881 | // correct page and action will be in the query args now |
2882 | - $redirect_url = admin_url( 'admin.php' ); |
|
2882 | + $redirect_url = admin_url('admin.php'); |
|
2883 | 2883 | } |
2884 | 2884 | |
2885 | 2885 | //merge any default query_args set in _default_route_query_args property |
2886 | - if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) { |
|
2886 | + if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) { |
|
2887 | 2887 | $args_to_merge = array(); |
2888 | - foreach ( $this->_default_route_query_args as $query_param => $query_value ) { |
|
2888 | + foreach ($this->_default_route_query_args as $query_param => $query_value) { |
|
2889 | 2889 | //is there a wp_referer array in our _default_route_query_args property? |
2890 | - if ( $query_param == 'wp_referer' ) { |
|
2890 | + if ($query_param == 'wp_referer') { |
|
2891 | 2891 | $query_value = (array) $query_value; |
2892 | - foreach ( $query_value as $reference => $value ) { |
|
2893 | - if ( strpos( $reference, 'nonce' ) !== false ) { |
|
2892 | + foreach ($query_value as $reference => $value) { |
|
2893 | + if (strpos($reference, 'nonce') !== false) { |
|
2894 | 2894 | continue; |
2895 | 2895 | } |
2896 | 2896 | |
2897 | 2897 | //finally we will override any arguments in the referer with |
2898 | 2898 | //what might be set on the _default_route_query_args array. |
2899 | - if ( isset( $this->_default_route_query_args[$reference] ) ) { |
|
2900 | - $args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] ); |
|
2899 | + if (isset($this->_default_route_query_args[$reference])) { |
|
2900 | + $args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]); |
|
2901 | 2901 | } else { |
2902 | - $args_to_merge[$reference] = urlencode( $value ); |
|
2902 | + $args_to_merge[$reference] = urlencode($value); |
|
2903 | 2903 | } |
2904 | 2904 | } |
2905 | 2905 | continue; |
@@ -2910,7 +2910,7 @@ discard block |
||
2910 | 2910 | |
2911 | 2911 | //now let's merge these arguments but override with what was specifically sent in to the |
2912 | 2912 | //redirect. |
2913 | - $query_args = array_merge( $args_to_merge, $query_args ); |
|
2913 | + $query_args = array_merge($args_to_merge, $query_args); |
|
2914 | 2914 | } |
2915 | 2915 | |
2916 | 2916 | $this->_process_notices($query_args); |
@@ -2919,19 +2919,19 @@ discard block |
||
2919 | 2919 | // generate redirect url |
2920 | 2920 | |
2921 | 2921 | // if redirecting to anything other than the main page, add a nonce |
2922 | - if ( isset( $query_args['action'] )) { |
|
2922 | + if (isset($query_args['action'])) { |
|
2923 | 2923 | // manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars |
2924 | - $query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
2924 | + $query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
2925 | 2925 | } |
2926 | 2926 | |
2927 | 2927 | //we're adding some hooks and filters in here for processing any things just before redirects (example: an admin page has done an insert or update and we want to run something after that). |
2928 | - do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args ); |
|
2928 | + do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args); |
|
2929 | 2929 | |
2930 | - $redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args ); |
|
2930 | + $redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args); |
|
2931 | 2931 | |
2932 | 2932 | |
2933 | 2933 | // check if we're doing ajax. If we are then lets just return the results and js can handle how it wants. |
2934 | - if ( defined('DOING_AJAX' ) ) { |
|
2934 | + if (defined('DOING_AJAX')) { |
|
2935 | 2935 | $default_data = array( |
2936 | 2936 | 'close' => TRUE, |
2937 | 2937 | 'redirect_url' => $redirect_url, |
@@ -2940,11 +2940,11 @@ discard block |
||
2940 | 2940 | ); |
2941 | 2941 | |
2942 | 2942 | $this->_template_args['success'] = $success; |
2943 | - $this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data; |
|
2943 | + $this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data; |
|
2944 | 2944 | $this->_return_json(); |
2945 | 2945 | } |
2946 | 2946 | |
2947 | - wp_safe_redirect( $redirect_url ); |
|
2947 | + wp_safe_redirect($redirect_url); |
|
2948 | 2948 | exit(); |
2949 | 2949 | } |
2950 | 2950 | |
@@ -2960,30 +2960,30 @@ discard block |
||
2960 | 2960 | * @param bool $sticky_notices This is used to flag that regardless of whether this is doing_ajax or not, we still save a transient for the notice. |
2961 | 2961 | * @return void |
2962 | 2962 | */ |
2963 | - protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) { |
|
2963 | + protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) { |
|
2964 | 2964 | |
2965 | 2965 | //first let's set individual error properties if doing_ajax and the properties aren't already set. |
2966 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
2967 | - $notices = EE_Error::get_notices( false ); |
|
2968 | - if ( empty( $this->_template_args['success'] ) ) { |
|
2969 | - $this->_template_args['success'] = isset( $notices['success'] ) ? $notices['success'] : false; |
|
2966 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
2967 | + $notices = EE_Error::get_notices(false); |
|
2968 | + if (empty($this->_template_args['success'])) { |
|
2969 | + $this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false; |
|
2970 | 2970 | } |
2971 | 2971 | |
2972 | - if ( empty( $this->_template_args['errors'] ) ) { |
|
2973 | - $this->_template_args['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : false; |
|
2972 | + if (empty($this->_template_args['errors'])) { |
|
2973 | + $this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false; |
|
2974 | 2974 | } |
2975 | 2975 | |
2976 | - if ( empty( $this->_template_args['attention'] ) ) { |
|
2977 | - $this->_template_args['attention'] = isset( $notices['attention'] ) ? $notices['attention'] : false; |
|
2976 | + if (empty($this->_template_args['attention'])) { |
|
2977 | + $this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false; |
|
2978 | 2978 | } |
2979 | 2979 | } |
2980 | 2980 | |
2981 | 2981 | $this->_template_args['notices'] = EE_Error::get_notices(); |
2982 | 2982 | |
2983 | 2983 | //IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true) |
2984 | - if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) { |
|
2985 | - $route = isset( $query_args['action'] ) ? $query_args['action'] : 'default'; |
|
2986 | - $this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify ); |
|
2984 | + if ( ! defined('DOING_AJAX') || $sticky_notices) { |
|
2985 | + $route = isset($query_args['action']) ? $query_args['action'] : 'default'; |
|
2986 | + $this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify); |
|
2987 | 2987 | } |
2988 | 2988 | } |
2989 | 2989 | |
@@ -3005,32 +3005,32 @@ discard block |
||
3005 | 3005 | * |
3006 | 3006 | * @return string html for button |
3007 | 3007 | */ |
3008 | - public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false ) { |
|
3008 | + public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false) { |
|
3009 | 3009 | //first let's validate the action (if $base_url is FALSE otherwise validation will happen further along) |
3010 | - if ( !isset($this->_page_routes[$action]) && !$base_url ) |
|
3011 | - throw new EE_Error( sprintf( __('There is no page route for given action for the button. This action was given: %s', 'event_espresso'), $action) ); |
|
3010 | + if ( ! isset($this->_page_routes[$action]) && ! $base_url) |
|
3011 | + throw new EE_Error(sprintf(__('There is no page route for given action for the button. This action was given: %s', 'event_espresso'), $action)); |
|
3012 | 3012 | |
3013 | - if ( !isset( $this->_labels['buttons'][$type] ) ) |
|
3014 | - throw new EE_Error( sprintf( __('There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.', 'event_espresso'), $type) ); |
|
3013 | + if ( ! isset($this->_labels['buttons'][$type])) |
|
3014 | + throw new EE_Error(sprintf(__('There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.', 'event_espresso'), $type)); |
|
3015 | 3015 | |
3016 | 3016 | //finally check user access for this button. |
3017 | - $has_access = $this->check_user_access( $action, TRUE ); |
|
3018 | - if ( ! $has_access ) { |
|
3017 | + $has_access = $this->check_user_access($action, TRUE); |
|
3018 | + if ( ! $has_access) { |
|
3019 | 3019 | return ''; |
3020 | 3020 | } |
3021 | 3021 | |
3022 | - $_base_url = !$base_url ? $this->_admin_base_url : $base_url; |
|
3022 | + $_base_url = ! $base_url ? $this->_admin_base_url : $base_url; |
|
3023 | 3023 | |
3024 | 3024 | $query_args = array( |
3025 | 3025 | 'action' => $action ); |
3026 | 3026 | |
3027 | 3027 | //merge extra_request args but make sure our original action takes precedence and doesn't get overwritten. |
3028 | - if ( !empty($extra_request) ) |
|
3029 | - $query_args = array_merge( $extra_request, $query_args ); |
|
3028 | + if ( ! empty($extra_request)) |
|
3029 | + $query_args = array_merge($extra_request, $query_args); |
|
3030 | 3030 | |
3031 | - $url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce ); |
|
3031 | + $url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce); |
|
3032 | 3032 | |
3033 | - $button = EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][$type], $class ); |
|
3033 | + $button = EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class); |
|
3034 | 3034 | |
3035 | 3035 | return $button; |
3036 | 3036 | } |
@@ -3050,11 +3050,11 @@ discard block |
||
3050 | 3050 | $args = array( |
3051 | 3051 | 'label' => $this->_admin_page_title, |
3052 | 3052 | 'default' => 10, |
3053 | - 'option' => $this->_current_page . '_' . $this->_current_view . '_per_page' |
|
3053 | + 'option' => $this->_current_page.'_'.$this->_current_view.'_per_page' |
|
3054 | 3054 | ); |
3055 | 3055 | //ONLY add the screen option if the user has access to it. |
3056 | - if ( $this->check_user_access( $this->_current_view, true ) ) { |
|
3057 | - add_screen_option( $option, $args ); |
|
3056 | + if ($this->check_user_access($this->_current_view, true)) { |
|
3057 | + add_screen_option($option, $args); |
|
3058 | 3058 | } |
3059 | 3059 | } |
3060 | 3060 | |
@@ -3070,36 +3070,36 @@ discard block |
||
3070 | 3070 | * @return void |
3071 | 3071 | */ |
3072 | 3072 | private function _set_per_page_screen_options() { |
3073 | - if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
|
3074 | - check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
|
3073 | + if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) { |
|
3074 | + check_admin_referer('screen-options-nonce', 'screenoptionnonce'); |
|
3075 | 3075 | |
3076 | - if ( !$user = wp_get_current_user() ) |
|
3076 | + if ( ! $user = wp_get_current_user()) |
|
3077 | 3077 | return; |
3078 | 3078 | $option = $_POST['wp_screen_options']['option']; |
3079 | 3079 | $value = $_POST['wp_screen_options']['value']; |
3080 | 3080 | |
3081 | - if ( $option != sanitize_key( $option ) ) |
|
3081 | + if ($option != sanitize_key($option)) |
|
3082 | 3082 | return; |
3083 | 3083 | |
3084 | 3084 | $map_option = $option; |
3085 | 3085 | |
3086 | 3086 | $option = str_replace('-', '_', $option); |
3087 | 3087 | |
3088 | - switch ( $map_option ) { |
|
3089 | - case $this->_current_page . '_' . $this->_current_view . '_per_page': |
|
3088 | + switch ($map_option) { |
|
3089 | + case $this->_current_page.'_'.$this->_current_view.'_per_page': |
|
3090 | 3090 | $value = (int) $value; |
3091 | - if ( $value < 1 || $value > 999 ) |
|
3091 | + if ($value < 1 || $value > 999) |
|
3092 | 3092 | return; |
3093 | 3093 | break; |
3094 | 3094 | default: |
3095 | - $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
|
3096 | - if ( false === $value ) |
|
3095 | + $value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value); |
|
3096 | + if (false === $value) |
|
3097 | 3097 | return; |
3098 | 3098 | break; |
3099 | 3099 | } |
3100 | 3100 | |
3101 | 3101 | update_user_meta($user->ID, $option, $value); |
3102 | - wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) ); |
|
3102 | + wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer())); |
|
3103 | 3103 | exit; |
3104 | 3104 | } |
3105 | 3105 | } |
@@ -3110,8 +3110,8 @@ discard block |
||
3110 | 3110 | * This just allows for setting the $_template_args property if it needs to be set outside the object |
3111 | 3111 | * @param array $data array that will be assigned to template args. |
3112 | 3112 | */ |
3113 | - public function set_template_args( $data ) { |
|
3114 | - $this->_template_args = array_merge( $this->_template_args, (array) $data ); |
|
3113 | + public function set_template_args($data) { |
|
3114 | + $this->_template_args = array_merge($this->_template_args, (array) $data); |
|
3115 | 3115 | } |
3116 | 3116 | |
3117 | 3117 | |
@@ -3127,26 +3127,26 @@ discard block |
||
3127 | 3127 | * @param bool $skip_route_verify Used to indicate we want to skip route verification. This is usually ONLY used when we are adding a transient before page_routes have been defined. |
3128 | 3128 | * @return void |
3129 | 3129 | */ |
3130 | - protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
|
3130 | + protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) { |
|
3131 | 3131 | $user_id = get_current_user_id(); |
3132 | 3132 | |
3133 | - if ( !$skip_route_verify ) |
|
3133 | + if ( ! $skip_route_verify) |
|
3134 | 3134 | $this->_verify_route($route); |
3135 | 3135 | |
3136 | 3136 | |
3137 | 3137 | //now let's set the string for what kind of transient we're setting |
3138 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3139 | - $data = $notices ? array( 'notices' => $data ) : $data; |
|
3138 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3139 | + $data = $notices ? array('notices' => $data) : $data; |
|
3140 | 3140 | //is there already a transient for this route? If there is then let's ADD to that transient |
3141 | - $existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3142 | - if ( $existing ) { |
|
3143 | - $data = array_merge( (array) $data, (array) $existing ); |
|
3141 | + $existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3142 | + if ($existing) { |
|
3143 | + $data = array_merge((array) $data, (array) $existing); |
|
3144 | 3144 | } |
3145 | 3145 | |
3146 | - if ( is_multisite() && is_network_admin() ) { |
|
3147 | - set_site_transient( $transient, $data, 8 ); |
|
3146 | + if (is_multisite() && is_network_admin()) { |
|
3147 | + set_site_transient($transient, $data, 8); |
|
3148 | 3148 | } else { |
3149 | - set_transient( $transient, $data, 8 ); |
|
3149 | + set_transient($transient, $data, 8); |
|
3150 | 3150 | } |
3151 | 3151 | } |
3152 | 3152 | |
@@ -3158,18 +3158,18 @@ discard block |
||
3158 | 3158 | * @param bool $notices true we get notices transient. False we just return normal route transient |
3159 | 3159 | * @return mixed data |
3160 | 3160 | */ |
3161 | - protected function _get_transient( $notices = FALSE, $route = FALSE ) { |
|
3161 | + protected function _get_transient($notices = FALSE, $route = FALSE) { |
|
3162 | 3162 | $user_id = get_current_user_id(); |
3163 | - $route = !$route ? $this->_req_action : $route; |
|
3164 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3165 | - $data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3163 | + $route = ! $route ? $this->_req_action : $route; |
|
3164 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3165 | + $data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3166 | 3166 | //delete transient after retrieval (just in case it hasn't expired); |
3167 | - if ( is_multisite() && is_network_admin() ) { |
|
3168 | - delete_site_transient( $transient ); |
|
3167 | + if (is_multisite() && is_network_admin()) { |
|
3168 | + delete_site_transient($transient); |
|
3169 | 3169 | } else { |
3170 | - delete_transient( $transient ); |
|
3170 | + delete_transient($transient); |
|
3171 | 3171 | } |
3172 | - return $notices && isset( $data['notices'] ) ? $data['notices'] : $data; |
|
3172 | + return $notices && isset($data['notices']) ? $data['notices'] : $data; |
|
3173 | 3173 | } |
3174 | 3174 | |
3175 | 3175 | |
@@ -3186,12 +3186,12 @@ discard block |
||
3186 | 3186 | |
3187 | 3187 | //retrieve all existing transients |
3188 | 3188 | $query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'"; |
3189 | - if ( $results = $wpdb->get_results( $query ) ) { |
|
3190 | - foreach ( $results as $result ) { |
|
3191 | - $transient = str_replace( '_transient_', '', $result->option_name ); |
|
3192 | - get_transient( $transient ); |
|
3193 | - if ( is_multisite() && is_network_admin() ) { |
|
3194 | - get_site_transient( $transient ); |
|
3189 | + if ($results = $wpdb->get_results($query)) { |
|
3190 | + foreach ($results as $result) { |
|
3191 | + $transient = str_replace('_transient_', '', $result->option_name); |
|
3192 | + get_transient($transient); |
|
3193 | + if (is_multisite() && is_network_admin()) { |
|
3194 | + get_site_transient($transient); |
|
3195 | 3195 | } |
3196 | 3196 | } |
3197 | 3197 | } |
@@ -3315,23 +3315,23 @@ discard block |
||
3315 | 3315 | * @param string $line line no where error occurred |
3316 | 3316 | * @return boolean |
3317 | 3317 | */ |
3318 | - protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) { |
|
3318 | + protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') { |
|
3319 | 3319 | |
3320 | 3320 | //remove any options that are NOT going to be saved with the config settings. |
3321 | - if ( isset( $config->core->ee_ueip_optin ) ) { |
|
3321 | + if (isset($config->core->ee_ueip_optin)) { |
|
3322 | 3322 | $config->core->ee_ueip_has_notified = TRUE; |
3323 | 3323 | // TODO: remove the following two lines and make sure values are migrated from 3.1 |
3324 | - update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3325 | - update_option( 'ee_ueip_has_notified', TRUE ); |
|
3324 | + update_option('ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3325 | + update_option('ee_ueip_has_notified', TRUE); |
|
3326 | 3326 | } |
3327 | 3327 | // and save it (note we're also doing the network save here) |
3328 | - $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE; |
|
3329 | - $config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
3330 | - if ( $config_saved && $net_saved ) { |
|
3331 | - EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab )); |
|
3328 | + $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE; |
|
3329 | + $config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
3330 | + if ($config_saved && $net_saved) { |
|
3331 | + EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab)); |
|
3332 | 3332 | return TRUE; |
3333 | 3333 | } else { |
3334 | - EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line ); |
|
3334 | + EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line); |
|
3335 | 3335 | return FALSE; |
3336 | 3336 | } |
3337 | 3337 | } |
@@ -3344,7 +3344,7 @@ discard block |
||
3344 | 3344 | * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument. |
3345 | 3345 | * @return array |
3346 | 3346 | */ |
3347 | - public function get_yes_no_values(){ |
|
3347 | + public function get_yes_no_values() { |
|
3348 | 3348 | return $this->_yes_no_values; |
3349 | 3349 | } |
3350 | 3350 | |
@@ -3366,8 +3366,8 @@ discard block |
||
3366 | 3366 | * |
3367 | 3367 | * @return string |
3368 | 3368 | */ |
3369 | - protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) { |
|
3370 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3369 | + protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') { |
|
3370 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3371 | 3371 | } |
3372 | 3372 | |
3373 | 3373 | |
@@ -3381,8 +3381,8 @@ discard block |
||
3381 | 3381 | * |
3382 | 3382 | * @return string |
3383 | 3383 | */ |
3384 | - protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) { |
|
3385 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3384 | + protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') { |
|
3385 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3386 | 3386 | } |
3387 | 3387 | |
3388 | 3388 | |
@@ -3401,8 +3401,8 @@ discard block |
||
3401 | 3401 | * @return bool success/fail |
3402 | 3402 | */ |
3403 | 3403 | protected function _process_resend_registration() { |
3404 | - $this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data ); |
|
3405 | - do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data ); |
|
3404 | + $this->_template_args['success'] = EED_Messages::process_resend($this->_req_data); |
|
3405 | + do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data); |
|
3406 | 3406 | return $this->_template_args['success']; |
3407 | 3407 | } |
3408 | 3408 | |
@@ -3415,11 +3415,11 @@ discard block |
||
3415 | 3415 | * @param \EE_Payment $payment |
3416 | 3416 | * @return bool success/fail |
3417 | 3417 | */ |
3418 | - protected function _process_payment_notification( EE_Payment $payment ) { |
|
3419 | - add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' ); |
|
3420 | - do_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', $payment ); |
|
3421 | - $this->_template_args['success'] = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment ); |
|
3422 | - return $this->_template_args[ 'success' ]; |
|
3418 | + protected function _process_payment_notification(EE_Payment $payment) { |
|
3419 | + add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true'); |
|
3420 | + do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment); |
|
3421 | + $this->_template_args['success'] = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment); |
|
3422 | + return $this->_template_args['success']; |
|
3423 | 3423 | } |
3424 | 3424 | |
3425 | 3425 |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * @param bool $routing |
57 | 57 | * @return Transactions_Admin_Page |
58 | 58 | */ |
59 | - public function __construct( $routing = TRUE ) { |
|
60 | - parent::__construct( $routing ); |
|
59 | + public function __construct($routing = TRUE) { |
|
60 | + parent::__construct($routing); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | protected function _ajax_hooks() { |
83 | - add_action('wp_ajax_espresso_apply_payment', array( $this, 'apply_payments_or_refunds')); |
|
84 | - add_action('wp_ajax_espresso_apply_refund', array( $this, 'apply_payments_or_refunds')); |
|
85 | - add_action('wp_ajax_espresso_delete_payment', array( $this, 'delete_payment')); |
|
83 | + add_action('wp_ajax_espresso_apply_payment', array($this, 'apply_payments_or_refunds')); |
|
84 | + add_action('wp_ajax_espresso_apply_refund', array($this, 'apply_payments_or_refunds')); |
|
85 | + add_action('wp_ajax_espresso_delete_payment', array($this, 'delete_payment')); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | 'buttons' => array( |
98 | 98 | 'add' => __('Add New Transaction', 'event_espresso'), |
99 | 99 | 'edit' => __('Edit Transaction', 'event_espresso'), |
100 | - 'delete' => __('Delete Transaction','event_espresso'), |
|
100 | + 'delete' => __('Delete Transaction', 'event_espresso'), |
|
101 | 101 | ) |
102 | 102 | ); |
103 | 103 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $this->_set_transaction_status_array(); |
115 | 115 | |
116 | - $txn_id = ! empty( $this->_req_data['TXN_ID'] ) && ! is_array( $this->_req_data['TXN_ID'] ) ? $this->_req_data['TXN_ID'] : 0; |
|
116 | + $txn_id = ! empty($this->_req_data['TXN_ID']) && ! is_array($this->_req_data['TXN_ID']) ? $this->_req_data['TXN_ID'] : 0; |
|
117 | 117 | |
118 | 118 | $this->_page_routes = array( |
119 | 119 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | 'filename' => 'transactions_overview_views_filters_search' |
186 | 186 | ), |
187 | 187 | ), |
188 | - 'help_tour' => array( 'Transactions_Overview_Help_Tour' ), |
|
188 | + 'help_tour' => array('Transactions_Overview_Help_Tour'), |
|
189 | 189 | /** |
190 | 190 | * commented out because currently we are not displaying tips for transaction list table status but this |
191 | 191 | * may change in a later iteration so want to keep the code for then. |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | 'nav' => array( |
198 | 198 | 'label' => __('View Transaction', 'event_espresso'), |
199 | 199 | 'order' => 5, |
200 | - 'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
200 | + 'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
201 | 201 | 'persistent' => FALSE |
202 | 202 | ), |
203 | 203 | 'help_tabs' => array( |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | 'filename' => 'transactions_view_transaction_primary_registrant_billing_information' |
219 | 219 | ), |
220 | 220 | ), |
221 | - 'qtips' => array( 'Transaction_Details_Tips' ), |
|
222 | - 'help_tour' => array( 'Transaction_Details_Help_Tour' ), |
|
221 | + 'qtips' => array('Transaction_Details_Tips'), |
|
222 | + 'help_tour' => array('Transaction_Details_Help_Tour'), |
|
223 | 223 | 'metaboxes' => array('_transaction_details_metaboxes'), |
224 | 224 | |
225 | 225 | 'require_nonce' => FALSE |
@@ -237,21 +237,21 @@ discard block |
||
237 | 237 | // IF a registration was JUST added via the admin... |
238 | 238 | if ( |
239 | 239 | isset( |
240 | - $this->_req_data[ 'redirect_from' ], |
|
241 | - $this->_req_data[ 'EVT_ID' ], |
|
242 | - $this->_req_data[ 'event_name' ] |
|
240 | + $this->_req_data['redirect_from'], |
|
241 | + $this->_req_data['EVT_ID'], |
|
242 | + $this->_req_data['event_name'] |
|
243 | 243 | ) |
244 | 244 | ) { |
245 | 245 | // then set a cookie so that we can block any attempts to use |
246 | 246 | // the back button as a way to enter another registration. |
247 | - setcookie( 'ee_registration_added', $this->_req_data[ 'EVT_ID' ], time() + WEEK_IN_SECONDS, '/' ); |
|
247 | + setcookie('ee_registration_added', $this->_req_data['EVT_ID'], time() + WEEK_IN_SECONDS, '/'); |
|
248 | 248 | // and update the global |
249 | - $_COOKIE[ 'ee_registration_added' ] = $this->_req_data[ 'EVT_ID' ]; |
|
249 | + $_COOKIE['ee_registration_added'] = $this->_req_data['EVT_ID']; |
|
250 | 250 | } |
251 | - EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = __( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' ); |
|
252 | - EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' ); |
|
253 | - EE_Registry::$i18n_js_strings[ 'txn_status_array' ] = self::$_txn_status; |
|
254 | - EE_Registry::$i18n_js_strings[ 'pay_status_array' ] = self::$_pay_status; |
|
251 | + EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso'); |
|
252 | + EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso'); |
|
253 | + EE_Registry::$i18n_js_strings['txn_status_array'] = self::$_txn_status; |
|
254 | + EE_Registry::$i18n_js_strings['pay_status_array'] = self::$_pay_status; |
|
255 | 255 | } |
256 | 256 | public function admin_notices() {} |
257 | 257 | public function admin_footer_scripts() {} |
@@ -318,14 +318,14 @@ discard block |
||
318 | 318 | */ |
319 | 319 | public function load_scripts_styles() { |
320 | 320 | //enqueue style |
321 | - wp_register_style( 'espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
321 | + wp_register_style('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
322 | 322 | wp_enqueue_style('espresso_txn'); |
323 | 323 | |
324 | 324 | //scripts |
325 | 325 | add_filter('FHEE_load_accounting_js', '__return_true'); |
326 | 326 | |
327 | 327 | //scripts |
328 | - wp_register_script('espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE); |
|
328 | + wp_register_script('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE); |
|
329 | 329 | wp_enqueue_script('espresso_txn'); |
330 | 330 | |
331 | 331 | } |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | * @return void |
366 | 366 | */ |
367 | 367 | protected function _set_list_table_views_default() { |
368 | - $this->_views = array ( |
|
369 | - 'all' => array ( |
|
368 | + $this->_views = array( |
|
369 | + 'all' => array( |
|
370 | 370 | 'slug' => 'all', |
371 | 371 | 'label' => __('View All Transactions', 'event_espresso'), |
372 | 372 | 'count' => 0 |
@@ -394,20 +394,20 @@ discard block |
||
394 | 394 | * @return void |
395 | 395 | */ |
396 | 396 | private function _set_transaction_object() { |
397 | - if ( is_object( $this->_transaction) ) |
|
397 | + if (is_object($this->_transaction)) |
|
398 | 398 | return; //get out we've already set the object |
399 | 399 | |
400 | 400 | $TXN = EEM_Transaction::instance(); |
401 | 401 | |
402 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
402 | + $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE; |
|
403 | 403 | |
404 | 404 | //get transaction object |
405 | 405 | $this->_transaction = $TXN->get_one_by_ID($TXN_ID); |
406 | - $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
406 | + $this->_session = ! empty($this->_transaction) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
407 | 407 | |
408 | - if ( empty( $this->_transaction ) ) { |
|
409 | - $error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID . __(' could not be retrieved.', 'event_espresso'); |
|
410 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
408 | + if (empty($this->_transaction)) { |
|
409 | + $error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso').$TXN_ID.__(' could not be retrieved.', 'event_espresso'); |
|
410 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | |
@@ -420,11 +420,11 @@ discard block |
||
420 | 420 | * @return array |
421 | 421 | */ |
422 | 422 | protected function _transaction_legend_items() { |
423 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
423 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
424 | 424 | |
425 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_messages', 'view_filtered_messages' ) ) { |
|
426 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' ); |
|
427 | - if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) { |
|
425 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_messages', 'view_filtered_messages')) { |
|
426 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
427 | + if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
|
428 | 428 | $items['view_related_messages'] = array( |
429 | 429 | 'class' => $related_for_icon['css_class'], |
430 | 430 | 'desc' => $related_for_icon['label'], |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | |
435 | 435 | $items = apply_filters( |
436 | 436 | 'FHEE__Transactions_Admin_Page___transaction_legend_items__items', |
437 | - array_merge( $items, |
|
437 | + array_merge($items, |
|
438 | 438 | array( |
439 | 439 | 'view_details' => array( |
440 | 440 | 'class' => 'dashicons dashicons-cart', |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | ), |
447 | 447 | 'view_receipt' => array( |
448 | 448 | 'class' => 'dashicons dashicons-media-default', |
449 | - 'desc' => __('View Transaction Receipt', 'event_espresso' ) |
|
449 | + 'desc' => __('View Transaction Receipt', 'event_espresso') |
|
450 | 450 | ), |
451 | 451 | 'view_registration' => array( |
452 | 452 | 'class' => 'dashicons dashicons-clipboard', |
@@ -456,8 +456,8 @@ discard block |
||
456 | 456 | ) |
457 | 457 | ); |
458 | 458 | |
459 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) { |
|
460 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
459 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) { |
|
460 | + if (EEH_MSG_Template::is_mt_active('payment_reminder')) { |
|
461 | 461 | $items['send_payment_reminder'] = array( |
462 | 462 | 'class' => 'dashicons dashicons-email-alt', |
463 | 463 | 'desc' => __('Send Payment Reminder', 'event_espresso') |
@@ -478,29 +478,29 @@ discard block |
||
478 | 478 | 'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items', |
479 | 479 | array( |
480 | 480 | 'overpaid' => array( |
481 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::overpaid_status_code, |
|
482 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::overpaid_status_code, FALSE, 'sentence' ) |
|
481 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::overpaid_status_code, |
|
482 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::overpaid_status_code, FALSE, 'sentence') |
|
483 | 483 | ), |
484 | 484 | 'complete' => array( |
485 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::complete_status_code, |
|
486 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::complete_status_code, FALSE, 'sentence' ) |
|
485 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::complete_status_code, |
|
486 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::complete_status_code, FALSE, 'sentence') |
|
487 | 487 | ), |
488 | 488 | 'incomplete' => array( |
489 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::incomplete_status_code, |
|
490 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::incomplete_status_code, FALSE, 'sentence' ) |
|
489 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::incomplete_status_code, |
|
490 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::incomplete_status_code, FALSE, 'sentence') |
|
491 | 491 | ), |
492 | 492 | 'abandoned' => array( |
493 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::abandoned_status_code, |
|
494 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::abandoned_status_code, FALSE, 'sentence' ) |
|
493 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::abandoned_status_code, |
|
494 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::abandoned_status_code, FALSE, 'sentence') |
|
495 | 495 | ), |
496 | 496 | 'failed' => array( |
497 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::failed_status_code, |
|
498 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::failed_status_code, FALSE, 'sentence' ) |
|
497 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::failed_status_code, |
|
498 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::failed_status_code, FALSE, 'sentence') |
|
499 | 499 | ) |
500 | 500 | ) |
501 | 501 | ); |
502 | 502 | |
503 | - return array_merge( $items, $more_items); |
|
503 | + return array_merge($items, $more_items); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | |
@@ -513,9 +513,9 @@ discard block |
||
513 | 513 | */ |
514 | 514 | protected function _transactions_overview_list_table() { |
515 | 515 | $this->_admin_page_title = __('Transactions', 'event_espresso'); |
516 | - $event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID'] ) : NULL; |
|
517 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL ) . '" title="' . esc_attr__('Click to Edit event', 'event_espresso') . '">' . $event->get('EVT_name') . '</a>', '</h3>' ) : ''; |
|
518 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_transaction_legend_items() ); |
|
516 | + $event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']) : NULL; |
|
517 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'" title="'.esc_attr__('Click to Edit event', 'event_espresso').'">'.$event->get('EVT_name').'</a>', '</h3>') : ''; |
|
518 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items()); |
|
519 | 519 | $this->display_admin_list_table_page_with_no_sidebar(); |
520 | 520 | } |
521 | 521 | |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | * @return void |
530 | 530 | */ |
531 | 531 | protected function _transaction_details() { |
532 | - do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction ); |
|
532 | + do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction); |
|
533 | 533 | |
534 | 534 | $this->_set_transaction_status_array(); |
535 | 535 | |
@@ -542,14 +542,14 @@ discard block |
||
542 | 542 | $attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : NULL; |
543 | 543 | |
544 | 544 | $this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID(); |
545 | - $this->_template_args['txn_nmbr']['label'] = __( 'Transaction Number', 'event_espresso' ); |
|
545 | + $this->_template_args['txn_nmbr']['label'] = __('Transaction Number', 'event_espresso'); |
|
546 | 546 | |
547 | 547 | $this->_template_args['txn_datetime']['value'] = $this->_transaction->get_i18n_datetime('TXN_timestamp'); |
548 | - $this->_template_args['txn_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
548 | + $this->_template_args['txn_datetime']['label'] = __('Date', 'event_espresso'); |
|
549 | 549 | |
550 | - $this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->get('STS_ID') ]; |
|
551 | - $this->_template_args['txn_status']['label'] = __( 'Transaction Status', 'event_espresso' ); |
|
552 | - $this->_template_args['txn_status']['class'] = 'status-' . $this->_transaction->get('STS_ID'); |
|
550 | + $this->_template_args['txn_status']['value'] = self::$_txn_status[$this->_transaction->get('STS_ID')]; |
|
551 | + $this->_template_args['txn_status']['label'] = __('Transaction Status', 'event_espresso'); |
|
552 | + $this->_template_args['txn_status']['class'] = 'status-'.$this->_transaction->get('STS_ID'); |
|
553 | 553 | |
554 | 554 | $this->_template_args['grand_total'] = $this->_transaction->get('TXN_total'); |
555 | 555 | $this->_template_args['total_paid'] = $this->_transaction->get('TXN_paid'); |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | ) |
563 | 563 | ) { |
564 | 564 | $this->_template_args['send_payment_reminder_button'] = |
565 | - EEH_MSG_Template::is_mt_active( 'payment_reminder' ) |
|
565 | + EEH_MSG_Template::is_mt_active('payment_reminder') |
|
566 | 566 | && $this->_transaction->get('STS_ID') != EEM_Transaction::complete_status_code |
567 | 567 | && $this->_transaction->get('STS_ID') != EEM_Transaction::overpaid_status_code |
568 | 568 | ? EEH_Template::get_button_or_link( |
@@ -584,40 +584,40 @@ discard block |
||
584 | 584 | } |
585 | 585 | |
586 | 586 | $amount_due = $this->_transaction->get('TXN_total') - $this->_transaction->get('TXN_paid'); |
587 | - $this->_template_args['amount_due'] = EEH_Template::format_currency( $amount_due, TRUE ); |
|
588 | - if ( EE_Registry::instance()->CFG->currency->sign_b4 ) { |
|
589 | - $this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign . $this->_template_args['amount_due']; |
|
587 | + $this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, TRUE); |
|
588 | + if (EE_Registry::instance()->CFG->currency->sign_b4) { |
|
589 | + $this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign.$this->_template_args['amount_due']; |
|
590 | 590 | } else { |
591 | - $this->_template_args['amount_due'] = $this->_template_args['amount_due'] . EE_Registry::instance()->CFG->currency->sign; |
|
591 | + $this->_template_args['amount_due'] = $this->_template_args['amount_due'].EE_Registry::instance()->CFG->currency->sign; |
|
592 | 592 | } |
593 | - $this->_template_args['amount_due_class'] = ''; |
|
593 | + $this->_template_args['amount_due_class'] = ''; |
|
594 | 594 | |
595 | - if ( $this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total') ) { |
|
595 | + if ($this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total')) { |
|
596 | 596 | // paid in full |
597 | - $this->_template_args['amount_due'] = FALSE; |
|
598 | - } elseif ( $this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total') ) { |
|
597 | + $this->_template_args['amount_due'] = FALSE; |
|
598 | + } elseif ($this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total')) { |
|
599 | 599 | // overpaid |
600 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
601 | - } elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') > 0 )) { |
|
600 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
601 | + } elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') > 0)) { |
|
602 | 602 | // monies owing |
603 | - $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn'; |
|
604 | - } elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') == 0 )) { |
|
603 | + $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn'; |
|
604 | + } elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') == 0)) { |
|
605 | 605 | // no payments made yet |
606 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
607 | - } elseif ( $this->_transaction->get('TXN_total') == 0 ) { |
|
606 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
607 | + } elseif ($this->_transaction->get('TXN_total') == 0) { |
|
608 | 608 | // free event |
609 | - $this->_template_args['amount_due'] = FALSE; |
|
609 | + $this->_template_args['amount_due'] = FALSE; |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | $payment_method = $this->_transaction->payment_method(); |
613 | 613 | |
614 | 614 | $this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method |
615 | 615 | ? $payment_method->admin_name() |
616 | - : __( 'Unknown', 'event_espresso' ); |
|
616 | + : __('Unknown', 'event_espresso'); |
|
617 | 617 | |
618 | 618 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
619 | 619 | // link back to overview |
620 | - $this->_template_args['txn_overview_url'] = ! empty ( $_SERVER['HTTP_REFERER'] ) |
|
620 | + $this->_template_args['txn_overview_url'] = ! empty ($_SERVER['HTTP_REFERER']) |
|
621 | 621 | ? $_SERVER['HTTP_REFERER'] |
622 | 622 | : TXN_ADMIN_URL; |
623 | 623 | |
@@ -625,13 +625,13 @@ discard block |
||
625 | 625 | // next link |
626 | 626 | $next_txn = $this->_transaction->next( |
627 | 627 | null, |
628 | - array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), |
|
628 | + array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), |
|
629 | 629 | 'TXN_ID' |
630 | 630 | ); |
631 | 631 | $this->_template_args['next_transaction'] = $next_txn |
632 | 632 | ? $this->_next_link( |
633 | 633 | EE_Admin_Page::add_query_args_and_nonce( |
634 | - array( 'action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID'] ), |
|
634 | + array('action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']), |
|
635 | 635 | TXN_ADMIN_URL |
636 | 636 | ), |
637 | 637 | 'dashicons dashicons-arrow-right ee-icon-size-22' |
@@ -640,13 +640,13 @@ discard block |
||
640 | 640 | // previous link |
641 | 641 | $previous_txn = $this->_transaction->previous( |
642 | 642 | null, |
643 | - array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), |
|
643 | + array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), |
|
644 | 644 | 'TXN_ID' |
645 | 645 | ); |
646 | 646 | $this->_template_args['previous_transaction'] = $previous_txn |
647 | 647 | ? $this->_previous_link( |
648 | 648 | EE_Admin_Page::add_query_args_and_nonce( |
649 | - array( 'action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID'] ), |
|
649 | + array('action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']), |
|
650 | 650 | TXN_ADMIN_URL |
651 | 651 | ), |
652 | 652 | 'dashicons dashicons-arrow-left ee-icon-size-22' |
@@ -656,16 +656,16 @@ discard block |
||
656 | 656 | // were we just redirected here after adding a new registration ??? |
657 | 657 | if ( |
658 | 658 | isset( |
659 | - $this->_req_data[ 'redirect_from' ], |
|
660 | - $this->_req_data[ 'EVT_ID' ], |
|
661 | - $this->_req_data[ 'event_name' ] |
|
659 | + $this->_req_data['redirect_from'], |
|
660 | + $this->_req_data['EVT_ID'], |
|
661 | + $this->_req_data['event_name'] |
|
662 | 662 | ) |
663 | 663 | ) { |
664 | 664 | if ( |
665 | 665 | EE_Registry::instance()->CAP->current_user_can( |
666 | 666 | 'ee_edit_registrations', |
667 | 667 | 'espresso_registrations_new_registration', |
668 | - $this->_req_data[ 'EVT_ID' ] |
|
668 | + $this->_req_data['EVT_ID'] |
|
669 | 669 | ) |
670 | 670 | ) { |
671 | 671 | $this->_admin_page_title .= '<a id="add-new-registration" class="add-new-h2 button-primary" href="'; |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | 'action' => 'new_registration', |
676 | 676 | 'return' => 'default', |
677 | 677 | 'TXN_ID' => $this->_transaction->ID(), |
678 | - 'event_id' => $this->_req_data[ 'EVT_ID' ], |
|
678 | + 'event_id' => $this->_req_data['EVT_ID'], |
|
679 | 679 | ), |
680 | 680 | REG_ADMIN_URL |
681 | 681 | ); |
@@ -683,17 +683,17 @@ discard block |
||
683 | 683 | |
684 | 684 | $this->_admin_page_title .= sprintf( |
685 | 685 | __('Add Another New Registration to Event: "%1$s" ?'), |
686 | - htmlentities( urldecode( $this->_req_data[ 'event_name' ] ), ENT_QUOTES, 'UTF-8' ) |
|
686 | + htmlentities(urldecode($this->_req_data['event_name']), ENT_QUOTES, 'UTF-8') |
|
687 | 687 | ); |
688 | 688 | $this->_admin_page_title .= '</a>'; |
689 | 689 | } |
690 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
690 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
691 | 691 | } |
692 | 692 | // grab messages at the last second |
693 | 693 | $this->_template_args['notices'] = EE_Error::get_notices(); |
694 | 694 | // path to template |
695 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php'; |
|
696 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
695 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_header.template.php'; |
|
696 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
697 | 697 | |
698 | 698 | // the details template wrapper |
699 | 699 | $this->display_admin_page_with_sidebar(); |
@@ -712,18 +712,18 @@ discard block |
||
712 | 712 | |
713 | 713 | $this->_set_transaction_object(); |
714 | 714 | |
715 | - add_meta_box( 'edit-txn-details-mbox', __( 'Transaction Details', 'event_espresso' ), array( $this, 'txn_details_meta_box' ), $this->_wp_page_slug, 'normal', 'high' ); |
|
715 | + add_meta_box('edit-txn-details-mbox', __('Transaction Details', 'event_espresso'), array($this, 'txn_details_meta_box'), $this->_wp_page_slug, 'normal', 'high'); |
|
716 | 716 | add_meta_box( |
717 | 717 | 'edit-txn-attendees-mbox', |
718 | - __( 'Attendees Registered in this Transaction', 'event_espresso' ), |
|
719 | - array( $this, 'txn_attendees_meta_box' ), |
|
718 | + __('Attendees Registered in this Transaction', 'event_espresso'), |
|
719 | + array($this, 'txn_attendees_meta_box'), |
|
720 | 720 | $this->_wp_page_slug, |
721 | 721 | 'normal', |
722 | 722 | 'high', |
723 | - array( 'TXN_ID' => $this->_transaction->ID() ) |
|
723 | + array('TXN_ID' => $this->_transaction->ID()) |
|
724 | 724 | ); |
725 | - add_meta_box( 'edit-txn-registrant-mbox', __( 'Primary Contact', 'event_espresso' ), array( $this, 'txn_registrant_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' ); |
|
726 | - add_meta_box( 'edit-txn-billing-info-mbox', __( 'Billing Information', 'event_espresso' ), array( $this, 'txn_billing_info_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' ); |
|
725 | + add_meta_box('edit-txn-registrant-mbox', __('Primary Contact', 'event_espresso'), array($this, 'txn_registrant_side_meta_box'), $this->_wp_page_slug, 'side', 'high'); |
|
726 | + add_meta_box('edit-txn-billing-info-mbox', __('Billing Information', 'event_espresso'), array($this, 'txn_billing_info_side_meta_box'), $this->_wp_page_slug, 'side', 'high'); |
|
727 | 727 | |
728 | 728 | } |
729 | 729 | |
@@ -744,15 +744,15 @@ discard block |
||
744 | 744 | |
745 | 745 | //get line table |
746 | 746 | EEH_Autoloader::register_line_item_display_autoloaders(); |
747 | - $Line_Item_Display = new EE_Line_Item_Display( 'admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy' ); |
|
748 | - $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( $this->_transaction->total_line_item() ); |
|
747 | + $Line_Item_Display = new EE_Line_Item_Display('admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy'); |
|
748 | + $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item($this->_transaction->total_line_item()); |
|
749 | 749 | $this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code'); |
750 | 750 | |
751 | 751 | // process taxes |
752 | - $taxes = $this->_transaction->get_many_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax ))); |
|
753 | - $this->_template_args['taxes'] = ! empty( $taxes ) ? $taxes : FALSE; |
|
752 | + $taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax))); |
|
753 | + $this->_template_args['taxes'] = ! empty($taxes) ? $taxes : FALSE; |
|
754 | 754 | |
755 | - $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE ); |
|
755 | + $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE); |
|
756 | 756 | $this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total'); |
757 | 757 | $this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID'); |
758 | 758 | |
@@ -760,63 +760,63 @@ discard block |
||
760 | 760 | |
761 | 761 | // process payment details |
762 | 762 | $payments = $this->_transaction->get_many_related('Payment'); |
763 | - if( ! empty( $payments ) ) { |
|
764 | - $this->_template_args[ 'payments' ] = $payments; |
|
765 | - $this->_template_args[ 'existing_reg_payments' ] = $this->_get_registration_payment_IDs( $payments ); |
|
763 | + if ( ! empty($payments)) { |
|
764 | + $this->_template_args['payments'] = $payments; |
|
765 | + $this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments); |
|
766 | 766 | } else { |
767 | - $this->_template_args[ 'payments' ] = false; |
|
768 | - $this->_template_args[ 'existing_reg_payments' ] = array(); |
|
767 | + $this->_template_args['payments'] = false; |
|
768 | + $this->_template_args['existing_reg_payments'] = array(); |
|
769 | 769 | } |
770 | 770 | |
771 | - $this->_template_args['edit_payment_url'] = add_query_arg( array( 'action' => 'edit_payment' ), TXN_ADMIN_URL ); |
|
772 | - $this->_template_args['delete_payment_url'] = add_query_arg( array( 'action' => 'espresso_delete_payment' ), TXN_ADMIN_URL ); |
|
771 | + $this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL); |
|
772 | + $this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL); |
|
773 | 773 | |
774 | - if ( isset( $txn_details['invoice_number'] )) { |
|
774 | + if (isset($txn_details['invoice_number'])) { |
|
775 | 775 | $this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code']; |
776 | - $this->_template_args['txn_details']['invoice_number']['label'] = __( 'Invoice Number', 'event_espresso' ); |
|
776 | + $this->_template_args['txn_details']['invoice_number']['label'] = __('Invoice Number', 'event_espresso'); |
|
777 | 777 | } |
778 | 778 | |
779 | 779 | $this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session'); |
780 | - $this->_template_args['txn_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
780 | + $this->_template_args['txn_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
781 | 781 | |
782 | - $this->_template_args['txn_details']['ip_address']['value'] = isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : ''; |
|
783 | - $this->_template_args['txn_details']['ip_address']['label'] = __( 'Transaction placed from IP', 'event_espresso' ); |
|
782 | + $this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : ''; |
|
783 | + $this->_template_args['txn_details']['ip_address']['label'] = __('Transaction placed from IP', 'event_espresso'); |
|
784 | 784 | |
785 | - $this->_template_args['txn_details']['user_agent']['value'] = isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : ''; |
|
786 | - $this->_template_args['txn_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
785 | + $this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : ''; |
|
786 | + $this->_template_args['txn_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
787 | 787 | |
788 | 788 | $reg_steps = '<ul>'; |
789 | - foreach ( $this->_transaction->reg_steps() as $reg_step => $reg_step_status ) { |
|
790 | - if ( $reg_step_status === true ) { |
|
791 | - $reg_steps .= '<li style="color:#70cc50">' . sprintf( __( '%1$s : Completed', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>'; |
|
792 | - } else if ( is_numeric( $reg_step_status ) && $reg_step_status !== false ) { |
|
793 | - $reg_steps .= '<li style="color:#2EA2CC">' . sprintf( |
|
794 | - __( '%1$s : Initiated %2$s', 'event_espresso' ), |
|
795 | - ucwords( str_replace( '_', ' ', $reg_step ) ), |
|
796 | - gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), ( $reg_step_status + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ) |
|
797 | - ) . '</li>'; |
|
789 | + foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) { |
|
790 | + if ($reg_step_status === true) { |
|
791 | + $reg_steps .= '<li style="color:#70cc50">'.sprintf(__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>'; |
|
792 | + } else if (is_numeric($reg_step_status) && $reg_step_status !== false) { |
|
793 | + $reg_steps .= '<li style="color:#2EA2CC">'.sprintf( |
|
794 | + __('%1$s : Initiated %2$s', 'event_espresso'), |
|
795 | + ucwords(str_replace('_', ' ', $reg_step)), |
|
796 | + gmdate(get_option('date_format').' '.get_option('time_format'), ($reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS))) |
|
797 | + ).'</li>'; |
|
798 | 798 | } else { |
799 | - $reg_steps .= '<li style="color:#E76700">' . sprintf( __( '%1$s : Never Initiated', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>'; |
|
799 | + $reg_steps .= '<li style="color:#E76700">'.sprintf(__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>'; |
|
800 | 800 | } |
801 | 801 | } |
802 | 802 | $reg_steps .= '</ul>'; |
803 | 803 | $this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps; |
804 | - $this->_template_args['txn_details']['reg_steps']['label'] = __( 'Registration Step Progress', 'event_espresso' ); |
|
804 | + $this->_template_args['txn_details']['reg_steps']['label'] = __('Registration Step Progress', 'event_espresso'); |
|
805 | 805 | |
806 | 806 | |
807 | 807 | $this->_get_registrations_to_apply_payment_to(); |
808 | - $this->_get_payment_methods( $payments ); |
|
808 | + $this->_get_payment_methods($payments); |
|
809 | 809 | $this->_get_payment_status_array(); |
810 | 810 | $this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction. |
811 | 811 | |
812 | - $this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'transaction' ), TXN_ADMIN_URL ); |
|
813 | - $this->_template_args['apply_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_apply_payment' ), WP_AJAX_URL ); |
|
814 | - $this->_template_args['delete_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_delete_payment' ), WP_AJAX_URL ); |
|
812 | + $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL); |
|
813 | + $this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL); |
|
814 | + $this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL); |
|
815 | 815 | |
816 | 816 | // 'espresso_delete_payment_nonce' |
817 | 817 | |
818 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php'; |
|
819 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
818 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_txn_details.template.php'; |
|
819 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
820 | 820 | |
821 | 821 | } |
822 | 822 | |
@@ -831,27 +831,27 @@ discard block |
||
831 | 831 | * @param EE_Payment[] $payments |
832 | 832 | * @return array |
833 | 833 | */ |
834 | - protected function _get_registration_payment_IDs( $payments = array() ) { |
|
834 | + protected function _get_registration_payment_IDs($payments = array()) { |
|
835 | 835 | $existing_reg_payments = array(); |
836 | 836 | // get all reg payments for these payments |
837 | - $reg_payments = EEM_Registration_Payment::instance()->get_all( array( |
|
837 | + $reg_payments = EEM_Registration_Payment::instance()->get_all(array( |
|
838 | 838 | array( |
839 | 839 | 'PAY_ID' => array( |
840 | 840 | 'IN', |
841 | - array_keys( $payments ) |
|
841 | + array_keys($payments) |
|
842 | 842 | ) |
843 | 843 | ) |
844 | - ) ); |
|
845 | - if ( ! empty( $reg_payments ) ) { |
|
846 | - foreach ( $payments as $payment ) { |
|
847 | - if ( ! $payment instanceof EE_Payment ) { |
|
844 | + )); |
|
845 | + if ( ! empty($reg_payments)) { |
|
846 | + foreach ($payments as $payment) { |
|
847 | + if ( ! $payment instanceof EE_Payment) { |
|
848 | 848 | continue; |
849 | - } else if ( ! isset( $existing_reg_payments[ $payment->ID() ] ) ) { |
|
850 | - $existing_reg_payments[ $payment->ID() ] = array(); |
|
849 | + } else if ( ! isset($existing_reg_payments[$payment->ID()])) { |
|
850 | + $existing_reg_payments[$payment->ID()] = array(); |
|
851 | 851 | } |
852 | - foreach ( $reg_payments as $reg_payment ) { |
|
853 | - if ( $reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID() ) { |
|
854 | - $existing_reg_payments[ $payment->ID() ][ ] = $reg_payment->registration_ID(); |
|
852 | + foreach ($reg_payments as $reg_payment) { |
|
853 | + if ($reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID()) { |
|
854 | + $existing_reg_payments[$payment->ID()][] = $reg_payment->registration_ID(); |
|
855 | 855 | } |
856 | 856 | } |
857 | 857 | } |
@@ -888,39 +888,39 @@ discard block |
||
888 | 888 | $registrations_to_apply_payment_to .= '<br /><div class="admin-primary-mbox-tbl-wrap">'; |
889 | 889 | $registrations_to_apply_payment_to .= '<table class="admin-primary-mbox-tbl">'; |
890 | 890 | $registrations_to_apply_payment_to .= '<thead><tr>'; |
891 | - $registrations_to_apply_payment_to .= '<td>' . __( 'ID', 'event_espresso' ) . '</td>'; |
|
892 | - $registrations_to_apply_payment_to .= '<td>' . __( 'Registrant', 'event_espresso' ) . '</td>'; |
|
893 | - $registrations_to_apply_payment_to .= '<td>' . __( 'Ticket', 'event_espresso' ) . '</td>'; |
|
894 | - $registrations_to_apply_payment_to .= '<td>' . __( 'Event', 'event_espresso' ) . '</td>'; |
|
895 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">' . __( 'Paid', 'event_espresso' ) . '</td>'; |
|
896 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">' . __( 'Owing', 'event_espresso' ) . '</td>'; |
|
897 | - $registrations_to_apply_payment_to .= '<td class="jst-cntr">' . __( 'Apply', 'event_espresso' ) . '</td>'; |
|
891 | + $registrations_to_apply_payment_to .= '<td>'.__('ID', 'event_espresso').'</td>'; |
|
892 | + $registrations_to_apply_payment_to .= '<td>'.__('Registrant', 'event_espresso').'</td>'; |
|
893 | + $registrations_to_apply_payment_to .= '<td>'.__('Ticket', 'event_espresso').'</td>'; |
|
894 | + $registrations_to_apply_payment_to .= '<td>'.__('Event', 'event_espresso').'</td>'; |
|
895 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">'.__('Paid', 'event_espresso').'</td>'; |
|
896 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">'.__('Owing', 'event_espresso').'</td>'; |
|
897 | + $registrations_to_apply_payment_to .= '<td class="jst-cntr">'.__('Apply', 'event_espresso').'</td>'; |
|
898 | 898 | $registrations_to_apply_payment_to .= '</tr></thead><tbody>'; |
899 | 899 | // get registrations for TXN |
900 | - $registrations = $this->_transaction->registrations( $query_params ); |
|
901 | - foreach ( $registrations as $registration ) { |
|
902 | - if ( $registration instanceof EE_Registration ) { |
|
900 | + $registrations = $this->_transaction->registrations($query_params); |
|
901 | + foreach ($registrations as $registration) { |
|
902 | + if ($registration instanceof EE_Registration) { |
|
903 | 903 | $owing = $registration->final_price() - $registration->paid(); |
904 | - $taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> ' . __( '+ tax', 'event_espresso' ) . '</span>' : ''; |
|
905 | - $checked = empty( $existing_reg_payments ) || in_array( $registration->ID(), $existing_reg_payments ) ? ' checked="checked"' : ''; |
|
906 | - $registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-' . $registration->ID() . '">'; |
|
904 | + $taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> '.__('+ tax', 'event_espresso').'</span>' : ''; |
|
905 | + $checked = empty($existing_reg_payments) || in_array($registration->ID(), $existing_reg_payments) ? ' checked="checked"' : ''; |
|
906 | + $registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-'.$registration->ID().'">'; |
|
907 | 907 | // add html for checkbox input and label |
908 | - $registrations_to_apply_payment_to .= '<td>' . $registration->ID() . '</td>'; |
|
909 | - $registrations_to_apply_payment_to .= '<td>' . $registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ) . '</td>'; |
|
910 | - $registrations_to_apply_payment_to .= '<td>' . $registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable . '</td>'; |
|
911 | - $registrations_to_apply_payment_to .= '<td>' . $registration->event_name() . '</td>'; |
|
912 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">' . $registration->pretty_paid() . '</td>'; |
|
913 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">' . EEH_Template::format_currency( $owing ) . '</td>'; |
|
908 | + $registrations_to_apply_payment_to .= '<td>'.$registration->ID().'</td>'; |
|
909 | + $registrations_to_apply_payment_to .= '<td>'.$registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : __('Unknown Attendee', 'event_espresso').'</td>'; |
|
910 | + $registrations_to_apply_payment_to .= '<td>'.$registration->ticket()->name().' : '.$registration->ticket()->pretty_price().$taxable.'</td>'; |
|
911 | + $registrations_to_apply_payment_to .= '<td>'.$registration->event_name().'</td>'; |
|
912 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">'.$registration->pretty_paid().'</td>'; |
|
913 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">'.EEH_Template::format_currency($owing).'</td>'; |
|
914 | 914 | $registrations_to_apply_payment_to .= '<td class="jst-cntr">'; |
915 | 915 | $disabled = $registration->final_price() > 0 ? '' : ' disabled'; |
916 | - $registrations_to_apply_payment_to .= '<input type="checkbox" value="' . $registration->ID() . '" name="txn_admin_payment[registrations]"' . $checked . $disabled . '>'; |
|
916 | + $registrations_to_apply_payment_to .= '<input type="checkbox" value="'.$registration->ID().'" name="txn_admin_payment[registrations]"'.$checked.$disabled.'>'; |
|
917 | 917 | $registrations_to_apply_payment_to .= '</td>'; |
918 | 918 | $registrations_to_apply_payment_to .= '</tr>'; |
919 | 919 | } |
920 | 920 | } |
921 | 921 | $registrations_to_apply_payment_to .= '</tbody></table></div>'; |
922 | - $registrations_to_apply_payment_to .= '<p class="clear description">' . __( 'The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', 'event_espresso' ) . '</p></div>'; |
|
923 | - $this->_template_args[ 'registrations_to_apply_payment_to' ] = $registrations_to_apply_payment_to; |
|
922 | + $registrations_to_apply_payment_to .= '<p class="clear description">'.__('The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', 'event_espresso').'</p></div>'; |
|
923 | + $this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to; |
|
924 | 924 | } |
925 | 925 | |
926 | 926 | |
@@ -937,9 +937,9 @@ discard block |
||
937 | 937 | $statuses = EEM_Registration::reg_status_array(array(), TRUE); |
938 | 938 | //let's add a "don't change" option. |
939 | 939 | $status_array['NAN'] = __('Leave the Same', 'event_espresso'); |
940 | - $status_array = array_merge( $status_array, $statuses ); |
|
941 | - $this->_template_args['status_change_select'] = EEH_Form_Fields::select_input( 'txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status' ); |
|
942 | - $this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input( 'delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status' ); |
|
940 | + $status_array = array_merge($status_array, $statuses); |
|
941 | + $this->_template_args['status_change_select'] = EEH_Form_Fields::select_input('txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status'); |
|
942 | + $this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input('delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status'); |
|
943 | 943 | |
944 | 944 | } |
945 | 945 | |
@@ -954,21 +954,21 @@ discard block |
||
954 | 954 | * @param EE_Payment[] to show on this page |
955 | 955 | * @return void |
956 | 956 | */ |
957 | - private function _get_payment_methods( $payments = array() ) { |
|
957 | + private function _get_payment_methods($payments = array()) { |
|
958 | 958 | $payment_methods_of_payments = array(); |
959 | - foreach( $payments as $payment ){ |
|
960 | - if( $payment instanceof EE_Payment ){ |
|
961 | - $payment_methods_of_payments[] = $payment->get( 'PMD_ID' ); |
|
959 | + foreach ($payments as $payment) { |
|
960 | + if ($payment instanceof EE_Payment) { |
|
961 | + $payment_methods_of_payments[] = $payment->get('PMD_ID'); |
|
962 | 962 | } |
963 | 963 | } |
964 | - if( $payment_methods_of_payments ){ |
|
965 | - $query_args = array( array( 'OR*payment_method_for_payment' => array( |
|
966 | - 'PMD_ID' => array( 'IN', $payment_methods_of_payments ), |
|
967 | - 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) ); |
|
968 | - }else{ |
|
969 | - $query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ); |
|
964 | + if ($payment_methods_of_payments) { |
|
965 | + $query_args = array(array('OR*payment_method_for_payment' => array( |
|
966 | + 'PMD_ID' => array('IN', $payment_methods_of_payments), |
|
967 | + 'PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%') ))); |
|
968 | + } else { |
|
969 | + $query_args = array(array('PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%'))); |
|
970 | 970 | } |
971 | - $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args ); |
|
971 | + $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args); |
|
972 | 972 | } |
973 | 973 | |
974 | 974 | |
@@ -982,46 +982,46 @@ discard block |
||
982 | 982 | * @param array $metabox |
983 | 983 | * @return void |
984 | 984 | */ |
985 | - public function txn_attendees_meta_box( $post, $metabox = array( 'args' => array() )) { |
|
985 | + public function txn_attendees_meta_box($post, $metabox = array('args' => array())) { |
|
986 | 986 | |
987 | - extract( $metabox['args'] ); |
|
987 | + extract($metabox['args']); |
|
988 | 988 | $this->_template_args['post'] = $post; |
989 | 989 | $this->_template_args['event_attendees'] = array(); |
990 | 990 | // process items in cart |
991 | - $line_items = $this->_transaction->get_many_related('Line_Item', array( array( 'LIN_type' => 'line-item' ) ) ); |
|
992 | - if ( ! empty( $line_items )) { |
|
993 | - foreach ( $line_items as $item ) { |
|
994 | - if ( $item instanceof EE_Line_Item ) { |
|
995 | - switch( $item->OBJ_type() ) { |
|
991 | + $line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item'))); |
|
992 | + if ( ! empty($line_items)) { |
|
993 | + foreach ($line_items as $item) { |
|
994 | + if ($item instanceof EE_Line_Item) { |
|
995 | + switch ($item->OBJ_type()) { |
|
996 | 996 | |
997 | 997 | case 'Event' : |
998 | 998 | break; |
999 | 999 | |
1000 | 1000 | case 'Ticket' : |
1001 | 1001 | $ticket = $item->ticket(); |
1002 | - if ( empty( $ticket )) { |
|
1002 | + if (empty($ticket)) { |
|
1003 | 1003 | continue; //right now we're only handling tickets here. Cause its expected that only tickets will have attendees right? |
1004 | 1004 | } |
1005 | - $ticket_price = EEH_Template::format_currency( $item->get( 'LIN_unit_price' )); |
|
1005 | + $ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price')); |
|
1006 | 1006 | $event = $ticket->get_first_related('Registration')->get_first_related('Event'); |
1007 | - $event_name = $event instanceof EE_Event ? $event->get('EVT_name') . ' - ' . $item->get('LIN_name') : ''; |
|
1007 | + $event_name = $event instanceof EE_Event ? $event->get('EVT_name').' - '.$item->get('LIN_name') : ''; |
|
1008 | 1008 | |
1009 | - $registrations = $ticket->get_many_related('Registration', array( array('TXN_ID' => $this->_transaction->ID() ))); |
|
1010 | - foreach( $registrations as $registration ) { |
|
1011 | - $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count'); |
|
1012 | - $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
|
1013 | - $this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price; |
|
1009 | + $registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID()))); |
|
1010 | + foreach ($registrations as $registration) { |
|
1011 | + $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count'); |
|
1012 | + $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
|
1013 | + $this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price; |
|
1014 | 1014 | // attendee info |
1015 | 1015 | $attendee = $registration->get_first_related('Attendee'); |
1016 | - if ( $attendee instanceof EE_Attendee ) { |
|
1016 | + if ($attendee instanceof EE_Attendee) { |
|
1017 | 1017 | $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID(); |
1018 | 1018 | $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name(); |
1019 | - $this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:' . $attendee->email() . '?subject=' . $event->get('EVT_name') . __(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>'; |
|
1020 | - $this->_template_args['event_attendees'][$registration->ID()]['address'] = implode(',<br>', $attendee->full_address_as_array() ); |
|
1019 | + $this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:'.$attendee->email().'?subject='.$event->get('EVT_name').__(' Event', 'event_espresso').'">'.$attendee->email().'</a>'; |
|
1020 | + $this->_template_args['event_attendees'][$registration->ID()]['address'] = implode(',<br>', $attendee->full_address_as_array()); |
|
1021 | 1021 | } else { |
1022 | 1022 | $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = ''; |
1023 | 1023 | $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = ''; |
1024 | - $this->_template_args['event_attendees'][$registration->ID()]['email'] = ''; |
|
1024 | + $this->_template_args['event_attendees'][$registration->ID()]['email'] = ''; |
|
1025 | 1025 | $this->_template_args['event_attendees'][$registration->ID()]['address'] = ''; |
1026 | 1026 | } |
1027 | 1027 | } |
@@ -1031,12 +1031,12 @@ discard block |
||
1031 | 1031 | } |
1032 | 1032 | } |
1033 | 1033 | |
1034 | - $this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'attendees' ), TXN_ADMIN_URL ); |
|
1035 | - echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE ); |
|
1034 | + $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL); |
|
1035 | + echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE); |
|
1036 | 1036 | |
1037 | 1037 | } else { |
1038 | 1038 | echo sprintf( |
1039 | - __( '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso' ), |
|
1039 | + __('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'), |
|
1040 | 1040 | '<p class="important-notice">', |
1041 | 1041 | '</p>' |
1042 | 1042 | ); |
@@ -1055,19 +1055,19 @@ discard block |
||
1055 | 1055 | */ |
1056 | 1056 | public function txn_registrant_side_meta_box() { |
1057 | 1057 | $primary_att = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->get_first_related('Attendee') : null; |
1058 | - if ( ! $primary_att instanceof EE_Attendee ) { |
|
1058 | + if ( ! $primary_att instanceof EE_Attendee) { |
|
1059 | 1059 | $this->_template_args['no_attendee_message'] = __('There is no attached contact for this transaction. The transaction either failed due to an error or was abandoned.', 'event_espresso'); |
1060 | 1060 | $primary_att = EEM_Attendee::instance()->create_default_object(); |
1061 | 1061 | } |
1062 | - $this->_template_args['ATT_ID'] = $primary_att->ID(); |
|
1062 | + $this->_template_args['ATT_ID'] = $primary_att->ID(); |
|
1063 | 1063 | $this->_template_args['prime_reg_fname'] = $primary_att->fname(); |
1064 | 1064 | $this->_template_args['prime_reg_lname'] = $primary_att->lname(); |
1065 | - $this->_template_args['prime_reg_email'] = $primary_att->email(); |
|
1065 | + $this->_template_args['prime_reg_email'] = $primary_att->email(); |
|
1066 | 1066 | $this->_template_args['prime_reg_phone'] = $primary_att->phone(); |
1067 | - $this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'edit_attendee', 'post' => $primary_att->ID() ), REG_ADMIN_URL ); |
|
1067 | + $this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $primary_att->ID()), REG_ADMIN_URL); |
|
1068 | 1068 | // get formatted address for registrant |
1069 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $primary_att ); |
|
1070 | - echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE ); |
|
1069 | + $this->_template_args['formatted_address'] = EEH_Address::format($primary_att); |
|
1070 | + echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE); |
|
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | |
@@ -1083,12 +1083,12 @@ discard block |
||
1083 | 1083 | |
1084 | 1084 | $this->_template_args['billing_form'] = $this->_transaction->billing_info(); |
1085 | 1085 | $this->_template_args['billing_form_url'] = add_query_arg( |
1086 | - array( 'action' => 'edit_transaction', 'process' => 'billing' ), |
|
1086 | + array('action' => 'edit_transaction', 'process' => 'billing'), |
|
1087 | 1087 | TXN_ADMIN_URL |
1088 | 1088 | ); |
1089 | 1089 | |
1090 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php'; |
|
1091 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );/**/ |
|
1090 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_billing_info.template.php'; |
|
1091 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); /**/ |
|
1092 | 1092 | } |
1093 | 1093 | |
1094 | 1094 | |
@@ -1101,42 +1101,42 @@ discard block |
||
1101 | 1101 | * @return void |
1102 | 1102 | */ |
1103 | 1103 | public function apply_payments_or_refunds() { |
1104 | - $json_response_data = array( 'return_data' => FALSE ); |
|
1104 | + $json_response_data = array('return_data' => FALSE); |
|
1105 | 1105 | $valid_data = $this->_validate_payment_request_data(); |
1106 | - if ( ! empty( $valid_data ) ) { |
|
1107 | - $PAY_ID = $valid_data[ 'PAY_ID' ]; |
|
1106 | + if ( ! empty($valid_data)) { |
|
1107 | + $PAY_ID = $valid_data['PAY_ID']; |
|
1108 | 1108 | //save the new payment |
1109 | - $payment = $this->_create_payment_from_request_data( $valid_data ); |
|
1109 | + $payment = $this->_create_payment_from_request_data($valid_data); |
|
1110 | 1110 | // get the TXN for this payment |
1111 | 1111 | $transaction = $payment->transaction(); |
1112 | 1112 | // verify transaction |
1113 | - if ( $transaction instanceof EE_Transaction ) { |
|
1113 | + if ($transaction instanceof EE_Transaction) { |
|
1114 | 1114 | // calculate_total_payments_and_update_status |
1115 | - $this->_process_transaction_payments( $transaction ); |
|
1116 | - $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to( $payment ); |
|
1117 | - $this->_remove_existing_registration_payments( $payment, $PAY_ID ); |
|
1115 | + $this->_process_transaction_payments($transaction); |
|
1116 | + $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment); |
|
1117 | + $this->_remove_existing_registration_payments($payment, $PAY_ID); |
|
1118 | 1118 | // apply payment to registrations (if applicable) |
1119 | - if ( ! empty( $REG_IDs ) ) { |
|
1120 | - $this->_update_registration_payments( $transaction, $payment, $REG_IDs ); |
|
1119 | + if ( ! empty($REG_IDs)) { |
|
1120 | + $this->_update_registration_payments($transaction, $payment, $REG_IDs); |
|
1121 | 1121 | $this->_maybe_send_notifications(); |
1122 | 1122 | // now process status changes for the same registrations |
1123 | - $this->_process_registration_status_change( $transaction, $REG_IDs ); |
|
1123 | + $this->_process_registration_status_change($transaction, $REG_IDs); |
|
1124 | 1124 | } |
1125 | - $this->_maybe_send_notifications( $payment ); |
|
1125 | + $this->_maybe_send_notifications($payment); |
|
1126 | 1126 | //prepare to render page |
1127 | - $json_response_data[ 'return_data' ] = $this->_build_payment_json_response( $payment, $REG_IDs ); |
|
1128 | - do_action( 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment ); |
|
1127 | + $json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs); |
|
1128 | + do_action('AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment); |
|
1129 | 1129 | } else { |
1130 | 1130 | EE_Error::add_error( |
1131 | - __( 'A valid Transaction for this payment could not be retrieved.', 'event_espresso' ), |
|
1131 | + __('A valid Transaction for this payment could not be retrieved.', 'event_espresso'), |
|
1132 | 1132 | __FILE__, __FUNCTION__, __LINE__ |
1133 | 1133 | ); |
1134 | 1134 | } |
1135 | 1135 | } else { |
1136 | - EE_Error::add_error( __( 'The payment form data could not be processed. Please try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1136 | + EE_Error::add_error(__('The payment form data could not be processed. Please try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1137 | 1137 | } |
1138 | 1138 | |
1139 | - $notices = EE_Error::get_notices( false, false, false ); |
|
1139 | + $notices = EE_Error::get_notices(false, false, false); |
|
1140 | 1140 | $this->_template_args = array( |
1141 | 1141 | 'data' => $json_response_data, |
1142 | 1142 | 'error' => $notices['errors'], |
@@ -1153,30 +1153,30 @@ discard block |
||
1153 | 1153 | * @return array |
1154 | 1154 | */ |
1155 | 1155 | protected function _validate_payment_request_data() { |
1156 | - if ( ! isset( $this->_req_data[ 'txn_admin_payment' ] ) ) { |
|
1156 | + if ( ! isset($this->_req_data['txn_admin_payment'])) { |
|
1157 | 1157 | return false; |
1158 | 1158 | } |
1159 | 1159 | $payment_form = $this->_generate_payment_form_section(); |
1160 | 1160 | try { |
1161 | - if ( $payment_form->was_submitted() ) { |
|
1161 | + if ($payment_form->was_submitted()) { |
|
1162 | 1162 | $payment_form->receive_form_submission(); |
1163 | - if ( ! $payment_form->is_valid() ) { |
|
1163 | + if ( ! $payment_form->is_valid()) { |
|
1164 | 1164 | $submission_error_messages = array(); |
1165 | - foreach ( $payment_form->get_validation_errors_accumulated() as $validation_error ) { |
|
1166 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1165 | + foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) { |
|
1166 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1167 | 1167 | $submission_error_messages[] = sprintf( |
1168 | - _x( '%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso' ), |
|
1168 | + _x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'), |
|
1169 | 1169 | $validation_error->get_form_section()->html_label_text(), |
1170 | 1170 | $validation_error->getMessage() |
1171 | 1171 | ); |
1172 | 1172 | } |
1173 | 1173 | } |
1174 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1174 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1175 | 1175 | return array(); |
1176 | 1176 | } |
1177 | 1177 | } |
1178 | - } catch ( EE_Error $e ) { |
|
1179 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1178 | + } catch (EE_Error $e) { |
|
1179 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
1180 | 1180 | return array(); |
1181 | 1181 | } |
1182 | 1182 | return $payment_form->valid_data(); |
@@ -1198,63 +1198,63 @@ discard block |
||
1198 | 1198 | array( |
1199 | 1199 | 'default' => 0, |
1200 | 1200 | 'required' => false, |
1201 | - 'html_label_text' => __( 'Payment ID', 'event_espresso' ), |
|
1202 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1201 | + 'html_label_text' => __('Payment ID', 'event_espresso'), |
|
1202 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1203 | 1203 | ) |
1204 | 1204 | ), |
1205 | 1205 | 'TXN_ID' => new EE_Text_Input( |
1206 | 1206 | array( |
1207 | 1207 | 'default' => 0, |
1208 | 1208 | 'required' => true, |
1209 | - 'html_label_text' => __( 'Transaction ID', 'event_espresso' ), |
|
1210 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1209 | + 'html_label_text' => __('Transaction ID', 'event_espresso'), |
|
1210 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1211 | 1211 | ) |
1212 | 1212 | ), |
1213 | 1213 | 'type' => new EE_Text_Input( |
1214 | 1214 | array( |
1215 | 1215 | 'default' => 1, |
1216 | 1216 | 'required' => true, |
1217 | - 'html_label_text' => __( 'Payment or Refund', 'event_espresso' ), |
|
1218 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1217 | + 'html_label_text' => __('Payment or Refund', 'event_espresso'), |
|
1218 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1219 | 1219 | ) |
1220 | 1220 | ), |
1221 | 1221 | 'amount' => new EE_Text_Input( |
1222 | 1222 | array( |
1223 | 1223 | 'default' => 0, |
1224 | 1224 | 'required' => true, |
1225 | - 'html_label_text' => __( 'Payment amount', 'event_espresso' ), |
|
1226 | - 'validation_strategies' => array( new EE_Float_Normalization() ) |
|
1225 | + 'html_label_text' => __('Payment amount', 'event_espresso'), |
|
1226 | + 'validation_strategies' => array(new EE_Float_Normalization()) |
|
1227 | 1227 | ) |
1228 | 1228 | ), |
1229 | 1229 | 'status' => new EE_Text_Input( |
1230 | 1230 | array( |
1231 | 1231 | 'default' => EEM_Payment::status_id_approved, |
1232 | 1232 | 'required' => true, |
1233 | - 'html_label_text' => __( 'Payment status', 'event_espresso' ), |
|
1233 | + 'html_label_text' => __('Payment status', 'event_espresso'), |
|
1234 | 1234 | ) |
1235 | 1235 | ), |
1236 | 1236 | 'PMD_ID' => new EE_Text_Input( |
1237 | 1237 | array( |
1238 | 1238 | 'default' => 2, |
1239 | 1239 | 'required' => true, |
1240 | - 'html_label_text' => __( 'Payment Method', 'event_espresso' ), |
|
1241 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1240 | + 'html_label_text' => __('Payment Method', 'event_espresso'), |
|
1241 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1242 | 1242 | ) |
1243 | 1243 | ), |
1244 | 1244 | 'date' => new EE_Text_Input( |
1245 | 1245 | array( |
1246 | 1246 | 'default' => time(), |
1247 | 1247 | 'required' => true, |
1248 | - 'html_label_text' => __( 'Payment date', 'event_espresso' ), |
|
1248 | + 'html_label_text' => __('Payment date', 'event_espresso'), |
|
1249 | 1249 | ) |
1250 | 1250 | ), |
1251 | 1251 | 'txn_id_chq_nmbr' => new EE_Text_Input( |
1252 | 1252 | array( |
1253 | 1253 | 'default' => '', |
1254 | 1254 | 'required' => false, |
1255 | - 'html_label_text' => __( 'Transaction or Cheque Number', 'event_espresso' ), |
|
1255 | + 'html_label_text' => __('Transaction or Cheque Number', 'event_espresso'), |
|
1256 | 1256 | 'validation_strategies' => array( |
1257 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1257 | + new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100), |
|
1258 | 1258 | ) |
1259 | 1259 | ) |
1260 | 1260 | ), |
@@ -1262,9 +1262,9 @@ discard block |
||
1262 | 1262 | array( |
1263 | 1263 | 'default' => '', |
1264 | 1264 | 'required' => false, |
1265 | - 'html_label_text' => __( 'Purchase Order Number', 'event_espresso' ), |
|
1265 | + 'html_label_text' => __('Purchase Order Number', 'event_espresso'), |
|
1266 | 1266 | 'validation_strategies' => array( |
1267 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1267 | + new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100), |
|
1268 | 1268 | ) |
1269 | 1269 | ) |
1270 | 1270 | ), |
@@ -1272,9 +1272,9 @@ discard block |
||
1272 | 1272 | array( |
1273 | 1273 | 'default' => '', |
1274 | 1274 | 'required' => false, |
1275 | - 'html_label_text' => __( 'Extra Field for Accounting', 'event_espresso' ), |
|
1275 | + 'html_label_text' => __('Extra Field for Accounting', 'event_espresso'), |
|
1276 | 1276 | 'validation_strategies' => array( |
1277 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1277 | + new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100), |
|
1278 | 1278 | ) |
1279 | 1279 | ) |
1280 | 1280 | ), |
@@ -1291,37 +1291,37 @@ discard block |
||
1291 | 1291 | * @param array $valid_data |
1292 | 1292 | * @return EE_Payment |
1293 | 1293 | */ |
1294 | - protected function _create_payment_from_request_data( $valid_data ) { |
|
1295 | - $PAY_ID = $valid_data[ 'PAY_ID' ]; |
|
1294 | + protected function _create_payment_from_request_data($valid_data) { |
|
1295 | + $PAY_ID = $valid_data['PAY_ID']; |
|
1296 | 1296 | // get payment amount |
1297 | - $amount = $valid_data[ 'amount' ] ? abs( $valid_data[ 'amount' ] ) : 0; |
|
1297 | + $amount = $valid_data['amount'] ? abs($valid_data['amount']) : 0; |
|
1298 | 1298 | // payments have a type value of 1 and refunds have a type value of -1 |
1299 | 1299 | // so multiplying amount by type will give a positive value for payments, and negative values for refunds |
1300 | - $amount = $valid_data[ 'type' ] < 0 ? $amount * -1 : $amount; |
|
1300 | + $amount = $valid_data['type'] < 0 ? $amount * -1 : $amount; |
|
1301 | 1301 | // for some reason the date string coming in has extra spaces between the date and time. This fixes that. |
1302 | - $date = $valid_data['date'] ? preg_replace( '/\s+/', ' ', $valid_data['date'] ) : date( 'Y-m-d g:i a', current_time( 'timestamp' ) ); |
|
1302 | + $date = $valid_data['date'] ? preg_replace('/\s+/', ' ', $valid_data['date']) : date('Y-m-d g:i a', current_time('timestamp')); |
|
1303 | 1303 | $payment = EE_Payment::new_instance( |
1304 | 1304 | array( |
1305 | - 'TXN_ID' => $valid_data[ 'TXN_ID' ], |
|
1306 | - 'STS_ID' => $valid_data[ 'status' ], |
|
1305 | + 'TXN_ID' => $valid_data['TXN_ID'], |
|
1306 | + 'STS_ID' => $valid_data['status'], |
|
1307 | 1307 | 'PAY_timestamp' => $date, |
1308 | 1308 | 'PAY_source' => EEM_Payment_Method::scope_admin, |
1309 | - 'PMD_ID' => $valid_data[ 'PMD_ID' ], |
|
1309 | + 'PMD_ID' => $valid_data['PMD_ID'], |
|
1310 | 1310 | 'PAY_amount' => $amount, |
1311 | - 'PAY_txn_id_chq_nmbr' => $valid_data[ 'txn_id_chq_nmbr' ], |
|
1312 | - 'PAY_po_number' => $valid_data[ 'po_number' ], |
|
1313 | - 'PAY_extra_accntng' => $valid_data[ 'accounting' ], |
|
1311 | + 'PAY_txn_id_chq_nmbr' => $valid_data['txn_id_chq_nmbr'], |
|
1312 | + 'PAY_po_number' => $valid_data['po_number'], |
|
1313 | + 'PAY_extra_accntng' => $valid_data['accounting'], |
|
1314 | 1314 | 'PAY_details' => $valid_data, |
1315 | 1315 | 'PAY_ID' => $PAY_ID |
1316 | 1316 | ), |
1317 | 1317 | '', |
1318 | - array( 'Y-m-d', 'g:i a' ) |
|
1318 | + array('Y-m-d', 'g:i a') |
|
1319 | 1319 | ); |
1320 | 1320 | |
1321 | - if ( ! $payment->save() ) { |
|
1321 | + if ( ! $payment->save()) { |
|
1322 | 1322 | EE_Error::add_error( |
1323 | 1323 | sprintf( |
1324 | - __( 'Payment %1$d has not been successfully saved to the database.', 'event_espresso' ), |
|
1324 | + __('Payment %1$d has not been successfully saved to the database.', 'event_espresso'), |
|
1325 | 1325 | $payment->ID() |
1326 | 1326 | ), |
1327 | 1327 | __FILE__, __FUNCTION__, __LINE__ |
@@ -1338,15 +1338,15 @@ discard block |
||
1338 | 1338 | * @param \EE_Transaction $transaction |
1339 | 1339 | * @return array |
1340 | 1340 | */ |
1341 | - protected function _process_transaction_payments( EE_Transaction $transaction ) { |
|
1341 | + protected function _process_transaction_payments(EE_Transaction $transaction) { |
|
1342 | 1342 | /** @type EE_Transaction_Payments $transaction_payments */ |
1343 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1343 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1344 | 1344 | //update the transaction with this payment |
1345 | - if ( $transaction_payments->calculate_total_payments_and_update_status( $transaction ) ) { |
|
1346 | - EE_Error::add_success( __( 'The payment has been processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1345 | + if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) { |
|
1346 | + EE_Error::add_success(__('The payment has been processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1347 | 1347 | } else { |
1348 | 1348 | EE_Error::add_error( |
1349 | - __( 'The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso' ) |
|
1349 | + __('The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso') |
|
1350 | 1350 | , __FILE__, __FUNCTION__, __LINE__ |
1351 | 1351 | ); |
1352 | 1352 | } |
@@ -1362,19 +1362,19 @@ discard block |
||
1362 | 1362 | * @param \EE_Payment $payment |
1363 | 1363 | * @return array |
1364 | 1364 | */ |
1365 | - protected function _get_REG_IDs_to_apply_payment_to( EE_Payment $payment ) { |
|
1365 | + protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) { |
|
1366 | 1366 | $REG_IDs = array(); |
1367 | 1367 | // grab array of IDs for specific registrations to apply changes to |
1368 | - if ( isset( $this->_req_data[ 'txn_admin_payment' ][ 'registrations' ] ) ) { |
|
1369 | - $REG_IDs = (array)$this->_req_data[ 'txn_admin_payment' ][ 'registrations' ]; |
|
1368 | + if (isset($this->_req_data['txn_admin_payment']['registrations'])) { |
|
1369 | + $REG_IDs = (array) $this->_req_data['txn_admin_payment']['registrations']; |
|
1370 | 1370 | } |
1371 | 1371 | //nothing specified ? then get all reg IDs |
1372 | - if ( empty( $REG_IDs ) ) { |
|
1372 | + if (empty($REG_IDs)) { |
|
1373 | 1373 | $registrations = $payment->transaction()->registrations(); |
1374 | - $REG_IDs = ! empty( $registrations ) ? array_keys( $registrations ) : $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1374 | + $REG_IDs = ! empty($registrations) ? array_keys($registrations) : $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1375 | 1375 | } |
1376 | 1376 | // ensure that REG_IDs are integers and NOT strings |
1377 | - return array_map( 'intval', $REG_IDs ); |
|
1377 | + return array_map('intval', $REG_IDs); |
|
1378 | 1378 | } |
1379 | 1379 | |
1380 | 1380 | |
@@ -1391,7 +1391,7 @@ discard block |
||
1391 | 1391 | /** |
1392 | 1392 | * @param array $existing_reg_payment_REG_IDs |
1393 | 1393 | */ |
1394 | - public function set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs = null ) { |
|
1394 | + public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) { |
|
1395 | 1395 | $this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs; |
1396 | 1396 | } |
1397 | 1397 | |
@@ -1406,13 +1406,13 @@ discard block |
||
1406 | 1406 | * @param \EE_Payment $payment |
1407 | 1407 | * @return array |
1408 | 1408 | */ |
1409 | - protected function _get_existing_reg_payment_REG_IDs( EE_Payment $payment ) { |
|
1410 | - if ( $this->existing_reg_payment_REG_IDs() === null ) { |
|
1409 | + protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) { |
|
1410 | + if ($this->existing_reg_payment_REG_IDs() === null) { |
|
1411 | 1411 | // let's get any existing reg payment records for this payment |
1412 | - $existing_reg_payment_REG_IDs = $payment->get_many_related( 'Registration' ); |
|
1412 | + $existing_reg_payment_REG_IDs = $payment->get_many_related('Registration'); |
|
1413 | 1413 | // but we only want the REG IDs, so grab the array keys |
1414 | - $existing_reg_payment_REG_IDs = ! empty( $existing_reg_payment_REG_IDs ) ? array_keys( $existing_reg_payment_REG_IDs ) : array(); |
|
1415 | - $this->set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs ); |
|
1414 | + $existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) ? array_keys($existing_reg_payment_REG_IDs) : array(); |
|
1415 | + $this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs); |
|
1416 | 1416 | } |
1417 | 1417 | return $this->existing_reg_payment_REG_IDs(); |
1418 | 1418 | } |
@@ -1431,23 +1431,23 @@ discard block |
||
1431 | 1431 | * @param int $PAY_ID |
1432 | 1432 | * @return bool; |
1433 | 1433 | */ |
1434 | - protected function _remove_existing_registration_payments( EE_Payment $payment, $PAY_ID = 0 ) { |
|
1434 | + protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) { |
|
1435 | 1435 | // newly created payments will have nothing recorded for $PAY_ID |
1436 | - if ( $PAY_ID == 0 ) { |
|
1436 | + if ($PAY_ID == 0) { |
|
1437 | 1437 | return false; |
1438 | 1438 | } |
1439 | - $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1440 | - if ( empty( $existing_reg_payment_REG_IDs )) { |
|
1439 | + $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1440 | + if (empty($existing_reg_payment_REG_IDs)) { |
|
1441 | 1441 | return false; |
1442 | 1442 | } |
1443 | 1443 | /** @type EE_Transaction_Payments $transaction_payments */ |
1444 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1444 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1445 | 1445 | return $transaction_payments->delete_registration_payments_and_update_registrations( |
1446 | 1446 | $payment, |
1447 | 1447 | array( |
1448 | 1448 | array( |
1449 | 1449 | 'PAY_ID' => $payment->ID(), |
1450 | - 'REG_ID' => array( 'IN', $existing_reg_payment_REG_IDs ), |
|
1450 | + 'REG_ID' => array('IN', $existing_reg_payment_REG_IDs), |
|
1451 | 1451 | ) |
1452 | 1452 | ) |
1453 | 1453 | ); |
@@ -1466,25 +1466,25 @@ discard block |
||
1466 | 1466 | * @param array $REG_IDs |
1467 | 1467 | * @return bool |
1468 | 1468 | */ |
1469 | - protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) { |
|
1469 | + protected function _update_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array()) { |
|
1470 | 1470 | // we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments() |
1471 | 1471 | // so let's do that using our set of REG_IDs from the form |
1472 | 1472 | $registration_query_where_params = array( |
1473 | - 'REG_ID' => array( 'IN', $REG_IDs ) |
|
1473 | + 'REG_ID' => array('IN', $REG_IDs) |
|
1474 | 1474 | ); |
1475 | 1475 | // but add in some conditions regarding payment, |
1476 | 1476 | // so that we don't apply payments to registrations that are free or have already been paid for |
1477 | 1477 | // but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative ) |
1478 | - if ( ! $payment->is_a_refund() ) { |
|
1479 | - $registration_query_where_params[ 'REG_final_price' ] = array( '!=', 0 ); |
|
1480 | - $registration_query_where_params[ 'REG_final_price*' ] = array( '!=', 'REG_paid', true ); |
|
1478 | + if ( ! $payment->is_a_refund()) { |
|
1479 | + $registration_query_where_params['REG_final_price'] = array('!=', 0); |
|
1480 | + $registration_query_where_params['REG_final_price*'] = array('!=', 'REG_paid', true); |
|
1481 | 1481 | } |
1482 | 1482 | //EEH_Debug_Tools::printr( $registration_query_where_params, '$registration_query_where_params', __FILE__, __LINE__ ); |
1483 | - $registrations = $transaction->registrations( array( $registration_query_where_params ) ); |
|
1484 | - if ( ! empty( $registrations ) ) { |
|
1483 | + $registrations = $transaction->registrations(array($registration_query_where_params)); |
|
1484 | + if ( ! empty($registrations)) { |
|
1485 | 1485 | /** @type EE_Payment_Processor $payment_processor */ |
1486 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1487 | - $payment_processor->process_registration_payments( $transaction, $payment, $registrations ); |
|
1486 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1487 | + $payment_processor->process_registration_payments($transaction, $payment, $registrations); |
|
1488 | 1488 | } |
1489 | 1489 | } |
1490 | 1490 | |
@@ -1500,22 +1500,22 @@ discard block |
||
1500 | 1500 | * @param array $REG_IDs |
1501 | 1501 | * @return bool |
1502 | 1502 | */ |
1503 | - protected function _process_registration_status_change( EE_Transaction $transaction, $REG_IDs = array() ) { |
|
1503 | + protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = array()) { |
|
1504 | 1504 | // first if there is no change in status then we get out. |
1505 | 1505 | if ( |
1506 | - ! isset( $this->_req_data['txn_reg_status_change'], $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ) |
|
1506 | + ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['reg_status']) |
|
1507 | 1507 | || $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN' |
1508 | 1508 | ) { |
1509 | 1509 | //no error message, no change requested, just nothing to do man. |
1510 | 1510 | return FALSE; |
1511 | 1511 | } |
1512 | 1512 | /** @type EE_Transaction_Processor $transaction_processor */ |
1513 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1513 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1514 | 1514 | // made it here dude? Oh WOW. K, let's take care of changing the statuses |
1515 | 1515 | return $transaction_processor->manually_update_registration_statuses( |
1516 | 1516 | $transaction, |
1517 | - sanitize_text_field( $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ), |
|
1518 | - array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) |
|
1517 | + sanitize_text_field($this->_req_data['txn_reg_status_change']['reg_status']), |
|
1518 | + array(array('REG_ID' => array('IN', $REG_IDs))) |
|
1519 | 1519 | ); |
1520 | 1520 | } |
1521 | 1521 | |
@@ -1530,16 +1530,16 @@ discard block |
||
1530 | 1530 | * @param bool | null $delete_txn_reg_status_change |
1531 | 1531 | * @return array |
1532 | 1532 | */ |
1533 | - protected function _build_payment_json_response( EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null ) { |
|
1533 | + protected function _build_payment_json_response(EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null) { |
|
1534 | 1534 | // was the payment deleted ? |
1535 | - if ( is_bool( $delete_txn_reg_status_change )) { |
|
1535 | + if (is_bool($delete_txn_reg_status_change)) { |
|
1536 | 1536 | return array( |
1537 | 1537 | 'PAY_ID' => $payment->ID(), |
1538 | 1538 | 'amount' => $payment->amount(), |
1539 | 1539 | 'total_paid' => $payment->transaction()->paid(), |
1540 | 1540 | 'txn_status' => $payment->transaction()->status_ID(), |
1541 | 1541 | 'pay_status' => $payment->STS_ID(), |
1542 | - 'registrations' => $this->_registration_payment_data_array( $REG_IDs ), |
|
1542 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), |
|
1543 | 1543 | 'delete_txn_reg_status_change' => $delete_txn_reg_status_change, |
1544 | 1544 | ); |
1545 | 1545 | } else { |
@@ -1551,16 +1551,16 @@ discard block |
||
1551 | 1551 | 'pay_status' => $payment->STS_ID(), |
1552 | 1552 | 'PAY_ID' => $payment->ID(), |
1553 | 1553 | 'STS_ID' => $payment->STS_ID(), |
1554 | - 'status' => self::$_pay_status[ $payment->STS_ID() ], |
|
1555 | - 'date' => $payment->timestamp( 'Y-m-d', 'h:i a' ), |
|
1556 | - 'method' => strtoupper( $payment->source() ), |
|
1554 | + 'status' => self::$_pay_status[$payment->STS_ID()], |
|
1555 | + 'date' => $payment->timestamp('Y-m-d', 'h:i a'), |
|
1556 | + 'method' => strtoupper($payment->source()), |
|
1557 | 1557 | 'PM_ID' => $payment->payment_method() ? $payment->payment_method()->ID() : 1, |
1558 | - 'gateway' => $payment->payment_method() ? $payment->payment_method()->admin_name() : __( "Unknown", 'event_espresso' ), |
|
1558 | + 'gateway' => $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso'), |
|
1559 | 1559 | 'gateway_response' => $payment->gateway_response(), |
1560 | 1560 | 'txn_id_chq_nmbr' => $payment->txn_id_chq_nmbr(), |
1561 | 1561 | 'po_number' => $payment->po_number(), |
1562 | 1562 | 'extra_accntng' => $payment->extra_accntng(), |
1563 | - 'registrations' => $this->_registration_payment_data_array( $REG_IDs ), |
|
1563 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), |
|
1564 | 1564 | ); |
1565 | 1565 | } |
1566 | 1566 | } |
@@ -1575,39 +1575,39 @@ discard block |
||
1575 | 1575 | * @return void |
1576 | 1576 | */ |
1577 | 1577 | public function delete_payment() { |
1578 | - $json_response_data = array( 'return_data' => FALSE ); |
|
1579 | - $PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0; |
|
1580 | - if ( $PAY_ID ) { |
|
1581 | - $delete_txn_reg_status_change = isset( $this->_req_data[ 'delete_txn_reg_status_change' ] ) ? $this->_req_data[ 'delete_txn_reg_status_change' ] : false; |
|
1582 | - $payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID ); |
|
1583 | - if ( $payment instanceof EE_Payment ) { |
|
1584 | - $REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1578 | + $json_response_data = array('return_data' => FALSE); |
|
1579 | + $PAY_ID = isset($this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID']) ? absint($this->_req_data['delete_txn_admin_payment']['PAY_ID']) : 0; |
|
1580 | + if ($PAY_ID) { |
|
1581 | + $delete_txn_reg_status_change = isset($this->_req_data['delete_txn_reg_status_change']) ? $this->_req_data['delete_txn_reg_status_change'] : false; |
|
1582 | + $payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID); |
|
1583 | + if ($payment instanceof EE_Payment) { |
|
1584 | + $REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1585 | 1585 | /** @type EE_Transaction_Payments $transaction_payments */ |
1586 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1587 | - if ( $transaction_payments->delete_payment_and_update_transaction( $payment )) { |
|
1588 | - $json_response_data['return_data'] = $this->_build_payment_json_response( $payment, $REG_IDs, $delete_txn_reg_status_change ); |
|
1589 | - if ( $delete_txn_reg_status_change ) { |
|
1586 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1587 | + if ($transaction_payments->delete_payment_and_update_transaction($payment)) { |
|
1588 | + $json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs, $delete_txn_reg_status_change); |
|
1589 | + if ($delete_txn_reg_status_change) { |
|
1590 | 1590 | $this->_req_data['txn_reg_status_change'] = $delete_txn_reg_status_change; |
1591 | 1591 | //MAKE sure we also add the delete_txn_req_status_change to the |
1592 | 1592 | //$_REQUEST global because that's how messages will be looking for it. |
1593 | 1593 | $_REQUEST['txn_reg_status_change'] = $delete_txn_reg_status_change; |
1594 | 1594 | $this->_maybe_send_notifications(); |
1595 | - $this->_process_registration_status_change( $payment->transaction(), $REG_IDs ); |
|
1595 | + $this->_process_registration_status_change($payment->transaction(), $REG_IDs); |
|
1596 | 1596 | } |
1597 | 1597 | } |
1598 | 1598 | } else { |
1599 | 1599 | EE_Error::add_error( |
1600 | - __( 'Valid Payment data could not be retrieved from the database.', 'event_espresso' ), |
|
1600 | + __('Valid Payment data could not be retrieved from the database.', 'event_espresso'), |
|
1601 | 1601 | __FILE__, __FUNCTION__, __LINE__ |
1602 | 1602 | ); |
1603 | 1603 | } |
1604 | 1604 | } else { |
1605 | 1605 | EE_Error::add_error( |
1606 | - __( 'A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso' ), |
|
1606 | + __('A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso'), |
|
1607 | 1607 | __FILE__, __FUNCTION__, __LINE__ |
1608 | 1608 | ); |
1609 | 1609 | } |
1610 | - $notices = EE_Error::get_notices( false, false, false); |
|
1610 | + $notices = EE_Error::get_notices(false, false, false); |
|
1611 | 1611 | $this->_template_args = array( |
1612 | 1612 | 'data' => $json_response_data, |
1613 | 1613 | 'success' => $notices['success'], |
@@ -1627,16 +1627,16 @@ discard block |
||
1627 | 1627 | * @param array $REG_IDs |
1628 | 1628 | * @return array |
1629 | 1629 | */ |
1630 | - protected function _registration_payment_data_array( $REG_IDs ) { |
|
1630 | + protected function _registration_payment_data_array($REG_IDs) { |
|
1631 | 1631 | $registration_payment_data = array(); |
1632 | 1632 | //if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows. |
1633 | - if ( ! empty( $REG_IDs ) ) { |
|
1634 | - $registrations = EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) ); |
|
1635 | - foreach ( $registrations as $registration ) { |
|
1636 | - if ( $registration instanceof EE_Registration ) { |
|
1637 | - $registration_payment_data[ $registration->ID() ] = array( |
|
1633 | + if ( ! empty($REG_IDs)) { |
|
1634 | + $registrations = EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $REG_IDs)))); |
|
1635 | + foreach ($registrations as $registration) { |
|
1636 | + if ($registration instanceof EE_Registration) { |
|
1637 | + $registration_payment_data[$registration->ID()] = array( |
|
1638 | 1638 | 'paid' => $registration->pretty_paid(), |
1639 | - 'owing' => EEH_Template::format_currency( $registration->final_price() - $registration->paid() ), |
|
1639 | + 'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()), |
|
1640 | 1640 | ); |
1641 | 1641 | } |
1642 | 1642 | } |
@@ -1656,30 +1656,30 @@ discard block |
||
1656 | 1656 | * @access protected |
1657 | 1657 | * @param \EE_Payment | null $payment |
1658 | 1658 | */ |
1659 | - protected function _maybe_send_notifications( $payment = null ) { |
|
1660 | - switch ( $payment instanceof EE_Payment ) { |
|
1659 | + protected function _maybe_send_notifications($payment = null) { |
|
1660 | + switch ($payment instanceof EE_Payment) { |
|
1661 | 1661 | // payment notifications |
1662 | 1662 | case true : |
1663 | 1663 | if ( |
1664 | 1664 | isset( |
1665 | - $this->_req_data[ 'txn_payments' ], |
|
1666 | - $this->_req_data[ 'txn_payments' ][ 'send_notifications' ] |
|
1665 | + $this->_req_data['txn_payments'], |
|
1666 | + $this->_req_data['txn_payments']['send_notifications'] |
|
1667 | 1667 | ) && |
1668 | - filter_var( $this->_req_data[ 'txn_payments' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN ) |
|
1668 | + filter_var($this->_req_data['txn_payments']['send_notifications'], FILTER_VALIDATE_BOOLEAN) |
|
1669 | 1669 | ) { |
1670 | - $this->_process_payment_notification( $payment ); |
|
1670 | + $this->_process_payment_notification($payment); |
|
1671 | 1671 | } |
1672 | 1672 | break; |
1673 | 1673 | // registration notifications |
1674 | 1674 | case false : |
1675 | 1675 | if ( |
1676 | 1676 | isset( |
1677 | - $this->_req_data[ 'txn_reg_status_change' ], |
|
1678 | - $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] |
|
1677 | + $this->_req_data['txn_reg_status_change'], |
|
1678 | + $this->_req_data['txn_reg_status_change']['send_notifications'] |
|
1679 | 1679 | ) && |
1680 | - filter_var( $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN ) |
|
1680 | + filter_var($this->_req_data['txn_reg_status_change']['send_notifications'], FILTER_VALIDATE_BOOLEAN) |
|
1681 | 1681 | ) { |
1682 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
1682 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
1683 | 1683 | } |
1684 | 1684 | break; |
1685 | 1685 | } |
@@ -1695,11 +1695,11 @@ discard block |
||
1695 | 1695 | * @return void |
1696 | 1696 | */ |
1697 | 1697 | protected function _send_payment_reminder() { |
1698 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
1699 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
1700 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array(); |
|
1701 | - do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction ); |
|
1702 | - $this->_redirect_after_action( FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE ); |
|
1698 | + $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE; |
|
1699 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
1700 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID']) : array(); |
|
1701 | + do_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction); |
|
1702 | + $this->_redirect_after_action(FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE); |
|
1703 | 1703 | } |
1704 | 1704 | |
1705 | 1705 | |
@@ -1713,36 +1713,36 @@ discard block |
||
1713 | 1713 | * @param string $view |
1714 | 1714 | * @return mixed int = count || array of transaction objects |
1715 | 1715 | */ |
1716 | - public function get_transactions( $perpage, $count = FALSE, $view = '' ) { |
|
1716 | + public function get_transactions($perpage, $count = FALSE, $view = '') { |
|
1717 | 1717 | |
1718 | 1718 | $TXN = EEM_Transaction::instance(); |
1719 | 1719 | |
1720 | - $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' )); |
|
1721 | - $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' ); |
|
1720 | + $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year')); |
|
1721 | + $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y'); |
|
1722 | 1722 | |
1723 | 1723 | //make sure our timestamps start and end right at the boundaries for each day |
1724 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
1725 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
1724 | + $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; |
|
1725 | + $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; |
|
1726 | 1726 | |
1727 | 1727 | |
1728 | 1728 | //convert to timestamps |
1729 | - $start_date = strtotime( $start_date ); |
|
1730 | - $end_date = strtotime( $end_date ); |
|
1729 | + $start_date = strtotime($start_date); |
|
1730 | + $end_date = strtotime($end_date); |
|
1731 | 1731 | |
1732 | 1732 | //makes sure start date is the lowest value and vice versa |
1733 | - $start_date = min( $start_date, $end_date ); |
|
1734 | - $end_date = max( $start_date, $end_date ); |
|
1733 | + $start_date = min($start_date, $end_date); |
|
1734 | + $end_date = max($start_date, $end_date); |
|
1735 | 1735 | |
1736 | 1736 | //convert to correct format for query |
1737 | - $start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' ); |
|
1738 | - $end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' ); |
|
1737 | + $start_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s'); |
|
1738 | + $end_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s'); |
|
1739 | 1739 | |
1740 | 1740 | |
1741 | 1741 | |
1742 | 1742 | //set orderby |
1743 | 1743 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
1744 | 1744 | |
1745 | - switch ( $this->_req_data['orderby'] ) { |
|
1745 | + switch ($this->_req_data['orderby']) { |
|
1746 | 1746 | case 'TXN_ID': |
1747 | 1747 | $orderby = 'TXN_ID'; |
1748 | 1748 | break; |
@@ -1756,66 +1756,66 @@ discard block |
||
1756 | 1756 | $orderby = 'TXN_timestamp'; |
1757 | 1757 | } |
1758 | 1758 | |
1759 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
1760 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1761 | - $per_page = isset( $perpage ) && !empty( $perpage ) ? $perpage : 10; |
|
1762 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1759 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
1760 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1761 | + $per_page = isset($perpage) && ! empty($perpage) ? $perpage : 10; |
|
1762 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1763 | 1763 | |
1764 | - $offset = ($current_page-1)*$per_page; |
|
1765 | - $limit = array( $offset, $per_page ); |
|
1764 | + $offset = ($current_page - 1) * $per_page; |
|
1765 | + $limit = array($offset, $per_page); |
|
1766 | 1766 | |
1767 | 1767 | $_where = array( |
1768 | - 'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date) ), |
|
1768 | + 'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date)), |
|
1769 | 1769 | 'Registration.REG_count' => 1 |
1770 | 1770 | ); |
1771 | 1771 | |
1772 | - if ( isset( $this->_req_data['EVT_ID'] ) ) { |
|
1772 | + if (isset($this->_req_data['EVT_ID'])) { |
|
1773 | 1773 | $_where['Registration.EVT_ID'] = $this->_req_data['EVT_ID']; |
1774 | 1774 | } |
1775 | 1775 | |
1776 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1777 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1776 | + if (isset($this->_req_data['s'])) { |
|
1777 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1778 | 1778 | $_where['OR'] = array( |
1779 | - 'Registration.Event.EVT_name' => array( 'LIKE', $search_string ), |
|
1780 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $search_string ), |
|
1781 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $search_string ), |
|
1782 | - 'Registration.Attendee.ATT_full_name' => array( 'LIKE', $search_string ), |
|
1783 | - 'Registration.Attendee.ATT_fname' => array( 'LIKE', $search_string ), |
|
1784 | - 'Registration.Attendee.ATT_lname' => array( 'LIKE', $search_string ), |
|
1785 | - 'Registration.Attendee.ATT_short_bio' => array( 'LIKE', $search_string ), |
|
1786 | - 'Registration.Attendee.ATT_email' => array('LIKE', $search_string ), |
|
1787 | - 'Registration.Attendee.ATT_address' => array( 'LIKE', $search_string ), |
|
1788 | - 'Registration.Attendee.ATT_address2' => array( 'LIKE', $search_string ), |
|
1789 | - 'Registration.Attendee.ATT_city' => array( 'LIKE', $search_string ), |
|
1790 | - 'Registration.REG_final_price' => array( 'LIKE', $search_string ), |
|
1791 | - 'Registration.REG_code' => array( 'LIKE', $search_string ), |
|
1792 | - 'Registration.REG_count' => array( 'LIKE' , $search_string ), |
|
1793 | - 'Registration.REG_group_size' => array( 'LIKE' , $search_string ), |
|
1794 | - 'Registration.Ticket.TKT_name' => array( 'LIKE', $search_string ), |
|
1795 | - 'Registration.Ticket.TKT_description' => array( 'LIKE', $search_string ), |
|
1796 | - 'Payment.PAY_source' => array('LIKE', $search_string ), |
|
1797 | - 'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string ), |
|
1798 | - 'TXN_session_data' => array( 'LIKE', $search_string ), |
|
1799 | - 'Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $search_string ) |
|
1779 | + 'Registration.Event.EVT_name' => array('LIKE', $search_string), |
|
1780 | + 'Registration.Event.EVT_desc' => array('LIKE', $search_string), |
|
1781 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $search_string), |
|
1782 | + 'Registration.Attendee.ATT_full_name' => array('LIKE', $search_string), |
|
1783 | + 'Registration.Attendee.ATT_fname' => array('LIKE', $search_string), |
|
1784 | + 'Registration.Attendee.ATT_lname' => array('LIKE', $search_string), |
|
1785 | + 'Registration.Attendee.ATT_short_bio' => array('LIKE', $search_string), |
|
1786 | + 'Registration.Attendee.ATT_email' => array('LIKE', $search_string), |
|
1787 | + 'Registration.Attendee.ATT_address' => array('LIKE', $search_string), |
|
1788 | + 'Registration.Attendee.ATT_address2' => array('LIKE', $search_string), |
|
1789 | + 'Registration.Attendee.ATT_city' => array('LIKE', $search_string), |
|
1790 | + 'Registration.REG_final_price' => array('LIKE', $search_string), |
|
1791 | + 'Registration.REG_code' => array('LIKE', $search_string), |
|
1792 | + 'Registration.REG_count' => array('LIKE', $search_string), |
|
1793 | + 'Registration.REG_group_size' => array('LIKE', $search_string), |
|
1794 | + 'Registration.Ticket.TKT_name' => array('LIKE', $search_string), |
|
1795 | + 'Registration.Ticket.TKT_description' => array('LIKE', $search_string), |
|
1796 | + 'Payment.PAY_source' => array('LIKE', $search_string), |
|
1797 | + 'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string), |
|
1798 | + 'TXN_session_data' => array('LIKE', $search_string), |
|
1799 | + 'Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $search_string) |
|
1800 | 1800 | ); |
1801 | 1801 | } |
1802 | 1802 | |
1803 | 1803 | //failed transactions |
1804 | - $failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) || ( $count && $view == 'failed' ) ? TRUE: FALSE; |
|
1805 | - $abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) || ( $count && $view == 'abandoned' ) ? TRUE: FALSE; |
|
1804 | + $failed = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'failed' && ! $count) || ($count && $view == 'failed') ? TRUE : FALSE; |
|
1805 | + $abandoned = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'abandoned' && ! $count) || ($count && $view == 'abandoned') ? TRUE : FALSE; |
|
1806 | 1806 | |
1807 | - if ( $failed ) { |
|
1808 | - $_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code; |
|
1809 | - } else if ( $abandoned ) { |
|
1807 | + if ($failed) { |
|
1808 | + $_where['STS_ID'] = EEM_Transaction::failed_status_code; |
|
1809 | + } else if ($abandoned) { |
|
1810 | 1810 | $_where['STS_ID'] = EEM_Transaction::abandoned_status_code; |
1811 | 1811 | } else { |
1812 | - $_where['STS_ID'] = array( '!=', EEM_Transaction::failed_status_code ); |
|
1813 | - $_where['STS_ID*'] = array( '!=', EEM_Transaction::abandoned_status_code ); |
|
1812 | + $_where['STS_ID'] = array('!=', EEM_Transaction::failed_status_code); |
|
1813 | + $_where['STS_ID*'] = array('!=', EEM_Transaction::abandoned_status_code); |
|
1814 | 1814 | } |
1815 | 1815 | |
1816 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'limit' => $limit ); |
|
1816 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'limit' => $limit); |
|
1817 | 1817 | |
1818 | - $transactions = $count ? $TXN->count( array($_where), 'TXN_ID', TRUE ) : $TXN->get_all($query_params); |
|
1818 | + $transactions = $count ? $TXN->count(array($_where), 'TXN_ID', TRUE) : $TXN->get_all($query_params); |
|
1819 | 1819 | |
1820 | 1820 | |
1821 | 1821 | return $transactions; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @throws \EE_Error |
152 | 152 | */ |
153 | 153 | public function column_TXN_ID( EE_Transaction $item ){ |
154 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
154 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
155 | 155 | $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>'; |
156 | 156 | |
157 | 157 | //txn timestamp |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * @throws \EE_Error |
322 | 322 | */ |
323 | 323 | public function column_event_name( EE_Transaction $item ){ |
324 | - $actions = array(); |
|
324 | + $actions = array(); |
|
325 | 325 | $event = $item->primary_registration()->get_first_related('Event'); |
326 | 326 | if ( !empty( $event ) ) { |
327 | 327 | $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL ); |
@@ -350,18 +350,18 @@ discard block |
||
350 | 350 | */ |
351 | 351 | public function column_actions( EE_Transaction $item ){ |
352 | 352 | |
353 | - $registration = $item->primary_registration(); |
|
354 | - $attendee = $registration->attendee(); |
|
353 | + $registration = $item->primary_registration(); |
|
354 | + $attendee = $registration->attendee(); |
|
355 | 355 | |
356 | - //Build row actions |
|
356 | + //Build row actions |
|
357 | 357 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
358 | 358 | $dl_invoice_lnk_url = $registration->invoice_url(); |
359 | 359 | $dl_receipt_lnk_url = $registration->receipt_url(); |
360 | 360 | $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
361 | 361 | $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
362 | - $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
363 | - 'TXN_ID' => $item->ID() |
|
364 | - )); |
|
362 | + $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
363 | + 'TXN_ID' => $item->ID() |
|
364 | + )); |
|
365 | 365 | |
366 | 366 | //Build row actions |
367 | 367 | $view_lnk = ' |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | } |
435 | 435 | |
436 | 436 | return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul' ); |
437 | - } |
|
437 | + } |
|
438 | 438 | |
439 | 439 | |
440 | 440 | } |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * @param \Transactions_Admin_Page $admin_page |
33 | 33 | */ |
34 | - public function __construct( \Transactions_Admin_Page $admin_page ){ |
|
35 | - parent::__construct( $admin_page ); |
|
34 | + public function __construct(\Transactions_Admin_Page $admin_page) { |
|
35 | + parent::__construct($admin_page); |
|
36 | 36 | $this->_status = $this->_admin_page->get_transaction_status_array(); |
37 | 37 | } |
38 | 38 | |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | *_setup_data |
43 | 43 | */ |
44 | 44 | protected function _setup_data() { |
45 | - $this->_data = $this->_admin_page->get_transactions( $this->_per_page ); |
|
46 | - $status = ! empty( $this->_req_data['status'] )? $this->_req_data['status'] : 'all'; |
|
47 | - $this->_all_data_count = $this->_admin_page->get_transactions( $this->_per_page, TRUE, $status ); |
|
45 | + $this->_data = $this->_admin_page->get_transactions($this->_per_page); |
|
46 | + $status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all'; |
|
47 | + $this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, TRUE, $status); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -59,25 +59,25 @@ discard block |
||
59 | 59 | 'ajax' => TRUE, |
60 | 60 | 'screen' => $this->_admin_page->get_current_screen()->id |
61 | 61 | ); |
62 | - $ID_column_name = __( 'ID', 'event_espresso' ); |
|
62 | + $ID_column_name = __('ID', 'event_espresso'); |
|
63 | 63 | $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">'; |
64 | - $ID_column_name .= __( 'Transaction Date', 'event_espresso' ); |
|
64 | + $ID_column_name .= __('Transaction Date', 'event_espresso'); |
|
65 | 65 | $ID_column_name .= '</span> '; |
66 | 66 | $this->_columns = array( |
67 | 67 | 'TXN_ID' => $ID_column_name, |
68 | - 'TXN_timestamp' => __( 'Transaction Date', 'event_espresso' ), |
|
69 | - 'TXN_total' => __( 'Total', 'event_espresso' ), |
|
70 | - 'TXN_paid' => __( 'Paid', 'event_espresso' ), |
|
71 | - 'ATT_fname' => __( 'Primary Registrant', 'event_espresso' ), |
|
72 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
73 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
68 | + 'TXN_timestamp' => __('Transaction Date', 'event_espresso'), |
|
69 | + 'TXN_total' => __('Total', 'event_espresso'), |
|
70 | + 'TXN_paid' => __('Paid', 'event_espresso'), |
|
71 | + 'ATT_fname' => __('Primary Registrant', 'event_espresso'), |
|
72 | + 'event_name' => __('Event', 'event_espresso'), |
|
73 | + 'actions' => __('Actions', 'event_espresso') |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | $this->_sortable_columns = array( |
77 | - 'TXN_ID' => array( 'TXN_ID' => FALSE ), |
|
78 | - 'event_name' => array( 'event_name'=> FALSE ), |
|
79 | - 'ATT_fname' => array( 'ATT_fname'=> FALSE ), |
|
80 | - 'TXN_timestamp' => array( 'TXN_timestamp'=> TRUE ) //true means its already sorted |
|
77 | + 'TXN_ID' => array('TXN_ID' => FALSE), |
|
78 | + 'event_name' => array('event_name'=> FALSE), |
|
79 | + 'ATT_fname' => array('ATT_fname'=> FALSE), |
|
80 | + 'TXN_timestamp' => array('TXN_timestamp'=> TRUE) //true means its already sorted |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | $this->_primary_column = 'TXN_ID'; |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | * @return string |
96 | 96 | * @throws \EE_Error |
97 | 97 | */ |
98 | - protected function _get_row_class( $item ) { |
|
99 | - $class = parent::_get_row_class( $item ); |
|
98 | + protected function _get_row_class($item) { |
|
99 | + $class = parent::_get_row_class($item); |
|
100 | 100 | //add status class |
101 | - $class .= ' ee-status-strip txn-status-' . $item->status_ID(); |
|
102 | - if ( $this->_has_checkbox_column ) { |
|
101 | + $class .= ' ee-status-strip txn-status-'.$item->status_ID(); |
|
102 | + if ($this->_has_checkbox_column) { |
|
103 | 103 | $class .= ' has-checkbox-column'; |
104 | 104 | } |
105 | 105 | return $class; |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | */ |
117 | 117 | protected function _get_table_filters() { |
118 | 118 | $filters = array(); |
119 | - $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' )); |
|
120 | - $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' ); |
|
119 | + $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year')); |
|
120 | + $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y'); |
|
121 | 121 | ob_start(); |
122 | 122 | ?> |
123 | 123 | <label for="txn-filter-start-date">Display Transactions from </label> |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | *_add_view_counts |
137 | 137 | */ |
138 | 138 | protected function _add_view_counts() { |
139 | - $this->_views['all']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'all' ); |
|
140 | - $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'abandoned' ); |
|
141 | - $this->_views['failed']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'failed' ); |
|
139 | + $this->_views['all']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'all'); |
|
140 | + $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'abandoned'); |
|
141 | + $this->_views['failed']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'failed'); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | * @return string |
151 | 151 | * @throws \EE_Error |
152 | 152 | */ |
153 | - public function column_TXN_ID( EE_Transaction $item ){ |
|
154 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
155 | - $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>'; |
|
153 | + public function column_TXN_ID(EE_Transaction $item) { |
|
154 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
155 | + $content = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details', 'event_espresso').'">'.$item->ID().'</a>'; |
|
156 | 156 | |
157 | 157 | //txn timestamp |
158 | - $content .= ' <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp( $item ) . '</span>'; |
|
158 | + $content .= ' <span class="show-on-mobile-view-only">'.$this->_get_txn_timestamp($item).'</span>'; |
|
159 | 159 | return $content; |
160 | 160 | } |
161 | 161 | |
@@ -166,18 +166,18 @@ discard block |
||
166 | 166 | * @return mixed|string|void |
167 | 167 | * @throws \EE_Error |
168 | 168 | */ |
169 | - protected function _get_txn_timestamp( EE_Transaction $item ) { |
|
169 | + protected function _get_txn_timestamp(EE_Transaction $item) { |
|
170 | 170 | //txn timestamp |
171 | 171 | // is TXN less than 2 hours old ? |
172 | 172 | if ( |
173 | - ( $item->failed() || $item->is_abandoned() ) |
|
173 | + ($item->failed() || $item->is_abandoned()) |
|
174 | 174 | && ( |
175 | - ( time() - EE_Registry::instance()->SSN->lifespan() ) < $item->datetime( false, true ) |
|
175 | + (time() - EE_Registry::instance()->SSN->lifespan()) < $item->datetime(false, true) |
|
176 | 176 | ) |
177 | 177 | ) { |
178 | - $timestamp = __( 'TXN in progress...', 'event_espresso' ); |
|
178 | + $timestamp = __('TXN in progress...', 'event_espresso'); |
|
179 | 179 | } else { |
180 | - $timestamp = $item->get_i18n_datetime( 'TXN_timestamp' ); |
|
180 | + $timestamp = $item->get_i18n_datetime('TXN_timestamp'); |
|
181 | 181 | } |
182 | 182 | return $timestamp; |
183 | 183 | } |
@@ -191,8 +191,8 @@ discard block |
||
191 | 191 | * @return string |
192 | 192 | * @throws \EE_Error |
193 | 193 | */ |
194 | - public function column_cb($item ){ |
|
195 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); |
|
194 | + public function column_cb($item) { |
|
195 | + return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | * @return string |
205 | 205 | * @throws \EE_Error |
206 | 206 | */ |
207 | - public function column_TXN_timestamp( EE_Transaction $item ){ |
|
208 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
209 | - $txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . $this->_get_txn_timestamp( $item ) . '</a>'; |
|
207 | + public function column_TXN_timestamp(EE_Transaction $item) { |
|
208 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
209 | + $txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.$this->_get_txn_timestamp($item).'</a>'; |
|
210 | 210 | //status |
211 | - $txn_date .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
211 | + $txn_date .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
212 | 212 | return $txn_date; |
213 | 213 | } |
214 | 214 | |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | * @return string |
222 | 222 | * @throws \EE_Error |
223 | 223 | */ |
224 | - public function column_TXN_total( EE_Transaction $item ){ |
|
225 | - if ( $item->get('TXN_total') > 0 ) { |
|
226 | - return '<span class="txn-pad-rght">' . apply_filters( 'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item ) . '</span>'; |
|
224 | + public function column_TXN_total(EE_Transaction $item) { |
|
225 | + if ($item->get('TXN_total') > 0) { |
|
226 | + return '<span class="txn-pad-rght">'.apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item).'</span>'; |
|
227 | 227 | } else { |
228 | - return '<span class="txn-overview-free-event-spn">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
228 | + return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>'; |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
@@ -238,17 +238,17 @@ discard block |
||
238 | 238 | * @return mixed|string |
239 | 239 | * @throws \EE_Error |
240 | 240 | */ |
241 | - public function column_TXN_paid( EE_Transaction $item ){ |
|
241 | + public function column_TXN_paid(EE_Transaction $item) { |
|
242 | 242 | $transaction_total = $item->get('TXN_total'); |
243 | 243 | $transaction_paid = $item->get('TXN_paid'); |
244 | 244 | |
245 | - if ( \EEH_Money::compare_floats( $transaction_total, 0,'>' ) ) { |
|
245 | + if (\EEH_Money::compare_floats($transaction_total, 0, '>')) { |
|
246 | 246 | // monies owing |
247 | 247 | $span_class = 'txn-overview-part-payment-spn'; |
248 | - if ( \EEH_Money::compare_floats( $transaction_paid, $transaction_total, '>=' ) ) { |
|
248 | + if (\EEH_Money::compare_floats($transaction_paid, $transaction_total, '>=')) { |
|
249 | 249 | // paid in full |
250 | 250 | $span_class = 'txn-overview-full-payment-spn'; |
251 | - } elseif ( \EEH_Money::compare_floats( $transaction_paid, 0, '==' ) ) { |
|
251 | + } elseif (\EEH_Money::compare_floats($transaction_paid, 0, '==')) { |
|
252 | 252 | // no payments made |
253 | 253 | $span_class = 'txn-overview-no-payment-spn'; |
254 | 254 | } |
@@ -258,11 +258,11 @@ discard block |
||
258 | 258 | } |
259 | 259 | |
260 | 260 | $payment_method = $item->payment_method(); |
261 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' ); |
|
261 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); |
|
262 | 262 | |
263 | - $content = '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>'; |
|
264 | - if ( $transaction_paid > 0 ) { |
|
265 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>'; |
|
263 | + $content = '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>'; |
|
264 | + if ($transaction_paid > 0) { |
|
265 | + $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; |
|
266 | 266 | } |
267 | 267 | return $content; |
268 | 268 | } |
@@ -276,13 +276,13 @@ discard block |
||
276 | 276 | * @return string|void |
277 | 277 | * @throws \EE_Error |
278 | 278 | */ |
279 | - public function column_ATT_fname( EE_Transaction $item ){ |
|
279 | + public function column_ATT_fname(EE_Transaction $item) { |
|
280 | 280 | $primary_reg = $item->primary_registration(); |
281 | 281 | $attendee = $primary_reg->get_first_related('Attendee'); |
282 | - if ( $attendee instanceof EE_Attendee ) { |
|
283 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$primary_reg->ID() ), REG_ADMIN_URL ); |
|
284 | - $content = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee->full_name() . '</a>' : $attendee->full_name(); |
|
285 | - $content .= '<br>' . $attendee->email(); |
|
282 | + if ($attendee instanceof EE_Attendee) { |
|
283 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$primary_reg->ID()), REG_ADMIN_URL); |
|
284 | + $content = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee->full_name().'</a>' : $attendee->full_name(); |
|
285 | + $content .= '<br>'.$attendee->email(); |
|
286 | 286 | return $content; |
287 | 287 | } |
288 | 288 | return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); |
@@ -297,13 +297,13 @@ discard block |
||
297 | 297 | * @return string|void |
298 | 298 | * @throws \EE_Error |
299 | 299 | */ |
300 | - public function column_ATT_email( EE_Transaction $item ){ |
|
300 | + public function column_ATT_email(EE_Transaction $item) { |
|
301 | 301 | $attendee = $item->primary_registration()->get_first_related('Attendee'); |
302 | - if ( ! empty( $attendee ) ) { |
|
303 | - return '<a href="mailto:' . $attendee->get( 'ATT_email' ) . '">' . $attendee->get( 'ATT_email' ) . '</a>'; |
|
302 | + if ( ! empty($attendee)) { |
|
303 | + return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>'; |
|
304 | 304 | } else { |
305 | 305 | return $item->failed() || $item->is_abandoned() |
306 | - ? __( 'no contact record.', 'event_espresso' ) |
|
306 | + ? __('no contact record.', 'event_espresso') |
|
307 | 307 | : __( |
308 | 308 | 'No contact record, because the transaction was abandoned or the registration process failed.', |
309 | 309 | 'event_espresso' |
@@ -320,20 +320,20 @@ discard block |
||
320 | 320 | * @return string|void |
321 | 321 | * @throws \EE_Error |
322 | 322 | */ |
323 | - public function column_event_name( EE_Transaction $item ){ |
|
323 | + public function column_event_name(EE_Transaction $item) { |
|
324 | 324 | $actions = array(); |
325 | 325 | $event = $item->primary_registration()->get_first_related('Event'); |
326 | - if ( !empty( $event ) ) { |
|
327 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL ); |
|
326 | + if ( ! empty($event)) { |
|
327 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$event->ID()), EVENTS_ADMIN_URL); |
|
328 | 328 | $event_name = $event->get('EVT_name'); |
329 | 329 | |
330 | 330 | //filter this view by transactions for this event |
331 | - $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event->ID() ) ); |
|
332 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ) { |
|
333 | - $actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event', 'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>'; |
|
331 | + $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event->ID())); |
|
332 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) { |
|
333 | + $actions['filter_by_event'] = '<a href="'.$txn_by_event_lnk.'" title="'.esc_attr__('Filter transactions by this event', 'event_espresso').'">'.__('View Transactions for this event', 'event_espresso').'</a>'; |
|
334 | 334 | } |
335 | 335 | |
336 | - return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ? '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Edit Event: %s', 'event_espresso' ), $event->get('EVT_name') ) .'">' . wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ), $this->row_actions($actions) ); |
|
336 | + return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID()) ? '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Edit Event: %s', 'event_espresso'), $event->get('EVT_name')).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions)); |
|
337 | 337 | } else { |
338 | 338 | return __('The event associated with this transaction via the primary registration cannot be retrieved.', 'event_espresso'); |
339 | 339 | } |
@@ -348,35 +348,35 @@ discard block |
||
348 | 348 | * @return string |
349 | 349 | * @throws \EE_Error |
350 | 350 | */ |
351 | - public function column_actions( EE_Transaction $item ){ |
|
351 | + public function column_actions(EE_Transaction $item) { |
|
352 | 352 | |
353 | 353 | $registration = $item->primary_registration(); |
354 | 354 | $attendee = $registration->attendee(); |
355 | 355 | |
356 | 356 | //Build row actions |
357 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
357 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
358 | 358 | $dl_invoice_lnk_url = $registration->invoice_url(); |
359 | 359 | $dl_receipt_lnk_url = $registration->receipt_url(); |
360 | - $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
|
361 | - $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
362 | - $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
360 | + $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL); |
|
361 | + $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
362 | + $related_messages_link = EEH_MSG_Template::get_message_action_link('see_notifications_for', null, array( |
|
363 | 363 | 'TXN_ID' => $item->ID() |
364 | 364 | )); |
365 | 365 | |
366 | 366 | //Build row actions |
367 | 367 | $view_lnk = ' |
368 | 368 | <li> |
369 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text"> |
|
369 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text"> |
|
370 | 370 | <span class="dashicons dashicons-cart"></span> |
371 | 371 | </a> |
372 | 372 | </li>'; |
373 | 373 | |
374 | 374 | $dl_invoice_lnk = ''; |
375 | 375 | //only show invoice link if message type is active. |
376 | - if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
376 | + if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) { |
|
377 | 377 | $dl_invoice_lnk = ' |
378 | 378 | <li> |
379 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
379 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
380 | 380 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
381 | 381 | </a> |
382 | 382 | </li>'; |
@@ -384,17 +384,17 @@ discard block |
||
384 | 384 | |
385 | 385 | $dl_receipt_lnk = ''; |
386 | 386 | //only show receipt link if message type is active. |
387 | - if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) { |
|
387 | + if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) { |
|
388 | 388 | $dl_receipt_lnk = ' |
389 | 389 | <li> |
390 | - <a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> |
|
390 | + <a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> |
|
391 | 391 | <span class="dashicons dashicons-media-default ee-icon-size-18"></span> |
392 | 392 | </a> |
393 | 393 | </li>'; |
394 | 394 | } |
395 | 395 | |
396 | 396 | //only show payment reminder link if the message type is active. |
397 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
397 | + if (EEH_MSG_Template::is_mt_active('payment_reminder')) { |
|
398 | 398 | $send_pay_lnk = $attendee instanceof EE_Attendee |
399 | 399 | && EE_Registry::instance()->CAP->current_user_can( |
400 | 400 | 'ee_send_message', |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | ) |
403 | 403 | ? ' |
404 | 404 | <li> |
405 | - <a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text"> |
|
405 | + <a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text"> |
|
406 | 406 | <span class="dashicons dashicons-email-alt"></span> |
407 | 407 | </a> |
408 | 408 | </li>' |
@@ -422,18 +422,18 @@ discard block |
||
422 | 422 | ) |
423 | 423 | ? ' |
424 | 424 | <li> |
425 | - <a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
425 | + <a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
426 | 426 | <span class="dashicons dashicons-clipboard"></span> |
427 | 427 | </a> |
428 | 428 | </li>' |
429 | 429 | : ''; |
430 | 430 | |
431 | 431 | $view_related_messages_lnk = ''; |
432 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_messages', 'view_filtered_messages' ) ) { |
|
433 | - $view_related_messages_lnk = '<li>' . $related_messages_link . '</li>'; |
|
432 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_messages', 'view_filtered_messages')) { |
|
433 | + $view_related_messages_lnk = '<li>'.$related_messages_link.'</li>'; |
|
434 | 434 | } |
435 | 435 | |
436 | - return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul' ); |
|
436 | + return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk.$view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul'); |
|
437 | 437 | } |
438 | 438 | |
439 | 439 |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | * @return string |
371 | 371 | * @throws \EE_Error |
372 | 372 | */ |
373 | - public function column_cb($item){ |
|
373 | + public function column_cb($item){ |
|
374 | 374 | /** checkbox/lock **/ |
375 | 375 | $transaction = $item->get_first_related( 'Transaction' ); |
376 | 376 | $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
377 | - return $payment_count > 0 |
|
378 | - ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) |
|
379 | - . '<span class="ee-lock-icon"></span>' |
|
380 | - : sprintf( |
|
381 | - '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', |
|
382 | - $item->ID() |
|
383 | - ); |
|
384 | - } |
|
377 | + return $payment_count > 0 |
|
378 | + ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) |
|
379 | + . '<span class="ee-lock-icon"></span>' |
|
380 | + : sprintf( |
|
381 | + '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', |
|
382 | + $item->ID() |
|
383 | + ); |
|
384 | + } |
|
385 | 385 | |
386 | 386 | |
387 | 387 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | */ |
418 | 418 | public function column__REG_date(EE_Registration $item){ |
419 | 419 | $this->_set_related_details($item); |
420 | - //Build row actions |
|
420 | + //Build row actions |
|
421 | 421 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
422 | 422 | $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
423 | 423 | $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>'; |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | } else { |
472 | 472 | return __( 'There is no ticket on this registration', 'event_espresso' ); |
473 | 473 | } |
474 | - } |
|
474 | + } |
|
475 | 475 | |
476 | 476 | |
477 | 477 | |
@@ -494,14 +494,14 @@ discard block |
||
494 | 494 | $t = $item->get_first_related('Transaction'); |
495 | 495 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
496 | 496 | |
497 | - //append group count to name |
|
498 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
497 | + //append group count to name |
|
498 | + $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
499 | 499 | |
500 | - //append reg_code |
|
501 | - $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
500 | + //append reg_code |
|
501 | + $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
502 | 502 | |
503 | - //reg status text for accessibility |
|
504 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
503 | + //reg status text for accessibility |
|
504 | + $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
505 | 505 | |
506 | 506 | //trash/restore/delete actions |
507 | 507 | $actions = array(); |
@@ -731,14 +731,14 @@ discard block |
||
731 | 731 | //message list table link (filtered by REG_ID |
732 | 732 | if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_messages', 'view_filtered_messages' ) ) { |
733 | 733 | $filtered_messages_link = '<li>' |
734 | - . EEH_MSG_Template::get_message_action_link( |
|
734 | + . EEH_MSG_Template::get_message_action_link( |
|
735 | 735 | 'see_notifications_for', |
736 | 736 | null, |
737 | 737 | array( |
738 | 738 | '_REG_ID' => $item->ID() |
739 | 739 | ) |
740 | 740 | ) |
741 | - . '</li>'; |
|
741 | + . '</li>'; |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk . $dl_invoice_lnk . $filtered_messages_link, $item, 'ul', 'reg-overview-actions-ul' ); |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | /** |
55 | 55 | * @param \Registrations_Admin_Page $admin_page |
56 | 56 | */ |
57 | - public function __construct( Registrations_Admin_Page $admin_page ){ |
|
58 | - if ( ! empty( $_GET['event_id'] ) ) { |
|
57 | + public function __construct(Registrations_Admin_Page $admin_page) { |
|
58 | + if ( ! empty($_GET['event_id'])) { |
|
59 | 59 | $extra_query_args = array(); |
60 | - foreach ( $admin_page->get_views() as $key => $view_details ) { |
|
61 | - $extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] ); |
|
60 | + foreach ($admin_page->get_views() as $key => $view_details) { |
|
61 | + $extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']); |
|
62 | 62 | } |
63 | - $this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args ); |
|
63 | + $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
|
64 | 64 | } |
65 | 65 | parent::__construct($admin_page); |
66 | 66 | $this->_status = $this->_admin_page->get_registration_status_array(); |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @return void |
76 | 76 | */ |
77 | 77 | protected function _setup_data() { |
78 | - $this->_data = $this->_admin_page->get_registrations( $this->_per_page ); |
|
79 | - $this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE ); |
|
78 | + $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
79 | + $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -93,30 +93,30 @@ discard block |
||
93 | 93 | 'ajax' => TRUE, |
94 | 94 | 'screen' => $this->_admin_page->get_current_screen()->id |
95 | 95 | ); |
96 | - $ID_column_name = __( 'ID', 'event_espresso' ); |
|
96 | + $ID_column_name = __('ID', 'event_espresso'); |
|
97 | 97 | $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">'; |
98 | - $ID_column_name .= __( 'Registrant Name', 'event_espresso' ); |
|
98 | + $ID_column_name .= __('Registrant Name', 'event_espresso'); |
|
99 | 99 | $ID_column_name .= '</span> '; |
100 | - if ( isset( $_GET['event_id'] )) { |
|
100 | + if (isset($_GET['event_id'])) { |
|
101 | 101 | $this->_columns = array( |
102 | 102 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
103 | 103 | '_REG_ID' => $ID_column_name, |
104 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
104 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
105 | 105 | 'ATT_email' => __('Email', 'event_espresso'), |
106 | - '_REG_date' => __( 'Reg Date', 'event_espresso' ), |
|
107 | - 'PRC_amount' => __( 'TKT Price', 'event_espresso' ), |
|
108 | - '_REG_final_price' => __( 'Final Price', 'event_espresso' ), |
|
109 | - 'TXN_total' => __( 'Total Txn', 'event_espresso' ), |
|
106 | + '_REG_date' => __('Reg Date', 'event_espresso'), |
|
107 | + 'PRC_amount' => __('TKT Price', 'event_espresso'), |
|
108 | + '_REG_final_price' => __('Final Price', 'event_espresso'), |
|
109 | + 'TXN_total' => __('Total Txn', 'event_espresso'), |
|
110 | 110 | 'TXN_paid' => __('Paid', 'event_espresso'), |
111 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
111 | + 'actions' => __('Actions', 'event_espresso') |
|
112 | 112 | ); |
113 | 113 | $this->_bottom_buttons = array( |
114 | 114 | 'report'=> array( |
115 | 115 | 'route' => 'registrations_report', |
116 | 116 | 'extra_request' => |
117 | 117 | array( |
118 | - 'EVT_ID'=> isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null, |
|
119 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) |
|
118 | + 'EVT_ID'=> isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, |
|
119 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") |
|
120 | 120 | ) |
121 | 121 | ), |
122 | 122 | ); |
@@ -124,19 +124,19 @@ discard block |
||
124 | 124 | $this->_columns = array( |
125 | 125 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
126 | 126 | '_REG_ID' => $ID_column_name, |
127 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
128 | - '_REG_date' => __( 'TXN Date', 'event_espresso' ), |
|
129 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
130 | - 'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ), |
|
131 | - '_REG_final_price' => __( 'Price', 'event_espresso' ), |
|
132 | - '_REG_paid' => __( 'Paid', 'event_espresso' ), |
|
133 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
127 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
128 | + '_REG_date' => __('TXN Date', 'event_espresso'), |
|
129 | + 'event_name' => __('Event', 'event_espresso'), |
|
130 | + 'DTT_EVT_start' => __('Event Date', 'event_espresso'), |
|
131 | + '_REG_final_price' => __('Price', 'event_espresso'), |
|
132 | + '_REG_paid' => __('Paid', 'event_espresso'), |
|
133 | + 'actions' => __('Actions', 'event_espresso') |
|
134 | 134 | ); |
135 | 135 | $this->_bottom_buttons = array( |
136 | 136 | 'report_all'=> array( |
137 | 137 | 'route' => 'registrations_report', |
138 | 138 | 'extra_request' => array( |
139 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) ) |
|
139 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
140 | 140 | ), |
141 | 141 | ); |
142 | 142 | } |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | $this->_primary_column = '_REG_ID'; |
145 | 145 | |
146 | 146 | $this->_sortable_columns = array( |
147 | - '_REG_date' => array( '_REG_date' => TRUE ), //true means its already sorted |
|
148 | - 'ATT_fname' => array( 'ATT_fname' => FALSE ), |
|
149 | - 'event_name' => array( 'event_name' => FALSE ), |
|
150 | - 'DTT_EVT_start' => array( 'DTT_EVT_start' => FALSE ), |
|
151 | - '_REG_ID' => array( '_REG_ID' => FALSE ), |
|
147 | + '_REG_date' => array('_REG_date' => TRUE), //true means its already sorted |
|
148 | + 'ATT_fname' => array('ATT_fname' => FALSE), |
|
149 | + 'event_name' => array('event_name' => FALSE), |
|
150 | + 'DTT_EVT_start' => array('DTT_EVT_start' => FALSE), |
|
151 | + '_REG_ID' => array('_REG_ID' => FALSE), |
|
152 | 152 | ); |
153 | 153 | |
154 | 154 | $this->_hidden_columns = array(); |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | * @param EE_Registration $item the current item |
163 | 163 | * @return string |
164 | 164 | */ |
165 | - protected function _get_row_class( $item ) { |
|
166 | - $class = parent::_get_row_class( $item ); |
|
165 | + protected function _get_row_class($item) { |
|
166 | + $class = parent::_get_row_class($item); |
|
167 | 167 | //add status class |
168 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
169 | - if ( $this->_has_checkbox_column ) { |
|
168 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
169 | + if ($this->_has_checkbox_column) { |
|
170 | 170 | $class .= ' has-checkbox-column'; |
171 | 171 | } |
172 | 172 | return $class; |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | * @param EE_Registration $registration |
181 | 181 | * @throws \EE_Error |
182 | 182 | */ |
183 | - protected function _set_related_details( EE_Registration $registration ) { |
|
183 | + protected function _set_related_details(EE_Registration $registration) { |
|
184 | 184 | |
185 | - $transaction = $registration->get_first_related( 'Transaction' ); |
|
185 | + $transaction = $registration->get_first_related('Transaction'); |
|
186 | 186 | $status = $transaction instanceof EE_Transaction |
187 | 187 | ? $transaction->status_ID() |
188 | 188 | : EEM_Transaction::failed_status_code; |
@@ -191,8 +191,8 @@ discard block |
||
191 | 191 | 'status' => $status, |
192 | 192 | 'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0, |
193 | 193 | 'title_attr' => sprintf( |
194 | - __( 'View Transaction Details (%s)', 'event_espresso' ), |
|
195 | - EEH_Template::pretty_status( $status, false, 'sentence' ) |
|
194 | + __('View Transaction Details (%s)', 'event_espresso'), |
|
195 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
196 | 196 | ) |
197 | 197 | ); |
198 | 198 | |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | 'status' => $status, |
204 | 204 | 'id' => $event instanceof EE_Event ? $event->ID() : 0, |
205 | 205 | 'title_attr' => sprintf( |
206 | - __( 'Edit Event (%s)', 'event_espresso' ), |
|
207 | - EEH_Template::pretty_status( $status, false, 'sentence' ) |
|
206 | + __('Edit Event (%s)', 'event_espresso'), |
|
207 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
208 | 208 | ) |
209 | 209 | ); |
210 | 210 | } |
@@ -221,30 +221,30 @@ discard block |
||
221 | 221 | |
222 | 222 | //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods. |
223 | 223 | |
224 | - $cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : ''; |
|
225 | - $cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1; |
|
226 | - $reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : ''; |
|
224 | + $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
225 | + $cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
226 | + $reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : ''; |
|
227 | 227 | |
228 | - $filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category ); |
|
229 | - $filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category ); |
|
228 | + $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
229 | + $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
230 | 230 | |
231 | 231 | $status = array(); |
232 | - $status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') ); |
|
233 | - foreach ( $this->_status as $key => $value ) { |
|
234 | - $status[] = array( 'id' => $key, 'text' => $value ); |
|
232 | + $status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso')); |
|
233 | + foreach ($this->_status as $key => $value) { |
|
234 | + $status[] = array('id' => $key, 'text' => $value); |
|
235 | 235 | } |
236 | - if ( $this->_view !== 'incomplete' ) { |
|
236 | + if ($this->_view !== 'incomplete') { |
|
237 | 237 | $filters[] = EEH_Form_Fields::select_input( |
238 | 238 | '_reg_status', |
239 | 239 | $status, |
240 | - isset( $this->_req_data['_reg_status'] ) |
|
241 | - ? strtoupper( sanitize_key( $this->_req_data['_reg_status'] )) |
|
240 | + isset($this->_req_data['_reg_status']) |
|
241 | + ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) |
|
242 | 242 | : '' |
243 | 243 | ); |
244 | 244 | } |
245 | 245 | |
246 | - if ( isset( $this->_req_data['event_id'] ) ) { |
|
247 | - $filters[] = EEH_Form_Fields::hidden_input( 'event_id', $this->_req_data['event_id'], 'reg_event_id' ); |
|
246 | + if (isset($this->_req_data['event_id'])) { |
|
247 | + $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | return $filters; |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | $this->_views['all']['count'] = $this->_total_registrations(); |
264 | 264 | $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
265 | 265 | $this->_views['today']['count'] = $this->_total_registrations_today(); |
266 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) { |
|
267 | - $this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' ); |
|
268 | - $this->_views['trash']['count'] = $this->_total_registrations( 'trash' ); |
|
266 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) { |
|
267 | + $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
268 | + $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
269 | 269 | } |
270 | 270 | } |
271 | 271 | |
@@ -279,23 +279,23 @@ discard block |
||
279 | 279 | * @return int |
280 | 280 | * @throws \EE_Error |
281 | 281 | */ |
282 | - protected function _total_registrations( $view = '' ){ |
|
282 | + protected function _total_registrations($view = '') { |
|
283 | 283 | $_where = array(); |
284 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
285 | - if( $EVT_ID ) { |
|
284 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
285 | + if ($EVT_ID) { |
|
286 | 286 | $_where['EVT_ID'] = $EVT_ID; |
287 | 287 | } |
288 | - switch ( $view ) { |
|
288 | + switch ($view) { |
|
289 | 289 | case 'trash' : |
290 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
290 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
291 | 291 | break; |
292 | 292 | case 'incomplete' : |
293 | 293 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
294 | 294 | break; |
295 | 295 | default : |
296 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
296 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
297 | 297 | } |
298 | - return EEM_Registration::instance()->count( array( $_where )); |
|
298 | + return EEM_Registration::instance()->count(array($_where)); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | |
@@ -307,32 +307,32 @@ discard block |
||
307 | 307 | * @return int |
308 | 308 | * @throws \EE_Error |
309 | 309 | */ |
310 | - protected function _total_registrations_this_month(){ |
|
311 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
312 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
310 | + protected function _total_registrations_this_month() { |
|
311 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
312 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
313 | 313 | $this_year_r = date('Y', current_time('timestamp')); |
314 | 314 | $time_start = ' 00:00:00'; |
315 | 315 | $time_end = ' 23:59:59'; |
316 | 316 | $this_month_r = date('m', current_time('timestamp')); |
317 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
317 | + $days_this_month = date('t', current_time('timestamp')); |
|
318 | 318 | //setup date query. |
319 | 319 | $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
320 | 320 | 'REG_date', |
321 | - $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, |
|
321 | + $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, |
|
322 | 322 | 'Y-m-d H:i:s' |
323 | 323 | ); |
324 | 324 | $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
325 | 325 | 'REG_date', |
326 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, |
|
326 | + $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, |
|
327 | 327 | 'Y-m-d H:i:s' |
328 | 328 | ); |
329 | - $_where['REG_date']= array('BETWEEN', |
|
329 | + $_where['REG_date'] = array('BETWEEN', |
|
330 | 330 | array( |
331 | 331 | $beginning_string, |
332 | 332 | $end_string |
333 | 333 | )); |
334 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
335 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
334 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
335 | + return EEM_Registration::instance()->count(array($_where)); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | |
@@ -344,20 +344,20 @@ discard block |
||
344 | 344 | * @return int |
345 | 345 | * @throws \EE_Error |
346 | 346 | */ |
347 | - protected function _total_registrations_today(){ |
|
347 | + protected function _total_registrations_today() { |
|
348 | 348 | |
349 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
350 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
349 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
350 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
351 | 351 | $current_date = date('Y-m-d', current_time('timestamp')); |
352 | 352 | $time_start = ' 00:00:00'; |
353 | 353 | $time_end = ' 23:59:59'; |
354 | - $_where['REG_date']= array('BETWEEN', |
|
354 | + $_where['REG_date'] = array('BETWEEN', |
|
355 | 355 | array( |
356 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_start, 'Y-m-d H:i:s' ), |
|
357 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_end, 'Y-m-d H:i:s' ) |
|
356 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'), |
|
357 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s') |
|
358 | 358 | )); |
359 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
360 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
359 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
360 | + return EEM_Registration::instance()->count(array($_where)); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
@@ -370,12 +370,12 @@ discard block |
||
370 | 370 | * @return string |
371 | 371 | * @throws \EE_Error |
372 | 372 | */ |
373 | - public function column_cb($item){ |
|
373 | + public function column_cb($item) { |
|
374 | 374 | /** checkbox/lock **/ |
375 | - $transaction = $item->get_first_related( 'Transaction' ); |
|
376 | - $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
|
375 | + $transaction = $item->get_first_related('Transaction'); |
|
376 | + $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0; |
|
377 | 377 | return $payment_count > 0 |
378 | - ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) |
|
378 | + ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()) |
|
379 | 379 | . '<span class="ee-lock-icon"></span>' |
380 | 380 | : sprintf( |
381 | 381 | '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', |
@@ -393,14 +393,14 @@ discard block |
||
393 | 393 | * @return string |
394 | 394 | * @throws \EE_Error |
395 | 395 | */ |
396 | - public function column__REG_ID(EE_Registration $item){ |
|
396 | + public function column__REG_ID(EE_Registration $item) { |
|
397 | 397 | $attendee = $item->attendee(); |
398 | 398 | $content = $item->ID(); |
399 | 399 | $content .= '<div class="show-on-mobile-view-only">'; |
400 | 400 | $content .= '<br>'; |
401 | 401 | $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
402 | - $content .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
403 | - $content .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
402 | + $content .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
403 | + $content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
404 | 404 | $content .= '</div>'; |
405 | 405 | return $content; |
406 | 406 | } |
@@ -415,12 +415,12 @@ discard block |
||
415 | 415 | * @return string |
416 | 416 | * @throws \EE_Error |
417 | 417 | */ |
418 | - public function column__REG_date(EE_Registration $item){ |
|
418 | + public function column__REG_date(EE_Registration $item) { |
|
419 | 419 | $this->_set_related_details($item); |
420 | 420 | //Build row actions |
421 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
422 | - $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
|
423 | - $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>'; |
|
421 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL); |
|
422 | + $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date'); |
|
423 | + $view_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence').'</span>'; |
|
424 | 424 | return $view_link; |
425 | 425 | } |
426 | 426 | |
@@ -434,18 +434,18 @@ discard block |
||
434 | 434 | * @return string |
435 | 435 | * @throws \EE_Error |
436 | 436 | */ |
437 | - public function column_event_name(EE_Registration $item){ |
|
438 | - $this->_set_related_details( $item ); |
|
437 | + public function column_event_name(EE_Registration $item) { |
|
438 | + $this->_set_related_details($item); |
|
439 | 439 | // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62 |
440 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$item->event_ID() ), EVENTS_ADMIN_URL ); |
|
440 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$item->event_ID()), EVENTS_ADMIN_URL); |
|
441 | 441 | $event_name = $item->event_name(); |
442 | 442 | $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso'); |
443 | - $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID() ) ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr( $this->_event_details['title_attr'] ) .'">' . wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ) ; |
|
443 | + $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID()) ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'); |
|
444 | 444 | |
445 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'event_id'=>$item->event_ID() ), REG_ADMIN_URL ); |
|
446 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Filter this list to only show registrations for %s', 'event_espresso' ), $event_name ) .'">' . __( 'View Registrations', 'event_espresso' ) . '</a>'; |
|
445 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id'=>$item->event_ID()), REG_ADMIN_URL); |
|
446 | + $actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), $event_name).'">'.__('View Registrations', 'event_espresso').'</a>'; |
|
447 | 447 | |
448 | - return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) ); |
|
448 | + return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | |
@@ -458,18 +458,18 @@ discard block |
||
458 | 458 | * @return string |
459 | 459 | * @throws \EE_Error |
460 | 460 | */ |
461 | - public function column_DTT_EVT_start(EE_Registration $item){ |
|
461 | + public function column_DTT_EVT_start(EE_Registration $item) { |
|
462 | 462 | $datetime_strings = array(); |
463 | - $ticket = $item->ticket( TRUE ); |
|
464 | - if ( $ticket instanceof EE_Ticket ) { |
|
463 | + $ticket = $item->ticket(TRUE); |
|
464 | + if ($ticket instanceof EE_Ticket) { |
|
465 | 465 | $remove_defaults = array('default_where_conditions' => 'none'); |
466 | 466 | $datetimes = $ticket->datetimes($remove_defaults); |
467 | - foreach($datetimes as $datetime){ |
|
468 | - $datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
467 | + foreach ($datetimes as $datetime) { |
|
468 | + $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
469 | 469 | } |
470 | - return implode("<br />",$datetime_strings); |
|
470 | + return implode("<br />", $datetime_strings); |
|
471 | 471 | } else { |
472 | - return __( 'There is no ticket on this registration', 'event_espresso' ); |
|
472 | + return __('There is no ticket on this registration', 'event_espresso'); |
|
473 | 473 | } |
474 | 474 | } |
475 | 475 | |
@@ -483,45 +483,45 @@ discard block |
||
483 | 483 | * @return string |
484 | 484 | * @throws \EE_Error |
485 | 485 | */ |
486 | - public function column_ATT_fname(EE_Registration $item){ |
|
486 | + public function column_ATT_fname(EE_Registration $item) { |
|
487 | 487 | $attendee = $item->attendee(); |
488 | 488 | |
489 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
489 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
490 | 490 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
491 | - $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' : $attendee_name; |
|
491 | + $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>' : $attendee_name; |
|
492 | 492 | $link .= $item->count() === 1 ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : ''; |
493 | 493 | |
494 | 494 | $t = $item->get_first_related('Transaction'); |
495 | 495 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
496 | 496 | |
497 | 497 | //append group count to name |
498 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
498 | + $link .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
499 | 499 | |
500 | 500 | //append reg_code |
501 | - $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
501 | + $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
502 | 502 | |
503 | 503 | //reg status text for accessibility |
504 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
504 | + $link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
505 | 505 | |
506 | 506 | //trash/restore/delete actions |
507 | 507 | $actions = array(); |
508 | - if ( $this->_view !== 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) { |
|
509 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
510 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>'; |
|
511 | - } elseif ( $this->_view === 'trash' ) { |
|
508 | + if ($this->_view !== 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) { |
|
509 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
510 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
511 | + } elseif ($this->_view === 'trash') { |
|
512 | 512 | // restore registration link |
513 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) { |
|
514 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
515 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
513 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) { |
|
514 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
515 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
516 | 516 | } |
517 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) { |
|
518 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
517 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) { |
|
518 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
519 | 519 | |
520 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>'; |
|
520 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>'; |
|
521 | 521 | } |
522 | 522 | } |
523 | 523 | |
524 | - return sprintf('%1$s %2$s', $link, $this->row_actions($actions) ); |
|
524 | + return sprintf('%1$s %2$s', $link, $this->row_actions($actions)); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * @return string |
535 | 535 | * @throws \EE_Error |
536 | 536 | */ |
537 | - public function column_ATT_email( EE_Registration $item ) { |
|
537 | + public function column_ATT_email(EE_Registration $item) { |
|
538 | 538 | $attendee = $item->get_first_related('Attendee'); |
539 | 539 | return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email(); |
540 | 540 | } |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | * @param \EE_Registration $item |
549 | 549 | * @return string |
550 | 550 | */ |
551 | - public function column__REG_count(EE_Registration $item){ |
|
552 | - return sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size()); |
|
551 | + public function column__REG_count(EE_Registration $item) { |
|
552 | + return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size()); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | |
@@ -561,16 +561,16 @@ discard block |
||
561 | 561 | * @param \EE_Registration $item |
562 | 562 | * @return string |
563 | 563 | */ |
564 | - public function column_PRC_amount(EE_Registration $item){ |
|
564 | + public function column_PRC_amount(EE_Registration $item) { |
|
565 | 565 | $ticket = $item->ticket(); |
566 | 566 | |
567 | - $content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : ''; |
|
567 | + $content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : ''; |
|
568 | 568 | |
569 | - if ( $item->final_price() > 0 ) { |
|
570 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
569 | + if ($item->final_price() > 0) { |
|
570 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
571 | 571 | } else { |
572 | 572 | // free event |
573 | - $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
573 | + $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>'; |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | return $content; |
@@ -586,11 +586,11 @@ discard block |
||
586 | 586 | * @param \EE_Registration $item |
587 | 587 | * @return string |
588 | 588 | */ |
589 | - public function column__REG_final_price(EE_Registration $item){ |
|
589 | + public function column__REG_final_price(EE_Registration $item) { |
|
590 | 590 | $ticket = $item->ticket(); |
591 | - $content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />'; |
|
591 | + $content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />'; |
|
592 | 592 | |
593 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
593 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
594 | 594 | return $content; |
595 | 595 | |
596 | 596 | } |
@@ -604,13 +604,13 @@ discard block |
||
604 | 604 | * @param \EE_Registration $item |
605 | 605 | * @return string |
606 | 606 | */ |
607 | - public function column__REG_paid(EE_Registration $item){ |
|
607 | + public function column__REG_paid(EE_Registration $item) { |
|
608 | 608 | $payment_method = $item->payment_method(); |
609 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' ); |
|
609 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); |
|
610 | 610 | |
611 | - $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
612 | - if ( $item->paid() > 0 ) { |
|
613 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>'; |
|
611 | + $content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>'; |
|
612 | + if ($item->paid() > 0) { |
|
613 | + $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; |
|
614 | 614 | } |
615 | 615 | return $content; |
616 | 616 | } |
@@ -625,11 +625,11 @@ discard block |
||
625 | 625 | * @return string |
626 | 626 | * @throws \EE_Error |
627 | 627 | */ |
628 | - public function column_TXN_total(EE_Registration $item){ |
|
629 | - if($item->transaction()){ |
|
630 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
631 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
632 | - }else{ |
|
628 | + public function column_TXN_total(EE_Registration $item) { |
|
629 | + if ($item->transaction()) { |
|
630 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
631 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>'; |
|
632 | + } else { |
|
633 | 633 | return __("None", "event_espresso"); |
634 | 634 | } |
635 | 635 | } |
@@ -644,15 +644,15 @@ discard block |
||
644 | 644 | * @return string |
645 | 645 | * @throws \EE_Error |
646 | 646 | */ |
647 | - public function column_TXN_paid(EE_Registration $item){ |
|
647 | + public function column_TXN_paid(EE_Registration $item) { |
|
648 | 648 | |
649 | - if ( $item->count() === 1 ) { |
|
649 | + if ($item->count() === 1) { |
|
650 | 650 | $transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance(); |
651 | - if ( $transaction->paid() >= $transaction->total() ) { |
|
651 | + if ($transaction->paid() >= $transaction->total()) { |
|
652 | 652 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
653 | 653 | } else { |
654 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
655 | - return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
654 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
655 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
656 | 656 | } |
657 | 657 | } |
658 | 658 | |
@@ -672,44 +672,44 @@ discard block |
||
672 | 672 | */ |
673 | 673 | public function column_actions(EE_Registration $item) { |
674 | 674 | $attendee = $item->attendee(); |
675 | - $this->_set_related_details( $item ); |
|
675 | + $this->_set_related_details($item); |
|
676 | 676 | |
677 | 677 | //Build row actions |
678 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
679 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL ); |
|
678 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
679 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL); |
|
680 | 680 | |
681 | 681 | // page=attendees&event_admin_reports=resend_email®istration_id=43653465634&event_id=2&form_action=resend_email |
682 | 682 | //$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID ); |
683 | - $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true ); |
|
683 | + $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true); |
|
684 | 684 | |
685 | 685 | |
686 | 686 | //Build row actions |
687 | - $view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? ' |
|
687 | + $view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? ' |
|
688 | 688 | <li> |
689 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
689 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
690 | 690 | <div class="dashicons dashicons-clipboard"></div> |
691 | 691 | </a> |
692 | 692 | </li>' : ''; |
693 | 693 | |
694 | - $edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) && $attendee instanceof EE_Attendee ?' |
|
694 | + $edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? ' |
|
695 | 695 | <li> |
696 | - <a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text"> |
|
696 | + <a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text"> |
|
697 | 697 | <div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div> |
698 | 698 | </a> |
699 | 699 | </li>' : ''; |
700 | 700 | |
701 | - $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? ' |
|
701 | + $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? ' |
|
702 | 702 | <li> |
703 | - <a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
703 | + <a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text"> |
|
704 | 704 | <div class="dashicons dashicons-email-alt"></div> |
705 | 705 | </a> |
706 | 706 | </li>' : ''; |
707 | 707 | |
708 | 708 | // page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb |
709 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
710 | - $view_txn_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? ' |
|
709 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL); |
|
710 | + $view_txn_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? ' |
|
711 | 711 | <li> |
712 | - <a class="ee-status-color-' . $this->_transaction_details['status'] . ' tiny-text" href="'.$view_txn_lnk_url.'" title="' . $this->_transaction_details['title_attr'] . '"> |
|
712 | + <a class="ee-status-color-' . $this->_transaction_details['status'].' tiny-text" href="'.$view_txn_lnk_url.'" title="'.$this->_transaction_details['title_attr'].'"> |
|
713 | 713 | <div class="dashicons dashicons-cart"></div> |
714 | 714 | </a> |
715 | 715 | </li>' : ''; |
@@ -718,10 +718,10 @@ discard block |
||
718 | 718 | $dl_invoice_lnk = ''; |
719 | 719 | $dl_invoice_lnk_url = $item->invoice_url(); |
720 | 720 | //only show invoice link if message type is active. |
721 | - if ( $attendee instanceof EE_Attendee && $item->is_primary_registrant() && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
721 | + if ($attendee instanceof EE_Attendee && $item->is_primary_registrant() && EEH_MSG_Template::is_mt_active('invoice')) { |
|
722 | 722 | $dl_invoice_lnk = ' |
723 | 723 | <li> |
724 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
724 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
725 | 725 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
726 | 726 | </a> |
727 | 727 | </li>'; |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | |
730 | 730 | $filtered_messages_link = ''; |
731 | 731 | //message list table link (filtered by REG_ID |
732 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_messages', 'view_filtered_messages' ) ) { |
|
732 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_messages', 'view_filtered_messages')) { |
|
733 | 733 | $filtered_messages_link = '<li>' |
734 | 734 | . EEH_MSG_Template::get_message_action_link( |
735 | 735 | 'see_notifications_for', |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | . '</li>'; |
742 | 742 | } |
743 | 743 | |
744 | - return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk . $dl_invoice_lnk . $filtered_messages_link, $item, 'ul', 'reg-overview-actions-ul' ); |
|
744 | + return $this->_action_string($view_lnk.$edit_lnk.$resend_reg_lnk.$view_txn_lnk.$dl_invoice_lnk.$filtered_messages_link, $item, 'ul', 'reg-overview-actions-ul'); |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ){ |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | } |
5 | 5 | /** |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | |
27 | 27 | |
28 | 28 | protected function _setup_data() { |
29 | - $this->_data = $this->_get_messages( $this->_per_page, $this->_view ); |
|
30 | - $this->_all_data_count = $this->_get_messages( $this->_per_page, $this->_view, true ); |
|
29 | + $this->_data = $this->_get_messages($this->_per_page, $this->_view); |
|
30 | + $this->_all_data_count = $this->_get_messages($this->_per_page, $this->_view, true); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -35,32 +35,32 @@ discard block |
||
35 | 35 | |
36 | 36 | protected function _set_properties() { |
37 | 37 | $this->_wp_list_args = array( |
38 | - 'singular' => __( 'Message', 'event_espresso' ), |
|
39 | - 'plural' => __( 'Messages', 'event_espresso' ), |
|
38 | + 'singular' => __('Message', 'event_espresso'), |
|
39 | + 'plural' => __('Messages', 'event_espresso'), |
|
40 | 40 | 'ajax' => true, |
41 | 41 | 'screen' => $this->get_admin_page()->get_current_screen()->id |
42 | 42 | ); |
43 | 43 | |
44 | 44 | $this->_columns = array( |
45 | 45 | 'cb' => '<input type="checkbox" />', |
46 | - 'to' => __( 'To', 'event_espresso' ), |
|
47 | - 'from' => __( 'From', 'event_espresso' ), |
|
48 | - 'messenger' => __( 'Messenger', 'event_espresso' ), |
|
49 | - 'message_type' => __( 'Message Type', 'event_espresso' ), |
|
50 | - 'context' => __( 'Context', 'event_espresso' ), |
|
51 | - 'modified' => __( 'Modified', 'event_espresso' ), |
|
52 | - 'action' => __( 'Actions', 'event_espresso' ), |
|
53 | - 'msg_id' => __( 'ID', 'event_espresso' ), |
|
46 | + 'to' => __('To', 'event_espresso'), |
|
47 | + 'from' => __('From', 'event_espresso'), |
|
48 | + 'messenger' => __('Messenger', 'event_espresso'), |
|
49 | + 'message_type' => __('Message Type', 'event_espresso'), |
|
50 | + 'context' => __('Context', 'event_espresso'), |
|
51 | + 'modified' => __('Modified', 'event_espresso'), |
|
52 | + 'action' => __('Actions', 'event_espresso'), |
|
53 | + 'msg_id' => __('ID', 'event_espresso'), |
|
54 | 54 | ); |
55 | 55 | |
56 | 56 | $this->_sortable_columns = array( |
57 | - 'modified' => array( 'MSG_modified' => true ), |
|
58 | - 'message_type' => array( 'MSG_message_type' => false ), |
|
59 | - 'messenger' => array( 'MSG_messenger' => false ), |
|
60 | - 'to' => array( 'MSG_to' => false ), |
|
61 | - 'from' => array( 'MSG_from' => false ), |
|
62 | - 'context' => array( 'MSG_context' => false ), |
|
63 | - 'msg_id' => array( 'MSG_ID', false ), |
|
57 | + 'modified' => array('MSG_modified' => true), |
|
58 | + 'message_type' => array('MSG_message_type' => false), |
|
59 | + 'messenger' => array('MSG_messenger' => false), |
|
60 | + 'to' => array('MSG_to' => false), |
|
61 | + 'from' => array('MSG_from' => false), |
|
62 | + 'context' => array('MSG_context' => false), |
|
63 | + 'msg_id' => array('MSG_ID', false), |
|
64 | 64 | ); |
65 | 65 | |
66 | 66 | $this->_primary_column = 'to'; |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | * @param object $item the current item |
79 | 79 | * @return string |
80 | 80 | */ |
81 | - protected function _get_row_class( $item ) { |
|
82 | - $class = parent::_get_row_class( $item ); |
|
81 | + protected function _get_row_class($item) { |
|
82 | + $class = parent::_get_row_class($item); |
|
83 | 83 | //add status class |
84 | - $class .= ' ee-status-strip msg-status-' . $item->STS_ID(); |
|
85 | - if ( $this->_has_checkbox_column ) { |
|
84 | + $class .= ' ee-status-strip msg-status-'.$item->STS_ID(); |
|
85 | + if ($this->_has_checkbox_column) { |
|
86 | 86 | $class .= ' has-checkbox-column'; |
87 | 87 | } |
88 | 88 | return $class; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | protected function _get_table_filters() { |
103 | 103 | $filters = array(); |
104 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
104 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
105 | 105 | //setup messengers for selects |
106 | 106 | $m_values = $this->get_admin_page()->get_messengers_for_list_table(); |
107 | 107 | //lets do the same for message types |
@@ -110,88 +110,88 @@ discard block |
||
110 | 110 | $contexts = $this->get_admin_page()->get_contexts_for_message_types_for_list_table(); |
111 | 111 | $i = 1; |
112 | 112 | $labels = $c_values = array(); |
113 | - foreach ( $contexts as $context => $label ) { |
|
113 | + foreach ($contexts as $context => $label) { |
|
114 | 114 | //some message types may have the same label for a different context, so we're grouping these together so the end user |
115 | 115 | //doesn't get confused. |
116 | - if ( isset( $labels[ $label ] ) ) { |
|
117 | - $c_values[ $labels[ $label ] ]['id'] .= ',' . $context; |
|
116 | + if (isset($labels[$label])) { |
|
117 | + $c_values[$labels[$label]]['id'] .= ','.$context; |
|
118 | 118 | continue; |
119 | 119 | } |
120 | - $c_values[ $i ]['id'] = $context; |
|
121 | - $c_values[ $i ]['text'] = $label; |
|
122 | - $labels[ $label ] = $i; |
|
120 | + $c_values[$i]['id'] = $context; |
|
121 | + $c_values[$i]['text'] = $label; |
|
122 | + $labels[$label] = $i; |
|
123 | 123 | $i++; |
124 | 124 | } |
125 | 125 | |
126 | 126 | $msgr_default[0] = array( |
127 | 127 | 'id' => 'none_selected', |
128 | - 'text' => __( 'All Messengers', 'event_espresso' ) |
|
128 | + 'text' => __('All Messengers', 'event_espresso') |
|
129 | 129 | ); |
130 | 130 | |
131 | 131 | $mt_default[0] = array( |
132 | 132 | 'id' => 'none_selected', |
133 | - 'text' => __( 'All Message Types', 'event_espresso' ) |
|
133 | + 'text' => __('All Message Types', 'event_espresso') |
|
134 | 134 | ); |
135 | 135 | |
136 | 136 | $c_default[0] = array( |
137 | 137 | 'id' => 'none_selected', |
138 | - 'text' => __( 'All Contexts', 'event_espresso ' ) |
|
138 | + 'text' => __('All Contexts', 'event_espresso ') |
|
139 | 139 | ); |
140 | 140 | |
141 | - $msgr_filters = count( $m_values ) > 1 |
|
142 | - ? array_merge( $msgr_default, $m_values ) |
|
141 | + $msgr_filters = count($m_values) > 1 |
|
142 | + ? array_merge($msgr_default, $m_values) |
|
143 | 143 | : $m_values; |
144 | - $mt_filters = ! empty( $mt_values ) && count( $mt_values ) > 1 |
|
145 | - ? array_merge( $mt_default, $mt_values ) |
|
144 | + $mt_filters = ! empty($mt_values) && count($mt_values) > 1 |
|
145 | + ? array_merge($mt_default, $mt_values) |
|
146 | 146 | : (array) $mt_values; |
147 | - $c_filters = ! empty( $c_values ) && count( $c_values ) > 1 |
|
148 | - ? array_merge( $c_default, $c_values ) |
|
147 | + $c_filters = ! empty($c_values) && count($c_values) > 1 |
|
148 | + ? array_merge($c_default, $c_values) |
|
149 | 149 | : (array) $c_values; |
150 | 150 | |
151 | - if ( empty( $msgr_filters ) ) { |
|
151 | + if (empty($msgr_filters)) { |
|
152 | 152 | $msgr_filters[0] = array( |
153 | 153 | 'id' => 'none_selected', |
154 | - 'text' => __( 'No Messengers active', 'event_espresso' ) |
|
154 | + 'text' => __('No Messengers active', 'event_espresso') |
|
155 | 155 | ); |
156 | 156 | } |
157 | 157 | |
158 | - if ( empty( $mt_filters ) ) { |
|
158 | + if (empty($mt_filters)) { |
|
159 | 159 | $mt_filters[0] = array( |
160 | 160 | 'id' => 'none_selected', |
161 | - 'text' => __( 'No Message Types active', 'event_espresso' ) |
|
161 | + 'text' => __('No Message Types active', 'event_espresso') |
|
162 | 162 | ); |
163 | 163 | } |
164 | 164 | |
165 | - if ( empty( $c_filters ) ) { |
|
165 | + if (empty($c_filters)) { |
|
166 | 166 | $c_filters[0] = array( |
167 | 167 | 'id' => 'none_selected', |
168 | - 'text' => __( 'No Contexts (because no message types active)', 'event_espresso' ) |
|
168 | + 'text' => __('No Contexts (because no message types active)', 'event_espresso') |
|
169 | 169 | ); |
170 | 170 | } |
171 | 171 | |
172 | - if ( count ( $msgr_filters ) > 1 ) { |
|
172 | + if (count($msgr_filters) > 1) { |
|
173 | 173 | $filters[] = EEH_Form_Fields::select_input( |
174 | 174 | 'ee_messenger_filter_by', |
175 | - array_values( $msgr_filters ), |
|
176 | - isset( $this->_req_data['ee_messenger_filter_by'] ) |
|
177 | - ? sanitize_title( $this->_req_data['ee_messenger_filter_by'] ) |
|
175 | + array_values($msgr_filters), |
|
176 | + isset($this->_req_data['ee_messenger_filter_by']) |
|
177 | + ? sanitize_title($this->_req_data['ee_messenger_filter_by']) |
|
178 | 178 | : '' |
179 | 179 | ); |
180 | 180 | } |
181 | - if ( count( $mt_filters ) > 1 ) { |
|
181 | + if (count($mt_filters) > 1) { |
|
182 | 182 | $filters[] = EEH_Form_Fields::select_input( |
183 | 183 | 'ee_message_type_filter_by', |
184 | - array_values( $mt_filters ), |
|
185 | - isset( $this->_req_data['ee_message_type_filter_by'] ) ? sanitize_title( |
|
184 | + array_values($mt_filters), |
|
185 | + isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_title( |
|
186 | 186 | $this->_req_data['ee_message_type_filter_by'] |
187 | 187 | ) : '' |
188 | 188 | ); |
189 | 189 | } |
190 | - if ( count( $c_filters ) > 1 ) { |
|
190 | + if (count($c_filters) > 1) { |
|
191 | 191 | $filters[] = EEH_Form_Fields::select_input( |
192 | 192 | 'ee_context_filter_by', |
193 | - array_values( $c_filters ), |
|
194 | - isset( $this->_req_data['ee_context_filter_by'] ) ? sanitize_text_field( |
|
193 | + array_values($c_filters), |
|
194 | + isset($this->_req_data['ee_context_filter_by']) ? sanitize_text_field( |
|
195 | 195 | $this->_req_data['ee_context_filter_by'] |
196 | 196 | ) : '' |
197 | 197 | ); |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | |
203 | 203 | |
204 | 204 | protected function _add_view_counts() { |
205 | - foreach ( $this->_views as $view => $args ) { |
|
206 | - $this->_views[ $view ]['count'] = $this->_get_messages( $this->_per_page, $view, true, true ); |
|
205 | + foreach ($this->_views as $view => $args) { |
|
206 | + $this->_views[$view]['count'] = $this->_get_messages($this->_per_page, $view, true, true); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | * @return string checkbox |
215 | 215 | * @throws \EE_Error |
216 | 216 | */ |
217 | - public function column_cb( $message ) { |
|
218 | - return sprintf( '<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID() ); |
|
217 | + public function column_cb($message) { |
|
218 | + return sprintf('<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID()); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @return string |
226 | 226 | * @throws \EE_Error |
227 | 227 | */ |
228 | - public function column_msg_id( EE_Message $message ) { |
|
228 | + public function column_msg_id(EE_Message $message) { |
|
229 | 229 | return $message->ID(); |
230 | 230 | } |
231 | 231 | |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | * @return string The recipient of the message |
237 | 237 | * @throws \EE_Error |
238 | 238 | */ |
239 | - public function column_to( EE_Message $message ) { |
|
240 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
239 | + public function column_to(EE_Message $message) { |
|
240 | + EE_Registry::instance()->load_helper('URL'); |
|
241 | 241 | $actions = array(); |
242 | 242 | $actions['delete'] = '<a href="' |
243 | 243 | . EEH_URL::add_query_args_and_nonce( |
@@ -246,10 +246,10 @@ discard block |
||
246 | 246 | 'action' => 'delete_ee_message', |
247 | 247 | 'MSG_ID' => $message->ID() |
248 | 248 | ), |
249 | - admin_url( 'admin.php' ) |
|
249 | + admin_url('admin.php') |
|
250 | 250 | ) |
251 | - . '">' . __( 'Delete', 'event_espresso' ) . '</a>'; |
|
252 | - return $message->to() . $this->row_actions( $actions ); |
|
251 | + . '">'.__('Delete', 'event_espresso').'</a>'; |
|
252 | + return $message->to().$this->row_actions($actions); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @param EE_Message $message |
258 | 258 | * @return string The sender of the message |
259 | 259 | */ |
260 | - public function column_from( EE_Message $message ) { |
|
260 | + public function column_from(EE_Message $message) { |
|
261 | 261 | return $message->from(); |
262 | 262 | } |
263 | 263 | |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | * @param EE_Message $message |
268 | 268 | * @return string The messenger used to send the message. |
269 | 269 | */ |
270 | - public function column_messenger( EE_Message $message ) { |
|
271 | - return ucwords( $message->messenger_label() ); |
|
270 | + public function column_messenger(EE_Message $message) { |
|
271 | + return ucwords($message->messenger_label()); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
@@ -276,8 +276,8 @@ discard block |
||
276 | 276 | * @param EE_Message $message |
277 | 277 | * @return string The message type used to generate the message. |
278 | 278 | */ |
279 | - public function column_message_type( EE_Message $message ) { |
|
280 | - return ucwords( $message->message_type_label() ); |
|
279 | + public function column_message_type(EE_Message $message) { |
|
280 | + return ucwords($message->message_type_label()); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @param EE_Message $message |
286 | 286 | * @return string The context the message was generated for. |
287 | 287 | */ |
288 | - public function column_context( EE_Message $message ) { |
|
288 | + public function column_context(EE_Message $message) { |
|
289 | 289 | return $message->context_label(); |
290 | 290 | } |
291 | 291 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * @param EE_Message $message |
295 | 295 | * @return string The timestamp when this message was last modified. |
296 | 296 | */ |
297 | - public function column_modified( EE_Message $message ) { |
|
297 | + public function column_modified(EE_Message $message) { |
|
298 | 298 | return $message->modified(); |
299 | 299 | } |
300 | 300 | |
@@ -303,36 +303,36 @@ discard block |
||
303 | 303 | * @param EE_Message $message |
304 | 304 | * @return string Actions that can be done on the current message. |
305 | 305 | */ |
306 | - public function column_action( EE_Message $message ) { |
|
307 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
306 | + public function column_action(EE_Message $message) { |
|
307 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
308 | 308 | $action_links = array( |
309 | - 'view' => EEH_MSG_Template::get_message_action_link( 'view', $message ), |
|
310 | - 'error' => EEH_MSG_Template::get_message_action_link( 'error', $message ), |
|
311 | - 'generate_now' => EEH_MSG_Template::get_message_action_link( 'generate_now', $message ), |
|
312 | - 'send_now' => EEH_MSG_Template::get_message_action_link( 'send_now', $message ), |
|
313 | - 'queue_for_resending' => EEH_MSG_Template::get_message_action_link( 'queue_for_resending', $message ), |
|
314 | - 'view_transaction' => EEH_MSG_Template::get_message_action_link( 'view_transaction', $message ), |
|
309 | + 'view' => EEH_MSG_Template::get_message_action_link('view', $message), |
|
310 | + 'error' => EEH_MSG_Template::get_message_action_link('error', $message), |
|
311 | + 'generate_now' => EEH_MSG_Template::get_message_action_link('generate_now', $message), |
|
312 | + 'send_now' => EEH_MSG_Template::get_message_action_link('send_now', $message), |
|
313 | + 'queue_for_resending' => EEH_MSG_Template::get_message_action_link('queue_for_resending', $message), |
|
314 | + 'view_transaction' => EEH_MSG_Template::get_message_action_link('view_transaction', $message), |
|
315 | 315 | ); |
316 | 316 | $content = ''; |
317 | - switch ( $message->STS_ID() ) { |
|
317 | + switch ($message->STS_ID()) { |
|
318 | 318 | case EEM_Message::status_sent : |
319 | - $content = $action_links['view'] . $action_links['queue_for_resending'] . $action_links['view_transaction']; |
|
319 | + $content = $action_links['view'].$action_links['queue_for_resending'].$action_links['view_transaction']; |
|
320 | 320 | break; |
321 | 321 | case EEM_Message::status_resend : |
322 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction']; |
|
322 | + $content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction']; |
|
323 | 323 | break; |
324 | 324 | case EEM_Message::status_retry : |
325 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['error'] . $action_links['view_transaction']; |
|
325 | + $content = $action_links['view'].$action_links['send_now'].$action_links['error'].$action_links['view_transaction']; |
|
326 | 326 | break; |
327 | 327 | case EEM_Message::status_failed : |
328 | 328 | case EEM_Message::status_debug_only : |
329 | - $content = $action_links['error'] . $action_links['view_transaction']; |
|
329 | + $content = $action_links['error'].$action_links['view_transaction']; |
|
330 | 330 | break; |
331 | 331 | case EEM_Message::status_idle : |
332 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction']; |
|
332 | + $content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction']; |
|
333 | 333 | break; |
334 | 334 | case EEM_Message::status_incomplete; |
335 | - $content = $action_links['generate_now'] . $action_links['view_transaction']; |
|
335 | + $content = $action_links['generate_now'].$action_links['view_transaction']; |
|
336 | 336 | break; |
337 | 337 | } |
338 | 338 | return $content; |
@@ -350,69 +350,69 @@ discard block |
||
350 | 350 | * @return int | EE_Message[] |
351 | 351 | * @throws \EE_Error |
352 | 352 | */ |
353 | - protected function _get_messages( $perpage = 10, $view = 'all', $count = false, $all = false ) { |
|
353 | + protected function _get_messages($perpage = 10, $view = 'all', $count = false, $all = false) { |
|
354 | 354 | |
355 | - $current_page = isset( $this->_req_data['paged'] ) && ! empty( $this->_req_data['paged'] ) |
|
355 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
356 | 356 | ? $this->_req_data['paged'] |
357 | 357 | : 1; |
358 | 358 | |
359 | - $per_page = isset( $this->_req_data['perpage'] ) && ! empty( $this->_req_data['perpage'] ) |
|
359 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
360 | 360 | ? $this->_req_data['perpage'] |
361 | 361 | : $perpage; |
362 | 362 | |
363 | - $offset = ( $current_page - 1 ) * $per_page; |
|
364 | - $limit = $all || $count ? null : array( $offset, $per_page ); |
|
363 | + $offset = ($current_page - 1) * $per_page; |
|
364 | + $limit = $all || $count ? null : array($offset, $per_page); |
|
365 | 365 | $query_params = array( |
366 | - 'order_by' => empty( $this->_req_data[ 'orderby' ] ) ? 'MSG_modified' : $this->_req_data[ 'orderby' ], |
|
367 | - 'order' => empty( $this->_req_data[ 'order' ] ) ? 'DESC' : $this->_req_data[ 'order' ], |
|
366 | + 'order_by' => empty($this->_req_data['orderby']) ? 'MSG_modified' : $this->_req_data['orderby'], |
|
367 | + 'order' => empty($this->_req_data['order']) ? 'DESC' : $this->_req_data['order'], |
|
368 | 368 | 'limit' => $limit, |
369 | 369 | ); |
370 | 370 | |
371 | 371 | /** |
372 | 372 | * Any filters coming in from other routes? |
373 | 373 | */ |
374 | - if ( isset( $this->_req_data['filterby'] ) ) { |
|
375 | - $query_params = array_merge( $query_params, EEM_Message::instance()->filter_by_query_params() ); |
|
376 | - if ( ! $count ) { |
|
374 | + if (isset($this->_req_data['filterby'])) { |
|
375 | + $query_params = array_merge($query_params, EEM_Message::instance()->filter_by_query_params()); |
|
376 | + if ( ! $count) { |
|
377 | 377 | $query_params['group_by'] = 'MSG_ID'; |
378 | 378 | } |
379 | 379 | } |
380 | 380 | |
381 | 381 | //view conditionals |
382 | - if ( $view !== 'all' && $count && $all ) { |
|
382 | + if ($view !== 'all' && $count && $all) { |
|
383 | 383 | $query_params[0]['AND*view_conditional'] = array( |
384 | - 'STS_ID' => strtoupper( $view ), |
|
384 | + 'STS_ID' => strtoupper($view), |
|
385 | 385 | ); |
386 | 386 | } |
387 | 387 | |
388 | - if ( ! $all && ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] !== 'all' ) { |
|
388 | + if ( ! $all && ! empty($this->_req_data['status']) && $this->_req_data['status'] !== 'all') { |
|
389 | 389 | $query_params[0]['AND*view_conditional'] = array( |
390 | - 'STS_ID' => strtoupper( $this->_req_data['status'] ), |
|
390 | + 'STS_ID' => strtoupper($this->_req_data['status']), |
|
391 | 391 | ); |
392 | 392 | } |
393 | 393 | |
394 | - if ( ! $all && ! empty( $this->_req_data['s'] ) ) { |
|
395 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
394 | + if ( ! $all && ! empty($this->_req_data['s'])) { |
|
395 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
396 | 396 | $query_params[0]['OR'] = array( |
397 | - 'MSG_to' => array( 'LIKE', $search_string ), |
|
398 | - 'MSG_from' => array( 'LIKE', $search_string ), |
|
399 | - 'MSG_subject' => array( 'LIKE', $search_string ), |
|
400 | - 'MSG_content' => array( 'LIKE', $search_string ), |
|
397 | + 'MSG_to' => array('LIKE', $search_string), |
|
398 | + 'MSG_from' => array('LIKE', $search_string), |
|
399 | + 'MSG_subject' => array('LIKE', $search_string), |
|
400 | + 'MSG_content' => array('LIKE', $search_string), |
|
401 | 401 | ); |
402 | 402 | } |
403 | 403 | |
404 | 404 | //account for debug only status. We don't show Messages with the EEM_Message::status_debug_only to clients when |
405 | 405 | //`WP_DEBUG` is false. |
406 | - if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) { |
|
406 | + if ( ! defined('WP_DEBUG') || ! WP_DEBUG) { |
|
407 | 407 | $query_params[0]['AND*debug_only_conditional'] = array( |
408 | - 'STS_ID' => array( '!=', EEM_Message::status_debug_only ) |
|
408 | + 'STS_ID' => array('!=', EEM_Message::status_debug_only) |
|
409 | 409 | ); |
410 | 410 | } |
411 | 411 | |
412 | 412 | //account for filters |
413 | 413 | if ( |
414 | 414 | ! $all |
415 | - && isset( $this->_req_data['ee_messenger_filter_by'] ) |
|
415 | + && isset($this->_req_data['ee_messenger_filter_by']) |
|
416 | 416 | && $this->_req_data['ee_messenger_filter_by'] !== 'none_selected' |
417 | 417 | ) { |
418 | 418 | $query_params[0]['AND*messenger_filter'] = array( |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | } |
422 | 422 | if ( |
423 | 423 | ! $all |
424 | - && ! empty( $this->_req_data['ee_message_type_filter_by'] ) |
|
424 | + && ! empty($this->_req_data['ee_message_type_filter_by']) |
|
425 | 425 | && $this->_req_data['ee_message_type_filter_by'] !== 'none_selected' |
426 | 426 | ) { |
427 | 427 | $query_params[0]['AND*message_type_filter'] = array( |
@@ -431,17 +431,17 @@ discard block |
||
431 | 431 | |
432 | 432 | if ( |
433 | 433 | ! $all |
434 | - && ! empty( $this->_req_data['ee_context_filter_by'] ) |
|
434 | + && ! empty($this->_req_data['ee_context_filter_by']) |
|
435 | 435 | && $this->_req_data['ee_context_filter_by'] !== 'none_selected' |
436 | 436 | ) { |
437 | 437 | $query_params[0]['AND*context_filter'] = array( |
438 | - 'MSG_context' => array( 'IN', explode( ',', $this->_req_data['ee_context_filter_by'] ) ) |
|
438 | + 'MSG_context' => array('IN', explode(',', $this->_req_data['ee_context_filter_by'])) |
|
439 | 439 | ); |
440 | 440 | } |
441 | 441 | |
442 | 442 | return $count |
443 | - ? EEM_Message::instance()->count( $query_params, null, true ) |
|
444 | - : EEM_Message::instance()->get_all( $query_params ); |
|
443 | + ? EEM_Message::instance()->count($query_params, null, true) |
|
444 | + : EEM_Message::instance()->get_all($query_params); |
|
445 | 445 | |
446 | 446 | } |
447 | 447 | } //end EE_Message_List_Table class |
448 | 448 | \ No newline at end of file |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE ); |
3 | -if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) { |
|
4 | - set_error_handler( array( 'EE_Error', 'error_handler' )); |
|
5 | - register_shutdown_function( array( 'EE_Error', 'fatal_error_handler' )); |
|
3 | +if (defined('WP_DEBUG') && WP_DEBUG === TRUE && defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS === TRUE) { |
|
4 | + set_error_handler(array('EE_Error', 'error_handler')); |
|
5 | + register_shutdown_function(array('EE_Error', 'fatal_error_handler')); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @access private |
65 | 65 | * @var boolean |
66 | 66 | */ |
67 | - private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE ); |
|
67 | + private static $_espresso_notices = array('success' => FALSE, 'errors' => FALSE, 'attention' => FALSE); |
|
68 | 68 | |
69 | 69 | |
70 | 70 | |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | * @access public |
76 | 76 | * @echo string |
77 | 77 | */ |
78 | - function __construct( $message, $code = 0, Exception $previous = NULL ) { |
|
79 | - if ( version_compare( phpversion(), '5.3.0', '<' )) { |
|
80 | - parent::__construct( $message, $code ); |
|
78 | + function __construct($message, $code = 0, Exception $previous = NULL) { |
|
79 | + if (version_compare(phpversion(), '5.3.0', '<')) { |
|
80 | + parent::__construct($message, $code); |
|
81 | 81 | } else { |
82 | - parent::__construct( $message, $code, $previous ); |
|
82 | + parent::__construct($message, $code, $previous); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | * @param $line |
95 | 95 | * @return void |
96 | 96 | */ |
97 | - public static function error_handler( $code, $message, $file, $line ) { |
|
98 | - $type = EE_Error::error_type( $code ); |
|
97 | + public static function error_handler($code, $message, $file, $line) { |
|
98 | + $type = EE_Error::error_type($code); |
|
99 | 99 | $site = site_url(); |
100 | - switch ( $site ) { |
|
100 | + switch ($site) { |
|
101 | 101 | case 'http://ee4.eventespresso.com/' : |
102 | 102 | case 'http://ee4decaf.eventespresso.com/' : |
103 | 103 | case 'http://ee4hf.eventespresso.com/' : |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | $to = '[email protected]'; |
111 | 111 | break; |
112 | 112 | default : |
113 | - $to = get_option( 'admin_email' ); |
|
113 | + $to = get_option('admin_email'); |
|
114 | 114 | } |
115 | - $subject = $type . ' ' . $message . ' in ' . EVENT_ESPRESSO_VERSION . ' on ' . site_url(); |
|
116 | - $msg = EE_Error::_format_error( $type, $message, $file, $line ); |
|
117 | - if ( function_exists( 'wp_mail' )) { |
|
118 | - add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' )); |
|
119 | - wp_mail( $to, $subject, $msg ); |
|
115 | + $subject = $type.' '.$message.' in '.EVENT_ESPRESSO_VERSION.' on '.site_url(); |
|
116 | + $msg = EE_Error::_format_error($type, $message, $file, $line); |
|
117 | + if (function_exists('wp_mail')) { |
|
118 | + add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type')); |
|
119 | + wp_mail($to, $subject, $msg); |
|
120 | 120 | } |
121 | 121 | echo '<div id="message" class="espresso-notices error"><p>'; |
122 | - echo $type . ': ' . $message . '<br />' . $file . ' line ' . $line; |
|
122 | + echo $type.': '.$message.'<br />'.$file.' line '.$line; |
|
123 | 123 | echo '<br /></p></div>'; |
124 | 124 | } |
125 | 125 | |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * @param $code |
133 | 133 | * @return string |
134 | 134 | */ |
135 | - public static function error_type( $code ) { |
|
136 | - switch( $code ) { |
|
135 | + public static function error_type($code) { |
|
136 | + switch ($code) { |
|
137 | 137 | case E_ERROR: // 1 // |
138 | 138 | return 'E_ERROR'; |
139 | 139 | case E_WARNING: // 2 // |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public static function fatal_error_handler() { |
181 | 181 | $last_error = error_get_last(); |
182 | - if ( $last_error['type'] === E_ERROR ) { |
|
183 | - EE_Error::error_handler( E_ERROR, $last_error['message'], $last_error['file'], $last_error['line'] ); |
|
182 | + if ($last_error['type'] === E_ERROR) { |
|
183 | + EE_Error::error_handler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @param $line |
196 | 196 | * @return string |
197 | 197 | */ |
198 | - private static function _format_error( $code, $message, $file, $line ) { |
|
198 | + private static function _format_error($code, $message, $file, $line) { |
|
199 | 199 | $html = "<table cellpadding='5'><thead bgcolor='#f8f8f8'><th>Item</th><th align='left'>Details</th></thead><tbody>"; |
200 | 200 | $html .= "<tr valign='top'><td><b>Code</b></td><td>$code</td></tr>"; |
201 | 201 | $html .= "<tr valign='top'><td><b>Error</b></td><td>$message</td></tr>"; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param $content_type |
214 | 214 | * @return string |
215 | 215 | */ |
216 | - public static function set_content_type( $content_type ) { |
|
216 | + public static function set_content_type($content_type) { |
|
217 | 217 | return 'text/html'; |
218 | 218 | } |
219 | 219 | |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function get_error() { |
229 | 229 | |
230 | - if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){ |
|
230 | + if (apply_filters('FHEE__EE_Error__get_error__show_normal_exceptions', FALSE)) { |
|
231 | 231 | throw $this; |
232 | 232 | } |
233 | 233 | // get separate user and developer messages if they exist |
234 | - $msg = explode( '||', $this->getMessage() ); |
|
234 | + $msg = explode('||', $this->getMessage()); |
|
235 | 235 | $user_msg = $msg[0]; |
236 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
236 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
237 | 237 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
238 | 238 | |
239 | 239 | // add details to _all_exceptions array |
240 | 240 | $x_time = time(); |
241 | - self::$_all_exceptions[ $x_time ]['name'] = get_class( $this ); |
|
242 | - self::$_all_exceptions[ $x_time ]['file'] = $this->getFile(); |
|
243 | - self::$_all_exceptions[ $x_time ]['line'] = $this->getLine(); |
|
244 | - self::$_all_exceptions[ $x_time ]['msg'] = $msg; |
|
245 | - self::$_all_exceptions[ $x_time ]['code'] = $this->getCode(); |
|
246 | - self::$_all_exceptions[ $x_time ]['trace'] = $this->getTrace(); |
|
247 | - self::$_all_exceptions[ $x_time ]['string'] = $this->getTraceAsString(); |
|
241 | + self::$_all_exceptions[$x_time]['name'] = get_class($this); |
|
242 | + self::$_all_exceptions[$x_time]['file'] = $this->getFile(); |
|
243 | + self::$_all_exceptions[$x_time]['line'] = $this->getLine(); |
|
244 | + self::$_all_exceptions[$x_time]['msg'] = $msg; |
|
245 | + self::$_all_exceptions[$x_time]['code'] = $this->getCode(); |
|
246 | + self::$_all_exceptions[$x_time]['trace'] = $this->getTrace(); |
|
247 | + self::$_all_exceptions[$x_time]['string'] = $this->getTraceAsString(); |
|
248 | 248 | self::$_error_count++; |
249 | 249 | |
250 | 250 | //add_action( 'shutdown', array( $this, 'display_errors' )); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * @access public |
260 | 260 | * @return boolean |
261 | 261 | */ |
262 | - public static function has_error(){ |
|
262 | + public static function has_error() { |
|
263 | 263 | return self::$_error_count ? TRUE : FALSE; |
264 | 264 | } |
265 | 265 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @access public |
271 | 271 | * @echo string |
272 | 272 | */ |
273 | - public function display_errors(){ |
|
273 | + public function display_errors() { |
|
274 | 274 | |
275 | 275 | $trace_details = ''; |
276 | 276 | |
@@ -331,18 +331,18 @@ discard block |
||
331 | 331 | </style> |
332 | 332 | <div id="ee-error-message" class="error">'; |
333 | 333 | |
334 | - if ( ! WP_DEBUG ) { |
|
334 | + if ( ! WP_DEBUG) { |
|
335 | 335 | $output .= ' |
336 | 336 | <p>'; |
337 | 337 | } |
338 | 338 | |
339 | 339 | // cycle thru errors |
340 | - foreach ( self::$_all_exceptions as $time => $ex ) { |
|
340 | + foreach (self::$_all_exceptions as $time => $ex) { |
|
341 | 341 | |
342 | 342 | // process trace info |
343 | - if ( empty( $ex['trace'] )) { |
|
343 | + if (empty($ex['trace'])) { |
|
344 | 344 | |
345 | - $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' ); |
|
345 | + $trace_details .= __('Sorry, but no trace information was available for this exception.', 'event_espresso'); |
|
346 | 346 | |
347 | 347 | } else { |
348 | 348 | |
@@ -357,50 +357,50 @@ discard block |
||
357 | 357 | <th scope="col" align="left">Method( arguments )</th> |
358 | 358 | </tr>'; |
359 | 359 | |
360 | - $last_on_stack = count( $ex['trace'] ) - 1; |
|
360 | + $last_on_stack = count($ex['trace']) - 1; |
|
361 | 361 | // reverse array so that stack is in proper chronological order |
362 | - $sorted_trace = array_reverse( $ex['trace'] ); |
|
362 | + $sorted_trace = array_reverse($ex['trace']); |
|
363 | 363 | |
364 | - foreach ( $sorted_trace as $nmbr => $trace ) { |
|
364 | + foreach ($sorted_trace as $nmbr => $trace) { |
|
365 | 365 | |
366 | - $file = isset( $trace['file'] ) ? $trace['file'] : '' ; |
|
367 | - $class = isset( $trace['class'] ) ? $trace['class'] : ''; |
|
368 | - $type = isset( $trace['type'] ) ? $trace['type'] : ''; |
|
369 | - $function = isset( $trace['function'] ) ? $trace['function'] : ''; |
|
370 | - $args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : ''; |
|
371 | - $line = isset( $trace['line'] ) ? $trace['line'] : ''; |
|
366 | + $file = isset($trace['file']) ? $trace['file'] : ''; |
|
367 | + $class = isset($trace['class']) ? $trace['class'] : ''; |
|
368 | + $type = isset($trace['type']) ? $trace['type'] : ''; |
|
369 | + $function = isset($trace['function']) ? $trace['function'] : ''; |
|
370 | + $args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : ''; |
|
371 | + $line = isset($trace['line']) ? $trace['line'] : ''; |
|
372 | 372 | $zebra = $nmbr % 2 ? ' odd' : ''; |
373 | 373 | |
374 | - if ( empty( $file ) && ! empty( $class )) { |
|
375 | - $a = new ReflectionClass( $class ); |
|
374 | + if (empty($file) && ! empty($class)) { |
|
375 | + $a = new ReflectionClass($class); |
|
376 | 376 | $file = $a->getFileName(); |
377 | - if ( empty( $line ) && ! empty( $function )) { |
|
378 | - $b = new ReflectionMethod( $class, $function ); |
|
377 | + if (empty($line) && ! empty($function)) { |
|
378 | + $b = new ReflectionMethod($class, $function); |
|
379 | 379 | $line = $b->getStartLine(); |
380 | 380 | } |
381 | 381 | } |
382 | 382 | |
383 | - if ( $nmbr == $last_on_stack ) { |
|
383 | + if ($nmbr == $last_on_stack) { |
|
384 | 384 | $file = $ex['file'] != '' ? $ex['file'] : $file; |
385 | 385 | $line = $ex['line'] != '' ? $ex['line'] : $line; |
386 | - $error_code = self::generate_error_code ( $file, $trace['function'], $line ); |
|
386 | + $error_code = self::generate_error_code($file, $trace['function'], $line); |
|
387 | 387 | } |
388 | 388 | |
389 | - $nmbr_dsply = ! empty( $nmbr ) ? $nmbr : ' '; |
|
390 | - $line_dsply = ! empty( $line ) ? $line : ' '; |
|
391 | - $file_dsply = ! empty( $file ) ? $file : ' '; |
|
392 | - $class_dsply = ! empty( $class ) ? $class : ' '; |
|
393 | - $type_dsply = ! empty( $type ) ? $type : ' '; |
|
394 | - $function_dsply = ! empty( $function ) ? $function : ' '; |
|
395 | - $args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : ''; |
|
389 | + $nmbr_dsply = ! empty($nmbr) ? $nmbr : ' '; |
|
390 | + $line_dsply = ! empty($line) ? $line : ' '; |
|
391 | + $file_dsply = ! empty($file) ? $file : ' '; |
|
392 | + $class_dsply = ! empty($class) ? $class : ' '; |
|
393 | + $type_dsply = ! empty($type) ? $type : ' '; |
|
394 | + $function_dsply = ! empty($function) ? $function : ' '; |
|
395 | + $args_dsply = ! empty($args) ? '( '.$args.' )' : ''; |
|
396 | 396 | |
397 | 397 | $trace_details .= ' |
398 | 398 | <tr> |
399 | - <td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td> |
|
400 | - <td align="right" class="' . $zebra . '">' . $line_dsply . '</td> |
|
401 | - <td align="left" class="' . $zebra . '">' . $file_dsply . '</td> |
|
402 | - <td align="left" class="' . $zebra . '">' . $class_dsply . '</td> |
|
403 | - <td align="left" class="' . $zebra . '">' . $type_dsply . $function_dsply . $args_dsply . '</td> |
|
399 | + <td align="right" class="' . $zebra.'">'.$nmbr_dsply.'</td> |
|
400 | + <td align="right" class="' . $zebra.'">'.$line_dsply.'</td> |
|
401 | + <td align="left" class="' . $zebra.'">'.$file_dsply.'</td> |
|
402 | + <td align="left" class="' . $zebra.'">'.$class_dsply.'</td> |
|
403 | + <td align="left" class="' . $zebra.'">'.$type_dsply.$function_dsply.$args_dsply.'</td> |
|
404 | 404 | </tr>'; |
405 | 405 | |
406 | 406 | |
@@ -415,9 +415,9 @@ discard block |
||
415 | 415 | $ex['code'] = $ex['code'] ? $ex['code'] : $error_code; |
416 | 416 | |
417 | 417 | // add generic non-identifying messages for non-privileged uesrs |
418 | - if ( ! WP_DEBUG ) { |
|
418 | + if ( ! WP_DEBUG) { |
|
419 | 419 | |
420 | - $output .= '<span class="ee-error-user-msg-spn">' . trim( $ex['msg'] ) . '</span> <sup>' . $ex['code'] . '</sup><br />'; |
|
420 | + $output .= '<span class="ee-error-user-msg-spn">'.trim($ex['msg']).'</span> <sup>'.$ex['code'].'</sup><br />'; |
|
421 | 421 | |
422 | 422 | } else { |
423 | 423 | |
@@ -425,24 +425,24 @@ discard block |
||
425 | 425 | $output .= ' |
426 | 426 | <div class="ee-error-dev-msg-dv"> |
427 | 427 | <p class="ee-error-dev-msg-pg"> |
428 | - <strong class="ee-error-dev-msg-str">An ' . $ex['name'] . ' exception was thrown!</strong> <span>code: ' . $ex['code'] . '</span><br /> |
|
429 | - <span class="big-text">"' . trim( $ex['msg'] ) . '"</span><br/> |
|
430 | - <a id="display-ee-error-trace-' . self::$_error_count . $time . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-' . self::$_error_count . $time . '"> |
|
431 | - ' . __( 'click to view backtrace and class/method details', 'event_espresso' ) . ' |
|
428 | + <strong class="ee-error-dev-msg-str">An ' . $ex['name'].' exception was thrown!</strong> <span>code: '.$ex['code'].'</span><br /> |
|
429 | + <span class="big-text">"' . trim($ex['msg']).'"</span><br/> |
|
430 | + <a id="display-ee-error-trace-' . self::$_error_count.$time.'" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-'.self::$_error_count.$time.'"> |
|
431 | + ' . __('click to view backtrace and class/method details', 'event_espresso').' |
|
432 | 432 | </a><br /> |
433 | 433 | <span class="small-text lt-grey-text">'.$ex['file'].' ( line no: '.$ex['line'].' )</span> |
434 | 434 | </p> |
435 | - <div id="ee-error-trace-' . self::$_error_count . $time . '-dv" class="ee-error-trace-dv" style="display: none;"> |
|
435 | + <div id="ee-error-trace-' . self::$_error_count.$time.'-dv" class="ee-error-trace-dv" style="display: none;"> |
|
436 | 436 | ' . $trace_details; |
437 | 437 | |
438 | - if ( ! empty( $class )) { |
|
438 | + if ( ! empty($class)) { |
|
439 | 439 | $output .= ' |
440 | 440 | <div style="padding:3px; margin:0 0 1em; border:1px solid #666; background:#fff; border-radius:3px;"> |
441 | 441 | <div style="padding:1em 2em; border:1px solid #666; background:#f9f9f9;"> |
442 | 442 | <h3>Class Details</h3>'; |
443 | - $a = new ReflectionClass( $class ); |
|
443 | + $a = new ReflectionClass($class); |
|
444 | 444 | $output .= ' |
445 | - <pre>' . $a . '</pre> |
|
445 | + <pre>' . $a.'</pre> |
|
446 | 446 | </div> |
447 | 447 | </div>'; |
448 | 448 | } |
@@ -454,14 +454,14 @@ discard block |
||
454 | 454 | |
455 | 455 | } |
456 | 456 | |
457 | - $this->write_to_error_log( $time, $ex ); |
|
457 | + $this->write_to_error_log($time, $ex); |
|
458 | 458 | |
459 | 459 | } |
460 | 460 | |
461 | 461 | // remove last linebreak |
462 | - $output = substr( $output, 0, ( count( $output ) - 7 )); |
|
462 | + $output = substr($output, 0, (count($output) - 7)); |
|
463 | 463 | |
464 | - if ( ! WP_DEBUG ) { |
|
464 | + if ( ! WP_DEBUG) { |
|
465 | 465 | $output .= ' |
466 | 466 | </p>'; |
467 | 467 | } |
@@ -469,10 +469,10 @@ discard block |
||
469 | 469 | $output .= ' |
470 | 470 | </div>'; |
471 | 471 | |
472 | - $output .= self::_print_scripts( TRUE ); |
|
472 | + $output .= self::_print_scripts(TRUE); |
|
473 | 473 | |
474 | - if ( defined( 'DOING_AJAX' )) { |
|
475 | - echo json_encode( array( 'error' => $output )); |
|
474 | + if (defined('DOING_AJAX')) { |
|
475 | + echo json_encode(array('error' => $output)); |
|
476 | 476 | exit(); |
477 | 477 | } |
478 | 478 | |
@@ -492,29 +492,29 @@ discard block |
||
492 | 492 | * @ param array $arguments |
493 | 493 | * @ return string |
494 | 494 | */ |
495 | - private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) { |
|
495 | + private function _convert_args_to_string($arguments = array(), $array = FALSE) { |
|
496 | 496 | |
497 | 497 | $arg_string = ''; |
498 | - if ( ! empty( $arguments )) { |
|
498 | + if ( ! empty($arguments)) { |
|
499 | 499 | |
500 | 500 | $args = array(); |
501 | 501 | |
502 | - foreach ( $arguments as $arg ) { |
|
502 | + foreach ($arguments as $arg) { |
|
503 | 503 | |
504 | - if ( ! empty( $arg )) { |
|
504 | + if ( ! empty($arg)) { |
|
505 | 505 | |
506 | - if ( is_string( $arg )) { |
|
507 | - $args[] = " '" . $arg . "'"; |
|
508 | - } elseif ( is_array( $arg )) { |
|
509 | - $args[] = 'ARRAY(' . $this->_convert_args_to_string( $arg, TRUE ); |
|
510 | - } elseif ( is_null( $arg )) { |
|
506 | + if (is_string($arg)) { |
|
507 | + $args[] = " '".$arg."'"; |
|
508 | + } elseif (is_array($arg)) { |
|
509 | + $args[] = 'ARRAY('.$this->_convert_args_to_string($arg, TRUE); |
|
510 | + } elseif (is_null($arg)) { |
|
511 | 511 | $args[] = ' NULL'; |
512 | - } elseif ( is_bool( $arg )) { |
|
513 | - $args[] = ( $arg ) ? ' TRUE' : ' FALSE'; |
|
514 | - } elseif ( is_object( $arg )) { |
|
515 | - $args[] = ' OBJECT ' . get_class( $arg ); |
|
516 | - } elseif ( is_resource( $arg )) { |
|
517 | - $args[] = get_resource_type( $arg ); |
|
512 | + } elseif (is_bool($arg)) { |
|
513 | + $args[] = ($arg) ? ' TRUE' : ' FALSE'; |
|
514 | + } elseif (is_object($arg)) { |
|
515 | + $args[] = ' OBJECT '.get_class($arg); |
|
516 | + } elseif (is_resource($arg)) { |
|
517 | + $args[] = get_resource_type($arg); |
|
518 | 518 | } else { |
519 | 519 | $args[] = $arg; |
520 | 520 | } |
@@ -522,9 +522,9 @@ discard block |
||
522 | 522 | } |
523 | 523 | |
524 | 524 | } |
525 | - $arg_string = implode( ', ', $args ); |
|
525 | + $arg_string = implode(', ', $args); |
|
526 | 526 | } |
527 | - if ( $array ) { |
|
527 | + if ($array) { |
|
528 | 528 | $arg_string .= ' )'; |
529 | 529 | } |
530 | 530 | return $arg_string; |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | * @param string $line the line number where the error occurred - just use __LINE__ |
545 | 545 | * @return void |
546 | 546 | */ |
547 | - public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
548 | - self::_add_notice ( 'errors', $msg, $file, $func, $line ); |
|
547 | + public static function add_error($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
548 | + self::_add_notice('errors', $msg, $file, $func, $line); |
|
549 | 549 | self::$_error_count++; |
550 | 550 | } |
551 | 551 | |
@@ -558,11 +558,11 @@ discard block |
||
558 | 558 | * @param string $line |
559 | 559 | * @throws EE_Error |
560 | 560 | */ |
561 | - public static function throw_exception_if_debugging( $msg = null, $file = null, $func = null, $line = null ) { |
|
562 | - if( WP_DEBUG ) { |
|
563 | - throw new EE_Error( $msg ); |
|
564 | - } else { |
|
565 | - EE_Error::add_error( $msg, $file, $func, $line ); |
|
561 | + public static function throw_exception_if_debugging($msg = null, $file = null, $func = null, $line = null) { |
|
562 | + if (WP_DEBUG) { |
|
563 | + throw new EE_Error($msg); |
|
564 | + } else { |
|
565 | + EE_Error::add_error($msg, $file, $func, $line); |
|
566 | 566 | } |
567 | 567 | } |
568 | 568 | |
@@ -580,8 +580,8 @@ discard block |
||
580 | 580 | * @param string $line the line number where the error occurred - just use __LINE__ |
581 | 581 | * @return void |
582 | 582 | */ |
583 | - public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
584 | - self::_add_notice ( 'success', $msg, $file, $func, $line ); |
|
583 | + public static function add_success($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
584 | + self::_add_notice('success', $msg, $file, $func, $line); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | |
@@ -598,8 +598,8 @@ discard block |
||
598 | 598 | * @param string $line the line number where the error occurred - just use __LINE__ |
599 | 599 | * @return void |
600 | 600 | */ |
601 | - public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
602 | - self::_add_notice ( 'attention', $msg, $file, $func, $line ); |
|
601 | + public static function add_attention($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
602 | + self::_add_notice('attention', $msg, $file, $func, $line); |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | |
@@ -617,12 +617,12 @@ discard block |
||
617 | 617 | * @param string $line the line number where the error occurred - just use __LINE__ |
618 | 618 | * @return void |
619 | 619 | */ |
620 | - private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
621 | - if ( empty( $msg )) { |
|
620 | + private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
621 | + if (empty($msg)) { |
|
622 | 622 | EE_Error::doing_it_wrong( |
623 | - 'EE_Error::add_' . $type . '()', |
|
623 | + 'EE_Error::add_'.$type.'()', |
|
624 | 624 | sprintf( |
625 | - __( 'Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso' ), |
|
625 | + __('Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso'), |
|
626 | 626 | $type, |
627 | 627 | $file, |
628 | 628 | $line |
@@ -630,32 +630,32 @@ discard block |
||
630 | 630 | EVENT_ESPRESSO_VERSION |
631 | 631 | ); |
632 | 632 | } |
633 | - if ( $type == 'errors' && ( empty( $file ) || empty( $func ) || empty( $line ))) { |
|
633 | + if ($type == 'errors' && (empty($file) || empty($func) || empty($line))) { |
|
634 | 634 | EE_Error::doing_it_wrong( |
635 | 635 | 'EE_Error::add_error()', |
636 | - __('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso' ), |
|
636 | + __('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso'), |
|
637 | 637 | EVENT_ESPRESSO_VERSION |
638 | 638 | ); |
639 | 639 | } |
640 | 640 | // get separate user and developer messages if they exist |
641 | - $msg = explode( '||', $msg ); |
|
641 | + $msg = explode('||', $msg); |
|
642 | 642 | $user_msg = $msg[0]; |
643 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
643 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
644 | 644 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
645 | 645 | // add notice if message exists |
646 | - if ( ! empty( $msg )) { |
|
646 | + if ( ! empty($msg)) { |
|
647 | 647 | // get error code |
648 | - $notice_code = EE_Error::generate_error_code( $file, $func, $line ); |
|
649 | - if ( WP_DEBUG && $type == 'errors' ) { |
|
650 | - $msg .= '<br/><span class="tiny-text">' . $notice_code . '</span>'; |
|
648 | + $notice_code = EE_Error::generate_error_code($file, $func, $line); |
|
649 | + if (WP_DEBUG && $type == 'errors') { |
|
650 | + $msg .= '<br/><span class="tiny-text">'.$notice_code.'</span>'; |
|
651 | 651 | } |
652 | 652 | // add notice. Index by code if it's not blank |
653 | - if( $notice_code ) { |
|
654 | - self::$_espresso_notices[ $type ][ $notice_code ] = $msg; |
|
653 | + if ($notice_code) { |
|
654 | + self::$_espresso_notices[$type][$notice_code] = $msg; |
|
655 | 655 | } else { |
656 | - self::$_espresso_notices[ $type ][] = $msg; |
|
656 | + self::$_espresso_notices[$type][] = $msg; |
|
657 | 657 | } |
658 | - add_action( 'wp_footer', array( 'EE_Error', 'enqueue_error_scripts' ), 1 ); |
|
658 | + add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1); |
|
659 | 659 | } |
660 | 660 | |
661 | 661 | } |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | * @access private |
710 | 710 | * @return void |
711 | 711 | */ |
712 | - public static function reset_notices(){ |
|
712 | + public static function reset_notices() { |
|
713 | 713 | self::$_espresso_notices['success'] = FALSE; |
714 | 714 | self::$_espresso_notices['attention'] = FALSE; |
715 | 715 | self::$_espresso_notices['errors'] = FALSE; |
@@ -722,14 +722,14 @@ discard block |
||
722 | 722 | * @access public |
723 | 723 | * @return int |
724 | 724 | */ |
725 | - public static function has_notices(){ |
|
725 | + public static function has_notices() { |
|
726 | 726 | $has_notices = 0; |
727 | 727 | // check for success messages |
728 | - $has_notices = self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] ) ? 3 : $has_notices; |
|
728 | + $has_notices = self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success']) ? 3 : $has_notices; |
|
729 | 729 | // check for attention messages |
730 | - $has_notices = self::$_espresso_notices['attention'] && ! empty( self::$_espresso_notices['attention'] ) ? 2 : $has_notices; |
|
730 | + $has_notices = self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention']) ? 2 : $has_notices; |
|
731 | 731 | // check for error messages |
732 | - $has_notices = self::$_espresso_notices['errors'] && ! empty( self::$_espresso_notices['errors'] ) ? 1 : $has_notices; |
|
732 | + $has_notices = self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors']) ? 1 : $has_notices; |
|
733 | 733 | return $has_notices; |
734 | 734 | } |
735 | 735 | |
@@ -744,9 +744,9 @@ discard block |
||
744 | 744 | */ |
745 | 745 | public static function get_vanilla_notices() { |
746 | 746 | return array( |
747 | - 'success' => isset( self::$_espresso_notices['success'] ) ? self::$_espresso_notices['success'] : array(), |
|
748 | - 'attention' => isset( self::$_espresso_notices['attention'] ) ? self::$_espresso_notices['attention'] : array(), |
|
749 | - 'errors' => isset( self::$_espresso_notices['errors'] ) ? self::$_espresso_notices['errors'] : array(), |
|
747 | + 'success' => isset(self::$_espresso_notices['success']) ? self::$_espresso_notices['success'] : array(), |
|
748 | + 'attention' => isset(self::$_espresso_notices['attention']) ? self::$_espresso_notices['attention'] : array(), |
|
749 | + 'errors' => isset(self::$_espresso_notices['errors']) ? self::$_espresso_notices['errors'] : array(), |
|
750 | 750 | ); |
751 | 751 | } |
752 | 752 | |
@@ -762,8 +762,8 @@ discard block |
||
762 | 762 | * @param boolean $remove_empty whether or not to unset empty messages |
763 | 763 | * @return array |
764 | 764 | */ |
765 | - public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) { |
|
766 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
765 | + public static function get_notices($format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE) { |
|
766 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
767 | 767 | |
768 | 768 | $success_messages = ''; |
769 | 769 | $attention_messages = ''; |
@@ -773,44 +773,44 @@ discard block |
||
773 | 773 | // EEH_Debug_Tools::printr( self::$_espresso_notices, 'espresso_notices <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
774 | 774 | |
775 | 775 | // either save notices to the db |
776 | - if ( $save_to_transient ) { |
|
777 | - update_option( 'ee_notices', self::$_espresso_notices ); |
|
776 | + if ($save_to_transient) { |
|
777 | + update_option('ee_notices', self::$_espresso_notices); |
|
778 | 778 | return; |
779 | 779 | } |
780 | 780 | // grab any notices that have been previously saved |
781 | - if ( $notices = get_option( 'ee_notices', FALSE )) { |
|
782 | - foreach ( $notices as $type => $notice ) { |
|
783 | - if ( is_array( $notice ) && ! empty( $notice )) { |
|
781 | + if ($notices = get_option('ee_notices', FALSE)) { |
|
782 | + foreach ($notices as $type => $notice) { |
|
783 | + if (is_array($notice) && ! empty($notice)) { |
|
784 | 784 | // make sure that existsing notice type is an array |
785 | - self::$_espresso_notices[ $type ] = is_array( self::$_espresso_notices[ $type ] ) && ! empty( self::$_espresso_notices[ $type ] ) ? self::$_espresso_notices[ $type ] : array(); |
|
785 | + self::$_espresso_notices[$type] = is_array(self::$_espresso_notices[$type]) && ! empty(self::$_espresso_notices[$type]) ? self::$_espresso_notices[$type] : array(); |
|
786 | 786 | // merge stored notices with any newly created ones |
787 | - self::$_espresso_notices[ $type ] = array_merge( self::$_espresso_notices[ $type ], $notice ); |
|
787 | + self::$_espresso_notices[$type] = array_merge(self::$_espresso_notices[$type], $notice); |
|
788 | 788 | $print_scripts = TRUE; |
789 | 789 | } |
790 | 790 | } |
791 | 791 | // now clear any stored notices |
792 | - update_option( 'ee_notices', FALSE ); |
|
792 | + update_option('ee_notices', FALSE); |
|
793 | 793 | } |
794 | 794 | |
795 | 795 | // check for success messages |
796 | - if ( self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] )) { |
|
796 | + if (self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success'])) { |
|
797 | 797 | // combine messages |
798 | - $success_messages .= implode( self::$_espresso_notices['success'], '<br />' ); |
|
798 | + $success_messages .= implode(self::$_espresso_notices['success'], '<br />'); |
|
799 | 799 | $print_scripts = TRUE; |
800 | 800 | } |
801 | 801 | |
802 | 802 | // check for attention messages |
803 | - if ( self::$_espresso_notices['attention'] && ! empty( self::$_espresso_notices['attention'] ) ) { |
|
803 | + if (self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention'])) { |
|
804 | 804 | // combine messages |
805 | - $attention_messages .= implode( self::$_espresso_notices['attention'], '<br />' ); |
|
805 | + $attention_messages .= implode(self::$_espresso_notices['attention'], '<br />'); |
|
806 | 806 | $print_scripts = TRUE; |
807 | 807 | } |
808 | 808 | |
809 | 809 | // check for error messages |
810 | - if ( self::$_espresso_notices['errors'] && ! empty( self::$_espresso_notices['errors'] ) ) { |
|
811 | - $error_messages .= count( self::$_espresso_notices['errors'] ) > 1 ? __( 'The following errors have occurred:<br />', 'event_espresso' ) : __( 'An error has occurred:<br />', 'event_espresso' ); |
|
810 | + if (self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors'])) { |
|
811 | + $error_messages .= count(self::$_espresso_notices['errors']) > 1 ? __('The following errors have occurred:<br />', 'event_espresso') : __('An error has occurred:<br />', 'event_espresso'); |
|
812 | 812 | // combine messages |
813 | - $error_messages .= implode( self::$_espresso_notices['errors'], '<br />' ); |
|
813 | + $error_messages .= implode(self::$_espresso_notices['errors'], '<br />'); |
|
814 | 814 | $print_scripts = TRUE; |
815 | 815 | } |
816 | 816 | |
@@ -824,21 +824,21 @@ discard block |
||
824 | 824 | $css_id = is_admin() ? 'message' : 'espresso-notices-success'; |
825 | 825 | $css_class = is_admin() ? 'updated fade' : 'success fade-away'; |
826 | 826 | //showMessage( $success_messages ); |
827 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $success_messages . '</p>' . $close . '</div>'; |
|
827 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$success_messages.'</p>'.$close.'</div>'; |
|
828 | 828 | } |
829 | 829 | |
830 | 830 | if ($attention_messages != '') { |
831 | 831 | $css_id = is_admin() ? 'message' : 'espresso-notices-attention'; |
832 | 832 | $css_class = is_admin() ? 'updated ee-notices-attention' : 'attention fade-away'; |
833 | 833 | //showMessage( $error_messages, TRUE ); |
834 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $attention_messages . '</p>' . $close . '</div>'; |
|
834 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$attention_messages.'</p>'.$close.'</div>'; |
|
835 | 835 | } |
836 | 836 | |
837 | 837 | if ($error_messages != '') { |
838 | 838 | $css_id = is_admin() ? 'message' : 'espresso-notices-error'; |
839 | 839 | $css_class = is_admin() ? 'error' : 'error fade-away'; |
840 | 840 | //showMessage( $error_messages, TRUE ); |
841 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $error_messages . '</p>' . $close . '</div>'; |
|
841 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$error_messages.'</p>'.$close.'</div>'; |
|
842 | 842 | } |
843 | 843 | |
844 | 844 | $notices .= '</div>'; |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | 'errors' => $error_messages |
852 | 852 | ); |
853 | 853 | |
854 | - if ( $remove_empty ) { |
|
854 | + if ($remove_empty) { |
|
855 | 855 | // remove empty notices |
856 | 856 | foreach ($notices as $type => $notice) { |
857 | 857 | if (empty($notice)) { |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | } |
862 | 862 | } |
863 | 863 | |
864 | - if ( $print_scripts ) { |
|
864 | + if ($print_scripts) { |
|
865 | 865 | self::_print_scripts(); |
866 | 866 | } |
867 | 867 | |
@@ -881,17 +881,17 @@ discard block |
||
881 | 881 | * @param bool $force_update allows one to enforce the reappearance of a persistent message. |
882 | 882 | * @return void |
883 | 883 | */ |
884 | - public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) { |
|
885 | - if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
|
886 | - $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
|
884 | + public static function add_persistent_admin_notice($pan_name = '', $pan_message, $force_update = FALSE) { |
|
885 | + if ( ! empty($pan_name) && ! empty($pan_message)) { |
|
886 | + $persistent_admin_notices = get_option('ee_pers_admin_notices', array()); |
|
887 | 887 | //maybe initialize persistent_admin_notices |
888 | - if ( empty( $persistent_admin_notices )) { |
|
889 | - add_option( 'ee_pers_admin_notices', array(), '', 'no' ); |
|
888 | + if (empty($persistent_admin_notices)) { |
|
889 | + add_option('ee_pers_admin_notices', array(), '', 'no'); |
|
890 | 890 | } |
891 | - $pan_name = sanitize_key( $pan_name ); |
|
892 | - if ( ! array_key_exists( $pan_name, $persistent_admin_notices ) || $force_update ) { |
|
893 | - $persistent_admin_notices[ $pan_name ] = $pan_message; |
|
894 | - update_option( 'ee_pers_admin_notices', $persistent_admin_notices ); |
|
891 | + $pan_name = sanitize_key($pan_name); |
|
892 | + if ( ! array_key_exists($pan_name, $persistent_admin_notices) || $force_update) { |
|
893 | + $persistent_admin_notices[$pan_name] = $pan_message; |
|
894 | + update_option('ee_pers_admin_notices', $persistent_admin_notices); |
|
895 | 895 | } |
896 | 896 | } |
897 | 897 | } |
@@ -907,34 +907,34 @@ discard block |
||
907 | 907 | * @param bool $return_immediately |
908 | 908 | * @return void |
909 | 909 | */ |
910 | - public static function dismiss_persistent_admin_notice( $pan_name = '', $purge = FALSE, $return_immediately = FALSE ) { |
|
911 | - $pan_name = EE_Registry::instance()->REQ->is_set( 'ee_nag_notice' ) ? EE_Registry::instance()->REQ->get( 'ee_nag_notice' ) : $pan_name; |
|
912 | - if ( ! empty( $pan_name )) { |
|
913 | - $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
|
910 | + public static function dismiss_persistent_admin_notice($pan_name = '', $purge = FALSE, $return_immediately = FALSE) { |
|
911 | + $pan_name = EE_Registry::instance()->REQ->is_set('ee_nag_notice') ? EE_Registry::instance()->REQ->get('ee_nag_notice') : $pan_name; |
|
912 | + if ( ! empty($pan_name)) { |
|
913 | + $persistent_admin_notices = get_option('ee_pers_admin_notices', array()); |
|
914 | 914 | // check if notice we wish to dismiss is actually in the $persistent_admin_notices array |
915 | - if ( is_array( $persistent_admin_notices ) && isset( $persistent_admin_notices[ $pan_name ] )) { |
|
915 | + if (is_array($persistent_admin_notices) && isset($persistent_admin_notices[$pan_name])) { |
|
916 | 916 | // completely delete nag notice, or just NULL message so that it can NOT be added again ? |
917 | - if ( $purge ) { |
|
918 | - unset( $persistent_admin_notices[ $pan_name ] ); |
|
917 | + if ($purge) { |
|
918 | + unset($persistent_admin_notices[$pan_name]); |
|
919 | 919 | } else { |
920 | - $persistent_admin_notices[ $pan_name ] = NULL; |
|
920 | + $persistent_admin_notices[$pan_name] = NULL; |
|
921 | 921 | } |
922 | - if ( update_option( 'ee_pers_admin_notices', $persistent_admin_notices ) === FALSE ) { |
|
923 | - EE_Error::add_error( sprintf( __( 'The persistent admin notice for "%s" could not be deleted.', 'event_espresso' ), $pan_name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
922 | + if (update_option('ee_pers_admin_notices', $persistent_admin_notices) === FALSE) { |
|
923 | + EE_Error::add_error(sprintf(__('The persistent admin notice for "%s" could not be deleted.', 'event_espresso'), $pan_name), __FILE__, __FUNCTION__, __LINE__); |
|
924 | 924 | } |
925 | 925 | } |
926 | 926 | } |
927 | - if ( $return_immediately ) { |
|
927 | + if ($return_immediately) { |
|
928 | 928 | return; |
929 | - } else if ( EE_Registry::instance()->REQ->ajax ) { |
|
929 | + } else if (EE_Registry::instance()->REQ->ajax) { |
|
930 | 930 | // grab any notices and concatenate into string |
931 | - echo json_encode( array( 'errors' => implode( '<br />', EE_Error::get_notices( FALSE )))); |
|
931 | + echo json_encode(array('errors' => implode('<br />', EE_Error::get_notices(FALSE)))); |
|
932 | 932 | exit(); |
933 | 933 | } else { |
934 | 934 | // save errors to a transient to be displayed on next request (after redirect) |
935 | - EE_Error::get_notices( FALSE, TRUE ); |
|
936 | - $return_url = EE_Registry::instance()->REQ->is_set( 'return_url' ) ? EE_Registry::instance()->REQ->get( 'return_url' ) : ''; |
|
937 | - wp_safe_redirect( urldecode( $return_url )); |
|
935 | + EE_Error::get_notices(FALSE, TRUE); |
|
936 | + $return_url = EE_Registry::instance()->REQ->is_set('return_url') ? EE_Registry::instance()->REQ->get('return_url') : ''; |
|
937 | + wp_safe_redirect(urldecode($return_url)); |
|
938 | 938 | } |
939 | 939 | } |
940 | 940 | |
@@ -949,20 +949,20 @@ discard block |
||
949 | 949 | * @param string $return_url URL to go back to aftger nag notice is dismissed |
950 | 950 | * @return string |
951 | 951 | */ |
952 | - public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) { |
|
953 | - if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
|
952 | + public static function display_persistent_admin_notices($pan_name = '', $pan_message = '', $return_url = '') { |
|
953 | + if ( ! empty($pan_name) && ! empty($pan_message)) { |
|
954 | 954 | $args = array( |
955 | 955 | 'nag_notice' => $pan_name, |
956 | - 'return_url' => urlencode( $return_url ), |
|
956 | + 'return_url' => urlencode($return_url), |
|
957 | 957 | 'ajax_url' => WP_AJAX_URL, |
958 | - 'unknown_error' => __( 'An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso' ) |
|
958 | + 'unknown_error' => __('An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso') |
|
959 | 959 | ); |
960 | - wp_localize_script( 'espresso_core', 'ee_dismiss', $args ); |
|
960 | + wp_localize_script('espresso_core', 'ee_dismiss', $args); |
|
961 | 961 | return ' |
962 | - <div id="' . $pan_name . '" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;"> |
|
963 | - <p>' . $pan_message . '</p> |
|
964 | - <a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name . '"> |
|
965 | - <span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__( 'Dismiss', 'event_espresso' ) .' |
|
962 | + <div id="' . $pan_name.'" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;"> |
|
963 | + <p>' . $pan_message.'</p> |
|
964 | + <a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name.'"> |
|
965 | + <span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__('Dismiss', 'event_espresso').' |
|
966 | 966 | </a> |
967 | 967 | <div style="clear:both;"></div> |
968 | 968 | </div>'; |
@@ -978,24 +978,24 @@ discard block |
||
978 | 978 | * @param string $return_url |
979 | 979 | * @return array |
980 | 980 | */ |
981 | - public static function get_persistent_admin_notices( $return_url = '' ) { |
|
981 | + public static function get_persistent_admin_notices($return_url = '') { |
|
982 | 982 | $notices = ''; |
983 | 983 | // check for persistent admin notices |
984 | 984 | //filter the list though so plugins can notify the admin in a different way if they want |
985 | 985 | $persistent_admin_notices = apply_filters( |
986 | 986 | 'FHEE__EE_Error__get_persistent_admin_notices', |
987 | - get_option( 'ee_pers_admin_notices', FALSE ), |
|
987 | + get_option('ee_pers_admin_notices', FALSE), |
|
988 | 988 | 'ee_pers_admin_notices', |
989 | 989 | $return_url |
990 | 990 | ); |
991 | - if ( $persistent_admin_notices ) { |
|
991 | + if ($persistent_admin_notices) { |
|
992 | 992 | // load scripts |
993 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
994 | - wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
995 | - wp_enqueue_script( 'ee_error_js' ); |
|
993 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
994 | + wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
995 | + wp_enqueue_script('ee_error_js'); |
|
996 | 996 | // and display notices |
997 | - foreach( $persistent_admin_notices as $pan_name => $pan_message ) { |
|
998 | - $notices .= self::display_persistent_admin_notices( $pan_name, $pan_message, $return_url ); |
|
997 | + foreach ($persistent_admin_notices as $pan_name => $pan_message) { |
|
998 | + $notices .= self::display_persistent_admin_notices($pan_name, $pan_message, $return_url); |
|
999 | 999 | } |
1000 | 1000 | } |
1001 | 1001 | return $notices; |
@@ -1010,26 +1010,26 @@ discard block |
||
1010 | 1010 | * @param bool $force_print |
1011 | 1011 | * @return void |
1012 | 1012 | */ |
1013 | - private static function _print_scripts( $force_print = FALSE ) { |
|
1014 | - if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) { |
|
1015 | - if ( wp_script_is( 'ee_error_js', 'enqueued' )) { |
|
1013 | + private static function _print_scripts($force_print = FALSE) { |
|
1014 | + if ((did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts')) && ! $force_print) { |
|
1015 | + if (wp_script_is('ee_error_js', 'enqueued')) { |
|
1016 | 1016 | return; |
1017 | - } else if ( wp_script_is( 'ee_error_js', 'registered' )) { |
|
1018 | - add_filter( 'FHEE_load_css', '__return_true' ); |
|
1019 | - add_filter( 'FHEE_load_js', '__return_true' ); |
|
1020 | - wp_enqueue_script( 'ee_error_js' ); |
|
1021 | - wp_localize_script( 'ee_error_js','ee_settings', array( 'wp_debug'=>WP_DEBUG )); |
|
1017 | + } else if (wp_script_is('ee_error_js', 'registered')) { |
|
1018 | + add_filter('FHEE_load_css', '__return_true'); |
|
1019 | + add_filter('FHEE_load_js', '__return_true'); |
|
1020 | + wp_enqueue_script('ee_error_js'); |
|
1021 | + wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug'=>WP_DEBUG)); |
|
1022 | 1022 | } |
1023 | 1023 | } else { |
1024 | 1024 | return ' |
1025 | 1025 | <script> |
1026 | 1026 | /* <![CDATA[ */ |
1027 | -var ee_settings = {"wp_debug":"' . WP_DEBUG . '"}; |
|
1027 | +var ee_settings = {"wp_debug":"' . WP_DEBUG.'"}; |
|
1028 | 1028 | /* ]]> */ |
1029 | 1029 | </script> |
1030 | -<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script> |
|
1031 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
1032 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
1030 | +<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script> |
|
1031 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
1032 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
1033 | 1033 | '; |
1034 | 1034 | |
1035 | 1035 | } |
@@ -1063,11 +1063,11 @@ discard block |
||
1063 | 1063 | * @ param string $line |
1064 | 1064 | * @ return string |
1065 | 1065 | */ |
1066 | - public static function generate_error_code ( $file = '', $func = '', $line = '' ) { |
|
1067 | - $file = explode( '.', basename( $file )); |
|
1068 | - $error_code = ! empty( $file[0] ) ? $file[0] : ''; |
|
1069 | - $error_code .= ! empty( $func ) ? ' - ' . $func : ''; |
|
1070 | - $error_code .= ! empty( $line ) ? ' - ' . $line : ''; |
|
1066 | + public static function generate_error_code($file = '', $func = '', $line = '') { |
|
1067 | + $file = explode('.', basename($file)); |
|
1068 | + $error_code = ! empty($file[0]) ? $file[0] : ''; |
|
1069 | + $error_code .= ! empty($func) ? ' - '.$func : ''; |
|
1070 | + $error_code .= ! empty($line) ? ' - '.$line : ''; |
|
1071 | 1071 | return $error_code; |
1072 | 1072 | } |
1073 | 1073 | |
@@ -1083,36 +1083,36 @@ discard block |
||
1083 | 1083 | * @ param object $ex |
1084 | 1084 | * @ return void |
1085 | 1085 | */ |
1086 | - public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) { |
|
1086 | + public function write_to_error_log($time = FALSE, $ex = FALSE, $clear = FALSE) { |
|
1087 | 1087 | |
1088 | - if ( ! $ex ) { |
|
1088 | + if ( ! $ex) { |
|
1089 | 1089 | return; |
1090 | 1090 | } |
1091 | 1091 | |
1092 | - if ( ! $time ) { |
|
1092 | + if ( ! $time) { |
|
1093 | 1093 | $time = time(); |
1094 | 1094 | } |
1095 | 1095 | |
1096 | - $exception_log = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
1097 | - $exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . '] Exception Details' . PHP_EOL; |
|
1098 | - $exception_log .= 'Message: ' . $ex['msg'] . PHP_EOL; |
|
1099 | - $exception_log .= 'Code: '. $ex['code'] . PHP_EOL; |
|
1100 | - $exception_log .= 'File: '. $ex['file'] . PHP_EOL; |
|
1101 | - $exception_log .= 'Line No: ' . $ex['line'] . PHP_EOL; |
|
1102 | - $exception_log .= 'Stack trace: ' . PHP_EOL; |
|
1103 | - $exception_log .= $ex['string'] . PHP_EOL; |
|
1104 | - $exception_log .= '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
1096 | + $exception_log = '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
1097 | + $exception_log .= '['.date('Y-m-d H:i:s', $time).'] Exception Details'.PHP_EOL; |
|
1098 | + $exception_log .= 'Message: '.$ex['msg'].PHP_EOL; |
|
1099 | + $exception_log .= 'Code: '.$ex['code'].PHP_EOL; |
|
1100 | + $exception_log .= 'File: '.$ex['file'].PHP_EOL; |
|
1101 | + $exception_log .= 'Line No: '.$ex['line'].PHP_EOL; |
|
1102 | + $exception_log .= 'Stack trace: '.PHP_EOL; |
|
1103 | + $exception_log .= $ex['string'].PHP_EOL; |
|
1104 | + $exception_log .= '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
1105 | 1105 | |
1106 | 1106 | try { |
1107 | - EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ); |
|
1108 | - EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' ); |
|
1109 | - if ( ! $clear ) { |
|
1107 | + EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file); |
|
1108 | + EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs'); |
|
1109 | + if ( ! $clear) { |
|
1110 | 1110 | //get existing log file and append new log info |
1111 | - $exception_log = EEH_File::get_file_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ) . $exception_log; |
|
1111 | + $exception_log = EEH_File::get_file_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file).$exception_log; |
|
1112 | 1112 | } |
1113 | - EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file, $exception_log ); |
|
1114 | - } catch( EE_Error $e ){ |
|
1115 | - EE_Error::add_error( sprintf( __( 'Event Espresso error logging could not be setup because: %s', 'event_espresso' ), $e->getMessage() )); |
|
1113 | + EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file, $exception_log); |
|
1114 | + } catch (EE_Error $e) { |
|
1115 | + EE_Error::add_error(sprintf(__('Event Espresso error logging could not be setup because: %s', 'event_espresso'), $e->getMessage())); |
|
1116 | 1116 | return; |
1117 | 1117 | } |
1118 | 1118 | |
@@ -1136,9 +1136,9 @@ discard block |
||
1136 | 1136 | * @param int $error_type |
1137 | 1137 | * @return void |
1138 | 1138 | */ |
1139 | - public static function doing_it_wrong( $function, $message, $version, $error_type = E_USER_NOTICE ) { |
|
1140 | - if ( defined('WP_DEBUG') && WP_DEBUG ) { |
|
1141 | - EEH_Debug_Tools::instance()->doing_it_wrong( $function, $message, $version, $error_type ); |
|
1139 | + public static function doing_it_wrong($function, $message, $version, $error_type = E_USER_NOTICE) { |
|
1140 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
1141 | + EEH_Debug_Tools::instance()->doing_it_wrong($function, $message, $version, $error_type); |
|
1142 | 1142 | } |
1143 | 1143 | } |
1144 | 1144 | |
@@ -1170,13 +1170,13 @@ discard block |
||
1170 | 1170 | */ |
1171 | 1171 | function espresso_error_enqueue_scripts() { |
1172 | 1172 | // js for error handling |
1173 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE ); |
|
1174 | - wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE ); |
|
1173 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE); |
|
1174 | + wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE); |
|
1175 | 1175 | } |
1176 | -if ( is_admin() ) { |
|
1177 | - add_action( 'admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 ); |
|
1176 | +if (is_admin()) { |
|
1177 | + add_action('admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2); |
|
1178 | 1178 | } else { |
1179 | - add_action( 'wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 ); |
|
1179 | + add_action('wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2); |
|
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * before the hook wp_enqueue_scripts is called (so that the form section can enqueue its needed scripts). |
8 | 8 | * However, you may output the form (usually by calling get_html_and_js) anywhere you like. |
9 | 9 | */ |
10 | -class EE_Form_Section_Proper extends EE_Form_Section_Validatable{ |
|
10 | +class EE_Form_Section_Proper extends EE_Form_Section_Validatable { |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Subsections |
@@ -68,40 +68,40 @@ discard block |
||
68 | 68 | * } @see EE_Form_Section_Validatable::__construct() |
69 | 69 | * |
70 | 70 | */ |
71 | - public function __construct( $options_array = array() ){ |
|
72 | - $options_array = apply_filters( 'FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this ); |
|
71 | + public function __construct($options_array = array()) { |
|
72 | + $options_array = apply_filters('FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this); |
|
73 | 73 | //call parent first, as it may be setting the name |
74 | 74 | parent::__construct($options_array); |
75 | 75 | //if they've included subsections in the constructor, add them now |
76 | - if( isset( $options_array['include'] )){ |
|
76 | + if (isset($options_array['include'])) { |
|
77 | 77 | //we are going to make sure we ONLY have those subsections to include |
78 | 78 | //AND we are going to make sure they're in that specified order |
79 | 79 | $reordered_subsections = array(); |
80 | - foreach($options_array['include'] as $input_name){ |
|
81 | - if(isset($this->_subsections[$input_name])){ |
|
80 | + foreach ($options_array['include'] as $input_name) { |
|
81 | + if (isset($this->_subsections[$input_name])) { |
|
82 | 82 | $reordered_subsections[$input_name] = $this->_subsections[$input_name]; |
83 | 83 | } |
84 | 84 | } |
85 | 85 | $this->_subsections = $reordered_subsections; |
86 | 86 | } |
87 | - if(isset($options_array['exclude'])){ |
|
87 | + if (isset($options_array['exclude'])) { |
|
88 | 88 | $exclude = $options_array['exclude']; |
89 | 89 | $this->_subsections = array_diff_key($this->_subsections, array_flip($exclude)); |
90 | 90 | } |
91 | - if(isset($options_array['layout_strategy'])){ |
|
91 | + if (isset($options_array['layout_strategy'])) { |
|
92 | 92 | $this->_layout_strategy = $options_array['layout_strategy']; |
93 | 93 | } |
94 | - if( ! $this->_layout_strategy){ |
|
94 | + if ( ! $this->_layout_strategy) { |
|
95 | 95 | $this->_layout_strategy = new EE_Two_Column_Layout(); |
96 | 96 | } |
97 | 97 | $this->_layout_strategy->_construct_finalize($this); |
98 | 98 | |
99 | - add_action( 'wp_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' )); |
|
100 | - add_action( 'admin_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' )); |
|
101 | - add_action( 'wp_footer', array( $this, 'ensure_scripts_localized' ), 1 ); |
|
99 | + add_action('wp_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts')); |
|
100 | + add_action('admin_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts')); |
|
101 | + add_action('wp_footer', array($this, 'ensure_scripts_localized'), 1); |
|
102 | 102 | |
103 | - if( isset( $options_array[ 'name' ] ) ) { |
|
104 | - $this->_construct_finalize( null, $options_array[ 'name' ] ); |
|
103 | + if (isset($options_array['name'])) { |
|
104 | + $this->_construct_finalize(null, $options_array['name']); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
@@ -114,25 +114,25 @@ discard block |
||
114 | 114 | * @param string $name |
115 | 115 | * @throws \EE_Error |
116 | 116 | */ |
117 | - public function _construct_finalize( $parent_form_section, $name ) { |
|
117 | + public function _construct_finalize($parent_form_section, $name) { |
|
118 | 118 | parent::_construct_finalize($parent_form_section, $name); |
119 | 119 | $this->_set_default_name_if_empty(); |
120 | 120 | $this->_set_default_html_id_if_empty(); |
121 | - foreach( $this->_subsections as $subsection_name => $subsection ){ |
|
122 | - if ( $subsection instanceof EE_Form_Section_Base ) { |
|
123 | - $subsection->_construct_finalize( $this, $subsection_name ); |
|
121 | + foreach ($this->_subsections as $subsection_name => $subsection) { |
|
122 | + if ($subsection instanceof EE_Form_Section_Base) { |
|
123 | + $subsection->_construct_finalize($this, $subsection_name); |
|
124 | 124 | } else { |
125 | 125 | throw new EE_Error( |
126 | 126 | sprintf( |
127 | - __( 'Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso' ), |
|
127 | + __('Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso'), |
|
128 | 128 | $subsection_name, |
129 | 129 | get_class($this), |
130 | - $subsection ? get_class($subsection) : __( 'NULL', 'event_espresso' ) |
|
130 | + $subsection ? get_class($subsection) : __('NULL', 'event_espresso') |
|
131 | 131 | ) |
132 | 132 | ); |
133 | 133 | } |
134 | 134 | } |
135 | - do_action( 'AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name ); |
|
135 | + do_action('AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * Gets the layout strategy for this form section |
142 | 142 | * @return EE_Form_Section_Layout_Base |
143 | 143 | */ |
144 | - public function get_layout_strategy(){ |
|
144 | + public function get_layout_strategy() { |
|
145 | 145 | return $this->_layout_strategy; |
146 | 146 | } |
147 | 147 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @param EE_Form_Input_Base $input |
154 | 154 | * @return string |
155 | 155 | */ |
156 | - public function get_html_for_input($input){ |
|
156 | + public function get_html_for_input($input) { |
|
157 | 157 | return $this->_layout_strategy->layout_input($input); |
158 | 158 | } |
159 | 159 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @param null $form_data |
167 | 167 | * @return boolean |
168 | 168 | */ |
169 | - public function was_submitted($form_data = NULL){ |
|
169 | + public function was_submitted($form_data = NULL) { |
|
170 | 170 | return $this->form_data_present_in($form_data); |
171 | 171 | } |
172 | 172 | |
@@ -191,17 +191,17 @@ discard block |
||
191 | 191 | * (eg you validated the data then stored it in the DB) you may want to skip this step. |
192 | 192 | * @return void |
193 | 193 | */ |
194 | - public function receive_form_submission($req_data = NULL, $validate = TRUE){ |
|
195 | - $req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate ); |
|
196 | - if( $req_data === NULL){ |
|
197 | - $req_data = array_merge( $_GET, $_POST ); |
|
194 | + public function receive_form_submission($req_data = NULL, $validate = TRUE) { |
|
195 | + $req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate); |
|
196 | + if ($req_data === NULL) { |
|
197 | + $req_data = array_merge($_GET, $_POST); |
|
198 | 198 | } |
199 | - $req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', $req_data, $this ); |
|
199 | + $req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', $req_data, $this); |
|
200 | 200 | $this->_normalize($req_data); |
201 | - if( $validate ){ |
|
201 | + if ($validate) { |
|
202 | 202 | $this->_validate(); |
203 | 203 | } |
204 | - do_action( 'AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate ); |
|
204 | + do_action('AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | |
@@ -214,12 +214,12 @@ discard block |
||
214 | 214 | * the value being an array formatted in teh same way |
215 | 215 | * @param array $default_data |
216 | 216 | */ |
217 | - public function populate_defaults($default_data){ |
|
218 | - foreach($this->subsections() as $subsection_name => $subsection){ |
|
219 | - if(isset($default_data[$subsection_name])){ |
|
220 | - if($subsection instanceof EE_Form_Input_Base){ |
|
217 | + public function populate_defaults($default_data) { |
|
218 | + foreach ($this->subsections() as $subsection_name => $subsection) { |
|
219 | + if (isset($default_data[$subsection_name])) { |
|
220 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
221 | 221 | $subsection->set_default($default_data[$subsection_name]); |
222 | - }elseif($subsection instanceof EE_Form_Section_Proper){ |
|
222 | + }elseif ($subsection instanceof EE_Form_Section_Proper) { |
|
223 | 223 | $subsection->populate_defaults($default_data[$subsection_name]); |
224 | 224 | } |
225 | 225 | } |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | * (realizing that the subsections' html names might not be set yet, etc.) |
238 | 238 | * @return EE_Form_Section_Base |
239 | 239 | */ |
240 | - public function get_subsection($name, $require_construction_to_be_finalized = TRUE ){ |
|
241 | - if( $require_construction_to_be_finalized ){ |
|
240 | + public function get_subsection($name, $require_construction_to_be_finalized = TRUE) { |
|
241 | + if ($require_construction_to_be_finalized) { |
|
242 | 242 | $this->ensure_construct_finalized_called(); |
243 | 243 | } |
244 | 244 | return isset($this->_subsections[$name]) ? $this->_subsections[$name] : NULL; |
@@ -250,10 +250,10 @@ discard block |
||
250 | 250 | * Gets all the validatable subsections of this form section |
251 | 251 | * @return EE_Form_Section_Validatable[] |
252 | 252 | */ |
253 | - public function get_validatable_subsections(){ |
|
253 | + public function get_validatable_subsections() { |
|
254 | 254 | $validatable_subsections = array(); |
255 | - foreach($this->subsections() as $name=>$obj){ |
|
256 | - if($obj instanceof EE_Form_Section_Validatable){ |
|
255 | + foreach ($this->subsections() as $name=>$obj) { |
|
256 | + if ($obj instanceof EE_Form_Section_Validatable) { |
|
257 | 257 | $validatable_subsections[$name] = $obj; |
258 | 258 | } |
259 | 259 | } |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | * @return EE_Form_Input_Base |
274 | 274 | * @throws EE_Error |
275 | 275 | */ |
276 | - public function get_input($name, $require_construction_to_be_finalized = TRUE ){ |
|
276 | + public function get_input($name, $require_construction_to_be_finalized = TRUE) { |
|
277 | 277 | $subsection = $this->get_subsection($name, $require_construction_to_be_finalized); |
278 | - if( ! $subsection instanceof EE_Form_Input_Base){ |
|
279 | - throw new EE_Error(sprintf(__("Subsection '%s' is not an instanceof EE_Form_Input_Base on form '%s'. It is a '%s'", 'event_espresso'),$name, get_class($this),$subsection ? get_class($subsection) : __("NULL", 'event_espresso'))); |
|
278 | + if ( ! $subsection instanceof EE_Form_Input_Base) { |
|
279 | + throw new EE_Error(sprintf(__("Subsection '%s' is not an instanceof EE_Form_Input_Base on form '%s'. It is a '%s'", 'event_espresso'), $name, get_class($this), $subsection ? get_class($subsection) : __("NULL", 'event_espresso'))); |
|
280 | 280 | } |
281 | 281 | return $subsection; |
282 | 282 | } |
@@ -294,10 +294,10 @@ discard block |
||
294 | 294 | * @return EE_Form_Section_Proper |
295 | 295 | * @throws EE_Error |
296 | 296 | */ |
297 | - public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE ){ |
|
298 | - $subsection = $this->get_subsection( $name, $require_construction_to_be_finalized ); |
|
299 | - if( ! $subsection instanceof EE_Form_Section_Proper){ |
|
300 | - throw new EE_Error(sprintf(__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'),$name, get_class($this))); |
|
297 | + public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE) { |
|
298 | + $subsection = $this->get_subsection($name, $require_construction_to_be_finalized); |
|
299 | + if ( ! $subsection instanceof EE_Form_Section_Proper) { |
|
300 | + throw new EE_Error(sprintf(__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'), $name, get_class($this))); |
|
301 | 301 | } |
302 | 302 | return $subsection; |
303 | 303 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * @param string $name |
311 | 311 | * @return mixed depending on the input's type and its normalization strategy |
312 | 312 | */ |
313 | - public function get_input_value($name){ |
|
313 | + public function get_input_value($name) { |
|
314 | 314 | $input = $this->get_input($name); |
315 | 315 | return $input->normalized_value(); |
316 | 316 | } |
@@ -323,16 +323,16 @@ discard block |
||
323 | 323 | * @return boolean |
324 | 324 | */ |
325 | 325 | public function is_valid() { |
326 | - if( ! $this->has_received_submission()){ |
|
326 | + if ( ! $this->has_received_submission()) { |
|
327 | 327 | throw new EE_Error(sprintf(__("You cannot check if a form is valid before receiving the form submission using receive_form_submission", "event_espresso"))); |
328 | 328 | } |
329 | - if( ! parent::is_valid()){ |
|
329 | + if ( ! parent::is_valid()) { |
|
330 | 330 | return false; |
331 | 331 | } |
332 | 332 | //ok so no errors general to this entire form section. so let's check the subsections |
333 | - foreach( $this->get_validatable_subsections() as $subsection ){ |
|
334 | - if( ! $subsection->is_valid() || $subsection->get_validation_error_string() != '' ){ |
|
335 | - $this->set_submission_error_message( $subsection->get_validation_error_string() ); |
|
333 | + foreach ($this->get_validatable_subsections() as $subsection) { |
|
334 | + if ( ! $subsection->is_valid() || $subsection->get_validation_error_string() != '') { |
|
335 | + $this->set_submission_error_message($subsection->get_validation_error_string()); |
|
336 | 336 | return false; |
337 | 337 | } |
338 | 338 | } |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | * gets teh default name of this form section if none is specified |
346 | 346 | * @return string |
347 | 347 | */ |
348 | - protected function _set_default_name_if_empty(){ |
|
349 | - if( ! $this->_name ){ |
|
348 | + protected function _set_default_name_if_empty() { |
|
349 | + if ( ! $this->_name) { |
|
350 | 350 | $classname = get_class($this); |
351 | 351 | $default_name = str_replace("EE_", "", $classname); |
352 | - $this->_name = $default_name; |
|
352 | + $this->_name = $default_name; |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * Also returns the HTML for the form, except for the form opening and closing tags |
361 | 361 | * (as the form section doesn't know where you necessarily want to send the information to), and except for a submit button. |
362 | 362 | */ |
363 | - public function get_html_and_js(){ |
|
363 | + public function get_html_and_js() { |
|
364 | 364 | $this->enqueue_js(); |
365 | 365 | return $this->get_html(); |
366 | 366 | } |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | * returns HTML for displaying this form section. recursively calls display_section() on all subsections |
372 | 372 | * @return string |
373 | 373 | */ |
374 | - public function get_html(){ |
|
374 | + public function get_html() { |
|
375 | 375 | $this->ensure_construct_finalized_called(); |
376 | 376 | return $this->_layout_strategy->layout_form(); |
377 | 377 | } |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | * enqueues JS for the form |
383 | 383 | * @return string |
384 | 384 | */ |
385 | - public function enqueue_js(){ |
|
385 | + public function enqueue_js() { |
|
386 | 386 | $this->_enqueue_and_localize_form_js(); |
387 | 387 | } |
388 | 388 | |
@@ -398,10 +398,10 @@ discard block |
||
398 | 398 | * @param boolean $init_form_validation_automatically whether or not we want the form validation to be triggered automatically or not |
399 | 399 | * @return void |
400 | 400 | */ |
401 | - public static function wp_enqueue_scripts( $init_form_validation_automatically = false ){ |
|
402 | - add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
|
403 | - wp_register_script( 'ee_form_section_validation', EE_GLOBAL_ASSETS_URL . 'scripts' . DS . 'form_section_validation.js', array( 'jquery-validate', 'jquery-ui-datepicker', 'jquery-validate-extra-methods' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
404 | - wp_localize_script( 'ee_form_section_validation', 'ee_form_section_validation_init', array( 'init' => $init_form_validation_automatically ) ); |
|
401 | + public static function wp_enqueue_scripts($init_form_validation_automatically = false) { |
|
402 | + add_filter('FHEE_load_jquery_validate', '__return_true'); |
|
403 | + wp_register_script('ee_form_section_validation', EE_GLOBAL_ASSETS_URL.'scripts'.DS.'form_section_validation.js', array('jquery-validate', 'jquery-ui-datepicker', 'jquery-validate-extra-methods'), EVENT_ESPRESSO_VERSION, TRUE); |
|
404 | + wp_localize_script('ee_form_section_validation', 'ee_form_section_validation_init', array('init' => $init_form_validation_automatically)); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | |
@@ -411,14 +411,14 @@ discard block |
||
411 | 411 | * This needs to be called AFTER we've called $this->_enqueue_jquery_validate_script, |
412 | 412 | * but before the wordpress hook wp_loaded |
413 | 413 | */ |
414 | - public function _enqueue_and_localize_form_js(){ |
|
414 | + public function _enqueue_and_localize_form_js() { |
|
415 | 415 | $this->ensure_construct_finalized_called(); |
416 | 416 | //actually, we don't want to localize just yet. There may be other forms on the page. |
417 | 417 | //so we need to add our form section data to a static variable accessible by all form sections |
418 | 418 | //and localize it just before the footer |
419 | 419 | $this->localize_validation_rules(); |
420 | - add_action( 'wp_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ), 2 ); |
|
421 | - add_action( 'admin_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ) ); |
|
420 | + add_action('wp_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'), 2); |
|
421 | + add_action('admin_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms')); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | |
@@ -428,11 +428,11 @@ discard block |
||
428 | 428 | * @param bool $return_for_subsection |
429 | 429 | * @return void |
430 | 430 | */ |
431 | - public function localize_validation_rules( $return_for_subsection = FALSE ){ |
|
431 | + public function localize_validation_rules($return_for_subsection = FALSE) { |
|
432 | 432 | // we only want to localize vars ONCE for the entire form, so if the form section doesn't have a parent, then it must be the top dog |
433 | - if ( ! $this->parent_section() || $return_for_subsection ) { |
|
434 | - EE_Form_Section_Proper::$_js_localization['form_data'][ $this->html_id() ] = array( |
|
435 | - 'form_section_id'=> $this->html_id( TRUE ), |
|
433 | + if ( ! $this->parent_section() || $return_for_subsection) { |
|
434 | + EE_Form_Section_Proper::$_js_localization['form_data'][$this->html_id()] = array( |
|
435 | + 'form_section_id'=> $this->html_id(TRUE), |
|
436 | 436 | 'validation_rules'=> $this->get_jquery_validation_rules(), |
437 | 437 | 'other_data' => $this->get_other_js_data(), |
438 | 438 | 'errors'=> $this->subsection_validation_errors_by_html_name() |
@@ -448,9 +448,9 @@ discard block |
||
448 | 448 | * @param array $form_other_js_data |
449 | 449 | * @return array |
450 | 450 | */ |
451 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
452 | - foreach( $this->subsections() as $subsection ) { |
|
453 | - $form_other_js_data = $subsection->get_other_js_data( $form_other_js_data ); |
|
451 | + public function get_other_js_data($form_other_js_data = array()) { |
|
452 | + foreach ($this->subsections() as $subsection) { |
|
453 | + $form_other_js_data = $subsection->get_other_js_data($form_other_js_data); |
|
454 | 454 | } |
455 | 455 | return $form_other_js_data; |
456 | 456 | } |
@@ -461,12 +461,12 @@ discard block |
||
461 | 461 | * Keys are their form names, and values are the inputs themselves |
462 | 462 | * @return EE_Form_Input_Base |
463 | 463 | */ |
464 | - public function inputs_in_subsections(){ |
|
464 | + public function inputs_in_subsections() { |
|
465 | 465 | $inputs = array(); |
466 | - foreach($this->subsections() as $subsection){ |
|
467 | - if( $subsection instanceof EE_Form_Input_Base ){ |
|
468 | - $inputs[ $subsection->html_name() ] = $subsection; |
|
469 | - }elseif($subsection instanceof EE_Form_Section_Proper ){ |
|
466 | + foreach ($this->subsections() as $subsection) { |
|
467 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
468 | + $inputs[$subsection->html_name()] = $subsection; |
|
469 | + }elseif ($subsection instanceof EE_Form_Section_Proper) { |
|
470 | 470 | $inputs += $subsection->inputs_in_subsections(); |
471 | 471 | } |
472 | 472 | } |
@@ -479,12 +479,12 @@ discard block |
||
479 | 479 | * and values are a string of all their validation errors |
480 | 480 | * @return string[] |
481 | 481 | */ |
482 | - public function subsection_validation_errors_by_html_name(){ |
|
482 | + public function subsection_validation_errors_by_html_name() { |
|
483 | 483 | $inputs = $this->inputs(); |
484 | 484 | $errors = array(); |
485 | - foreach( $inputs as $form_input ){ |
|
486 | - if ( $form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors() ){ |
|
487 | - $errors[ $form_input->html_name() ] = $form_input->get_validation_error_string(); |
|
485 | + foreach ($inputs as $form_input) { |
|
486 | + if ($form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors()) { |
|
487 | + $errors[$form_input->html_name()] = $form_input->get_validation_error_string(); |
|
488 | 488 | } |
489 | 489 | } |
490 | 490 | return $errors; |
@@ -496,16 +496,16 @@ discard block |
||
496 | 496 | * passes all the form data required by the JS to the JS, and enqueues the few required JS files. |
497 | 497 | * Should be setup by each form during the _enqueues_and_localize_form_js |
498 | 498 | */ |
499 | - public static function localize_script_for_all_forms(){ |
|
499 | + public static function localize_script_for_all_forms() { |
|
500 | 500 | //allow inputs and stuff to hook in their JS and stuff here |
501 | 501 | do_action('AHEE__EE_Form_Section_Proper__localize_script_for_all_forms__begin'); |
502 | 502 | EE_Form_Section_Proper::$_js_localization['localized_error_messages'] = EE_Form_Section_Proper::_get_localized_error_messages(); |
503 | - $email_validation_level = isset( EE_Registry::instance()->CFG->registration->email_validation_level ) |
|
503 | + $email_validation_level = isset(EE_Registry::instance()->CFG->registration->email_validation_level) |
|
504 | 504 | ? EE_Registry::instance()->CFG->registration->email_validation_level |
505 | 505 | : 'wp_default'; |
506 | 506 | EE_Form_Section_Proper::$_js_localization['email_validation_level'] = $email_validation_level; |
507 | - wp_enqueue_script( 'ee_form_section_validation' ); |
|
508 | - wp_localize_script( 'ee_form_section_validation', 'ee_form_section_vars', EE_Form_Section_Proper::$_js_localization ); |
|
507 | + wp_enqueue_script('ee_form_section_validation'); |
|
508 | + wp_localize_script('ee_form_section_validation', 'ee_form_section_vars', EE_Form_Section_Proper::$_js_localization); |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | |
@@ -513,8 +513,8 @@ discard block |
||
513 | 513 | /** |
514 | 514 | * ensure_scripts_localized |
515 | 515 | */ |
516 | - public function ensure_scripts_localized(){ |
|
517 | - if ( ! EE_Form_Section_Proper::$_scripts_localized ) { |
|
516 | + public function ensure_scripts_localized() { |
|
517 | + if ( ! EE_Form_Section_Proper::$_scripts_localized) { |
|
518 | 518 | $this->_enqueue_and_localize_form_js(); |
519 | 519 | } |
520 | 520 | } |
@@ -526,10 +526,10 @@ discard block |
||
526 | 526 | * is that the key here should be the same as the custom validation rule put in the JS file |
527 | 527 | * @return array keys are custom validation rules, and values are internationalized strings |
528 | 528 | */ |
529 | - private static function _get_localized_error_messages(){ |
|
529 | + private static function _get_localized_error_messages() { |
|
530 | 530 | return array( |
531 | 531 | 'validUrl'=> __("This is not a valid absolute URL. Eg, http://domain.com/monkey.jpg", "event_espresso"), |
532 | - 'regex' => __( 'Please check your input', 'event_espresso' ), |
|
532 | + 'regex' => __('Please check your input', 'event_espresso'), |
|
533 | 533 | ); |
534 | 534 | } |
535 | 535 | |
@@ -557,10 +557,10 @@ discard block |
||
557 | 557 | * Gets the JS to put inside the jquery validation rules for subsection of this form section. See parent function for more... |
558 | 558 | * @return array |
559 | 559 | */ |
560 | - public function get_jquery_validation_rules(){ |
|
560 | + public function get_jquery_validation_rules() { |
|
561 | 561 | $jquery_validation_rules = array(); |
562 | - foreach($this->get_validatable_subsections() as $subsection){ |
|
563 | - $jquery_validation_rules = array_merge( $jquery_validation_rules, $subsection->get_jquery_validation_rules() ); |
|
562 | + foreach ($this->get_validatable_subsections() as $subsection) { |
|
563 | + $jquery_validation_rules = array_merge($jquery_validation_rules, $subsection->get_jquery_validation_rules()); |
|
564 | 564 | } |
565 | 565 | return $jquery_validation_rules; |
566 | 566 | } |
@@ -575,11 +575,11 @@ discard block |
||
575 | 575 | protected function _normalize($req_data) { |
576 | 576 | $this->_received_submission = TRUE; |
577 | 577 | $this->_validation_errors = array(); |
578 | - foreach($this->get_validatable_subsections() as $subsection){ |
|
579 | - try{ |
|
578 | + foreach ($this->get_validatable_subsections() as $subsection) { |
|
579 | + try { |
|
580 | 580 | $subsection->_normalize($req_data); |
581 | - }catch( EE_Validation_Error $e ){ |
|
582 | - $subsection->add_validation_error( $e ); |
|
581 | + } catch (EE_Validation_Error $e) { |
|
582 | + $subsection->add_validation_error($e); |
|
583 | 583 | } |
584 | 584 | } |
585 | 585 | } |
@@ -593,9 +593,9 @@ discard block |
||
593 | 593 | * calling parent::_validate() first. |
594 | 594 | */ |
595 | 595 | protected function _validate() { |
596 | - foreach($this->get_validatable_subsections() as $subsection_name => $subsection){ |
|
597 | - if(method_exists($this,'_validate_'.$subsection_name)){ |
|
598 | - call_user_func_array(array($this,'_validate_'.$subsection_name), array($subsection)); |
|
596 | + foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) { |
|
597 | + if (method_exists($this, '_validate_'.$subsection_name)) { |
|
598 | + call_user_func_array(array($this, '_validate_'.$subsection_name), array($subsection)); |
|
599 | 599 | } |
600 | 600 | $subsection->_validate(); |
601 | 601 | } |
@@ -607,13 +607,13 @@ discard block |
||
607 | 607 | * Gets all the validated inputs for the form section |
608 | 608 | * @return array |
609 | 609 | */ |
610 | - public function valid_data(){ |
|
610 | + public function valid_data() { |
|
611 | 611 | $inputs = array(); |
612 | - foreach( $this->subsections() as $subsection_name =>$subsection ){ |
|
613 | - if ( $subsection instanceof EE_Form_Section_Proper ) { |
|
614 | - $inputs[ $subsection_name ] = $subsection->valid_data(); |
|
615 | - } else if ( $subsection instanceof EE_Form_Input_Base ){ |
|
616 | - $inputs[ $subsection_name ] = $subsection->normalized_value(); |
|
612 | + foreach ($this->subsections() as $subsection_name =>$subsection) { |
|
613 | + if ($subsection instanceof EE_Form_Section_Proper) { |
|
614 | + $inputs[$subsection_name] = $subsection->valid_data(); |
|
615 | + } else if ($subsection instanceof EE_Form_Input_Base) { |
|
616 | + $inputs[$subsection_name] = $subsection->normalized_value(); |
|
617 | 617 | } |
618 | 618 | } |
619 | 619 | return $inputs; |
@@ -625,11 +625,11 @@ discard block |
||
625 | 625 | * Gets all the inputs on this form section |
626 | 626 | * @return EE_Form_Input_Base[] |
627 | 627 | */ |
628 | - public function inputs(){ |
|
628 | + public function inputs() { |
|
629 | 629 | $inputs = array(); |
630 | - foreach( $this->subsections() as $subsection_name =>$subsection ){ |
|
631 | - if ( $subsection instanceof EE_Form_Input_Base ){ |
|
632 | - $inputs[ $subsection_name ] = $subsection; |
|
630 | + foreach ($this->subsections() as $subsection_name =>$subsection) { |
|
631 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
632 | + $inputs[$subsection_name] = $subsection; |
|
633 | 633 | } |
634 | 634 | } |
635 | 635 | return $inputs; |
@@ -641,10 +641,10 @@ discard block |
||
641 | 641 | * Gets all the subsections which are a proper form |
642 | 642 | * @return EE_Form_Section_Proper[] |
643 | 643 | */ |
644 | - public function subforms(){ |
|
644 | + public function subforms() { |
|
645 | 645 | $form_sections = array(); |
646 | - foreach($this->subsections() as $name=>$obj){ |
|
647 | - if($obj instanceof EE_Form_Section_Proper){ |
|
646 | + foreach ($this->subsections() as $name=>$obj) { |
|
647 | + if ($obj instanceof EE_Form_Section_Proper) { |
|
648 | 648 | $form_sections[$name] = $obj; |
649 | 649 | } |
650 | 650 | } |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | * if you only want form inputs or proper form sections. |
660 | 660 | * @return EE_Form_Section_Proper[] |
661 | 661 | */ |
662 | - public function subsections(){ |
|
662 | + public function subsections() { |
|
663 | 663 | $this->ensure_construct_finalized_called(); |
664 | 664 | return $this->_subsections; |
665 | 665 | } |
@@ -677,8 +677,8 @@ discard block |
||
677 | 677 | * it can be a multidimensional array where keys are always subsection names and values are either the |
678 | 678 | * input's normalized value, or an array like the top-level array |
679 | 679 | */ |
680 | - public function input_values( $include_subform_inputs = false, $flatten = false ){ |
|
681 | - return $this->_input_values( false, $include_subform_inputs, $flatten ); |
|
680 | + public function input_values($include_subform_inputs = false, $flatten = false) { |
|
681 | + return $this->_input_values(false, $include_subform_inputs, $flatten); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | /** |
@@ -694,8 +694,8 @@ discard block |
||
694 | 694 | * it can be a multidimensional array where keys are always subsection names and values are either the |
695 | 695 | * input's normalized value, or an array like the top-level array |
696 | 696 | */ |
697 | - public function input_pretty_values( $include_subform_inputs = false, $flatten = false ){ |
|
698 | - return $this->_input_values( true, $include_subform_inputs, $flatten ); |
|
697 | + public function input_pretty_values($include_subform_inputs = false, $flatten = false) { |
|
698 | + return $this->_input_values(true, $include_subform_inputs, $flatten); |
|
699 | 699 | } |
700 | 700 | |
701 | 701 | /** |
@@ -708,17 +708,17 @@ discard block |
||
708 | 708 | * it can be a multidimensional array where keys are always subsection names and values are either the |
709 | 709 | * input's normalized value, or an array like the top-level array |
710 | 710 | */ |
711 | - public function _input_values( $pretty = false, $include_subform_inputs = false, $flatten = false ) { |
|
711 | + public function _input_values($pretty = false, $include_subform_inputs = false, $flatten = false) { |
|
712 | 712 | $input_values = array(); |
713 | - foreach( $this->subsections() as $subsection_name => $subsection ) { |
|
714 | - if( $subsection instanceof EE_Form_Input_Base ) { |
|
715 | - $input_values[ $subsection_name ] = $pretty ? $subsection->pretty_value() : $subsection->normalized_value(); |
|
716 | - } else if( $subsection instanceof EE_Form_Section_Proper && $include_subform_inputs ) { |
|
717 | - $subform_input_values = $subsection->_input_values( $pretty, $include_subform_inputs, $flatten ); |
|
718 | - if( $flatten ) { |
|
719 | - $input_values = array_merge( $input_values, $subform_input_values ); |
|
713 | + foreach ($this->subsections() as $subsection_name => $subsection) { |
|
714 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
715 | + $input_values[$subsection_name] = $pretty ? $subsection->pretty_value() : $subsection->normalized_value(); |
|
716 | + } else if ($subsection instanceof EE_Form_Section_Proper && $include_subform_inputs) { |
|
717 | + $subform_input_values = $subsection->_input_values($pretty, $include_subform_inputs, $flatten); |
|
718 | + if ($flatten) { |
|
719 | + $input_values = array_merge($input_values, $subform_input_values); |
|
720 | 720 | } else { |
721 | - $input_values[ $subsection_name ] = $subform_input_values; |
|
721 | + $input_values[$subsection_name] = $subform_input_values; |
|
722 | 722 | } |
723 | 723 | } |
724 | 724 | } |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | * (ie, had receive_form_submission called on it yet) |
733 | 733 | * @return boolean |
734 | 734 | */ |
735 | - public function has_received_submission(){ |
|
735 | + public function has_received_submission() { |
|
736 | 736 | $this->ensure_construct_finalized_called(); |
737 | 737 | return $this->_received_submission; |
738 | 738 | } |
@@ -745,8 +745,8 @@ discard block |
||
745 | 745 | * @param array $inputs_to_exclude values are the input names |
746 | 746 | * @return void |
747 | 747 | */ |
748 | - public function exclude($inputs_to_exclude = array()){ |
|
749 | - foreach($inputs_to_exclude as $input_to_exclude_name){ |
|
748 | + public function exclude($inputs_to_exclude = array()) { |
|
749 | + foreach ($inputs_to_exclude as $input_to_exclude_name) { |
|
750 | 750 | unset($this->_subsections[$input_to_exclude_name]); |
751 | 751 | } |
752 | 752 | } |
@@ -756,8 +756,8 @@ discard block |
||
756 | 756 | /** |
757 | 757 | * @param array $inputs_to_hide |
758 | 758 | */ |
759 | - public function hide($inputs_to_hide= array()){ |
|
760 | - foreach($inputs_to_hide as $input_to_hide){ |
|
759 | + public function hide($inputs_to_hide = array()) { |
|
760 | + foreach ($inputs_to_hide as $input_to_hide) { |
|
761 | 761 | $input = $this->get_input($input_to_hide); |
762 | 762 | |
763 | 763 | $input->set_display_strategy(new EE_Hidden_Display_Strategy()); |
@@ -782,13 +782,13 @@ discard block |
||
782 | 782 | * or if $subsection_name_to_target is null, before or after entire subsections array |
783 | 783 | * @return void |
784 | 784 | */ |
785 | - public function add_subsections( $new_subsections, $subsection_name_to_target = NULL, $add_before = true ){ |
|
786 | - foreach($new_subsections as $subsection_name => $subsection){ |
|
787 | - if( ! $subsection instanceof EE_Form_Section_Base){ |
|
785 | + public function add_subsections($new_subsections, $subsection_name_to_target = NULL, $add_before = true) { |
|
786 | + foreach ($new_subsections as $subsection_name => $subsection) { |
|
787 | + if ( ! $subsection instanceof EE_Form_Section_Base) { |
|
788 | 788 | EE_Error::add_error( |
789 | 789 | sprintf( |
790 | 790 | __("Trying to add a %s as a subsection (it was named '%s') to the form section '%s'. It was removed.", "event_espresso"), |
791 | - get_class( $subsection ), |
|
791 | + get_class($subsection), |
|
792 | 792 | $subsection_name, |
793 | 793 | $this->name() |
794 | 794 | ) |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | } |
798 | 798 | } |
799 | 799 | |
800 | - $this->_subsections = EEH_Array::insert_into_array( $this->_subsections, $new_subsections, $subsection_name_to_target, $add_before ); |
|
800 | + $this->_subsections = EEH_Array::insert_into_array($this->_subsections, $new_subsections, $subsection_name_to_target, $add_before); |
|
801 | 801 | |
802 | 802 | /*$subsections_before = array(); |
803 | 803 | if( $subsection_name_to_target ){ |
@@ -828,8 +828,8 @@ discard block |
||
828 | 828 | $this->_subsections = $new_subsections; |
829 | 829 | } |
830 | 830 | }*/ |
831 | - if( $this->_construction_finalized ){ |
|
832 | - foreach($this->_subsections as $name => $subsection){ |
|
831 | + if ($this->_construction_finalized) { |
|
832 | + foreach ($this->_subsections as $name => $subsection) { |
|
833 | 833 | $subsection->_construct_finalize($this, $name); |
834 | 834 | } |
835 | 835 | } |
@@ -840,8 +840,8 @@ discard block |
||
840 | 840 | /** |
841 | 841 | * Just gets all validatable subsections to clean their sensitive data |
842 | 842 | */ |
843 | - public function clean_sensitive_data(){ |
|
844 | - foreach($this->get_validatable_subsections() as $subsection){ |
|
843 | + public function clean_sensitive_data() { |
|
844 | + foreach ($this->get_validatable_subsections() as $subsection) { |
|
845 | 845 | $subsection->clean_sensitive_data(); |
846 | 846 | } |
847 | 847 | } |
@@ -851,8 +851,8 @@ discard block |
||
851 | 851 | /** |
852 | 852 | * @param string $form_submission_error_message |
853 | 853 | */ |
854 | - public function set_submission_error_message( $form_submission_error_message = '' ) { |
|
855 | - $this->_form_submission_error_message .= ! empty( $form_submission_error_message ) ? $form_submission_error_message : __( 'Form submission failed due to errors', 'event_espresso' ); |
|
854 | + public function set_submission_error_message($form_submission_error_message = '') { |
|
855 | + $this->_form_submission_error_message .= ! empty($form_submission_error_message) ? $form_submission_error_message : __('Form submission failed due to errors', 'event_espresso'); |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | |
@@ -869,8 +869,8 @@ discard block |
||
869 | 869 | /** |
870 | 870 | * @param string $form_submission_success_message |
871 | 871 | */ |
872 | - public function set_submission_success_message( $form_submission_success_message ) { |
|
873 | - $this->_form_submission_success_message .= ! empty( $form_submission_success_message ) ? $form_submission_success_message : __( 'Form submitted successfully', 'event_espresso' ); |
|
872 | + public function set_submission_success_message($form_submission_success_message) { |
|
873 | + $this->_form_submission_success_message .= ! empty($form_submission_success_message) ? $form_submission_success_message : __('Form submitted successfully', 'event_espresso'); |
|
874 | 874 | } |
875 | 875 | |
876 | 876 | |
@@ -892,10 +892,10 @@ discard block |
||
892 | 892 | * EE_Form_Input_Base::_set_default_html_name_if_empty |
893 | 893 | * @return string |
894 | 894 | */ |
895 | - public function html_name_prefix(){ |
|
896 | - if( $this->parent_section() instanceof EE_Form_Section_Proper ){ |
|
897 | - return $this->parent_section()->html_name_prefix() . '[' . $this->name() . ']'; |
|
898 | - }else{ |
|
895 | + public function html_name_prefix() { |
|
896 | + if ($this->parent_section() instanceof EE_Form_Section_Proper) { |
|
897 | + return $this->parent_section()->html_name_prefix().'['.$this->name().']'; |
|
898 | + } else { |
|
899 | 899 | return $this->name(); |
900 | 900 | } |
901 | 901 | } |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | * was set, which is probably nothing, or the classname) |
907 | 907 | * @return string |
908 | 908 | */ |
909 | - public function name(){ |
|
909 | + public function name() { |
|
910 | 910 | $this->ensure_construct_finalized_called(); |
911 | 911 | return parent::name(); |
912 | 912 | } |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | * |
916 | 916 | * @return EE_Form_Section_Proper |
917 | 917 | */ |
918 | - public function parent_section(){ |
|
918 | + public function parent_section() { |
|
919 | 919 | $this->ensure_construct_finalized_called(); |
920 | 920 | return parent::parent_section(); |
921 | 921 | } |
@@ -924,9 +924,9 @@ discard block |
||
924 | 924 | * make sure construction finalized was called, otherwise children might not be ready |
925 | 925 | * @return void |
926 | 926 | */ |
927 | - public function ensure_construct_finalized_called(){ |
|
928 | - if( ! $this->_construction_finalized ){ |
|
929 | - $this->_construct_finalize($this->_parent_section, $this->_name ); |
|
927 | + public function ensure_construct_finalized_called() { |
|
928 | + if ( ! $this->_construction_finalized) { |
|
929 | + $this->_construct_finalize($this->_parent_section, $this->_name); |
|
930 | 930 | } |
931 | 931 | } |
932 | 932 | |
@@ -938,17 +938,17 @@ discard block |
||
938 | 938 | * @param array $req_data |
939 | 939 | * @return boolean |
940 | 940 | */ |
941 | - public function form_data_present_in( $req_data = NULL ) { |
|
942 | - if( $req_data === NULL){ |
|
941 | + public function form_data_present_in($req_data = NULL) { |
|
942 | + if ($req_data === NULL) { |
|
943 | 943 | $req_data = $_POST; |
944 | 944 | } |
945 | - foreach( $this->subsections() as $subsection ) { |
|
946 | - if($subsection instanceof EE_Form_Input_Base ) { |
|
947 | - if( $subsection->form_data_present_in( $req_data ) ) { |
|
945 | + foreach ($this->subsections() as $subsection) { |
|
946 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
947 | + if ($subsection->form_data_present_in($req_data)) { |
|
948 | 948 | return TRUE; |
949 | 949 | } |
950 | - }elseif( $subsection instanceof EE_Form_Section_Proper ) { |
|
951 | - if( $subsection->form_data_present_in( $req_data ) ) { |
|
950 | + }elseif ($subsection instanceof EE_Form_Section_Proper) { |
|
951 | + if ($subsection->form_data_present_in($req_data)) { |
|
952 | 952 | return TRUE; |
953 | 953 | } |
954 | 954 | } |
@@ -965,14 +965,14 @@ discard block |
||
965 | 965 | */ |
966 | 966 | public function get_validation_errors_accumulated() { |
967 | 967 | $validation_errors = $this->get_validation_errors(); |
968 | - foreach($this->get_validatable_subsections() as $subsection ) { |
|
969 | - if( $subsection instanceof EE_Form_Section_Proper ) { |
|
968 | + foreach ($this->get_validatable_subsections() as $subsection) { |
|
969 | + if ($subsection instanceof EE_Form_Section_Proper) { |
|
970 | 970 | $validation_errors_on_this_subsection = $subsection->get_validation_errors_accumulated(); |
971 | 971 | } else { |
972 | - $validation_errors_on_this_subsection = $subsection->get_validation_errors(); |
|
972 | + $validation_errors_on_this_subsection = $subsection->get_validation_errors(); |
|
973 | 973 | } |
974 | - if( $validation_errors_on_this_subsection ){ |
|
975 | - $validation_errors = array_merge( $validation_errors, $validation_errors_on_this_subsection ); |
|
974 | + if ($validation_errors_on_this_subsection) { |
|
975 | + $validation_errors = array_merge($validation_errors, $validation_errors_on_this_subsection); |
|
976 | 976 | } |
977 | 977 | } |
978 | 978 | return $validation_errors; |
@@ -994,24 +994,24 @@ discard block |
||
994 | 994 | * @param string|false $form_section_path we accept false also because substr( '../', '../' ) = false |
995 | 995 | * @return EE_Form_Section_Base |
996 | 996 | */ |
997 | - public function find_section_from_path( $form_section_path ) { |
|
997 | + public function find_section_from_path($form_section_path) { |
|
998 | 998 | //check if we can find the input from purely going straight up the tree |
999 | - $input = parent::find_section_from_path( $form_section_path ); |
|
1000 | - if( $input instanceof EE_Form_Section_Base ) { |
|
999 | + $input = parent::find_section_from_path($form_section_path); |
|
1000 | + if ($input instanceof EE_Form_Section_Base) { |
|
1001 | 1001 | return $input; |
1002 | 1002 | } |
1003 | 1003 | |
1004 | - $next_slash_pos = strpos( $form_section_path, '/' ); |
|
1005 | - if( $next_slash_pos !== false ) { |
|
1006 | - $child_section_name = substr( $form_section_path, 0, $next_slash_pos ); |
|
1007 | - $subpath = substr( $form_section_path, $next_slash_pos + 1 ); |
|
1004 | + $next_slash_pos = strpos($form_section_path, '/'); |
|
1005 | + if ($next_slash_pos !== false) { |
|
1006 | + $child_section_name = substr($form_section_path, 0, $next_slash_pos); |
|
1007 | + $subpath = substr($form_section_path, $next_slash_pos + 1); |
|
1008 | 1008 | } else { |
1009 | 1009 | $child_section_name = $form_section_path; |
1010 | 1010 | $subpath = ''; |
1011 | 1011 | } |
1012 | - $child_section = $this->get_subsection( $child_section_name ); |
|
1013 | - if ( $child_section instanceof EE_Form_Section_Base ) { |
|
1014 | - return $child_section->find_section_from_path( $subpath ); |
|
1012 | + $child_section = $this->get_subsection($child_section_name); |
|
1013 | + if ($child_section instanceof EE_Form_Section_Base) { |
|
1014 | + return $child_section->find_section_from_path($subpath); |
|
1015 | 1015 | } else { |
1016 | 1016 | return null; |
1017 | 1017 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @subpackage |
9 | 9 | * @author Mike Nelson |
10 | 10 | */ |
11 | -abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{ |
|
11 | +abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * the input's name attribute |
@@ -143,54 +143,54 @@ discard block |
||
143 | 143 | * @type EE_Validation_Strategy_Base[] $validation_strategies |
144 | 144 | * } |
145 | 145 | */ |
146 | - public function __construct( $input_args = array() ){ |
|
147 | - $input_args = (array) apply_filters( 'FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this ); |
|
146 | + public function __construct($input_args = array()) { |
|
147 | + $input_args = (array) apply_filters('FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this); |
|
148 | 148 | // the following properties must be cast as arrays |
149 | - if ( isset( $input_args['validation_strategies'] ) ) { |
|
150 | - foreach ( (array) $input_args['validation_strategies'] as $validation_strategy ) { |
|
151 | - if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) { |
|
152 | - $this->_validation_strategies[ get_class( $validation_strategy ) ] = $validation_strategy; |
|
149 | + if (isset($input_args['validation_strategies'])) { |
|
150 | + foreach ((array) $input_args['validation_strategies'] as $validation_strategy) { |
|
151 | + if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
152 | + $this->_validation_strategies[get_class($validation_strategy)] = $validation_strategy; |
|
153 | 153 | } |
154 | 154 | } |
155 | - unset( $input_args['validation_strategies'] ); |
|
155 | + unset($input_args['validation_strategies']); |
|
156 | 156 | } |
157 | 157 | // loop thru incoming options |
158 | - foreach( $input_args as $key => $value ) { |
|
158 | + foreach ($input_args as $key => $value) { |
|
159 | 159 | // add underscore to $key to match property names |
160 | - $_key = '_' . $key; |
|
161 | - if ( property_exists( $this, $_key )) { |
|
160 | + $_key = '_'.$key; |
|
161 | + if (property_exists($this, $_key)) { |
|
162 | 162 | $this->{$_key} = $value; |
163 | 163 | } |
164 | 164 | } |
165 | 165 | // ensure that "required" is set correctly |
166 | 166 | $this->set_required( |
167 | - $this->_required, isset( $input_args[ 'required_validation_error_message' ] ) |
|
168 | - ? $input_args[ 'required_validation_error_message' ] |
|
167 | + $this->_required, isset($input_args['required_validation_error_message']) |
|
168 | + ? $input_args['required_validation_error_message'] |
|
169 | 169 | : null |
170 | 170 | ); |
171 | 171 | |
172 | 172 | //$this->_html_name_specified = isset( $input_args['html_name'] ) ? TRUE : FALSE; |
173 | 173 | |
174 | 174 | $this->_display_strategy->_construct_finalize($this); |
175 | - foreach( $this->_validation_strategies as $validation_strategy ){ |
|
175 | + foreach ($this->_validation_strategies as $validation_strategy) { |
|
176 | 176 | $validation_strategy->_construct_finalize($this); |
177 | 177 | } |
178 | 178 | |
179 | - if( ! $this->_normalization_strategy){ |
|
179 | + if ( ! $this->_normalization_strategy) { |
|
180 | 180 | $this->_normalization_strategy = new EE_Text_Normalization(); |
181 | 181 | } |
182 | 182 | $this->_normalization_strategy->_construct_finalize($this); |
183 | 183 | |
184 | 184 | //at least we can use the normalization strategy to populate the default |
185 | - if( isset( $input_args[ 'default' ] ) ) { |
|
186 | - $this->set_default( $input_args[ 'default' ] ); |
|
185 | + if (isset($input_args['default'])) { |
|
186 | + $this->set_default($input_args['default']); |
|
187 | 187 | } |
188 | 188 | |
189 | - if( ! $this->_sensitive_data_removal_strategy){ |
|
189 | + if ( ! $this->_sensitive_data_removal_strategy) { |
|
190 | 190 | $this->_sensitive_data_removal_strategy = new EE_No_Sensitive_Data_Removal(); |
191 | 191 | } |
192 | 192 | $this->_sensitive_data_removal_strategy->_construct_finalize($this); |
193 | - parent::__construct( $input_args ); |
|
193 | + parent::__construct($input_args); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @throws \EE_Error |
203 | 203 | */ |
204 | - protected function _set_default_html_name_if_empty(){ |
|
205 | - if( ! $this->_html_name){ |
|
204 | + protected function _set_default_html_name_if_empty() { |
|
205 | + if ( ! $this->_html_name) { |
|
206 | 206 | $this->_html_name = $this->name(); |
207 | - if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){ |
|
208 | - $this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]"; |
|
207 | + if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) { |
|
208 | + $this->_html_name = $this->_parent_section->html_name_prefix()."[{$this->name()}]"; |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 | } |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | public function _construct_finalize($parent_form_section, $name) { |
221 | 221 | parent::_construct_finalize($parent_form_section, $name); |
222 | 222 | $this->_set_default_html_name_if_empty(); |
223 | - if( ! $this->_html_label && ! $this->_html_label_text){ |
|
224 | - $this->_html_label_text = ucwords( str_replace("_"," ",$name)); |
|
223 | + if ( ! $this->_html_label && ! $this->_html_label_text) { |
|
224 | + $this->_html_label_text = ucwords(str_replace("_", " ", $name)); |
|
225 | 225 | } |
226 | - do_action( 'AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name ); |
|
226 | + do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -231,8 +231,8 @@ discard block |
||
231 | 231 | * @return EE_Display_Strategy_Base |
232 | 232 | * @throws EE_Error |
233 | 233 | */ |
234 | - protected function _get_display_strategy(){ |
|
235 | - if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){ |
|
234 | + protected function _get_display_strategy() { |
|
235 | + if ( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base) { |
|
236 | 236 | throw new EE_Error( |
237 | 237 | sprintf( |
238 | 238 | __( |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $this->html_id() |
244 | 244 | ) |
245 | 245 | ); |
246 | - }else{ |
|
246 | + } else { |
|
247 | 247 | return $this->_display_strategy; |
248 | 248 | } |
249 | 249 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * Sets the display strategy. |
252 | 252 | * @param EE_Display_Strategy_Base $strategy |
253 | 253 | */ |
254 | - protected function _set_display_strategy(EE_Display_Strategy_Base $strategy){ |
|
254 | + protected function _set_display_strategy(EE_Display_Strategy_Base $strategy) { |
|
255 | 255 | $this->_display_strategy = $strategy; |
256 | 256 | } |
257 | 257 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * Sets the sanitization strategy |
260 | 260 | * @param EE_Normalization_Strategy_Base $strategy |
261 | 261 | */ |
262 | - protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy){ |
|
262 | + protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy) { |
|
263 | 263 | $this->_normalization_strategy = $strategy; |
264 | 264 | } |
265 | 265 | |
@@ -285,14 +285,14 @@ discard block |
||
285 | 285 | * Gets the display strategy for this input |
286 | 286 | * @return EE_Display_Strategy_Base |
287 | 287 | */ |
288 | - public function get_display_strategy(){ |
|
288 | + public function get_display_strategy() { |
|
289 | 289 | return $this->_display_strategy; |
290 | 290 | } |
291 | 291 | /** |
292 | 292 | * Overwrites the display strategy |
293 | 293 | * @param EE_Display_Strategy_Base $display_strategy |
294 | 294 | */ |
295 | - public function set_display_strategy($display_strategy){ |
|
295 | + public function set_display_strategy($display_strategy) { |
|
296 | 296 | $this->_display_strategy = $display_strategy; |
297 | 297 | $this->_display_strategy->_construct_finalize($this); |
298 | 298 | } |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | * Gets the normalization strategy set on this input |
301 | 301 | * @return EE_Normalization_Strategy_Base |
302 | 302 | */ |
303 | - public function get_normalization_strategy(){ |
|
303 | + public function get_normalization_strategy() { |
|
304 | 304 | return $this->_normalization_strategy; |
305 | 305 | } |
306 | 306 | /** |
307 | 307 | * Overwrites the normalization strategy |
308 | 308 | * @param EE_Normalization_Strategy_Base $normalization_strategy |
309 | 309 | */ |
310 | - public function set_normalization_strategy($normalization_strategy){ |
|
310 | + public function set_normalization_strategy($normalization_strategy) { |
|
311 | 311 | $this->_normalization_strategy = $normalization_strategy; |
312 | 312 | $this->_normalization_strategy->_construct_finalize($this); |
313 | 313 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * Returns all teh validation strategies which apply to this field, numerically indexed |
317 | 317 | * @return EE_Validation_Strategy_Base[] |
318 | 318 | */ |
319 | - public function get_validation_strategies(){ |
|
319 | + public function get_validation_strategies() { |
|
320 | 320 | return $this->_validation_strategies; |
321 | 321 | } |
322 | 322 | |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | * @param EE_Validation_Strategy_Base $validation_strategy |
328 | 328 | * @return void |
329 | 329 | */ |
330 | - protected function _add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ){ |
|
331 | - $validation_strategy->_construct_finalize( $this ); |
|
330 | + protected function _add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) { |
|
331 | + $validation_strategy->_construct_finalize($this); |
|
332 | 332 | $this->_validation_strategies[] = $validation_strategy; |
333 | 333 | } |
334 | 334 | |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | * @param EE_Validation_Strategy_Base $validation_strategy |
340 | 340 | * @return void |
341 | 341 | */ |
342 | - public function add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ) { |
|
343 | - $this->_add_validation_strategy( $validation_strategy ); |
|
342 | + public function add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) { |
|
343 | + $this->_add_validation_strategy($validation_strategy); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -350,13 +350,13 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @param string $validation_strategy_classname |
352 | 352 | */ |
353 | - public function remove_validation_strategy( $validation_strategy_classname ) { |
|
354 | - foreach( $this->_validation_strategies as $key => $validation_strategy ){ |
|
355 | - if( |
|
353 | + public function remove_validation_strategy($validation_strategy_classname) { |
|
354 | + foreach ($this->_validation_strategies as $key => $validation_strategy) { |
|
355 | + if ( |
|
356 | 356 | $validation_strategy instanceof $validation_strategy_classname |
357 | - || is_subclass_of( $validation_strategy, $validation_strategy_classname ) |
|
357 | + || is_subclass_of($validation_strategy, $validation_strategy_classname) |
|
358 | 358 | ) { |
359 | - unset( $this->_validation_strategies[ $key ] ); |
|
359 | + unset($this->_validation_strategies[$key]); |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 | } |
@@ -369,12 +369,12 @@ discard block |
||
369 | 369 | * @param array $validation_strategy_classnames |
370 | 370 | * @return bool |
371 | 371 | */ |
372 | - public function has_validation_strategy( $validation_strategy_classnames ) { |
|
373 | - $validation_strategy_classnames = is_array( $validation_strategy_classnames ) |
|
372 | + public function has_validation_strategy($validation_strategy_classnames) { |
|
373 | + $validation_strategy_classnames = is_array($validation_strategy_classnames) |
|
374 | 374 | ? $validation_strategy_classnames |
375 | - : array( $validation_strategy_classnames ); |
|
376 | - foreach( $this->_validation_strategies as $key => $validation_strategy ){ |
|
377 | - if( in_array( $key, $validation_strategy_classnames ) ) { |
|
375 | + : array($validation_strategy_classnames); |
|
376 | + foreach ($this->_validation_strategies as $key => $validation_strategy) { |
|
377 | + if (in_array($key, $validation_strategy_classnames)) { |
|
378 | 378 | return true; |
379 | 379 | } |
380 | 380 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | * to the parent form's layout strategy |
389 | 389 | * @return string |
390 | 390 | */ |
391 | - public function get_html_and_js(){ |
|
391 | + public function get_html_and_js() { |
|
392 | 392 | return $this->_parent_section->get_html_for_input($this); |
393 | 393 | } |
394 | 394 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | * @return string |
403 | 403 | * @throws \EE_Error |
404 | 404 | */ |
405 | - public function get_html_for_input(){ |
|
405 | + public function get_html_for_input() { |
|
406 | 406 | return $this->_get_display_strategy()->display(); |
407 | 407 | } |
408 | 408 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @return string |
413 | 413 | */ |
414 | 414 | public function html_other_attributes() { |
415 | - return ! empty( $this->_html_other_attributes ) ? ' ' . $this->_html_other_attributes : ''; |
|
415 | + return ! empty($this->_html_other_attributes) ? ' '.$this->_html_other_attributes : ''; |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | /** |
421 | 421 | * @param string $html_other_attributes |
422 | 422 | */ |
423 | - public function set_html_other_attributes( $html_other_attributes ) { |
|
423 | + public function set_html_other_attributes($html_other_attributes) { |
|
424 | 424 | $this->_html_other_attributes = $html_other_attributes; |
425 | 425 | } |
426 | 426 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * according to the form section's layout strategy |
430 | 430 | * @return string |
431 | 431 | */ |
432 | - public function get_html_for_label(){ |
|
432 | + public function get_html_for_label() { |
|
433 | 433 | return $this->_parent_section->get_layout_strategy()->display_label($this); |
434 | 434 | } |
435 | 435 | /** |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * according to the form section's layout strategy |
438 | 438 | * @return string |
439 | 439 | */ |
440 | - public function get_html_for_errors(){ |
|
440 | + public function get_html_for_errors() { |
|
441 | 441 | return $this->_parent_section->get_layout_strategy()->display_errors($this); |
442 | 442 | } |
443 | 443 | /** |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | * according to the form section's layout strategy |
446 | 446 | * @return string |
447 | 447 | */ |
448 | - public function get_html_for_help(){ |
|
448 | + public function get_html_for_help() { |
|
449 | 449 | return $this->_parent_section->get_layout_strategy()->display_help_text($this); |
450 | 450 | } |
451 | 451 | /** |
@@ -454,18 +454,18 @@ discard block |
||
454 | 454 | * @return boolean |
455 | 455 | */ |
456 | 456 | protected function _validate() { |
457 | - foreach($this->_validation_strategies as $validation_strategy){ |
|
458 | - if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) { |
|
459 | - try{ |
|
457 | + foreach ($this->_validation_strategies as $validation_strategy) { |
|
458 | + if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
459 | + try { |
|
460 | 460 | $validation_strategy->validate($this->normalized_value()); |
461 | - }catch(EE_Validation_Error $e){ |
|
461 | + } catch (EE_Validation_Error $e) { |
|
462 | 462 | $this->add_validation_error($e); |
463 | 463 | } |
464 | 464 | } |
465 | 465 | } |
466 | - if( $this->get_validation_errors()){ |
|
466 | + if ($this->get_validation_errors()) { |
|
467 | 467 | return false; |
468 | - }else{ |
|
468 | + } else { |
|
469 | 469 | return true; |
470 | 470 | } |
471 | 471 | } |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | * @param string $value |
479 | 479 | * @return null|string |
480 | 480 | */ |
481 | - private function _sanitize($value){ |
|
482 | - return $value !== NULL ?stripslashes(html_entity_decode($value)) : NULL;//don't sanitize_text_field |
|
481 | + private function _sanitize($value) { |
|
482 | + return $value !== NULL ? stripslashes(html_entity_decode($value)) : NULL; //don't sanitize_text_field |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | |
@@ -493,24 +493,24 @@ discard block |
||
493 | 493 | * @return boolean whether or not there was an error |
494 | 494 | * @throws \EE_Error |
495 | 495 | */ |
496 | - protected function _normalize( $req_data ) { |
|
496 | + protected function _normalize($req_data) { |
|
497 | 497 | //any existing validation errors don't apply so clear them |
498 | 498 | $this->_validation_errors = array(); |
499 | 499 | try { |
500 | - $raw_input = $this->find_form_data_for_this_section( $req_data ); |
|
500 | + $raw_input = $this->find_form_data_for_this_section($req_data); |
|
501 | 501 | //super simple sanitization for now |
502 | - if ( is_array( $raw_input )) { |
|
502 | + if (is_array($raw_input)) { |
|
503 | 503 | $this->_raw_value = array(); |
504 | - foreach( $raw_input as $key => $value ) { |
|
505 | - $this->_raw_value[ $key ] = $this->_sanitize( $value ); |
|
504 | + foreach ($raw_input as $key => $value) { |
|
505 | + $this->_raw_value[$key] = $this->_sanitize($value); |
|
506 | 506 | } |
507 | 507 | } else { |
508 | - $this->_raw_value = $this->_sanitize( $raw_input ); |
|
508 | + $this->_raw_value = $this->_sanitize($raw_input); |
|
509 | 509 | } |
510 | 510 | //we want ot mostly leave the input alone in case we need to re-display it to the user |
511 | - $this->_normalized_value = $this->_normalization_strategy->normalize( $this->raw_value() ); |
|
512 | - } catch ( EE_Validation_Error $e ) { |
|
513 | - $this->add_validation_error( $e ); |
|
511 | + $this->_normalized_value = $this->_normalization_strategy->normalize($this->raw_value()); |
|
512 | + } catch (EE_Validation_Error $e) { |
|
513 | + $this->add_validation_error($e); |
|
514 | 514 | } |
515 | 515 | } |
516 | 516 | |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | /** |
520 | 520 | * @return string |
521 | 521 | */ |
522 | - public function html_name(){ |
|
522 | + public function html_name() { |
|
523 | 523 | return $this->_html_name; |
524 | 524 | } |
525 | 525 | |
@@ -528,8 +528,8 @@ discard block |
||
528 | 528 | /** |
529 | 529 | * @return string |
530 | 530 | */ |
531 | - public function html_label_id(){ |
|
532 | - return ! empty( $this->_html_label_id ) ? $this->_html_label_id : $this->_html_id . '-lbl'; |
|
531 | + public function html_label_id() { |
|
532 | + return ! empty($this->_html_label_id) ? $this->_html_label_id : $this->_html_id.'-lbl'; |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | /** |
538 | 538 | * @return string |
539 | 539 | */ |
540 | - public function html_label_class(){ |
|
540 | + public function html_label_class() { |
|
541 | 541 | return $this->_html_label_class; |
542 | 542 | } |
543 | 543 | |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | /** |
547 | 547 | * @return string |
548 | 548 | */ |
549 | - public function html_label_style(){ |
|
549 | + public function html_label_style() { |
|
550 | 550 | return $this->_html_label_style; |
551 | 551 | } |
552 | 552 | |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | /** |
556 | 556 | * @return string |
557 | 557 | */ |
558 | - public function html_label_text(){ |
|
558 | + public function html_label_text() { |
|
559 | 559 | return $this->_html_label_text; |
560 | 560 | } |
561 | 561 | |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | /** |
565 | 565 | * @return string |
566 | 566 | */ |
567 | - public function html_help_text(){ |
|
567 | + public function html_help_text() { |
|
568 | 568 | return $this->_html_help_text; |
569 | 569 | } |
570 | 570 | |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | /** |
574 | 574 | * @return string |
575 | 575 | */ |
576 | - public function html_help_class(){ |
|
576 | + public function html_help_class() { |
|
577 | 577 | return $this->_html_help_class; |
578 | 578 | } |
579 | 579 | |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | /** |
583 | 583 | * @return string |
584 | 584 | */ |
585 | - public function html_help_style(){ |
|
585 | + public function html_help_style() { |
|
586 | 586 | return $this->_html_style; |
587 | 587 | } |
588 | 588 | /** |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | * in which case, we would have stored the malicious content to our database. |
596 | 596 | * @return string |
597 | 597 | */ |
598 | - public function raw_value(){ |
|
598 | + public function raw_value() { |
|
599 | 599 | return $this->_raw_value; |
600 | 600 | } |
601 | 601 | /** |
@@ -603,15 +603,15 @@ discard block |
||
603 | 603 | * it escapes all html entities |
604 | 604 | * @return string |
605 | 605 | */ |
606 | - public function raw_value_in_form(){ |
|
607 | - return htmlentities($this->raw_value(),ENT_QUOTES, 'UTF-8'); |
|
606 | + public function raw_value_in_form() { |
|
607 | + return htmlentities($this->raw_value(), ENT_QUOTES, 'UTF-8'); |
|
608 | 608 | } |
609 | 609 | /** |
610 | 610 | * returns the value after it's been sanitized, and then converted into it's proper type |
611 | 611 | * in PHP. Eg, a string, an int, an array, |
612 | 612 | * @return mixed |
613 | 613 | */ |
614 | - public function normalized_value(){ |
|
614 | + public function normalized_value() { |
|
615 | 615 | return $this->_normalized_value; |
616 | 616 | } |
617 | 617 | |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | * the best thing to display |
622 | 622 | * @return string |
623 | 623 | */ |
624 | - public function pretty_value(){ |
|
624 | + public function pretty_value() { |
|
625 | 625 | return $this->_normalized_value; |
626 | 626 | } |
627 | 627 | /** |
@@ -640,19 +640,19 @@ discard block |
||
640 | 640 | }</code> |
641 | 641 | * @return array |
642 | 642 | */ |
643 | - public function get_jquery_validation_rules(){ |
|
643 | + public function get_jquery_validation_rules() { |
|
644 | 644 | |
645 | 645 | $jquery_validation_rules = array(); |
646 | - foreach($this->get_validation_strategies() as $validation_strategy){ |
|
646 | + foreach ($this->get_validation_strategies() as $validation_strategy) { |
|
647 | 647 | $jquery_validation_rules = array_replace_recursive( |
648 | 648 | $jquery_validation_rules, |
649 | 649 | $validation_strategy->get_jquery_validation_rule_array() |
650 | 650 | ); |
651 | 651 | } |
652 | 652 | |
653 | - if(! empty($jquery_validation_rules)){ |
|
654 | - $jquery_validation_js[ $this->html_id( TRUE ) ] = $jquery_validation_rules; |
|
655 | - }else{ |
|
653 | + if ( ! empty($jquery_validation_rules)) { |
|
654 | + $jquery_validation_js[$this->html_id(TRUE)] = $jquery_validation_rules; |
|
655 | + } else { |
|
656 | 656 | return array(); |
657 | 657 | } |
658 | 658 | return $jquery_validation_js; |
@@ -664,9 +664,9 @@ discard block |
||
664 | 664 | * @param mixed $value |
665 | 665 | * @return void |
666 | 666 | */ |
667 | - public function set_default($value){ |
|
667 | + public function set_default($value) { |
|
668 | 668 | $this->_normalized_value = $value; |
669 | - $this->_raw_value = $this->_normalization_strategy->unnormalize( $value ); |
|
669 | + $this->_raw_value = $this->_normalization_strategy->unnormalize($value); |
|
670 | 670 | } |
671 | 671 | |
672 | 672 | /** |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | * @param string $label |
675 | 675 | * @return void |
676 | 676 | */ |
677 | - public function set_html_label_text($label){ |
|
677 | + public function set_html_label_text($label) { |
|
678 | 678 | $this->_html_label_text = $label; |
679 | 679 | } |
680 | 680 | |
@@ -688,13 +688,13 @@ discard block |
||
688 | 688 | * @param boolean $required boolean |
689 | 689 | * @param null $required_text |
690 | 690 | */ |
691 | - public function set_required($required = true, $required_text = NULL ){ |
|
692 | - $required = filter_var( $required, FILTER_VALIDATE_BOOLEAN ); |
|
691 | + public function set_required($required = true, $required_text = NULL) { |
|
692 | + $required = filter_var($required, FILTER_VALIDATE_BOOLEAN); |
|
693 | 693 | //whether $required is a string or a boolean, we want to add a required validation strategy |
694 | - if ( $required ) { |
|
695 | - $this->_add_validation_strategy( new EE_Required_Validation_Strategy( $required_text ) ); |
|
694 | + if ($required) { |
|
695 | + $this->_add_validation_strategy(new EE_Required_Validation_Strategy($required_text)); |
|
696 | 696 | } else { |
697 | - unset( $this->_validation_strategies[ 'EE_Required_Validation_Strategy' ] ); |
|
697 | + unset($this->_validation_strategies['EE_Required_Validation_Strategy']); |
|
698 | 698 | } |
699 | 699 | $this->_required = $required; |
700 | 700 | } |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | * Returns whether or not this field is required |
703 | 703 | * @return boolean |
704 | 704 | */ |
705 | - public function required(){ |
|
705 | + public function required() { |
|
706 | 706 | return $this->_required; |
707 | 707 | } |
708 | 708 | |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | /** |
712 | 712 | * @param string $required_css_class |
713 | 713 | */ |
714 | - public function set_required_css_class( $required_css_class ) { |
|
714 | + public function set_required_css_class($required_css_class) { |
|
715 | 715 | $this->_required_css_class = $required_css_class; |
716 | 716 | } |
717 | 717 | |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | * Sets the help text, in case |
731 | 731 | * @param string $text |
732 | 732 | */ |
733 | - public function set_html_help_text($text){ |
|
733 | + public function set_html_help_text($text) { |
|
734 | 734 | $this->_html_help_text = $text; |
735 | 735 | } |
736 | 736 | /** |
@@ -742,8 +742,8 @@ discard block |
||
742 | 742 | public function clean_sensitive_data() { |
743 | 743 | //if we do ANY kind of sensitive data removal on this, then just clear out the raw value |
744 | 744 | //if we need more logic than this we'll make a strategy for it |
745 | - if( $this->_sensitive_data_removal_strategy && |
|
746 | - ! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal ){ |
|
745 | + if ($this->_sensitive_data_removal_strategy && |
|
746 | + ! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal) { |
|
747 | 747 | $this->_raw_value = NULL; |
748 | 748 | } |
749 | 749 | //and clean the normalized value according to the appropriate strategy |
@@ -759,10 +759,10 @@ discard block |
||
759 | 759 | * @param string $button_size |
760 | 760 | * @param string $other_attributes |
761 | 761 | */ |
762 | - public function set_button_css_attributes( $primary = TRUE, $button_size = '', $other_attributes = '' ) { |
|
762 | + public function set_button_css_attributes($primary = TRUE, $button_size = '', $other_attributes = '') { |
|
763 | 763 | $button_css_attributes = 'button'; |
764 | 764 | $button_css_attributes .= $primary === TRUE ? ' button-primary' : ' button-secondary'; |
765 | - switch ( $button_size ) { |
|
765 | + switch ($button_size) { |
|
766 | 766 | case 'xs' : |
767 | 767 | case 'extra-small' : |
768 | 768 | $button_css_attributes .= ' button-xs'; |
@@ -783,8 +783,8 @@ discard block |
||
783 | 783 | default : |
784 | 784 | $button_css_attributes .= ''; |
785 | 785 | } |
786 | - $this->_button_css_attributes .= ! empty( $other_attributes ) |
|
787 | - ? $button_css_attributes . ' ' . $other_attributes |
|
786 | + $this->_button_css_attributes .= ! empty($other_attributes) |
|
787 | + ? $button_css_attributes.' '.$other_attributes |
|
788 | 788 | : $button_css_attributes; |
789 | 789 | } |
790 | 790 | |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | * @return string |
795 | 795 | */ |
796 | 796 | public function button_css_attributes() { |
797 | - if ( empty( $this->_button_css_attributes )) { |
|
797 | + if (empty($this->_button_css_attributes)) { |
|
798 | 798 | $this->set_button_css_attributes(); |
799 | 799 | } |
800 | 800 | return $this->_button_css_attributes; |
@@ -816,26 +816,26 @@ discard block |
||
816 | 816 | * @return mixed whatever the raw value of this form section is in the request data |
817 | 817 | * @throws \EE_Error |
818 | 818 | */ |
819 | - public function find_form_data_for_this_section( $req_data ){ |
|
819 | + public function find_form_data_for_this_section($req_data) { |
|
820 | 820 | // break up the html name by "[]" |
821 | - if ( strpos( $this->html_name(), '[' ) !== FALSE ) { |
|
822 | - $before_any_brackets = substr( $this->html_name(), 0, strpos($this->html_name(), '[') ); |
|
821 | + if (strpos($this->html_name(), '[') !== FALSE) { |
|
822 | + $before_any_brackets = substr($this->html_name(), 0, strpos($this->html_name(), '[')); |
|
823 | 823 | } else { |
824 | 824 | $before_any_brackets = $this->html_name(); |
825 | 825 | } |
826 | 826 | // grab all of the segments |
827 | - preg_match_all('~\[([^]]*)\]~',$this->html_name(), $matches); |
|
828 | - if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){ |
|
829 | - $name_parts = $matches[ 1 ]; |
|
827 | + preg_match_all('~\[([^]]*)\]~', $this->html_name(), $matches); |
|
828 | + if (isset($matches[1]) && is_array($matches[1])) { |
|
829 | + $name_parts = $matches[1]; |
|
830 | 830 | array_unshift($name_parts, $before_any_brackets); |
831 | - }else{ |
|
832 | - $name_parts = array( $before_any_brackets ); |
|
831 | + } else { |
|
832 | + $name_parts = array($before_any_brackets); |
|
833 | 833 | } |
834 | 834 | // now get the value for the input |
835 | 835 | $value = $this->_find_form_data_for_this_section_using_name_parts($name_parts, $req_data); |
836 | 836 | // check if this thing's name is at the TOP level of the request data |
837 | - if( $value === null && isset( $req_data[ $this->name() ] ) ){ |
|
838 | - $value = $req_data[ $this->name() ]; |
|
837 | + if ($value === null && isset($req_data[$this->name()])) { |
|
838 | + $value = $req_data[$this->name()]; |
|
839 | 839 | } |
840 | 840 | return $value; |
841 | 841 | } |
@@ -848,18 +848,18 @@ discard block |
||
848 | 848 | * @param array $req_data |
849 | 849 | * @return array | NULL |
850 | 850 | */ |
851 | - public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data){ |
|
852 | - $first_part_to_consider = array_shift( $html_name_parts ); |
|
853 | - if( isset( $req_data[ $first_part_to_consider ] ) ){ |
|
854 | - if( empty($html_name_parts ) ){ |
|
855 | - return $req_data[ $first_part_to_consider ]; |
|
856 | - }else{ |
|
851 | + public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data) { |
|
852 | + $first_part_to_consider = array_shift($html_name_parts); |
|
853 | + if (isset($req_data[$first_part_to_consider])) { |
|
854 | + if (empty($html_name_parts)) { |
|
855 | + return $req_data[$first_part_to_consider]; |
|
856 | + } else { |
|
857 | 857 | return $this->_find_form_data_for_this_section_using_name_parts( |
858 | 858 | $html_name_parts, |
859 | - $req_data[ $first_part_to_consider ] |
|
859 | + $req_data[$first_part_to_consider] |
|
860 | 860 | ); |
861 | 861 | } |
862 | - }else{ |
|
862 | + } else { |
|
863 | 863 | return NULL; |
864 | 864 | } |
865 | 865 | } |
@@ -873,14 +873,14 @@ discard block |
||
873 | 873 | * @return boolean |
874 | 874 | * @throws \EE_Error |
875 | 875 | */ |
876 | - public function form_data_present_in($req_data = NULL){ |
|
877 | - if( $req_data === NULL ){ |
|
876 | + public function form_data_present_in($req_data = NULL) { |
|
877 | + if ($req_data === NULL) { |
|
878 | 878 | $req_data = $_POST; |
879 | 879 | } |
880 | - $checked_value = $this->find_form_data_for_this_section( $req_data ); |
|
881 | - if( $checked_value !== null ){ |
|
880 | + $checked_value = $this->find_form_data_for_this_section($req_data); |
|
881 | + if ($checked_value !== null) { |
|
882 | 882 | return TRUE; |
883 | - }else{ |
|
883 | + } else { |
|
884 | 884 | return FALSE; |
885 | 885 | } |
886 | 886 | } |