@@ -131,8 +131,7 @@ discard block |
||
131 | 131 | return; |
132 | 132 | } |
133 | 133 | echo '<h5>For Tag: '. $tag .'</h5>'; |
134 | - } |
|
135 | - else { |
|
134 | + } else { |
|
136 | 135 | $hook=$wp_filter; |
137 | 136 | ksort( $hook ); |
138 | 137 | } |
@@ -200,7 +199,7 @@ discard block |
||
200 | 199 | if( isset( $this->_start_times[ $timer_name ] ) ){ |
201 | 200 | $start_time = $this->_start_times[ $timer_name ]; |
202 | 201 | unset( $this->_start_times[ $timer_name ] ); |
203 | - }else{ |
|
202 | + } else{ |
|
204 | 203 | $start_time = array_pop( $this->_start_times ); |
205 | 204 | } |
206 | 205 | $total_time = microtime( TRUE ) - $start_time; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | /** |
189 | 189 | * start_timer |
190 | - * @param null $timer_name |
|
190 | + * @param string $timer_name |
|
191 | 191 | */ |
192 | 192 | public function start_timer( $timer_name = NULL ){ |
193 | 193 | $this->_start_times[$timer_name] = microtime( TRUE ); |
@@ -468,12 +468,13 @@ discard block |
||
468 | 468 | |
469 | 469 | |
470 | 470 | /** |
471 | - * @param mixed $var |
|
471 | + * @param string $var |
|
472 | 472 | * @param string $var_name |
473 | 473 | * @param string $file |
474 | 474 | * @param int $line |
475 | 475 | * @param int $heading_tag |
476 | 476 | * @param bool $die |
477 | + * @param string $margin |
|
477 | 478 | */ |
478 | 479 | public static function printv( $var, $var_name = '', $file = __FILE__, $line = __LINE__, $heading_tag = 5, $die = false, $margin ) { |
479 | 480 | $var_name = ! $var_name ? 'string' : $var_name; |
@@ -480,9 +480,9 @@ discard block |
||
480 | 480 | $var_name = ucwords( str_replace( '$', '', $var_name ) ); |
481 | 481 | $is_method = method_exists( $var_name, $var ); |
482 | 482 | $var_name = ucwords( str_replace( '_', ' ', $var_name ) ); |
483 | - $heading_tag = is_int($heading_tag) ? "h{$heading_tag}" : "h5"; |
|
484 | - $result = EEH_Debug_Tools::heading($var_name, $heading_tag, $margin); |
|
485 | - $result .= $is_method |
|
483 | + $heading_tag = is_int($heading_tag) ? "h{$heading_tag}" : "h5"; |
|
484 | + $result = EEH_Debug_Tools::heading($var_name, $heading_tag, $margin); |
|
485 | + $result .= $is_method |
|
486 | 486 | ? \EEH_Debug_Tools::grey_span('::') . \EEH_Debug_Tools::orange_span($var . "()") |
487 | 487 | : \EEH_Debug_Tools::grey_span(' : ') . \EEH_Debug_Tools::orange_span($var); |
488 | 488 | $result .= \EEH_Debug_Tools::file_and_line($file, $line); |
@@ -496,93 +496,93 @@ discard block |
||
496 | 496 | |
497 | 497 | |
498 | 498 | |
499 | - /** |
|
500 | - * @param string $var_name |
|
501 | - * @param string $heading_tag |
|
502 | - * @param string $margin |
|
503 | - * @return string |
|
504 | - */ |
|
499 | + /** |
|
500 | + * @param string $var_name |
|
501 | + * @param string $heading_tag |
|
502 | + * @param string $margin |
|
503 | + * @return string |
|
504 | + */ |
|
505 | 505 | protected static function heading( $var_name = '', $heading_tag = 'h5', $margin = '' ) { |
506 | - if (defined('EE_TESTS_DIR')) { |
|
507 | - return "\n\n{$var_name}"; |
|
508 | - } |
|
509 | - return '<'.$heading_tag.' style="color:#2EA2CC; margin:25px 0 0'.$margin.';"><b>'.$var_name.'</b>'; |
|
510 | - } |
|
506 | + if (defined('EE_TESTS_DIR')) { |
|
507 | + return "\n\n{$var_name}"; |
|
508 | + } |
|
509 | + return '<'.$heading_tag.' style="color:#2EA2CC; margin:25px 0 0'.$margin.';"><b>'.$var_name.'</b>'; |
|
510 | + } |
|
511 | 511 | |
512 | 512 | |
513 | 513 | |
514 | - /** |
|
515 | - * @param string $heading_tag |
|
516 | - * @return string |
|
517 | - */ |
|
514 | + /** |
|
515 | + * @param string $heading_tag |
|
516 | + * @return string |
|
517 | + */ |
|
518 | 518 | protected static function headingx( $heading_tag = 'h5' ) { |
519 | - if (defined('EE_TESTS_DIR')) { |
|
520 | - return "\n"; |
|
521 | - } |
|
522 | - return '</' . $heading_tag . '>'; |
|
523 | - } |
|
519 | + if (defined('EE_TESTS_DIR')) { |
|
520 | + return "\n"; |
|
521 | + } |
|
522 | + return '</' . $heading_tag . '>'; |
|
523 | + } |
|
524 | 524 | |
525 | 525 | |
526 | 526 | |
527 | - /** |
|
528 | - * @param string $content |
|
529 | - * @return string |
|
530 | - */ |
|
527 | + /** |
|
528 | + * @param string $content |
|
529 | + * @return string |
|
530 | + */ |
|
531 | 531 | protected static function grey_span( $content = '' ) { |
532 | - if (defined('EE_TESTS_DIR')) { |
|
533 | - return $content; |
|
534 | - } |
|
535 | - return '<span style="color:#999">' . $content . '</span>'; |
|
536 | - } |
|
532 | + if (defined('EE_TESTS_DIR')) { |
|
533 | + return $content; |
|
534 | + } |
|
535 | + return '<span style="color:#999">' . $content . '</span>'; |
|
536 | + } |
|
537 | 537 | |
538 | 538 | |
539 | 539 | |
540 | - /** |
|
541 | - * @param string $file |
|
542 | - * @param int $line |
|
543 | - * @return string |
|
544 | - */ |
|
540 | + /** |
|
541 | + * @param string $file |
|
542 | + * @param int $line |
|
543 | + * @return string |
|
544 | + */ |
|
545 | 545 | protected static function file_and_line($file, $line) { |
546 | - if (defined('EE_TESTS_DIR')) { |
|
547 | - return "\n (" . $file . ' line no: ' . $line . ' ) '; |
|
548 | - } |
|
549 | - return '<br /><span style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;">' . $file . '<br />line no: ' . $line . '</span>'; |
|
550 | - } |
|
551 | - |
|
552 | - |
|
553 | - |
|
554 | - /** |
|
555 | - * @param string $content |
|
556 | - * @return string |
|
557 | - */ |
|
558 | - protected static function orange_span($content = '') |
|
559 | - { |
|
560 | - if (defined('EE_TESTS_DIR')) { |
|
561 | - return $content; |
|
562 | - } |
|
563 | - return '<span style="color:#E76700">' . $content . '</span>'; |
|
564 | - } |
|
565 | - |
|
566 | - |
|
567 | - |
|
568 | - /** |
|
569 | - * @param mixed $var |
|
570 | - * @return string |
|
571 | - */ |
|
572 | - protected static function pre_span($var) |
|
573 | - { |
|
574 | - ob_start(); |
|
575 | - var_dump($var); |
|
576 | - $var = ob_get_clean(); |
|
577 | - if (defined('EE_TESTS_DIR')) { |
|
578 | - return "\n" . $var; |
|
579 | - } |
|
580 | - return '<pre style="color:#999; padding:1em; background: #fff">' . $var . '</pre>'; |
|
581 | - } |
|
582 | - |
|
583 | - |
|
584 | - |
|
585 | - /** |
|
546 | + if (defined('EE_TESTS_DIR')) { |
|
547 | + return "\n (" . $file . ' line no: ' . $line . ' ) '; |
|
548 | + } |
|
549 | + return '<br /><span style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;">' . $file . '<br />line no: ' . $line . '</span>'; |
|
550 | + } |
|
551 | + |
|
552 | + |
|
553 | + |
|
554 | + /** |
|
555 | + * @param string $content |
|
556 | + * @return string |
|
557 | + */ |
|
558 | + protected static function orange_span($content = '') |
|
559 | + { |
|
560 | + if (defined('EE_TESTS_DIR')) { |
|
561 | + return $content; |
|
562 | + } |
|
563 | + return '<span style="color:#E76700">' . $content . '</span>'; |
|
564 | + } |
|
565 | + |
|
566 | + |
|
567 | + |
|
568 | + /** |
|
569 | + * @param mixed $var |
|
570 | + * @return string |
|
571 | + */ |
|
572 | + protected static function pre_span($var) |
|
573 | + { |
|
574 | + ob_start(); |
|
575 | + var_dump($var); |
|
576 | + $var = ob_get_clean(); |
|
577 | + if (defined('EE_TESTS_DIR')) { |
|
578 | + return "\n" . $var; |
|
579 | + } |
|
580 | + return '<pre style="color:#999; padding:1em; background: #fff">' . $var . '</pre>'; |
|
581 | + } |
|
582 | + |
|
583 | + |
|
584 | + |
|
585 | + /** |
|
586 | 586 | * @param mixed $var |
587 | 587 | * @param string $var_name |
588 | 588 | * @param string $file |
@@ -593,8 +593,8 @@ discard block |
||
593 | 593 | public static function printr( $var, $var_name = '', $file = __FILE__, $line = __LINE__, $heading_tag = 5, $die = false ) { |
594 | 594 | // return; |
595 | 595 | $file = str_replace( rtrim( ABSPATH, '\\/' ), '', $file ); |
596 | - $margin = is_admin() ? ' 180px' : '0'; |
|
597 | - //$print_r = false; |
|
596 | + $margin = is_admin() ? ' 180px' : '0'; |
|
597 | + //$print_r = false; |
|
598 | 598 | if ( is_string( $var ) ) { |
599 | 599 | EEH_Debug_Tools::printv( $var, $var_name, $file, $line, $heading_tag, $die, $margin ); |
600 | 600 | return; |
@@ -610,11 +610,11 @@ discard block |
||
610 | 610 | $var_name = ! $var_name ? 'null' : $var_name; |
611 | 611 | } |
612 | 612 | $var_name = ucwords( str_replace( array( '$', '_' ), array( '', ' ' ), $var_name ) ); |
613 | - $heading_tag = is_int($heading_tag) ? "h{$heading_tag}" : "h5"; |
|
614 | - $result = EEH_Debug_Tools::heading($var_name, $heading_tag, $margin); |
|
613 | + $heading_tag = is_int($heading_tag) ? "h{$heading_tag}" : "h5"; |
|
614 | + $result = EEH_Debug_Tools::heading($var_name, $heading_tag, $margin); |
|
615 | 615 | $result .= \EEH_Debug_Tools::grey_span(' : ') . \EEH_Debug_Tools::orange_span( |
616 | - \EEH_Debug_Tools::pre_span($var) |
|
617 | - ); |
|
616 | + \EEH_Debug_Tools::pre_span($var) |
|
617 | + ); |
|
618 | 618 | $result .= \EEH_Debug_Tools::file_and_line($file, $line); |
619 | 619 | $result .= \EEH_Debug_Tools::headingx($heading_tag); |
620 | 620 | if ( $die ) { |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * Class EEH_Debug_Tools |
4 | 4 | * |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @since 4.0 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EEH_Debug_Tools{ |
|
11 | +class EEH_Debug_Tools { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * instance of the EEH_Autoloader object |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public static function instance() { |
43 | 43 | // check if class object is instantiated, and instantiated properly |
44 | - if ( ! self::$_instance instanceof EEH_Debug_Tools ) { |
|
44 | + if ( ! self::$_instance instanceof EEH_Debug_Tools) { |
|
45 | 45 | self::$_instance = new self(); |
46 | 46 | } |
47 | 47 | return self::$_instance; |
@@ -57,21 +57,21 @@ discard block |
||
57 | 57 | */ |
58 | 58 | private function __construct() { |
59 | 59 | // load Kint PHP debugging library |
60 | - if ( ! class_exists( 'Kint' ) && file_exists( EE_PLUGIN_DIR_PATH . 'tests' . DS . 'kint' . DS . 'Kint.class.php' )){ |
|
60 | + if ( ! class_exists('Kint') && file_exists(EE_PLUGIN_DIR_PATH.'tests'.DS.'kint'.DS.'Kint.class.php')) { |
|
61 | 61 | // despite EE4 having a check for an existing copy of the Kint debugging class, |
62 | 62 | // if another plugin was loaded AFTER EE4 and they did NOT perform a similar check, |
63 | 63 | // then hilarity would ensue as PHP throws a "Cannot redeclare class Kint" error |
64 | 64 | // so we've moved it to our test folder so that it is not included with production releases |
65 | 65 | // plz use https://wordpress.org/plugins/kint-debugger/ if testing production versions of EE |
66 | - require_once( EE_PLUGIN_DIR_PATH . 'tests' . DS . 'kint' . DS . 'Kint.class.php' ); |
|
66 | + require_once(EE_PLUGIN_DIR_PATH.'tests'.DS.'kint'.DS.'Kint.class.php'); |
|
67 | 67 | } |
68 | 68 | // if ( ! defined('DOING_AJAX') || $_REQUEST['noheader'] !== 'true' || ! isset( $_REQUEST['noheader'], $_REQUEST['TB_iframe'] ) ) { |
69 | 69 | //add_action( 'shutdown', array($this,'espresso_session_footer_dump') ); |
70 | 70 | // } |
71 | - $plugin = basename( EE_PLUGIN_DIR_PATH ); |
|
72 | - add_action( "activate_{$plugin}", array( 'EEH_Debug_Tools', 'ee_plugin_activation_errors' )); |
|
73 | - add_action( 'activated_plugin', array( 'EEH_Debug_Tools', 'ee_plugin_activation_errors' )); |
|
74 | - add_action( 'shutdown', array( 'EEH_Debug_Tools', 'show_db_name' )); |
|
71 | + $plugin = basename(EE_PLUGIN_DIR_PATH); |
|
72 | + add_action("activate_{$plugin}", array('EEH_Debug_Tools', 'ee_plugin_activation_errors')); |
|
73 | + add_action('activated_plugin', array('EEH_Debug_Tools', 'ee_plugin_activation_errors')); |
|
74 | + add_action('shutdown', array('EEH_Debug_Tools', 'show_db_name')); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | public static function show_db_name() { |
85 | - if ( ! defined( 'DOING_AJAX' ) && ( defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS )) { |
|
86 | - echo '<p style="font-size:10px;font-weight:normal;color:#E76700;margin: 1em 2em; text-align: right;">DB_NAME: '. DB_NAME .'</p>'; |
|
85 | + if ( ! defined('DOING_AJAX') && (defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS)) { |
|
86 | + echo '<p style="font-size:10px;font-weight:normal;color:#E76700;margin: 1em 2em; text-align: right;">DB_NAME: '.DB_NAME.'</p>'; |
|
87 | 87 | } |
88 | - if ( EE_DEBUG ) { |
|
88 | + if (EE_DEBUG) { |
|
89 | 89 | EEH_Debug_Tools::instance()->show_times(); |
90 | 90 | } |
91 | 91 | } |
@@ -99,15 +99,15 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function espresso_session_footer_dump() { |
101 | 101 | if ( |
102 | - ( defined( 'WP_DEBUG' ) && WP_DEBUG ) |
|
103 | - && ! defined( 'DOING_AJAX' ) |
|
104 | - && class_exists( 'Kint' ) |
|
105 | - && function_exists( 'wp_get_current_user' ) |
|
106 | - && current_user_can( 'update_core' ) |
|
107 | - && class_exists( 'EE_Registry' ) |
|
102 | + (defined('WP_DEBUG') && WP_DEBUG) |
|
103 | + && ! defined('DOING_AJAX') |
|
104 | + && class_exists('Kint') |
|
105 | + && function_exists('wp_get_current_user') |
|
106 | + && current_user_can('update_core') |
|
107 | + && class_exists('EE_Registry') |
|
108 | 108 | ) { |
109 | - Kint::dump( EE_Registry::instance()->SSN->id() ); |
|
110 | - Kint::dump( EE_Registry::instance()->SSN ); |
|
109 | + Kint::dump(EE_Registry::instance()->SSN->id()); |
|
110 | + Kint::dump(EE_Registry::instance()->SSN); |
|
111 | 111 | // Kint::dump( EE_Registry::instance()->SSN->get_session_data('cart')->get_tickets() ); |
112 | 112 | $this->espresso_list_hooked_functions(); |
113 | 113 | $this->show_times(); |
@@ -124,27 +124,27 @@ discard block |
||
124 | 124 | * @param string $tag |
125 | 125 | * @return void |
126 | 126 | */ |
127 | - public function espresso_list_hooked_functions( $tag='' ){ |
|
127 | + public function espresso_list_hooked_functions($tag = '') { |
|
128 | 128 | global $wp_filter; |
129 | 129 | echo '<br/><br/><br/><h3>Hooked Functions</h3>'; |
130 | - if ( $tag ) { |
|
131 | - $hook[$tag]=$wp_filter[$tag]; |
|
132 | - if ( ! is_array( $hook[$tag] )) { |
|
133 | - trigger_error( "Nothing found for '$tag' hook", E_USER_WARNING ); |
|
130 | + if ($tag) { |
|
131 | + $hook[$tag] = $wp_filter[$tag]; |
|
132 | + if ( ! is_array($hook[$tag])) { |
|
133 | + trigger_error("Nothing found for '$tag' hook", E_USER_WARNING); |
|
134 | 134 | return; |
135 | 135 | } |
136 | - echo '<h5>For Tag: '. $tag .'</h5>'; |
|
136 | + echo '<h5>For Tag: '.$tag.'</h5>'; |
|
137 | 137 | } |
138 | 138 | else { |
139 | - $hook=$wp_filter; |
|
140 | - ksort( $hook ); |
|
139 | + $hook = $wp_filter; |
|
140 | + ksort($hook); |
|
141 | 141 | } |
142 | - foreach( $hook as $tag_name => $priorities ) { |
|
142 | + foreach ($hook as $tag_name => $priorities) { |
|
143 | 143 | echo "<br />>>>>>\t<strong>$tag_name</strong><br />"; |
144 | - ksort( $priorities ); |
|
145 | - foreach( $priorities as $priority => $function ){ |
|
144 | + ksort($priorities); |
|
145 | + foreach ($priorities as $priority => $function) { |
|
146 | 146 | echo $priority; |
147 | - foreach( $function as $name => $properties ) { |
|
147 | + foreach ($function as $name => $properties) { |
|
148 | 148 | echo "\t$name<br />"; |
149 | 149 | } |
150 | 150 | } |
@@ -159,15 +159,15 @@ discard block |
||
159 | 159 | * @param string $hook_name |
160 | 160 | * @return array |
161 | 161 | */ |
162 | - public static function registered_filter_callbacks( $hook_name = '' ) { |
|
162 | + public static function registered_filter_callbacks($hook_name = '') { |
|
163 | 163 | $filters = array(); |
164 | 164 | global $wp_filter; |
165 | - if ( isset( $wp_filter[ $hook_name ] ) ) { |
|
166 | - $filters[ $hook_name ] = array(); |
|
167 | - foreach ( $wp_filter[ $hook_name ] as $priority => $callbacks ) { |
|
168 | - $filters[ $hook_name ][ $priority ] = array(); |
|
169 | - foreach ( $callbacks as $callback ) { |
|
170 | - $filters[ $hook_name ][ $priority ][] = $callback['function']; |
|
165 | + if (isset($wp_filter[$hook_name])) { |
|
166 | + $filters[$hook_name] = array(); |
|
167 | + foreach ($wp_filter[$hook_name] as $priority => $callbacks) { |
|
168 | + $filters[$hook_name][$priority] = array(); |
|
169 | + foreach ($callbacks as $callback) { |
|
170 | + $filters[$hook_name][$priority][] = $callback['function']; |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | /** |
180 | 180 | * reset_times |
181 | 181 | */ |
182 | - public function reset_times(){ |
|
182 | + public function reset_times() { |
|
183 | 183 | $this->_times = array(); |
184 | 184 | } |
185 | 185 | |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | * start_timer |
190 | 190 | * @param null $timer_name |
191 | 191 | */ |
192 | - public function start_timer( $timer_name = NULL ){ |
|
193 | - $this->_start_times[$timer_name] = microtime( TRUE ); |
|
192 | + public function start_timer($timer_name = NULL) { |
|
193 | + $this->_start_times[$timer_name] = microtime(TRUE); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -199,15 +199,15 @@ discard block |
||
199 | 199 | * stop_timer |
200 | 200 | * @param string $timer_name |
201 | 201 | */ |
202 | - public function stop_timer( $timer_name = '' ){ |
|
202 | + public function stop_timer($timer_name = '') { |
|
203 | 203 | $timer_name = $timer_name !== '' ? $timer_name : get_called_class(); |
204 | - if( isset( $this->_start_times[ $timer_name ] ) ){ |
|
205 | - $start_time = $this->_start_times[ $timer_name ]; |
|
206 | - unset( $this->_start_times[ $timer_name ] ); |
|
207 | - }else{ |
|
208 | - $start_time = array_pop( $this->_start_times ); |
|
204 | + if (isset($this->_start_times[$timer_name])) { |
|
205 | + $start_time = $this->_start_times[$timer_name]; |
|
206 | + unset($this->_start_times[$timer_name]); |
|
207 | + } else { |
|
208 | + $start_time = array_pop($this->_start_times); |
|
209 | 209 | } |
210 | - $this->_times[ $timer_name ] = number_format( microtime( true ) - $start_time, 8 ); |
|
210 | + $this->_times[$timer_name] = number_format(microtime(true) - $start_time, 8); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
@@ -217,10 +217,10 @@ discard block |
||
217 | 217 | * @param boolean $output_now whether to echo now, or wait until EEH_Debug_Tools::show_times() is called |
218 | 218 | * @return void |
219 | 219 | */ |
220 | - public function measure_memory( $label, $output_now = false ) { |
|
221 | - $memory_used = $this->convert( memory_get_peak_usage( true ) ); |
|
222 | - $this->_memory_usage_points[ $label ] = $memory_used; |
|
223 | - if( $output_now ) { |
|
220 | + public function measure_memory($label, $output_now = false) { |
|
221 | + $memory_used = $this->convert(memory_get_peak_usage(true)); |
|
222 | + $this->_memory_usage_points[$label] = $memory_used; |
|
223 | + if ($output_now) { |
|
224 | 224 | echo "\r\n<br>$label : $memory_used"; |
225 | 225 | } |
226 | 226 | } |
@@ -230,9 +230,9 @@ discard block |
||
230 | 230 | * @param int $size |
231 | 231 | * @return string |
232 | 232 | */ |
233 | - public function convert( $size ) { |
|
234 | - $unit=array('b','kb','mb','gb','tb','pb'); |
|
235 | - return @round( $size / pow( 1024, $i = floor( log( $size, 1024 ) ) ), 2 ) . ' ' . $unit[ absint( $i ) ]; |
|
233 | + public function convert($size) { |
|
234 | + $unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb'); |
|
235 | + return @round($size / pow(1024, $i = floor(log($size, 1024))), 2).' '.$unit[absint($i)]; |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -242,25 +242,25 @@ discard block |
||
242 | 242 | * @param bool $output_now |
243 | 243 | * @return string |
244 | 244 | */ |
245 | - public function show_times($output_now=true){ |
|
245 | + public function show_times($output_now = true) { |
|
246 | 246 | $output = ''; |
247 | - if ( ! empty( $this->_times )) { |
|
247 | + if ( ! empty($this->_times)) { |
|
248 | 248 | $total = 0; |
249 | 249 | $output .= '<h2 style="margin:1em .5em 0;">Times:</h2>'; |
250 | 250 | $output .= '<span style="color:#9999CC; font-size:.8em; margin:0 1.5em 0;">( in milliseconds )</span><br />'; |
251 | - foreach( $this->_times as $timer_name => $total_time ) { |
|
252 | - $output .= $this->format_time( $timer_name, $total_time ); |
|
251 | + foreach ($this->_times as $timer_name => $total_time) { |
|
252 | + $output .= $this->format_time($timer_name, $total_time); |
|
253 | 253 | $total += $total_time; |
254 | 254 | } |
255 | 255 | $output .= '<br />'; |
256 | 256 | $output .= '<h4 style="margin:1em .5em 0;">TOTAL TIME</h4>'; |
257 | - $output .= $this->format_time( '', $total ); |
|
257 | + $output .= $this->format_time('', $total); |
|
258 | 258 | $output .= '<br />'; |
259 | 259 | } |
260 | - if ( ! empty( $this->_memory_usage_points )) { |
|
261 | - $output .= '<h2 style="margin:1em .5em 0;">Memory</h2>' . implode( '<br />', $this->_memory_usage_points ); |
|
260 | + if ( ! empty($this->_memory_usage_points)) { |
|
261 | + $output .= '<h2 style="margin:1em .5em 0;">Memory</h2>'.implode('<br />', $this->_memory_usage_points); |
|
262 | 262 | } |
263 | - if( $output_now ){ |
|
263 | + if ($output_now) { |
|
264 | 264 | echo $output; |
265 | 265 | return ''; |
266 | 266 | } |
@@ -274,9 +274,9 @@ discard block |
||
274 | 274 | * @param float $total_time |
275 | 275 | * @return string |
276 | 276 | */ |
277 | - public function format_time( $timer_name, $total_time ) { |
|
277 | + public function format_time($timer_name, $total_time) { |
|
278 | 278 | $total_time = $total_time * 1000; |
279 | - switch ( $total_time ) { |
|
279 | + switch ($total_time) { |
|
280 | 280 | case $total_time < 0.01 : |
281 | 281 | $color = '#8A549A'; |
282 | 282 | $bold = 'normal'; |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | . '; font-weight:' |
308 | 308 | . $bold |
309 | 309 | . '; font-size:1.2em;">' |
310 | - . str_pad( number_format( $total_time, 5 ), 11, '0', STR_PAD_LEFT ) |
|
310 | + . str_pad(number_format($total_time, 5), 11, '0', STR_PAD_LEFT) |
|
311 | 311 | . '</span> ' |
312 | 312 | . $timer_name |
313 | 313 | . '<br />'; |
@@ -321,25 +321,25 @@ discard block |
||
321 | 321 | * @return void |
322 | 322 | */ |
323 | 323 | public static function ee_plugin_activation_errors() { |
324 | - if ( WP_DEBUG ) { |
|
324 | + if (WP_DEBUG) { |
|
325 | 325 | $activation_errors = ob_get_contents(); |
326 | - if ( ! empty( $activation_errors ) ) { |
|
327 | - $activation_errors = date( 'Y-m-d H:i:s' ) . "\n" . $activation_errors; |
|
326 | + if ( ! empty($activation_errors)) { |
|
327 | + $activation_errors = date('Y-m-d H:i:s')."\n".$activation_errors; |
|
328 | 328 | } |
329 | - espresso_load_required( 'EEH_File', EE_HELPERS . 'EEH_File.helper.php' ); |
|
330 | - if ( class_exists( 'EEH_File' )) { |
|
329 | + espresso_load_required('EEH_File', EE_HELPERS.'EEH_File.helper.php'); |
|
330 | + if (class_exists('EEH_File')) { |
|
331 | 331 | try { |
332 | - EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html' ); |
|
333 | - EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html', $activation_errors ); |
|
334 | - } catch( EE_Error $e ){ |
|
335 | - EE_Error::add_error( sprintf( __( 'The Event Espresso activation errors file could not be setup because: %s', 'event_espresso' ), $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
332 | + EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html'); |
|
333 | + EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html', $activation_errors); |
|
334 | + } catch (EE_Error $e) { |
|
335 | + EE_Error::add_error(sprintf(__('The Event Espresso activation errors file could not be setup because: %s', 'event_espresso'), $e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
336 | 336 | } |
337 | 337 | } else { |
338 | 338 | // old school attempt |
339 | - file_put_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html', $activation_errors ); |
|
339 | + file_put_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html', $activation_errors); |
|
340 | 340 | } |
341 | - $activation_errors = get_option( 'ee_plugin_activation_errors', '' ) . $activation_errors; |
|
342 | - update_option( 'ee_plugin_activation_errors', $activation_errors ); |
|
341 | + $activation_errors = get_option('ee_plugin_activation_errors', '').$activation_errors; |
|
342 | + update_option('ee_plugin_activation_errors', $activation_errors); |
|
343 | 343 | } |
344 | 344 | } |
345 | 345 | |
@@ -368,33 +368,33 @@ discard block |
||
368 | 368 | $applies_when = '', |
369 | 369 | $error_type = null |
370 | 370 | ) { |
371 | - $applies_when = ! empty( $applies_when ) ? $applies_when : espresso_version(); |
|
371 | + $applies_when = ! empty($applies_when) ? $applies_when : espresso_version(); |
|
372 | 372 | $error_type = $error_type !== null ? $error_type : E_USER_NOTICE; |
373 | 373 | // because we swapped the parameter order around for the last two params, |
374 | 374 | // let's verify that some third party isn't still passing an error type value for the third param |
375 | - if ( is_int( $applies_when ) ) { |
|
375 | + if (is_int($applies_when)) { |
|
376 | 376 | $error_type = $applies_when; |
377 | 377 | $applies_when = espresso_version(); |
378 | 378 | } |
379 | 379 | // if not displaying notices yet, then just leave |
380 | - if ( version_compare( espresso_version(), $applies_when, '<' ) ) { |
|
380 | + if (version_compare(espresso_version(), $applies_when, '<')) { |
|
381 | 381 | return; |
382 | 382 | } |
383 | - do_action( 'AHEE__EEH_Debug_Tools__doing_it_wrong_run', $function, $message, $version); |
|
384 | - $version = $version === null ? '' : sprintf( __('(This message was added in version %s of Event Espresso)', 'event_espresso' ), $version ); |
|
385 | - $error_message = sprintf( esc_html__('%1$s was called %2$sincorrectly%3$s. %4$s %5$s','event_espresso' ), $function, '<strong>', '</strong>', $message, $version ); |
|
383 | + do_action('AHEE__EEH_Debug_Tools__doing_it_wrong_run', $function, $message, $version); |
|
384 | + $version = $version === null ? '' : sprintf(__('(This message was added in version %s of Event Espresso)', 'event_espresso'), $version); |
|
385 | + $error_message = sprintf(esc_html__('%1$s was called %2$sincorrectly%3$s. %4$s %5$s', 'event_espresso'), $function, '<strong>', '</strong>', $message, $version); |
|
386 | 386 | |
387 | 387 | //don't trigger error if doing ajax, instead we'll add a transient EE_Error notice that in theory should show on the next request. |
388 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
389 | - $error_message .= ' ' . esc_html__( 'This is a doing_it_wrong message that was triggered during an ajax request. The request params on this request were: ', 'event_espresso' ); |
|
388 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
389 | + $error_message .= ' '.esc_html__('This is a doing_it_wrong message that was triggered during an ajax request. The request params on this request were: ', 'event_espresso'); |
|
390 | 390 | $error_message .= '<ul><li>'; |
391 | - $error_message .= implode( '</li><li>', EE_Registry::instance()->REQ->params() ); |
|
391 | + $error_message .= implode('</li><li>', EE_Registry::instance()->REQ->params()); |
|
392 | 392 | $error_message .= '</ul>'; |
393 | - EE_Error::add_error( $error_message, 'debug::doing_it_wrong', $function, '42' ); |
|
393 | + EE_Error::add_error($error_message, 'debug::doing_it_wrong', $function, '42'); |
|
394 | 394 | //now we set this on the transient so it shows up on the next request. |
395 | - EE_Error::get_notices( false, true ); |
|
395 | + EE_Error::get_notices(false, true); |
|
396 | 396 | } else { |
397 | - trigger_error( $error_message, $error_type ); |
|
397 | + trigger_error($error_message, $error_type); |
|
398 | 398 | } |
399 | 399 | } |
400 | 400 | |
@@ -416,22 +416,22 @@ discard block |
||
416 | 416 | * @param string $debug_index |
417 | 417 | * @param string $debug_key |
418 | 418 | */ |
419 | - public static function log( $class='', $func = '', $line = '', $info = array(), $display_request = false, $debug_index = '', $debug_key = 'EE_DEBUG_SPCO' ) { |
|
420 | - if ( WP_DEBUG && false ) { |
|
421 | - $debug_key = $debug_key . '_' . EE_Session::instance()->id(); |
|
422 | - $debug_data = get_option( $debug_key, array() ); |
|
419 | + public static function log($class = '', $func = '', $line = '', $info = array(), $display_request = false, $debug_index = '', $debug_key = 'EE_DEBUG_SPCO') { |
|
420 | + if (WP_DEBUG && false) { |
|
421 | + $debug_key = $debug_key.'_'.EE_Session::instance()->id(); |
|
422 | + $debug_data = get_option($debug_key, array()); |
|
423 | 423 | $default_data = array( |
424 | - $class => $func . '() : ' . $line, |
|
424 | + $class => $func.'() : '.$line, |
|
425 | 425 | 'REQ' => $display_request ? $_REQUEST : '', |
426 | 426 | ); |
427 | 427 | // don't serialize objects |
428 | - $info = self::strip_objects( $info ); |
|
429 | - $index = ! empty( $debug_index ) ? $debug_index : 0; |
|
430 | - if ( ! isset( $debug_data[$index] ) ) { |
|
428 | + $info = self::strip_objects($info); |
|
429 | + $index = ! empty($debug_index) ? $debug_index : 0; |
|
430 | + if ( ! isset($debug_data[$index])) { |
|
431 | 431 | $debug_data[$index] = array(); |
432 | 432 | } |
433 | - $debug_data[$index][microtime()] = array_merge( $default_data, $info ); |
|
434 | - update_option( $debug_key, $debug_data ); |
|
433 | + $debug_data[$index][microtime()] = array_merge($default_data, $info); |
|
434 | + update_option($debug_key, $debug_data); |
|
435 | 435 | } |
436 | 436 | } |
437 | 437 | |
@@ -443,26 +443,26 @@ discard block |
||
443 | 443 | * @param array $info |
444 | 444 | * @return array |
445 | 445 | */ |
446 | - public static function strip_objects( $info = array() ) { |
|
447 | - foreach ( $info as $key => $value ) { |
|
448 | - if ( is_array( $value ) ) { |
|
449 | - $info[ $key ] = self::strip_objects( $value ); |
|
450 | - } else if ( is_object( $value ) ) { |
|
451 | - $object_class = get_class( $value ); |
|
452 | - $info[ $object_class ] = array(); |
|
453 | - $info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : spl_object_hash( $value ); |
|
454 | - if ( method_exists( $value, 'ID' ) ) { |
|
455 | - $info[ $object_class ][ 'ID' ] = $value->ID(); |
|
446 | + public static function strip_objects($info = array()) { |
|
447 | + foreach ($info as $key => $value) { |
|
448 | + if (is_array($value)) { |
|
449 | + $info[$key] = self::strip_objects($value); |
|
450 | + } else if (is_object($value)) { |
|
451 | + $object_class = get_class($value); |
|
452 | + $info[$object_class] = array(); |
|
453 | + $info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : spl_object_hash($value); |
|
454 | + if (method_exists($value, 'ID')) { |
|
455 | + $info[$object_class]['ID'] = $value->ID(); |
|
456 | 456 | } |
457 | - if ( method_exists( $value, 'status' ) ) { |
|
458 | - $info[ $object_class ][ 'status' ] = $value->status(); |
|
459 | - } else if ( method_exists( $value, 'status_ID' ) ) { |
|
460 | - $info[ $object_class ][ 'status' ] = $value->status_ID(); |
|
457 | + if (method_exists($value, 'status')) { |
|
458 | + $info[$object_class]['status'] = $value->status(); |
|
459 | + } else if (method_exists($value, 'status_ID')) { |
|
460 | + $info[$object_class]['status'] = $value->status_ID(); |
|
461 | 461 | } |
462 | - unset( $info[ $key ] ); |
|
462 | + unset($info[$key]); |
|
463 | 463 | } |
464 | 464 | } |
465 | - return (array)$info; |
|
465 | + return (array) $info; |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | |
@@ -475,20 +475,20 @@ discard block |
||
475 | 475 | * @param int $heading_tag |
476 | 476 | * @param bool $die |
477 | 477 | */ |
478 | - public static function printv( $var, $var_name = '', $file = __FILE__, $line = __LINE__, $heading_tag = 5, $die = false, $margin ) { |
|
478 | + public static function printv($var, $var_name = '', $file = __FILE__, $line = __LINE__, $heading_tag = 5, $die = false, $margin) { |
|
479 | 479 | $var_name = ! $var_name ? 'string' : $var_name; |
480 | - $var_name = ucwords( str_replace( '$', '', $var_name ) ); |
|
481 | - $is_method = method_exists( $var_name, $var ); |
|
482 | - $var_name = ucwords( str_replace( '_', ' ', $var_name ) ); |
|
480 | + $var_name = ucwords(str_replace('$', '', $var_name)); |
|
481 | + $is_method = method_exists($var_name, $var); |
|
482 | + $var_name = ucwords(str_replace('_', ' ', $var_name)); |
|
483 | 483 | $heading_tag = is_int($heading_tag) ? "h{$heading_tag}" : "h5"; |
484 | 484 | $result = EEH_Debug_Tools::heading($var_name, $heading_tag, $margin); |
485 | 485 | $result .= $is_method |
486 | - ? \EEH_Debug_Tools::grey_span('::') . \EEH_Debug_Tools::orange_span($var . "()") |
|
487 | - : \EEH_Debug_Tools::grey_span(' : ') . \EEH_Debug_Tools::orange_span($var); |
|
486 | + ? \EEH_Debug_Tools::grey_span('::').\EEH_Debug_Tools::orange_span($var."()") |
|
487 | + : \EEH_Debug_Tools::grey_span(' : ').\EEH_Debug_Tools::orange_span($var); |
|
488 | 488 | $result .= \EEH_Debug_Tools::file_and_line($file, $line); |
489 | 489 | $result .= \EEH_Debug_Tools::headingx($heading_tag); |
490 | - if ( $die ) { |
|
491 | - die( $result ); |
|
490 | + if ($die) { |
|
491 | + die($result); |
|
492 | 492 | } else { |
493 | 493 | echo $result; |
494 | 494 | } |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | * @param string $margin |
503 | 503 | * @return string |
504 | 504 | */ |
505 | - protected static function heading( $var_name = '', $heading_tag = 'h5', $margin = '' ) { |
|
505 | + protected static function heading($var_name = '', $heading_tag = 'h5', $margin = '') { |
|
506 | 506 | if (defined('EE_TESTS_DIR')) { |
507 | 507 | return "\n\n{$var_name}"; |
508 | 508 | } |
@@ -515,11 +515,11 @@ discard block |
||
515 | 515 | * @param string $heading_tag |
516 | 516 | * @return string |
517 | 517 | */ |
518 | - protected static function headingx( $heading_tag = 'h5' ) { |
|
518 | + protected static function headingx($heading_tag = 'h5') { |
|
519 | 519 | if (defined('EE_TESTS_DIR')) { |
520 | 520 | return "\n"; |
521 | 521 | } |
522 | - return '</' . $heading_tag . '>'; |
|
522 | + return '</'.$heading_tag.'>'; |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | |
@@ -528,11 +528,11 @@ discard block |
||
528 | 528 | * @param string $content |
529 | 529 | * @return string |
530 | 530 | */ |
531 | - protected static function grey_span( $content = '' ) { |
|
531 | + protected static function grey_span($content = '') { |
|
532 | 532 | if (defined('EE_TESTS_DIR')) { |
533 | 533 | return $content; |
534 | 534 | } |
535 | - return '<span style="color:#999">' . $content . '</span>'; |
|
535 | + return '<span style="color:#999">'.$content.'</span>'; |
|
536 | 536 | } |
537 | 537 | |
538 | 538 | |
@@ -544,9 +544,9 @@ discard block |
||
544 | 544 | */ |
545 | 545 | protected static function file_and_line($file, $line) { |
546 | 546 | if (defined('EE_TESTS_DIR')) { |
547 | - return "\n (" . $file . ' line no: ' . $line . ' ) '; |
|
547 | + return "\n (".$file.' line no: '.$line.' ) '; |
|
548 | 548 | } |
549 | - return '<br /><span style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;">' . $file . '<br />line no: ' . $line . '</span>'; |
|
549 | + return '<br /><span style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;">'.$file.'<br />line no: '.$line.'</span>'; |
|
550 | 550 | } |
551 | 551 | |
552 | 552 | |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | if (defined('EE_TESTS_DIR')) { |
561 | 561 | return $content; |
562 | 562 | } |
563 | - return '<span style="color:#E76700">' . $content . '</span>'; |
|
563 | + return '<span style="color:#E76700">'.$content.'</span>'; |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | |
@@ -575,9 +575,9 @@ discard block |
||
575 | 575 | var_dump($var); |
576 | 576 | $var = ob_get_clean(); |
577 | 577 | if (defined('EE_TESTS_DIR')) { |
578 | - return "\n" . $var; |
|
578 | + return "\n".$var; |
|
579 | 579 | } |
580 | - return '<pre style="color:#999; padding:1em; background: #fff">' . $var . '</pre>'; |
|
580 | + return '<pre style="color:#999; padding:1em; background: #fff">'.$var.'</pre>'; |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | |
@@ -590,35 +590,35 @@ discard block |
||
590 | 590 | * @param int $heading_tag |
591 | 591 | * @param bool $die |
592 | 592 | */ |
593 | - public static function printr( $var, $var_name = '', $file = __FILE__, $line = __LINE__, $heading_tag = 5, $die = false ) { |
|
593 | + public static function printr($var, $var_name = '', $file = __FILE__, $line = __LINE__, $heading_tag = 5, $die = false) { |
|
594 | 594 | // return; |
595 | - $file = str_replace( rtrim( ABSPATH, '\\/' ), '', $file ); |
|
595 | + $file = str_replace(rtrim(ABSPATH, '\\/'), '', $file); |
|
596 | 596 | $margin = is_admin() ? ' 180px' : '0'; |
597 | 597 | //$print_r = false; |
598 | - if ( is_string( $var ) ) { |
|
599 | - EEH_Debug_Tools::printv( $var, $var_name, $file, $line, $heading_tag, $die, $margin ); |
|
598 | + if (is_string($var)) { |
|
599 | + EEH_Debug_Tools::printv($var, $var_name, $file, $line, $heading_tag, $die, $margin); |
|
600 | 600 | return; |
601 | - } else if ( is_object( $var ) ) { |
|
601 | + } else if (is_object($var)) { |
|
602 | 602 | $var_name = ! $var_name ? 'object' : $var_name; |
603 | 603 | //$print_r = true; |
604 | - } else if ( is_array( $var ) ) { |
|
604 | + } else if (is_array($var)) { |
|
605 | 605 | $var_name = ! $var_name ? 'array' : $var_name; |
606 | 606 | //$print_r = true; |
607 | - } else if ( is_numeric( $var ) ) { |
|
607 | + } else if (is_numeric($var)) { |
|
608 | 608 | $var_name = ! $var_name ? 'numeric' : $var_name; |
609 | - } else if ( is_null( $var ) ) { |
|
609 | + } else if (is_null($var)) { |
|
610 | 610 | $var_name = ! $var_name ? 'null' : $var_name; |
611 | 611 | } |
612 | - $var_name = ucwords( str_replace( array( '$', '_' ), array( '', ' ' ), $var_name ) ); |
|
612 | + $var_name = ucwords(str_replace(array('$', '_'), array('', ' '), $var_name)); |
|
613 | 613 | $heading_tag = is_int($heading_tag) ? "h{$heading_tag}" : "h5"; |
614 | 614 | $result = EEH_Debug_Tools::heading($var_name, $heading_tag, $margin); |
615 | - $result .= \EEH_Debug_Tools::grey_span(' : ') . \EEH_Debug_Tools::orange_span( |
|
615 | + $result .= \EEH_Debug_Tools::grey_span(' : ').\EEH_Debug_Tools::orange_span( |
|
616 | 616 | \EEH_Debug_Tools::pre_span($var) |
617 | 617 | ); |
618 | 618 | $result .= \EEH_Debug_Tools::file_and_line($file, $line); |
619 | 619 | $result .= \EEH_Debug_Tools::headingx($heading_tag); |
620 | - if ( $die ) { |
|
621 | - die( $result ); |
|
620 | + if ($die) { |
|
621 | + die($result); |
|
622 | 622 | } else { |
623 | 623 | echo $result; |
624 | 624 | } |
@@ -635,8 +635,8 @@ discard block |
||
635 | 635 | * borrowed from Kint Debugger |
636 | 636 | * Plugin URI: http://upthemes.com/plugins/kint-debugger/ |
637 | 637 | */ |
638 | -if ( class_exists('Kint') && ! function_exists( 'dump_wp_query' ) ) { |
|
639 | - function dump_wp_query(){ |
|
638 | +if (class_exists('Kint') && ! function_exists('dump_wp_query')) { |
|
639 | + function dump_wp_query() { |
|
640 | 640 | global $wp_query; |
641 | 641 | d($wp_query); |
642 | 642 | } |
@@ -646,8 +646,8 @@ discard block |
||
646 | 646 | * borrowed from Kint Debugger |
647 | 647 | * Plugin URI: http://upthemes.com/plugins/kint-debugger/ |
648 | 648 | */ |
649 | -if ( class_exists('Kint') && ! function_exists( 'dump_wp' ) ) { |
|
650 | - function dump_wp(){ |
|
649 | +if (class_exists('Kint') && ! function_exists('dump_wp')) { |
|
650 | + function dump_wp() { |
|
651 | 651 | global $wp; |
652 | 652 | d($wp); |
653 | 653 | } |
@@ -657,8 +657,8 @@ discard block |
||
657 | 657 | * borrowed from Kint Debugger |
658 | 658 | * Plugin URI: http://upthemes.com/plugins/kint-debugger/ |
659 | 659 | */ |
660 | -if ( class_exists('Kint') && ! function_exists( 'dump_post' ) ) { |
|
661 | - function dump_post(){ |
|
660 | +if (class_exists('Kint') && ! function_exists('dump_post')) { |
|
661 | + function dump_post() { |
|
662 | 662 | global $post; |
663 | 663 | d($post); |
664 | 664 | } |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | * @since 4.8.35.rc.001 |
16 | 16 | * |
17 | 17 | */ |
18 | -if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
19 | - exit( 'No direct script access allowed' ); |
|
18 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
19 | + exit('No direct script access allowed'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | class Calculated_Model_Fields { |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * the WP_Request object, |
39 | 39 | * the controller object |
40 | 40 | */ |
41 | - public function mapping( $refresh = false ) { |
|
42 | - if( ! $this->_mapping || $refresh ) { |
|
41 | + public function mapping($refresh = false) { |
|
42 | + if ( ! $this->_mapping || $refresh) { |
|
43 | 43 | $this->_mapping = $this->_generate_new_mapping(); |
44 | 44 | } |
45 | 45 | return $this->_mapping; |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | */ |
53 | 53 | protected function _generate_new_mapping() { |
54 | 54 | $rest_api_calculations_namespace = 'EventEspresso\core\libraries\rest_api\calculations\\'; |
55 | - $event_calculations_class = $rest_api_calculations_namespace . 'Event'; |
|
56 | - $datetime_calculations_class = $rest_api_calculations_namespace . 'Datetime'; |
|
57 | - $registration_class = $rest_api_calculations_namespace . 'Registration'; |
|
55 | + $event_calculations_class = $rest_api_calculations_namespace.'Event'; |
|
56 | + $datetime_calculations_class = $rest_api_calculations_namespace.'Datetime'; |
|
57 | + $registration_class = $rest_api_calculations_namespace.'Registration'; |
|
58 | 58 | return apply_filters( |
59 | 59 | 'FHEE__EventEspresso\core\libraries\rest_api\Calculated_Model_Fields__mapping', |
60 | 60 | array( |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | * @param \EEM_Base $model |
92 | 92 | * @return array allowable values for this field |
93 | 93 | */ |
94 | - public function retrieve_calculated_fields_for_model( \EEM_Base $model ) { |
|
94 | + public function retrieve_calculated_fields_for_model(\EEM_Base $model) { |
|
95 | 95 | $mapping = $this->mapping(); |
96 | - if( isset( $mapping[ $model->get_this_model_name() ] ) ) { |
|
97 | - return array_keys( $mapping[ $model->get_this_model_name() ] ); |
|
96 | + if (isset($mapping[$model->get_this_model_name()])) { |
|
97 | + return array_keys($mapping[$model->get_this_model_name()]); |
|
98 | 98 | } else { |
99 | 99 | return array(); |
100 | 100 | } |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | * @return mixed|null |
114 | 114 | * @throws \EE_Error |
115 | 115 | */ |
116 | - public function retrieve_calculated_field_value( \EEM_Base $model, $field_name, $wpdb_row, $rest_request, Base $controller ) { |
|
116 | + public function retrieve_calculated_field_value(\EEM_Base $model, $field_name, $wpdb_row, $rest_request, Base $controller) { |
|
117 | 117 | $mapping = $this->mapping(); |
118 | - if( isset( $mapping[ $model->get_this_model_name() ] ) |
|
119 | - && isset( $mapping[ $model->get_this_model_name() ][ $field_name ] ) ) { |
|
120 | - $classname = $mapping[ $model->get_this_model_name() ][ $field_name ]; |
|
121 | - return call_user_func( array( $classname, $field_name ), $wpdb_row, $rest_request, $controller ); |
|
118 | + if (isset($mapping[$model->get_this_model_name()]) |
|
119 | + && isset($mapping[$model->get_this_model_name()][$field_name])) { |
|
120 | + $classname = $mapping[$model->get_this_model_name()][$field_name]; |
|
121 | + return call_user_func(array($classname, $field_name), $wpdb_row, $rest_request, $controller); |
|
122 | 122 | } |
123 | 123 | throw new Rest_Exception( |
124 | 124 | 'calculated_field_does_not_exist', |
125 | 125 | sprintf( |
126 | - __( 'There is no calculated field %1$s on resource %2$s', 'event_espresso' ), |
|
126 | + __('There is no calculated field %1$s on resource %2$s', 'event_espresso'), |
|
127 | 127 | $field_name, |
128 | 128 | $model->get_this_model_name() |
129 | 129 | ) |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | * @since $VID:$ |
16 | 16 | * |
17 | 17 | */ |
18 | -if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
19 | - exit( 'No direct script access allowed' ); |
|
18 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
19 | + exit('No direct script access allowed'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | class Registration extends Calculations_Base { |
@@ -30,19 +30,19 @@ discard block |
||
30 | 30 | * @return int |
31 | 31 | * @throws \EE_Error |
32 | 32 | */ |
33 | - public static function datetime_checkin_stati( $wpdb_row, $request, $controller ){ |
|
34 | - if( is_array( $wpdb_row ) && isset( $wpdb_row[ 'Registration.REG_ID' ] ) ) { |
|
35 | - $reg = \EEM_Registration::instance()->get_one_by_ID( $wpdb_row[ 'Registration.REG_ID' ] ); |
|
33 | + public static function datetime_checkin_stati($wpdb_row, $request, $controller) { |
|
34 | + if (is_array($wpdb_row) && isset($wpdb_row['Registration.REG_ID'])) { |
|
35 | + $reg = \EEM_Registration::instance()->get_one_by_ID($wpdb_row['Registration.REG_ID']); |
|
36 | 36 | } else { |
37 | 37 | $reg = null; |
38 | 38 | } |
39 | - if( ! $reg instanceof \EE_Registration |
|
39 | + if ( ! $reg instanceof \EE_Registration |
|
40 | 40 | ) { |
41 | 41 | throw new \EE_Error( |
42 | 42 | sprintf( |
43 | - __( 'Cannot calculate datetime_checkin_stati because the registration with ID %1$s (from database row %2$s) was not found', 'event_espresso' ), |
|
44 | - $wpdb_row[ 'Registration.REG_ID' ], |
|
45 | - print_r( $wpdb_row, true ) |
|
43 | + __('Cannot calculate datetime_checkin_stati because the registration with ID %1$s (from database row %2$s) was not found', 'event_espresso'), |
|
44 | + $wpdb_row['Registration.REG_ID'], |
|
45 | + print_r($wpdb_row, true) |
|
46 | 46 | ) |
47 | 47 | ); |
48 | 48 | } |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | ) |
55 | 55 | ); |
56 | 56 | $checkin_stati = array(); |
57 | - foreach( $datetime_ids as $datetime_id ) { |
|
58 | - $status = $reg->check_in_status_for_datetime( $datetime_id ); |
|
59 | - switch( $status ) { |
|
57 | + foreach ($datetime_ids as $datetime_id) { |
|
58 | + $status = $reg->check_in_status_for_datetime($datetime_id); |
|
59 | + switch ($status) { |
|
60 | 60 | case \EE_Registration::checkin_status_out: |
61 | 61 | $status_pretty = 'OUT'; |
62 | 62 | break; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $status_pretty = 'NEVER'; |
69 | 69 | break; |
70 | 70 | } |
71 | - $checkin_stati[ $datetime_id ] = $status_pretty; |
|
71 | + $checkin_stati[$datetime_id] = $status_pretty; |
|
72 | 72 | } |
73 | 73 | return $checkin_stati; |
74 | 74 | } |
@@ -74,6 +74,7 @@ |
||
74 | 74 | * [ee_tep_not_null description] |
75 | 75 | * |
76 | 76 | * @param string | array $value [description] |
77 | + * @param string $value |
|
77 | 78 | * @return bool [description] |
78 | 79 | */ |
79 | 80 | static public function ee_tep_not_null( $value ) { |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'NO direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * @param string $content content to format |
27 | 27 | * @return string formatted content |
28 | 28 | */ |
29 | - static public function admin_format_content( $content = '' ) { |
|
30 | - return wpautop( stripslashes_deep( html_entity_decode( $content, ENT_QUOTES, "UTF-8" ) ) ); |
|
29 | + static public function admin_format_content($content = '') { |
|
30 | + return wpautop(stripslashes_deep(html_entity_decode($content, ENT_QUOTES, "UTF-8"))); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | * @param boolean $protected true then we run htmlspecialchars and return |
44 | 44 | * @return string |
45 | 45 | */ |
46 | - static public function ee_tep_output_string( $string, $translate = false, $protected = false ) { |
|
47 | - if ( $protected === true ) { |
|
48 | - return htmlspecialchars( $string ); |
|
46 | + static public function ee_tep_output_string($string, $translate = false, $protected = false) { |
|
47 | + if ($protected === true) { |
|
48 | + return htmlspecialchars($string); |
|
49 | 49 | } else { |
50 | - if ( $translate === false ) { |
|
51 | - return self::ee_tep_parse_input_field_data( $string, array( '"' => '"' ) ); |
|
50 | + if ($translate === false) { |
|
51 | + return self::ee_tep_parse_input_field_data($string, array('"' => '"')); |
|
52 | 52 | } else { |
53 | - return self::ee_tep_parse_input_field_data( $string, $translate ); |
|
53 | + return self::ee_tep_parse_input_field_data($string, $translate); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | * @param array ] $parse array in the form array( 'from' => 'to', ... ) |
65 | 65 | * @return string |
66 | 66 | */ |
67 | - static public function ee_tep_parse_input_field_data( $data, $parse ) { |
|
68 | - return strtr( trim( $data ), $parse ); |
|
67 | + static public function ee_tep_parse_input_field_data($data, $parse) { |
|
68 | + return strtr(trim($data), $parse); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -76,15 +76,15 @@ discard block |
||
76 | 76 | * @param string | array $value [description] |
77 | 77 | * @return bool [description] |
78 | 78 | */ |
79 | - static public function ee_tep_not_null( $value ) { |
|
80 | - if ( is_array( $value ) ) { |
|
81 | - if ( count( $value ) > 0 ) { |
|
79 | + static public function ee_tep_not_null($value) { |
|
80 | + if (is_array($value)) { |
|
81 | + if (count($value) > 0) { |
|
82 | 82 | return true; |
83 | 83 | } else { |
84 | 84 | return false; |
85 | 85 | } |
86 | 86 | } else { |
87 | - if ( ( $value !== '' ) && ( strtolower( $value ) !== 'null' ) && ( strlen( trim( $value ) ) > 0 ) ) { |
|
87 | + if (($value !== '') && (strtolower($value) !== 'null') && (strlen(trim($value)) > 0)) { |
|
88 | 88 | return true; |
89 | 89 | } else { |
90 | 90 | return false; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @return string |
105 | 105 | * @deprecated v4.6.21 |
106 | 106 | */ |
107 | - static public function event_date_display( $date, $format = '' ) { |
|
107 | + static public function event_date_display($date, $format = '') { |
|
108 | 108 | EE_Error::doing_it_wrong( |
109 | 109 | __METHOD__, |
110 | 110 | __( |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | -add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' ); |
|
2 | +add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
3 | 3 | $values = EEH_Form_Fields::prep_answer_options( |
4 | 4 | array( |
5 | - array( 'id' => 1, 'text' => __( 'Yes', 'event_espresso' ) ), |
|
6 | - array( 'id' => 0, 'text' => __( 'No', 'event_espresso' ) ) |
|
5 | + array('id' => 1, 'text' => __('Yes', 'event_espresso')), |
|
6 | + array('id' => 0, 'text' => __('No', 'event_espresso')) |
|
7 | 7 | ) |
8 | 8 | ); |
9 | 9 | ?> |
@@ -22,27 +22,27 @@ discard block |
||
22 | 22 | </label> |
23 | 23 | </th> |
24 | 24 | <td> |
25 | - <?php echo EEH_Form_Fields::select( 'display_status_banner_single', $display_status_banner_single, $values, 'display_status_banner_single', 'display_status_banner_single' ); ?> |
|
26 | - <p class="description"><?php _e( 'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the single event page.', 'event_espresso' ); ?></p> |
|
25 | + <?php echo EEH_Form_Fields::select('display_status_banner_single', $display_status_banner_single, $values, 'display_status_banner_single', 'display_status_banner_single'); ?> |
|
26 | + <p class="description"><?php _e('Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the single event page.', 'event_espresso'); ?></p> |
|
27 | 27 | </td> |
28 | 28 | </tr> |
29 | 29 | |
30 | 30 | <tr> |
31 | 31 | <th> |
32 | 32 | <label for="display_venue"> |
33 | - <?php _e( 'Display Venue Details', 'event_espresso' ); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info');?> |
|
33 | + <?php _e('Display Venue Details', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info'); ?> |
|
34 | 34 | </label> |
35 | 35 | </th> |
36 | 36 | <td> |
37 | - <?php echo EEH_Form_Fields::select( 'display_venue', $display_venue, $values, 'display_venue', 'display_venue' ); ?> |
|
38 | - <p class="description"><?php _e( 'Do not use this if you are using the venue shortcodes in your event description.', 'event_espresso' ); ?></p> |
|
37 | + <?php echo EEH_Form_Fields::select('display_venue', $display_venue, $values, 'display_venue', 'display_venue'); ?> |
|
38 | + <p class="description"><?php _e('Do not use this if you are using the venue shortcodes in your event description.', 'event_espresso'); ?></p> |
|
39 | 39 | </td> |
40 | 40 | </tr> |
41 | 41 | |
42 | 42 | <tr> |
43 | 43 | <th> |
44 | 44 | <label for="EED_Events_Single_use_sortable_display_order"> |
45 | - <?php _e( 'Use Custom Display Order?', 'event_espresso' ); ?> |
|
45 | + <?php _e('Use Custom Display Order?', 'event_espresso'); ?> |
|
46 | 46 | </label> |
47 | 47 | </th> |
48 | 48 | <td> |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | <p class="description "> |
59 | 59 | <?php |
60 | 60 | echo sprintf( |
61 | - __( '%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Single page display, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso' ), |
|
61 | + __('%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Single page display, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso'), |
|
62 | 62 | '<span class="important-notice">', |
63 | 63 | '</span>', |
64 | 64 | '<br />' |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | |
71 | 71 | <tr> |
72 | 72 | <th> |
73 | - <?php _e('Display Order', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info');?> |
|
73 | + <?php _e('Display Order', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info'); ?> |
|
74 | 74 | </th> |
75 | 75 | <td> |
76 | 76 | |
77 | - <?php wp_nonce_field( 'espresso_update_event_single_order', 'espresso_update_event_single_order_nonce', false ); ?> |
|
77 | + <?php wp_nonce_field('espresso_update_event_single_order', 'espresso_update_event_single_order_nonce', false); ?> |
|
78 | 78 | <?php echo $event_single_display_order; ?> |
79 | 79 | |
80 | 80 | <p class="description"><?php _e('Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the single event page.', 'event_espresso'); ?></p> |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | -add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' ); |
|
2 | +add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
3 | 3 | |
4 | -$values = EEH_Form_Fields::prep_answer_options( array( |
|
5 | - array( 'id' => 1, 'text' => __('Yes', 'event_espresso')), |
|
6 | - array( 'id' => 0, 'text' => __('No', 'event_espresso')) |
|
4 | +$values = EEH_Form_Fields::prep_answer_options(array( |
|
5 | + array('id' => 1, 'text' => __('Yes', 'event_espresso')), |
|
6 | + array('id' => 0, 'text' => __('No', 'event_espresso')) |
|
7 | 7 | )); |
8 | 8 | |
9 | -$description = EEH_Form_Fields::prep_answer_options( array( |
|
10 | - array( 'id' => 0, 'text' => __('none', 'event_espresso')), |
|
11 | - array( 'id' => 1, 'text' => __('excerpt (short desc)', 'event_espresso')), |
|
12 | - array( 'id' => 2, 'text' => __('full description', 'event_espresso')) |
|
9 | +$description = EEH_Form_Fields::prep_answer_options(array( |
|
10 | + array('id' => 0, 'text' => __('none', 'event_espresso')), |
|
11 | + array('id' => 1, 'text' => __('excerpt (short desc)', 'event_espresso')), |
|
12 | + array('id' => 2, 'text' => __('full description', 'event_espresso')) |
|
13 | 13 | )); |
14 | 14 | |
15 | 15 | ?> |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | <tr> |
28 | 28 | <th> |
29 | 29 | <label for="event_listings_url"> |
30 | - <?php _e('Event Listings URL', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('event_listings_url_info');?> |
|
30 | + <?php _e('Event Listings URL', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('event_listings_url_info'); ?> |
|
31 | 31 | </label> |
32 | 32 | </th> |
33 | 33 | <td> |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | </label> |
43 | 43 | </th> |
44 | 44 | <td> |
45 | - <p><?php echo site_url() . '/ ' . EEH_Form_Fields::text( 'not_used', EE_Registry::instance()->CFG->core->event_cpt_slug, 'event_cpt_slug', 'event_cpt_slug', 'regular' ); ?></p> |
|
45 | + <p><?php echo site_url().'/ '.EEH_Form_Fields::text('not_used', EE_Registry::instance()->CFG->core->event_cpt_slug, 'event_cpt_slug', 'event_cpt_slug', 'regular'); ?></p> |
|
46 | 46 | <p class="description"><?php _e('This allows you to configure what slug is used for the url of all event pages.', 'event_espresso'); ?></p> |
47 | - <?php if ( has_filter( 'FHEE__EE_Register_CPTs__register_CPT__rewrite' ) ) : ?> |
|
47 | + <?php if (has_filter('FHEE__EE_Register_CPTs__register_CPT__rewrite')) : ?> |
|
48 | 48 | <p class="important-notice"> |
49 | 49 | <?php |
50 | 50 | sprintf( |
51 | - __( 'Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected. Please be aware that while this filter is being used, this setting has no affect.', 'event_espresso' ), |
|
51 | + __('Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected. Please be aware that while this filter is being used, this setting has no affect.', 'event_espresso'), |
|
52 | 52 | '<code>', |
53 | 53 | '</code>' |
54 | 54 | ); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | </label> |
66 | 66 | </th> |
67 | 67 | <td> |
68 | - <?php echo EEH_Form_Fields::select( 'display_status_banner', $display_status_banner, $values, 'EED_Events_Archive_display_status_banner', 'EED_Events_Archive_display_status_banner' );?> |
|
68 | + <?php echo EEH_Form_Fields::select('display_status_banner', $display_status_banner, $values, 'EED_Events_Archive_display_status_banner', 'EED_Events_Archive_display_status_banner'); ?> |
|
69 | 69 | <p class="description"><?php _e('Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the events archive page.', 'event_espresso'); ?></p> |
70 | 70 | </td> |
71 | 71 | </tr> |
@@ -73,55 +73,55 @@ discard block |
||
73 | 73 | <tr> |
74 | 74 | <th> |
75 | 75 | <label for="EED_Events_Archive_display_description"> |
76 | - <?php _e('Display Description', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_description_info');?> |
|
76 | + <?php _e('Display Description', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_description_info'); ?> |
|
77 | 77 | </label> |
78 | 78 | </th> |
79 | 79 | <td> |
80 | - <?php echo EEH_Form_Fields::select( 'description', $display_description, $description, 'EED_Events_Archive_display_description', 'EED_Events_Archive_display_description' );?> |
|
80 | + <?php echo EEH_Form_Fields::select('description', $display_description, $description, 'EED_Events_Archive_display_description', 'EED_Events_Archive_display_description'); ?> |
|
81 | 81 | </td> |
82 | 82 | </tr> |
83 | 83 | |
84 | 84 | <tr> |
85 | 85 | <th> |
86 | 86 | <label for="EED_Events_Archive_display_ticket_selector"> |
87 | - <?php _e('Display Ticket Selector', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_ticket_selector_info');?> |
|
87 | + <?php _e('Display Ticket Selector', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_ticket_selector_info'); ?> |
|
88 | 88 | </label> |
89 | 89 | </th> |
90 | 90 | <td> |
91 | - <?php echo EEH_Form_Fields::select( 'ticket_selector', $display_ticket_selector, $values, 'EED_Events_Archive_display_ticket_selector', 'EED_Events_Archive_display_ticket_selector' );?> |
|
91 | + <?php echo EEH_Form_Fields::select('ticket_selector', $display_ticket_selector, $values, 'EED_Events_Archive_display_ticket_selector', 'EED_Events_Archive_display_ticket_selector'); ?> |
|
92 | 92 | </td> |
93 | 93 | </tr> |
94 | 94 | |
95 | 95 | <tr> |
96 | 96 | <th> |
97 | 97 | <label for="EED_Events_Archive_display_datetimes"> |
98 | - <?php _e('Display Datetimes', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_datetimes_info');?> |
|
98 | + <?php _e('Display Datetimes', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_datetimes_info'); ?> |
|
99 | 99 | </label> |
100 | 100 | </th> |
101 | 101 | <td> |
102 | - <?php echo EEH_Form_Fields::select( 'venue_details', $display_datetimes, $values, 'EED_Events_Archive_display_datetimes', 'EED_Events_Archive_display_datetimes' );?> |
|
102 | + <?php echo EEH_Form_Fields::select('venue_details', $display_datetimes, $values, 'EED_Events_Archive_display_datetimes', 'EED_Events_Archive_display_datetimes'); ?> |
|
103 | 103 | </td> |
104 | 104 | </tr> |
105 | 105 | |
106 | 106 | <tr> |
107 | 107 | <th> |
108 | 108 | <label for="EED_Events_Archive_display_venue"> |
109 | - <?php _e('Display Venue Details', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_venue_details_info');?> |
|
109 | + <?php _e('Display Venue Details', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_venue_details_info'); ?> |
|
110 | 110 | </label> |
111 | 111 | </th> |
112 | 112 | <td> |
113 | - <?php echo EEH_Form_Fields::select( 'display_venue', $display_venue, $values, 'EED_Events_Archive_display_venue', 'EED_Events_Archive_display_venue' );?> |
|
113 | + <?php echo EEH_Form_Fields::select('display_venue', $display_venue, $values, 'EED_Events_Archive_display_venue', 'EED_Events_Archive_display_venue'); ?> |
|
114 | 114 | </td> |
115 | 115 | </tr> |
116 | 116 | |
117 | 117 | <tr> |
118 | 118 | <th> |
119 | 119 | <label for="EED_Events_Archive_display_expired_events"> |
120 | - <?php _e('Display Expired Events', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_expired_events_info');?> |
|
120 | + <?php _e('Display Expired Events', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_expired_events_info'); ?> |
|
121 | 121 | </label> |
122 | 122 | </th> |
123 | 123 | <td> |
124 | - <?php echo EEH_Form_Fields::select( 'expired_events', $display_expired_events, $values, 'EED_Events_Archive_display_expired_events', 'EED_Events_Archive_display_expired_events' );?> |
|
124 | + <?php echo EEH_Form_Fields::select('expired_events', $display_expired_events, $values, 'EED_Events_Archive_display_expired_events', 'EED_Events_Archive_display_expired_events'); ?> |
|
125 | 125 | </td> |
126 | 126 | </tr> |
127 | 127 | |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | </label> |
133 | 133 | </th> |
134 | 134 | <td> |
135 | - <?php echo EEH_Form_Fields::select( 'use_sortable_display_order', $use_sortable_display_order, $values, 'EED_Events_Archive_use_sortable_display_order', 'EED_Events_Archive_use_sortable_display_order' );?> |
|
135 | + <?php echo EEH_Form_Fields::select('use_sortable_display_order', $use_sortable_display_order, $values, 'EED_Events_Archive_use_sortable_display_order', 'EED_Events_Archive_use_sortable_display_order'); ?> |
|
136 | 136 | <p class="description "> |
137 | 137 | <?php |
138 | 138 | echo sprintf( |
139 | - __( '%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Archive listings, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso' ), |
|
139 | + __('%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Archive listings, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso'), |
|
140 | 140 | '<span class="important-notice">', |
141 | 141 | '</span>', |
142 | 142 | '<br />' |
@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | |
149 | 149 | <tr> |
150 | 150 | <th> |
151 | - <?php _e( 'Display Order', 'event_espresso' ); ?><?php //echo EEH_Template::get_help_tab_link( 'event_archive_order_info' ); ?> |
|
151 | + <?php _e('Display Order', 'event_espresso'); ?><?php //echo EEH_Template::get_help_tab_link( 'event_archive_order_info' ); ?> |
|
152 | 152 | </th> |
153 | 153 | <td> |
154 | 154 | |
155 | - <?php wp_nonce_field( 'espresso_update_event_archive_order', 'espresso_update_event_archive_order_nonce', false ); ?> |
|
155 | + <?php wp_nonce_field('espresso_update_event_archive_order', 'espresso_update_event_archive_order_nonce', false); ?> |
|
156 | 156 | <?php echo $event_archive_display_order; ?> |
157 | 157 | |
158 | - <p class="description"><?php _e( 'Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.', 'event_espresso' ); ?></p> |
|
158 | + <p class="description"><?php _e('Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.', 'event_espresso'); ?></p> |
|
159 | 159 | |
160 | 160 | </td> |
161 | 161 | </tr> |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | <tr> |
164 | 164 | <th> |
165 | 165 | <label for="EED_Events_Archive_reset_event_list_settings"> |
166 | - <?php _e( 'Reset Event List Settings', 'event_espresso' ); ?> |
|
166 | + <?php _e('Reset Event List Settings', 'event_espresso'); ?> |
|
167 | 167 | </label> |
168 | 168 | </th> |
169 | 169 | <td> |
170 | - <?php echo EEH_Form_Fields::select( 'reset_event_list_settings', 0, $values, 'EED_Events_Archive_reset_event_list_settings', 'EED_Events_Archive_reset_event_list_settings' ); ?> |
|
170 | + <?php echo EEH_Form_Fields::select('reset_event_list_settings', 0, $values, 'EED_Events_Archive_reset_event_list_settings', 'EED_Events_Archive_reset_event_list_settings'); ?> |
|
171 | 171 | </td> |
172 | 172 | </tr> |
173 | 173 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * Just initializes the status of the migration |
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | - $this->_pretty_name = __( 'Update Invoice Settings', 'event_espresso' ); |
|
30 | + $this->_pretty_name = __('Update Invoice Settings', 'event_espresso'); |
|
31 | 31 | parent::__construct(); |
32 | 32 | } |
33 | 33 | |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | * @throws EE_Error |
55 | 55 | * @return int number of items ACTUALLY migrated |
56 | 56 | */ |
57 | - protected function _migration_step( $num_items = 1 ){ |
|
57 | + protected function _migration_step($num_items = 1) { |
|
58 | 58 | |
59 | 59 | $templates_relative_path = 'modules/gateways/Invoice/lib/templates/'; |
60 | - $overridden_invoice_body = EEH_Template::locate_template( $templates_relative_path . 'invoice_body.template.php', NULL, FALSE, FALSE, TRUE ); |
|
61 | - $overridden_receipt_body= EEH_Template::locate_template( $templates_relative_path . 'receipt_body.template.php', NULL, FALSE, FALSE, TRUE ); |
|
62 | - if( $overridden_invoice_body || $overridden_receipt_body ) { |
|
63 | - EE_Error::add_persistent_admin_notice( 'invoice_overriding_templates', sprintf( __( 'Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overriden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents (but this will be removed in an upcoming version). We recommend deleting your old Invoice/Receipt templates and using the new messages system. Then modify the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.')), TRUE ); |
|
60 | + $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path.'invoice_body.template.php', NULL, FALSE, FALSE, TRUE); |
|
61 | + $overridden_receipt_body = EEH_Template::locate_template($templates_relative_path.'receipt_body.template.php', NULL, FALSE, FALSE, TRUE); |
|
62 | + if ($overridden_invoice_body || $overridden_receipt_body) { |
|
63 | + EE_Error::add_persistent_admin_notice('invoice_overriding_templates', sprintf(__('Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overriden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents (but this will be removed in an upcoming version). We recommend deleting your old Invoice/Receipt templates and using the new messages system. Then modify the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.')), TRUE); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | //regardless of whether it worked or not, we ought to continue the migration |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * |
4 | 4 | * EE_Billing_Info_Form |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Mike Nelson |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Billing_Info_Form extends EE_Form_Section_Proper{ |
|
14 | +class EE_Billing_Info_Form extends EE_Form_Section_Proper { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * The payment method this billing form is for |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | * @param EE_Payment_Method $payment_method |
27 | 27 | * @param array $options_array @see EE_Form_Section_Proper::__construct() |
28 | 28 | */ |
29 | - public function __construct( EE_Payment_Method $payment_method, $options_array= array()){ |
|
29 | + public function __construct(EE_Payment_Method $payment_method, $options_array = array()) { |
|
30 | 30 | $this->_pm_instance = $payment_method; |
31 | 31 | $this->_layout_strategy = new EE_Div_Per_Section_Layout(); |
32 | - parent::__construct( $options_array ); |
|
32 | + parent::__construct($options_array); |
|
33 | 33 | |
34 | 34 | } |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param EE_Payment_Method $payment_method |
41 | 41 | * @return void |
42 | 42 | */ |
43 | - public function set_payment_method( EE_Payment_Method $payment_method ){ |
|
43 | + public function set_payment_method(EE_Payment_Method $payment_method) { |
|
44 | 44 | $this->_pm_instance = $payment_method; |
45 | 45 | } |
46 | 46 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * Returns the instance of the payment method this billing form is for |
51 | 51 | * @return EE_Payment_Method |
52 | 52 | */ |
53 | - public function payment_method(){ |
|
53 | + public function payment_method() { |
|
54 | 54 | return $this->_pm_instance; |
55 | 55 | } |
56 | 56 | |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | * payment_fields_autofilled_notice_html |
61 | 61 | * @return string |
62 | 62 | */ |
63 | - public function payment_fields_autofilled_notice_html(){ |
|
63 | + public function payment_fields_autofilled_notice_html() { |
|
64 | 64 | return new EE_Form_Section_HTML( |
65 | 65 | EEH_HTML::p( |
66 | - apply_filters( 'FHEE__EE_Billing_Info_Form__payment_fields_autofilled_notice_html_text', __( 'Payment fields have been autofilled because you are in debug mode', 'event_espresso' )), |
|
66 | + apply_filters('FHEE__EE_Billing_Info_Form__payment_fields_autofilled_notice_html_text', __('Payment fields have been autofilled because you are in debug mode', 'event_espresso')), |
|
67 | 67 | '', |
68 | 68 | 'important-notice' |
69 | 69 | ) |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | /** |
76 | 76 | * @return string |
77 | 77 | */ |
78 | - public function html_class(){ |
|
79 | - return ! empty( $this->_html_class ) ? $this->_html_class . ' ee-billing-form' : 'ee-billing-form'; |
|
78 | + public function html_class() { |
|
79 | + return ! empty($this->_html_class) ? $this->_html_class.' ee-billing-form' : 'ee-billing-form'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | //namespace EventEspresso\core\libraries\templates; |
3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
4 | - exit( 'No direct script access allowed' ); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | + exit('No direct script access allowed'); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | |
@@ -70,23 +70,23 @@ discard block |
||
70 | 70 | * @param string $template - name or path of template to be used by EEH_Template::locate_template() |
71 | 71 | * @param int $priority - order in which template parts should be applied |
72 | 72 | */ |
73 | - public function add_template_part( $name, $label, $template, $priority ) { |
|
73 | + public function add_template_part($name, $label, $template, $priority) { |
|
74 | 74 | // SplPriorityQueue doesn't play nice with multiple items having the same priority |
75 | 75 | // so if the incoming priority is already occupied, then let's increment it by one, |
76 | 76 | // and then pass everything back into this method and try again with the new priority |
77 | - if ( isset( $this->priorities[ $priority ] ) ) { |
|
77 | + if (isset($this->priorities[$priority])) { |
|
78 | 78 | $priority++; |
79 | - $this->add_template_part( $name, $label, $template, $priority ); |
|
79 | + $this->add_template_part($name, $label, $template, $priority); |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | // kk now we can mark this priority as being occupied |
83 | - $this->priorities[ $priority ] = true; |
|
83 | + $this->priorities[$priority] = true; |
|
84 | 84 | // create the template part and add to the queue |
85 | 85 | $this->template_parts->insert( |
86 | - new EE_Template_Part( $name, $label, $template, $priority ), |
|
86 | + new EE_Template_Part($name, $label, $template, $priority), |
|
87 | 87 | $priority |
88 | 88 | ); |
89 | - if ( $name == 'event' ) { |
|
89 | + if ($name == 'event') { |
|
90 | 90 | $this->event_desc_priority = $priority; |
91 | 91 | } |
92 | 92 | } |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | * @param string $content |
104 | 104 | * @return string |
105 | 105 | */ |
106 | - public function apply_template_part_filters( $content = '' ) { |
|
106 | + public function apply_template_part_filters($content = '') { |
|
107 | 107 | $this->template_parts->rewind(); |
108 | 108 | // loop through template parts and position content |
109 | - while ( $this->template_parts->valid() ) { |
|
109 | + while ($this->template_parts->valid()) { |
|
110 | 110 | $this->_position_template_part( |
111 | 111 | $content, |
112 | 112 | $this->template_parts->current()->template(), |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $this->template_parts->next(); |
116 | 116 | } |
117 | 117 | // now simply add our three strings of content together |
118 | - return $this->before_event_content . $this->event_content . $this->after_event_content; |
|
118 | + return $this->before_event_content.$this->event_content.$this->after_event_content; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -136,16 +136,16 @@ discard block |
||
136 | 136 | * @param int $priority |
137 | 137 | * @return string |
138 | 138 | */ |
139 | - protected function _position_template_part( $content, $template, $priority ) { |
|
139 | + protected function _position_template_part($content, $template, $priority) { |
|
140 | 140 | // Event Description content is the actual incoming content itself |
141 | - if ( $priority === $this->event_desc_priority ) { |
|
141 | + if ($priority === $this->event_desc_priority) { |
|
142 | 142 | $this->event_content = $content; |
143 | - } else if ( $priority < $this->event_desc_priority ) { |
|
143 | + } else if ($priority < $this->event_desc_priority) { |
|
144 | 144 | // everything BEFORE the Event Description |
145 | - $this->before_event_content .= EEH_Template::locate_template( $template ); |
|
146 | - } else if ( $priority > $this->event_desc_priority ) { |
|
145 | + $this->before_event_content .= EEH_Template::locate_template($template); |
|
146 | + } else if ($priority > $this->event_desc_priority) { |
|
147 | 147 | // everything AFTER the Event Description |
148 | - $this->after_event_content .= EEH_Template::locate_template( $template ); |
|
148 | + $this->after_event_content .= EEH_Template::locate_template($template); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
@@ -170,15 +170,15 @@ discard block |
||
170 | 170 | $list_item_css_class = '', |
171 | 171 | $list_item_css_id_prefix = '' |
172 | 172 | ) { |
173 | - $event_archive_display_order = EEH_HTML::ul( $list_css_id, $list_css_class ); |
|
173 | + $event_archive_display_order = EEH_HTML::ul($list_css_id, $list_css_class); |
|
174 | 174 | $this->template_parts->rewind(); |
175 | 175 | // loop through template parts and add template content |
176 | - while ( $this->template_parts->valid() ) { |
|
176 | + while ($this->template_parts->valid()) { |
|
177 | 177 | $event_archive_display_order .= EEH_HTML::li( |
178 | - EEH_HTML::span( '', '', 'dashicons dashicons-arrow-up-alt2' ) . |
|
179 | - EEH_HTML::span( '', '', 'dashicons dashicons-arrow-down-alt2' ) . |
|
178 | + EEH_HTML::span('', '', 'dashicons dashicons-arrow-up-alt2'). |
|
179 | + EEH_HTML::span('', '', 'dashicons dashicons-arrow-down-alt2'). |
|
180 | 180 | $this->template_parts->current()->label(), |
181 | - $list_item_css_id_prefix . $this->template_parts->current()->name(), |
|
181 | + $list_item_css_id_prefix.$this->template_parts->current()->name(), |
|
182 | 182 | $list_item_css_class |
183 | 183 | ); |
184 | 184 | $this->template_parts->next(); |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | * @return string |
199 | 199 | */ |
200 | 200 | public function display_template_parts() { |
201 | - if ( WP_DEBUG ) { |
|
201 | + if (WP_DEBUG) { |
|
202 | 202 | $this->template_parts->rewind(); |
203 | - while ( $this->template_parts->valid() ) { |
|
204 | - EEH_Debug_Tools::printr( $this->template_parts->current(), 'template_part', __FILE__, __LINE__ ); |
|
203 | + while ($this->template_parts->valid()) { |
|
204 | + EEH_Debug_Tools::printr($this->template_parts->current(), 'template_part', __FILE__, __LINE__); |
|
205 | 205 | $this->template_parts->next(); |
206 | 206 | } |
207 | 207 | } |