@@ -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 | /** |
@@ -32,30 +32,30 @@ discard block |
||
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | - public function __construct( $routing = TRUE ) { |
|
36 | - parent::__construct( $routing ); |
|
37 | - define( 'GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/' ); |
|
35 | + public function __construct($routing = TRUE) { |
|
36 | + parent::__construct($routing); |
|
37 | + define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'general_settings/templates/'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
41 | 41 | |
42 | 42 | protected function _extend_page_config() { |
43 | 43 | |
44 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings'; |
|
44 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'general_settings'; |
|
45 | 45 | |
46 | 46 | //filters and action hooks here |
47 | - add_action('AHEE__admin_option_settings__template__before', array( $this, 'use_venue_and_staff_manager_settings'), 10 ); |
|
48 | - add_action( 'AHEE__admin_option_settings__template__before', array( $this, 'debug_logging_options' ), 9 ); |
|
49 | - add_filter( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', array( $this, 'update_debug_logging_options' ), 10, 1 ); |
|
47 | + add_action('AHEE__admin_option_settings__template__before', array($this, 'use_venue_and_staff_manager_settings'), 10); |
|
48 | + add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9); |
|
49 | + add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', array($this, 'update_debug_logging_options'), 10, 1); |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
53 | 53 | |
54 | 54 | |
55 | - public function use_venue_and_staff_manager_settings( $template_args ) { |
|
56 | - $_args['use_personnel_manager_select'] = EEH_Form_Fields::select_input('use_personnel_manager', $template_args['values'], $template_args['use_personnel_manager'] ); |
|
57 | - $template = GEN_SET_CAF_TEMPLATE_PATH . 'use_venue_and_staff_manager_settings.template.php'; |
|
58 | - EEH_Template::display_template( $template, $_args ); |
|
55 | + public function use_venue_and_staff_manager_settings($template_args) { |
|
56 | + $_args['use_personnel_manager_select'] = EEH_Form_Fields::select_input('use_personnel_manager', $template_args['values'], $template_args['use_personnel_manager']); |
|
57 | + $template = GEN_SET_CAF_TEMPLATE_PATH.'use_venue_and_staff_manager_settings.template.php'; |
|
58 | + EEH_Template::display_template($template, $_args); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | * @param array $template_args |
69 | 69 | * @return void |
70 | 70 | */ |
71 | - public function debug_logging_options( $template_args = array() ) { |
|
71 | + public function debug_logging_options($template_args = array()) { |
|
72 | 72 | $template_args['use_full_logging'] = EE_Registry::instance()->CFG->admin->use_full_logging; |
73 | - $template_args['use_remote_logging'] = isset( EE_Registry::instance()->CFG->admin->use_remote_logging ) ? absint( EE_Registry::instance()->CFG->admin->use_remote_logging ) : FALSE; |
|
74 | - $template_args['remote_logging_url'] = isset( EE_Registry::instance()->CFG->admin->remote_logging_url ) && ! empty( EE_Registry::instance()->CFG->admin->remote_logging_url ) ? stripslashes( EE_Registry::instance()->CFG->admin->remote_logging_url ) : ''; |
|
75 | - $template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php'; |
|
76 | - EEH_Template::display_template( $template, $template_args ); |
|
73 | + $template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : FALSE; |
|
74 | + $template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : ''; |
|
75 | + $template = GEN_SET_CAF_TEMPLATE_PATH.'debug_log_settings.template.php'; |
|
76 | + EEH_Template::display_template($template, $template_args); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -84,17 +84,17 @@ discard block |
||
84 | 84 | * @param array $admin_options |
85 | 85 | * @return array |
86 | 86 | */ |
87 | - public function update_debug_logging_options( $admin_options = array() ) { |
|
88 | - $use_full_logging = isset( $this->_req_data['use_full_logging'] ) ? (bool)absint( $this->_req_data['use_full_logging'] ) : $admin_options->use_full_logging; |
|
87 | + public function update_debug_logging_options($admin_options = array()) { |
|
88 | + $use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool) absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging; |
|
89 | 89 | $admin_options->use_full_logging = $use_full_logging; |
90 | 90 | |
91 | - if ( $use_full_logging === FALSE ) { |
|
92 | - EE_Error::get_notices( FALSE ); |
|
91 | + if ($use_full_logging === FALSE) { |
|
92 | + EE_Error::get_notices(FALSE); |
|
93 | 93 | EE_Error::reset_notices(); |
94 | 94 | } |
95 | 95 | |
96 | - $admin_options->use_remote_logging = isset( $this->_req_data['use_remote_logging'] ) ? absint( $this->_req_data['use_remote_logging'] ) : $admin_options->use_remote_logging; |
|
97 | - $admin_options->remote_logging_url = isset( $this->_req_data['remote_logging_url'] ) ? esc_url_raw( $this->_req_data['remote_logging_url'] ) : $admin_options->remote_logging_url; |
|
96 | + $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging; |
|
97 | + $admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url; |
|
98 | 98 | return $admin_options; |
99 | 99 | } |
100 | 100 |
@@ -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 | |
@@ -563,8 +563,8 @@ discard block |
||
563 | 563 | * @param string $line the line number where the error occurred - just use __LINE__ |
564 | 564 | * @return void |
565 | 565 | */ |
566 | - public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
567 | - self::_add_notice ( 'success', $msg, $file, $func, $line ); |
|
566 | + public static function add_success($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
567 | + self::_add_notice('success', $msg, $file, $func, $line); |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | |
@@ -581,8 +581,8 @@ discard block |
||
581 | 581 | * @param string $line the line number where the error occurred - just use __LINE__ |
582 | 582 | * @return void |
583 | 583 | */ |
584 | - public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
585 | - self::_add_notice ( 'attention', $msg, $file, $func, $line ); |
|
584 | + public static function add_attention($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
585 | + self::_add_notice('attention', $msg, $file, $func, $line); |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | |
@@ -600,12 +600,12 @@ discard block |
||
600 | 600 | * @param string $line the line number where the error occurred - just use __LINE__ |
601 | 601 | * @return void |
602 | 602 | */ |
603 | - private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
604 | - if ( empty( $msg )) { |
|
603 | + private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
604 | + if (empty($msg)) { |
|
605 | 605 | EE_Error::doing_it_wrong( |
606 | - 'EE_Error::add_' . $type . '()', |
|
606 | + 'EE_Error::add_'.$type.'()', |
|
607 | 607 | sprintf( |
608 | - __( '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' ), |
|
608 | + __('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'), |
|
609 | 609 | $type, |
610 | 610 | $file, |
611 | 611 | $line |
@@ -613,27 +613,27 @@ discard block |
||
613 | 613 | EVENT_ESPRESSO_VERSION |
614 | 614 | ); |
615 | 615 | } |
616 | - if ( $type == 'errors' && ( empty( $file ) || empty( $func ) || empty( $line ))) { |
|
616 | + if ($type == 'errors' && (empty($file) || empty($func) || empty($line))) { |
|
617 | 617 | EE_Error::doing_it_wrong( |
618 | 618 | 'EE_Error::add_error()', |
619 | - __('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' ), |
|
619 | + __('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'), |
|
620 | 620 | EVENT_ESPRESSO_VERSION |
621 | 621 | ); |
622 | 622 | } |
623 | 623 | // get separate user and developer messages if they exist |
624 | - $msg = explode( '||', $msg ); |
|
624 | + $msg = explode('||', $msg); |
|
625 | 625 | $user_msg = $msg[0]; |
626 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
626 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
627 | 627 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
628 | 628 | // add notice if message exists |
629 | - if ( ! empty( $msg )) { |
|
629 | + if ( ! empty($msg)) { |
|
630 | 630 | // get error code, but only on error |
631 | - if ( WP_DEBUG && $type == 'errors' ) { |
|
632 | - $msg .= '<br/><span class="tiny-text">' . EE_Error::generate_error_code( $file, $func, $line ) . '</span>'; |
|
631 | + if (WP_DEBUG && $type == 'errors') { |
|
632 | + $msg .= '<br/><span class="tiny-text">'.EE_Error::generate_error_code($file, $func, $line).'</span>'; |
|
633 | 633 | } |
634 | 634 | // add notice |
635 | - self::$_espresso_notices[ $type ][] = $msg; |
|
636 | - add_action( 'wp_footer', array( 'EE_Error', 'enqueue_error_scripts' ), 1 ); |
|
635 | + self::$_espresso_notices[$type][] = $msg; |
|
636 | + add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1); |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | } |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | * @access private |
688 | 688 | * @return void |
689 | 689 | */ |
690 | - public static function reset_notices(){ |
|
690 | + public static function reset_notices() { |
|
691 | 691 | self::$_espresso_notices['success'] = FALSE; |
692 | 692 | self::$_espresso_notices['attention'] = FALSE; |
693 | 693 | self::$_espresso_notices['errors'] = FALSE; |
@@ -700,14 +700,14 @@ discard block |
||
700 | 700 | * @access public |
701 | 701 | * @return int |
702 | 702 | */ |
703 | - public static function has_notices(){ |
|
703 | + public static function has_notices() { |
|
704 | 704 | $has_notices = 0; |
705 | 705 | // check for success messages |
706 | - $has_notices = self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] ) ? 3 : $has_notices; |
|
706 | + $has_notices = self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success']) ? 3 : $has_notices; |
|
707 | 707 | // check for attention messages |
708 | - $has_notices = self::$_espresso_notices['attention'] && ! empty( self::$_espresso_notices['attention'] ) ? 2 : $has_notices; |
|
708 | + $has_notices = self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention']) ? 2 : $has_notices; |
|
709 | 709 | // check for error messages |
710 | - $has_notices = self::$_espresso_notices['errors'] && ! empty( self::$_espresso_notices['errors'] ) ? 1 : $has_notices; |
|
710 | + $has_notices = self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors']) ? 1 : $has_notices; |
|
711 | 711 | return $has_notices; |
712 | 712 | } |
713 | 713 | |
@@ -722,8 +722,8 @@ discard block |
||
722 | 722 | * @param boolean $remove_empty whether or not to unset empty messages |
723 | 723 | * @return array |
724 | 724 | */ |
725 | - public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) { |
|
726 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
725 | + public static function get_notices($format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE) { |
|
726 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
727 | 727 | |
728 | 728 | $success_messages = ''; |
729 | 729 | $attention_messages = ''; |
@@ -733,44 +733,44 @@ discard block |
||
733 | 733 | // 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' ); |
734 | 734 | |
735 | 735 | // either save notices to the db |
736 | - if ( $save_to_transient ) { |
|
737 | - update_option( 'ee_notices', self::$_espresso_notices ); |
|
736 | + if ($save_to_transient) { |
|
737 | + update_option('ee_notices', self::$_espresso_notices); |
|
738 | 738 | return; |
739 | 739 | } |
740 | 740 | // grab any notices that have been previously saved |
741 | - if ( $notices = get_option( 'ee_notices', FALSE )) { |
|
742 | - foreach ( $notices as $type => $notice ) { |
|
743 | - if ( is_array( $notice ) && ! empty( $notice )) { |
|
741 | + if ($notices = get_option('ee_notices', FALSE)) { |
|
742 | + foreach ($notices as $type => $notice) { |
|
743 | + if (is_array($notice) && ! empty($notice)) { |
|
744 | 744 | // make sure that existsing notice type is an array |
745 | - self::$_espresso_notices[ $type ] = is_array( self::$_espresso_notices[ $type ] ) && ! empty( self::$_espresso_notices[ $type ] ) ? self::$_espresso_notices[ $type ] : array(); |
|
745 | + self::$_espresso_notices[$type] = is_array(self::$_espresso_notices[$type]) && ! empty(self::$_espresso_notices[$type]) ? self::$_espresso_notices[$type] : array(); |
|
746 | 746 | // merge stored notices with any newly created ones |
747 | - self::$_espresso_notices[ $type ] = array_merge( self::$_espresso_notices[ $type ], $notice ); |
|
747 | + self::$_espresso_notices[$type] = array_merge(self::$_espresso_notices[$type], $notice); |
|
748 | 748 | $print_scripts = TRUE; |
749 | 749 | } |
750 | 750 | } |
751 | 751 | // now clear any stored notices |
752 | - update_option( 'ee_notices', FALSE ); |
|
752 | + update_option('ee_notices', FALSE); |
|
753 | 753 | } |
754 | 754 | |
755 | 755 | // check for success messages |
756 | - if ( self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] )) { |
|
756 | + if (self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success'])) { |
|
757 | 757 | // combine messages |
758 | - $success_messages .= implode( self::$_espresso_notices['success'], '<br />' ); |
|
758 | + $success_messages .= implode(self::$_espresso_notices['success'], '<br />'); |
|
759 | 759 | $print_scripts = TRUE; |
760 | 760 | } |
761 | 761 | |
762 | 762 | // check for attention messages |
763 | - if ( self::$_espresso_notices['attention'] && ! empty( self::$_espresso_notices['attention'] ) ) { |
|
763 | + if (self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention'])) { |
|
764 | 764 | // combine messages |
765 | - $attention_messages .= implode( self::$_espresso_notices['attention'], '<br />' ); |
|
765 | + $attention_messages .= implode(self::$_espresso_notices['attention'], '<br />'); |
|
766 | 766 | $print_scripts = TRUE; |
767 | 767 | } |
768 | 768 | |
769 | 769 | // check for error messages |
770 | - if ( self::$_espresso_notices['errors'] && ! empty( self::$_espresso_notices['errors'] ) ) { |
|
771 | - $error_messages .= count( self::$_espresso_notices['errors'] ) > 1 ? __( 'The following errors have occurred:<br />', 'event_espresso' ) : __( 'An error has occurred:<br />', 'event_espresso' ); |
|
770 | + if (self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors'])) { |
|
771 | + $error_messages .= count(self::$_espresso_notices['errors']) > 1 ? __('The following errors have occurred:<br />', 'event_espresso') : __('An error has occurred:<br />', 'event_espresso'); |
|
772 | 772 | // combine messages |
773 | - $error_messages .= implode( self::$_espresso_notices['errors'], '<br />' ); |
|
773 | + $error_messages .= implode(self::$_espresso_notices['errors'], '<br />'); |
|
774 | 774 | $print_scripts = TRUE; |
775 | 775 | } |
776 | 776 | |
@@ -784,21 +784,21 @@ discard block |
||
784 | 784 | $css_id = is_admin() ? 'message' : 'espresso-notices-success'; |
785 | 785 | $css_class = is_admin() ? 'updated fade' : 'success fade-away'; |
786 | 786 | //showMessage( $success_messages ); |
787 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $success_messages . '</p>' . $close . '</div>'; |
|
787 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$success_messages.'</p>'.$close.'</div>'; |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | if ($attention_messages != '') { |
791 | 791 | $css_id = is_admin() ? 'message' : 'espresso-notices-attention'; |
792 | 792 | $css_class = is_admin() ? 'updated ee-notices-attention' : 'attention fade-away'; |
793 | 793 | //showMessage( $error_messages, TRUE ); |
794 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $attention_messages . '</p>' . $close . '</div>'; |
|
794 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$attention_messages.'</p>'.$close.'</div>'; |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | if ($error_messages != '') { |
798 | 798 | $css_id = is_admin() ? 'message' : 'espresso-notices-error'; |
799 | 799 | $css_class = is_admin() ? 'error' : 'error fade-away'; |
800 | 800 | //showMessage( $error_messages, TRUE ); |
801 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $error_messages . '</p>' . $close . '</div>'; |
|
801 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$error_messages.'</p>'.$close.'</div>'; |
|
802 | 802 | } |
803 | 803 | |
804 | 804 | $notices .= '</div>'; |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | 'errors' => $error_messages |
812 | 812 | ); |
813 | 813 | |
814 | - if ( $remove_empty ) { |
|
814 | + if ($remove_empty) { |
|
815 | 815 | // remove empty notices |
816 | 816 | foreach ($notices as $type => $notice) { |
817 | 817 | if (empty($notice)) { |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | } |
822 | 822 | } |
823 | 823 | |
824 | - if ( $print_scripts ) { |
|
824 | + if ($print_scripts) { |
|
825 | 825 | self::_print_scripts(); |
826 | 826 | } |
827 | 827 | |
@@ -841,17 +841,17 @@ discard block |
||
841 | 841 | * @param bool $force_update allows one to enforce the reappearance of a persistent message. |
842 | 842 | * @return void |
843 | 843 | */ |
844 | - public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) { |
|
845 | - if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
|
846 | - $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
|
844 | + public static function add_persistent_admin_notice($pan_name = '', $pan_message, $force_update = FALSE) { |
|
845 | + if ( ! empty($pan_name) && ! empty($pan_message)) { |
|
846 | + $persistent_admin_notices = get_option('ee_pers_admin_notices', array()); |
|
847 | 847 | //maybe initialize persistent_admin_notices |
848 | - if ( empty( $persistent_admin_notices )) { |
|
849 | - add_option( 'ee_pers_admin_notices', array(), '', 'no' ); |
|
848 | + if (empty($persistent_admin_notices)) { |
|
849 | + add_option('ee_pers_admin_notices', array(), '', 'no'); |
|
850 | 850 | } |
851 | - $pan_name = sanitize_key( $pan_name ); |
|
852 | - if ( ! array_key_exists( $pan_name, $persistent_admin_notices ) || $force_update ) { |
|
853 | - $persistent_admin_notices[ $pan_name ] = $pan_message; |
|
854 | - update_option( 'ee_pers_admin_notices', $persistent_admin_notices ); |
|
851 | + $pan_name = sanitize_key($pan_name); |
|
852 | + if ( ! array_key_exists($pan_name, $persistent_admin_notices) || $force_update) { |
|
853 | + $persistent_admin_notices[$pan_name] = $pan_message; |
|
854 | + update_option('ee_pers_admin_notices', $persistent_admin_notices); |
|
855 | 855 | } |
856 | 856 | } |
857 | 857 | } |
@@ -867,34 +867,34 @@ discard block |
||
867 | 867 | * @param bool $return_immediately |
868 | 868 | * @return void |
869 | 869 | */ |
870 | - public static function dismiss_persistent_admin_notice( $pan_name = '', $purge = FALSE, $return_immediately = FALSE ) { |
|
871 | - $pan_name = EE_Registry::instance()->REQ->is_set( 'ee_nag_notice' ) ? EE_Registry::instance()->REQ->get( 'ee_nag_notice' ) : $pan_name; |
|
872 | - if ( ! empty( $pan_name )) { |
|
873 | - $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
|
870 | + public static function dismiss_persistent_admin_notice($pan_name = '', $purge = FALSE, $return_immediately = FALSE) { |
|
871 | + $pan_name = EE_Registry::instance()->REQ->is_set('ee_nag_notice') ? EE_Registry::instance()->REQ->get('ee_nag_notice') : $pan_name; |
|
872 | + if ( ! empty($pan_name)) { |
|
873 | + $persistent_admin_notices = get_option('ee_pers_admin_notices', array()); |
|
874 | 874 | // check if notice we wish to dismiss is actually in the $persistent_admin_notices array |
875 | - if ( is_array( $persistent_admin_notices ) && isset( $persistent_admin_notices[ $pan_name ] )) { |
|
875 | + if (is_array($persistent_admin_notices) && isset($persistent_admin_notices[$pan_name])) { |
|
876 | 876 | // completely delete nag notice, or just NULL message so that it can NOT be added again ? |
877 | - if ( $purge ) { |
|
878 | - unset( $persistent_admin_notices[ $pan_name ] ); |
|
877 | + if ($purge) { |
|
878 | + unset($persistent_admin_notices[$pan_name]); |
|
879 | 879 | } else { |
880 | - $persistent_admin_notices[ $pan_name ] = NULL; |
|
880 | + $persistent_admin_notices[$pan_name] = NULL; |
|
881 | 881 | } |
882 | - if ( update_option( 'ee_pers_admin_notices', $persistent_admin_notices ) === FALSE ) { |
|
883 | - EE_Error::add_error( sprintf( __( 'The persistent admin notice for "%s" could not be deleted.', 'event_espresso' ), $pan_name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
882 | + if (update_option('ee_pers_admin_notices', $persistent_admin_notices) === FALSE) { |
|
883 | + EE_Error::add_error(sprintf(__('The persistent admin notice for "%s" could not be deleted.', 'event_espresso'), $pan_name), __FILE__, __FUNCTION__, __LINE__); |
|
884 | 884 | } |
885 | 885 | } |
886 | 886 | } |
887 | - if ( $return_immediately ) { |
|
887 | + if ($return_immediately) { |
|
888 | 888 | return; |
889 | - } else if ( EE_Registry::instance()->REQ->ajax ) { |
|
889 | + } else if (EE_Registry::instance()->REQ->ajax) { |
|
890 | 890 | // grab any notices and concatenate into string |
891 | - echo json_encode( array( 'errors' => implode( '<br />', EE_Error::get_notices( FALSE )))); |
|
891 | + echo json_encode(array('errors' => implode('<br />', EE_Error::get_notices(FALSE)))); |
|
892 | 892 | exit(); |
893 | 893 | } else { |
894 | 894 | // save errors to a transient to be displayed on next request (after redirect) |
895 | - EE_Error::get_notices( FALSE, TRUE ); |
|
896 | - $return_url = EE_Registry::instance()->REQ->is_set( 'return_url' ) ? EE_Registry::instance()->REQ->get( 'return_url' ) : ''; |
|
897 | - wp_safe_redirect( urldecode( $return_url )); |
|
895 | + EE_Error::get_notices(FALSE, TRUE); |
|
896 | + $return_url = EE_Registry::instance()->REQ->is_set('return_url') ? EE_Registry::instance()->REQ->get('return_url') : ''; |
|
897 | + wp_safe_redirect(urldecode($return_url)); |
|
898 | 898 | } |
899 | 899 | } |
900 | 900 | |
@@ -909,20 +909,20 @@ discard block |
||
909 | 909 | * @param string $return_url URL to go back to aftger nag notice is dismissed |
910 | 910 | * @return string |
911 | 911 | */ |
912 | - public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) { |
|
913 | - if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
|
912 | + public static function display_persistent_admin_notices($pan_name = '', $pan_message = '', $return_url = '') { |
|
913 | + if ( ! empty($pan_name) && ! empty($pan_message)) { |
|
914 | 914 | $args = array( |
915 | 915 | 'nag_notice' => $pan_name, |
916 | - 'return_url' => urlencode( $return_url ), |
|
916 | + 'return_url' => urlencode($return_url), |
|
917 | 917 | 'ajax_url' => WP_AJAX_URL, |
918 | - 'unknown_error' => __( 'An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso' ) |
|
918 | + 'unknown_error' => __('An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso') |
|
919 | 919 | ); |
920 | - wp_localize_script( 'espresso_core', 'ee_dismiss', $args ); |
|
920 | + wp_localize_script('espresso_core', 'ee_dismiss', $args); |
|
921 | 921 | return ' |
922 | - <div id="' . $pan_name . '" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;"> |
|
923 | - <p>' . $pan_message . '</p> |
|
924 | - <a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name . '"> |
|
925 | - <span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__( 'Dismiss', 'event_espresso' ) .' |
|
922 | + <div id="' . $pan_name.'" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;"> |
|
923 | + <p>' . $pan_message.'</p> |
|
924 | + <a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name.'"> |
|
925 | + <span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__('Dismiss', 'event_espresso').' |
|
926 | 926 | </a> |
927 | 927 | <div style="clear:both;"></div> |
928 | 928 | </div>'; |
@@ -938,17 +938,17 @@ discard block |
||
938 | 938 | * @param string $return_url |
939 | 939 | * @return array |
940 | 940 | */ |
941 | - public static function get_persistent_admin_notices( $return_url = '' ) { |
|
941 | + public static function get_persistent_admin_notices($return_url = '') { |
|
942 | 942 | $notices = ''; |
943 | 943 | // check for persistent admin notices |
944 | - if ( $persistent_admin_notices = get_option( 'ee_pers_admin_notices', FALSE )) { |
|
944 | + if ($persistent_admin_notices = get_option('ee_pers_admin_notices', FALSE)) { |
|
945 | 945 | // load scripts |
946 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
947 | - wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
948 | - wp_enqueue_script( 'ee_error_js' ); |
|
946 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
947 | + wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
948 | + wp_enqueue_script('ee_error_js'); |
|
949 | 949 | // and display notices |
950 | - foreach( $persistent_admin_notices as $pan_name => $pan_message ) { |
|
951 | - $notices .= self::display_persistent_admin_notices( $pan_name, $pan_message, $return_url ); |
|
950 | + foreach ($persistent_admin_notices as $pan_name => $pan_message) { |
|
951 | + $notices .= self::display_persistent_admin_notices($pan_name, $pan_message, $return_url); |
|
952 | 952 | } |
953 | 953 | } |
954 | 954 | return $notices; |
@@ -963,26 +963,26 @@ discard block |
||
963 | 963 | * @param bool $force_print |
964 | 964 | * @return void |
965 | 965 | */ |
966 | - private static function _print_scripts( $force_print = FALSE ) { |
|
967 | - if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) { |
|
968 | - if ( wp_script_is( 'ee_error_js', 'enqueued' )) { |
|
966 | + private static function _print_scripts($force_print = FALSE) { |
|
967 | + if ((did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts')) && ! $force_print) { |
|
968 | + if (wp_script_is('ee_error_js', 'enqueued')) { |
|
969 | 969 | return; |
970 | - } else if ( wp_script_is( 'ee_error_js', 'registered' )) { |
|
971 | - add_filter( 'FHEE_load_css', '__return_true' ); |
|
972 | - add_filter( 'FHEE_load_js', '__return_true' ); |
|
973 | - wp_enqueue_script( 'ee_error_js' ); |
|
974 | - wp_localize_script( 'ee_error_js','ee_settings', array( 'wp_debug'=>WP_DEBUG )); |
|
970 | + } else if (wp_script_is('ee_error_js', 'registered')) { |
|
971 | + add_filter('FHEE_load_css', '__return_true'); |
|
972 | + add_filter('FHEE_load_js', '__return_true'); |
|
973 | + wp_enqueue_script('ee_error_js'); |
|
974 | + wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug'=>WP_DEBUG)); |
|
975 | 975 | } |
976 | 976 | } else { |
977 | 977 | return ' |
978 | 978 | <script> |
979 | 979 | /* <![CDATA[ */ |
980 | -var ee_settings = {"wp_debug":"' . WP_DEBUG . '"}; |
|
980 | +var ee_settings = {"wp_debug":"' . WP_DEBUG.'"}; |
|
981 | 981 | /* ]]> */ |
982 | 982 | </script> |
983 | -<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script> |
|
984 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
985 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
983 | +<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script> |
|
984 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
985 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
986 | 986 | '; |
987 | 987 | |
988 | 988 | } |
@@ -1016,11 +1016,11 @@ discard block |
||
1016 | 1016 | * @ param string $line |
1017 | 1017 | * @ return string |
1018 | 1018 | */ |
1019 | - public static function generate_error_code ( $file = '', $func = '', $line = '' ) { |
|
1020 | - $file = explode( '.', basename( $file )); |
|
1021 | - $error_code = ! empty( $file[0] ) ? $file[0] : ''; |
|
1022 | - $error_code .= ! empty( $func ) ? ' - ' . $func : ''; |
|
1023 | - $error_code .= ! empty( $line ) ? ' - ' . $line : ''; |
|
1019 | + public static function generate_error_code($file = '', $func = '', $line = '') { |
|
1020 | + $file = explode('.', basename($file)); |
|
1021 | + $error_code = ! empty($file[0]) ? $file[0] : ''; |
|
1022 | + $error_code .= ! empty($func) ? ' - '.$func : ''; |
|
1023 | + $error_code .= ! empty($line) ? ' - '.$line : ''; |
|
1024 | 1024 | return $error_code; |
1025 | 1025 | } |
1026 | 1026 | |
@@ -1036,36 +1036,36 @@ discard block |
||
1036 | 1036 | * @ param object $ex |
1037 | 1037 | * @ return void |
1038 | 1038 | */ |
1039 | - public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) { |
|
1039 | + public function write_to_error_log($time = FALSE, $ex = FALSE, $clear = FALSE) { |
|
1040 | 1040 | |
1041 | - if ( ! $ex ) { |
|
1041 | + if ( ! $ex) { |
|
1042 | 1042 | return; |
1043 | 1043 | } |
1044 | 1044 | |
1045 | - if ( ! $time ) { |
|
1045 | + if ( ! $time) { |
|
1046 | 1046 | $time = time(); |
1047 | 1047 | } |
1048 | 1048 | |
1049 | - $exception_log = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
1050 | - $exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . '] Exception Details' . PHP_EOL; |
|
1051 | - $exception_log .= 'Message: ' . $ex['msg'] . PHP_EOL; |
|
1052 | - $exception_log .= 'Code: '. $ex['code'] . PHP_EOL; |
|
1053 | - $exception_log .= 'File: '. $ex['file'] . PHP_EOL; |
|
1054 | - $exception_log .= 'Line No: ' . $ex['line'] . PHP_EOL; |
|
1055 | - $exception_log .= 'Stack trace: ' . PHP_EOL; |
|
1056 | - $exception_log .= $ex['string'] . PHP_EOL; |
|
1057 | - $exception_log .= '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
1058 | - |
|
1059 | - EE_Registry::instance()->load_helper( 'File' ); |
|
1049 | + $exception_log = '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
1050 | + $exception_log .= '['.date('Y-m-d H:i:s', $time).'] Exception Details'.PHP_EOL; |
|
1051 | + $exception_log .= 'Message: '.$ex['msg'].PHP_EOL; |
|
1052 | + $exception_log .= 'Code: '.$ex['code'].PHP_EOL; |
|
1053 | + $exception_log .= 'File: '.$ex['file'].PHP_EOL; |
|
1054 | + $exception_log .= 'Line No: '.$ex['line'].PHP_EOL; |
|
1055 | + $exception_log .= 'Stack trace: '.PHP_EOL; |
|
1056 | + $exception_log .= $ex['string'].PHP_EOL; |
|
1057 | + $exception_log .= '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
1058 | + |
|
1059 | + EE_Registry::instance()->load_helper('File'); |
|
1060 | 1060 | try { |
1061 | - EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ); |
|
1062 | - if ( ! $clear ) { |
|
1061 | + EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file); |
|
1062 | + if ( ! $clear) { |
|
1063 | 1063 | //get existing log file and append new log info |
1064 | - $exception_log = EEH_File::get_file_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ) . $exception_log; |
|
1064 | + $exception_log = EEH_File::get_file_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file).$exception_log; |
|
1065 | 1065 | } |
1066 | - EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file, $exception_log ); |
|
1067 | - } catch( EE_Error $e ){ |
|
1068 | - EE_Error::add_error( sprintf( __( 'Event Espresso error logging could not be setup because: %s', 'event_espresso' ), $e->getMessage() )); |
|
1066 | + EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file, $exception_log); |
|
1067 | + } catch (EE_Error $e) { |
|
1068 | + EE_Error::add_error(sprintf(__('Event Espresso error logging could not be setup because: %s', 'event_espresso'), $e->getMessage())); |
|
1069 | 1069 | return; |
1070 | 1070 | } |
1071 | 1071 | |
@@ -1089,10 +1089,10 @@ discard block |
||
1089 | 1089 | * @param int $error_type |
1090 | 1090 | * @return void |
1091 | 1091 | */ |
1092 | - public static function doing_it_wrong( $function, $message, $version, $error_type = E_USER_NOTICE ) { |
|
1093 | - if ( defined('WP_DEBUG') && WP_DEBUG ) { |
|
1092 | + public static function doing_it_wrong($function, $message, $version, $error_type = E_USER_NOTICE) { |
|
1093 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
1094 | 1094 | EE_Registry::instance()->load_helper('Debug_Tools'); |
1095 | - EEH_Debug_Tools::instance()->doing_it_wrong( $function, $message, $version, $error_type ); |
|
1095 | + EEH_Debug_Tools::instance()->doing_it_wrong($function, $message, $version, $error_type); |
|
1096 | 1096 | } |
1097 | 1097 | } |
1098 | 1098 | |
@@ -1112,13 +1112,13 @@ discard block |
||
1112 | 1112 | */ |
1113 | 1113 | function espresso_error_enqueue_scripts() { |
1114 | 1114 | // js for error handling |
1115 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE ); |
|
1116 | - wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE ); |
|
1115 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE); |
|
1116 | + wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE); |
|
1117 | 1117 | } |
1118 | -if ( is_admin() ) { |
|
1119 | - add_action( 'admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 ); |
|
1118 | +if (is_admin()) { |
|
1119 | + add_action('admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2); |
|
1120 | 1120 | } else { |
1121 | - add_action( 'wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 ); |
|
1121 | + add_action('wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2); |
|
1122 | 1122 | } |
1123 | 1123 | |
1124 | 1124 |
@@ -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 | - if ( ! defined('DOING_AJAX') || ! isset( $_REQUEST['noheader'] ) || $_REQUEST['noheader'] != 'true' || ! isset( $_REQUEST['TB_iframe'] )) { |
|
68 | + if ( ! defined('DOING_AJAX') || ! isset($_REQUEST['noheader']) || $_REQUEST['noheader'] != 'true' || ! isset($_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,8 +82,8 @@ 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 | 88 | } |
89 | 89 | |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | public function espresso_session_footer_dump() { |
98 | - if ( class_exists('Kint') && function_exists( 'wp_get_current_user' ) && current_user_can('update_core') && ( defined('WP_DEBUG') && WP_DEBUG ) && ! defined('DOING_AJAX') && class_exists( 'EE_Registry' )) { |
|
99 | - Kint::dump( EE_Registry::instance()->SSN->id() ); |
|
100 | - Kint::dump( EE_Registry::instance()->SSN ); |
|
98 | + if (class_exists('Kint') && function_exists('wp_get_current_user') && current_user_can('update_core') && (defined('WP_DEBUG') && WP_DEBUG) && ! defined('DOING_AJAX') && class_exists('EE_Registry')) { |
|
99 | + Kint::dump(EE_Registry::instance()->SSN->id()); |
|
100 | + Kint::dump(EE_Registry::instance()->SSN); |
|
101 | 101 | // Kint::dump( EE_Registry::instance()->SSN->get_session_data('cart')->get_tickets() ); |
102 | 102 | $this->espresso_list_hooked_functions(); |
103 | 103 | $this->show_times(); |
@@ -114,27 +114,27 @@ discard block |
||
114 | 114 | * @param bool $tag |
115 | 115 | * @return void |
116 | 116 | */ |
117 | - public function espresso_list_hooked_functions( $tag=FALSE ){ |
|
117 | + public function espresso_list_hooked_functions($tag = FALSE) { |
|
118 | 118 | global $wp_filter; |
119 | 119 | echo '<br/><br/><br/><h3>Hooked Functions</h3>'; |
120 | - if ( $tag ) { |
|
121 | - $hook[$tag]=$wp_filter[$tag]; |
|
122 | - if ( ! is_array( $hook[$tag] )) { |
|
123 | - trigger_error( "Nothing found for '$tag' hook", E_USER_WARNING ); |
|
120 | + if ($tag) { |
|
121 | + $hook[$tag] = $wp_filter[$tag]; |
|
122 | + if ( ! is_array($hook[$tag])) { |
|
123 | + trigger_error("Nothing found for '$tag' hook", E_USER_WARNING); |
|
124 | 124 | return; |
125 | 125 | } |
126 | - echo '<h5>For Tag: '. $tag .'</h5>'; |
|
126 | + echo '<h5>For Tag: '.$tag.'</h5>'; |
|
127 | 127 | } |
128 | 128 | else { |
129 | - $hook=$wp_filter; |
|
130 | - ksort( $hook ); |
|
129 | + $hook = $wp_filter; |
|
130 | + ksort($hook); |
|
131 | 131 | } |
132 | - foreach( $hook as $tag => $priorities ) { |
|
132 | + foreach ($hook as $tag => $priorities) { |
|
133 | 133 | echo "<br />>>>>>\t<strong>$tag</strong><br />"; |
134 | - ksort( $priorities ); |
|
135 | - foreach( $priorities as $priority => $function ){ |
|
134 | + ksort($priorities); |
|
135 | + foreach ($priorities as $priority => $function) { |
|
136 | 136 | echo $priority; |
137 | - foreach( $function as $name => $properties ) { |
|
137 | + foreach ($function as $name => $properties) { |
|
138 | 138 | echo "\t$name<br />"; |
139 | 139 | } |
140 | 140 | } |
@@ -150,15 +150,15 @@ discard block |
||
150 | 150 | * @param string $hook_name |
151 | 151 | * @return array |
152 | 152 | */ |
153 | - public static function registered_filter_callbacks( $hook_name = '' ) { |
|
153 | + public static function registered_filter_callbacks($hook_name = '') { |
|
154 | 154 | $filters = array(); |
155 | 155 | global $wp_filter; |
156 | - if ( isset( $wp_filter[ $hook_name ] ) ) { |
|
157 | - $filters[ $hook_name ] = array(); |
|
158 | - foreach ( $wp_filter[ $hook_name ] as $priority => $callbacks ) { |
|
159 | - $filters[ $hook_name ][ $priority ] = array(); |
|
160 | - foreach ( $callbacks as $callback ) { |
|
161 | - $filters[ $hook_name ][ $priority ][] = $callback['function']; |
|
156 | + if (isset($wp_filter[$hook_name])) { |
|
157 | + $filters[$hook_name] = array(); |
|
158 | + foreach ($wp_filter[$hook_name] as $priority => $callbacks) { |
|
159 | + $filters[$hook_name][$priority] = array(); |
|
160 | + foreach ($callbacks as $callback) { |
|
161 | + $filters[$hook_name][$priority][] = $callback['function']; |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | } |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | * start_timer |
172 | 172 | * @param null $timer_name |
173 | 173 | */ |
174 | - public function start_timer( $timer_name = NULL ){ |
|
175 | - $this->_start_times[$timer_name] = microtime( TRUE ); |
|
174 | + public function start_timer($timer_name = NULL) { |
|
175 | + $this->_start_times[$timer_name] = microtime(TRUE); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -181,15 +181,15 @@ discard block |
||
181 | 181 | * stop_timer |
182 | 182 | * @param string $timer_name |
183 | 183 | */ |
184 | - public function stop_timer($timer_name = 'default'){ |
|
185 | - if( isset( $this->_start_times[ $timer_name ] ) ){ |
|
186 | - $start_time = $this->_start_times[ $timer_name ]; |
|
187 | - unset( $this->_start_times[ $timer_name ] ); |
|
188 | - }else{ |
|
189 | - $start_time = array_pop( $this->_start_times ); |
|
184 | + public function stop_timer($timer_name = 'default') { |
|
185 | + if (isset($this->_start_times[$timer_name])) { |
|
186 | + $start_time = $this->_start_times[$timer_name]; |
|
187 | + unset($this->_start_times[$timer_name]); |
|
188 | + } else { |
|
189 | + $start_time = array_pop($this->_start_times); |
|
190 | 190 | } |
191 | - $total_time = microtime( TRUE ) - $start_time; |
|
192 | - switch ( $total_time ) { |
|
191 | + $total_time = microtime(TRUE) - $start_time; |
|
192 | + switch ($total_time) { |
|
193 | 193 | case $total_time < 0.00001 : |
194 | 194 | $color = '#8A549A'; |
195 | 195 | $bold = 'normal'; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $bold = 'bold'; |
216 | 216 | break; |
217 | 217 | } |
218 | - $this->_times[] = '<hr /><div style="display: inline-block; min-width: 10px; margin:0 1em; color:'.$color.'; font-weight:'.$bold.'; font-size:1.2em;">' . number_format( $total_time, 8 ) . '</div> ' . $timer_name; |
|
218 | + $this->_times[] = '<hr /><div style="display: inline-block; min-width: 10px; margin:0 1em; color:'.$color.'; font-weight:'.$bold.'; font-size:1.2em;">'.number_format($total_time, 8).'</div> '.$timer_name; |
|
219 | 219 | } |
220 | 220 | /** |
221 | 221 | * Measure the memory usage by PHP so far. |
@@ -223,10 +223,10 @@ discard block |
||
223 | 223 | * @param boolean $output_now whether to echo now, or wait until EEH_Debug_Tools::show_times() is called |
224 | 224 | * @return void |
225 | 225 | */ |
226 | - public function measure_memory( $label, $output_now = false ) { |
|
227 | - $memory_used = $this->convert( memory_get_peak_usage( true ) ); |
|
228 | - $this->_memory_usage_points[ $label ] = $memory_used; |
|
229 | - if( $output_now ) { |
|
226 | + public function measure_memory($label, $output_now = false) { |
|
227 | + $memory_used = $this->convert(memory_get_peak_usage(true)); |
|
228 | + $this->_memory_usage_points[$label] = $memory_used; |
|
229 | + if ($output_now) { |
|
230 | 230 | echo "\r\n<br>$label : $memory_used"; |
231 | 231 | } |
232 | 232 | } |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | * @param int $size |
237 | 237 | * @return string |
238 | 238 | */ |
239 | - public function convert( $size ) { |
|
240 | - $unit=array('b','kb','mb','gb','tb','pb'); |
|
241 | - return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[ absint( $i ) ]; |
|
239 | + public function convert($size) { |
|
240 | + $unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb'); |
|
241 | + return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2).' '.$unit[absint($i)]; |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | |
@@ -248,9 +248,9 @@ discard block |
||
248 | 248 | * @param bool $output_now |
249 | 249 | * @return string |
250 | 250 | */ |
251 | - public function show_times($output_now=true){ |
|
252 | - $output = '<h2>Times:</h2>' . implode("<br>",$this->_times) . '<h2>Memory</h2>' . implode('<br>', $this->_memory_usage_points ); |
|
253 | - if($output_now){ |
|
251 | + public function show_times($output_now = true) { |
|
252 | + $output = '<h2>Times:</h2>'.implode("<br>", $this->_times).'<h2>Memory</h2>'.implode('<br>', $this->_memory_usage_points); |
|
253 | + if ($output_now) { |
|
254 | 254 | echo $output; |
255 | 255 | return ''; |
256 | 256 | } |
@@ -265,25 +265,25 @@ discard block |
||
265 | 265 | * @return void |
266 | 266 | */ |
267 | 267 | public static function ee_plugin_activation_errors() { |
268 | - if ( WP_DEBUG ) { |
|
268 | + if (WP_DEBUG) { |
|
269 | 269 | $activation_errors = ob_get_contents(); |
270 | - if ( ! empty( $activation_errors ) ) { |
|
271 | - $activation_errors = date( 'Y-m-d H:i:s' ) . "\n" . $activation_errors; |
|
270 | + if ( ! empty($activation_errors)) { |
|
271 | + $activation_errors = date('Y-m-d H:i:s')."\n".$activation_errors; |
|
272 | 272 | } |
273 | - espresso_load_required( 'EEH_File', EE_HELPERS . 'EEH_File.helper.php' ); |
|
274 | - if ( class_exists( 'EEH_File' )) { |
|
273 | + espresso_load_required('EEH_File', EE_HELPERS.'EEH_File.helper.php'); |
|
274 | + if (class_exists('EEH_File')) { |
|
275 | 275 | try { |
276 | - EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html' ); |
|
277 | - EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html', $activation_errors ); |
|
278 | - } catch( EE_Error $e ){ |
|
279 | - EE_Error::add_error( sprintf( __( 'The Event Espresso activation errors file could not be setup because: %s', 'event_espresso' ), $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
276 | + EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html'); |
|
277 | + EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html', $activation_errors); |
|
278 | + } catch (EE_Error $e) { |
|
279 | + EE_Error::add_error(sprintf(__('The Event Espresso activation errors file could not be setup because: %s', 'event_espresso'), $e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
280 | 280 | } |
281 | 281 | } else { |
282 | 282 | // old school attempt |
283 | - file_put_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html', $activation_errors ); |
|
283 | + file_put_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html', $activation_errors); |
|
284 | 284 | } |
285 | - $activation_errors = get_option( 'ee_plugin_activation_errors', '' ) . $activation_errors; |
|
286 | - update_option( 'ee_plugin_activation_errors', $activation_errors ); |
|
285 | + $activation_errors = get_option('ee_plugin_activation_errors', '').$activation_errors; |
|
286 | + update_option('ee_plugin_activation_errors', $activation_errors); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | |
@@ -299,10 +299,10 @@ discard block |
||
299 | 299 | * @param int $error_type |
300 | 300 | * @uses trigger_error() |
301 | 301 | */ |
302 | - public function doing_it_wrong( $function, $message, $version, $error_type = E_USER_NOTICE ) { |
|
303 | - do_action( 'AHEE__EEH_Debug_Tools__doing_it_wrong_run', $function, $message, $version); |
|
304 | - $version = is_null( $version ) ? '' : sprintf( __('(This message was added in version %s of Event Espresso.', 'event_espresso' ), $version ); |
|
305 | - trigger_error( sprintf( __('%1$s was called <strong>incorrectly</strong>. %2$s %3$s','event_espresso' ), $function, $message, $version ), $error_type ); |
|
302 | + public function doing_it_wrong($function, $message, $version, $error_type = E_USER_NOTICE) { |
|
303 | + do_action('AHEE__EEH_Debug_Tools__doing_it_wrong_run', $function, $message, $version); |
|
304 | + $version = is_null($version) ? '' : sprintf(__('(This message was added in version %s of Event Espresso.', 'event_espresso'), $version); |
|
305 | + trigger_error(sprintf(__('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', 'event_espresso'), $function, $message, $version), $error_type); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | |
@@ -323,22 +323,22 @@ discard block |
||
323 | 323 | * @param string $debug_index |
324 | 324 | * @param string $debug_key |
325 | 325 | */ |
326 | - public static function log( $class='', $func = '', $line = '', $info = array(), $display_request = false, $debug_index = '', $debug_key = 'EE_DEBUG_SPCO' ) { |
|
327 | - if ( WP_DEBUG && false ) { |
|
328 | - $debug_key = $debug_key . '_' . EE_Session::instance()->id(); |
|
329 | - $debug_data = get_option( $debug_key, array() ); |
|
326 | + public static function log($class = '', $func = '', $line = '', $info = array(), $display_request = false, $debug_index = '', $debug_key = 'EE_DEBUG_SPCO') { |
|
327 | + if (WP_DEBUG && false) { |
|
328 | + $debug_key = $debug_key.'_'.EE_Session::instance()->id(); |
|
329 | + $debug_data = get_option($debug_key, array()); |
|
330 | 330 | $default_data = array( |
331 | - $class => $func . '() : ' . $line, |
|
331 | + $class => $func.'() : '.$line, |
|
332 | 332 | 'REQ' => $display_request ? $_REQUEST : '', |
333 | 333 | ); |
334 | 334 | // don't serialize objects |
335 | - $info = self::strip_objects( $info ); |
|
336 | - $index = ! empty( $debug_index ) ? $debug_index : 0; |
|
337 | - if ( ! isset( $debug_data[$index] ) ) { |
|
335 | + $info = self::strip_objects($info); |
|
336 | + $index = ! empty($debug_index) ? $debug_index : 0; |
|
337 | + if ( ! isset($debug_data[$index])) { |
|
338 | 338 | $debug_data[$index] = array(); |
339 | 339 | } |
340 | - $debug_data[$index][microtime()] = array_merge( $default_data, $info ); |
|
341 | - update_option( $debug_key, $debug_data ); |
|
340 | + $debug_data[$index][microtime()] = array_merge($default_data, $info); |
|
341 | + update_option($debug_key, $debug_data); |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 | |
@@ -350,26 +350,26 @@ discard block |
||
350 | 350 | * @param array $info |
351 | 351 | * @return array |
352 | 352 | */ |
353 | - public static function strip_objects( $info = array() ) { |
|
354 | - foreach ( $info as $key => $value ) { |
|
355 | - if ( is_array( $value ) ) { |
|
356 | - $info[ $key ] = self::strip_objects( $value ); |
|
357 | - } else if ( is_object( $value ) ) { |
|
358 | - $object_class = get_class( $value ); |
|
359 | - $info[ $object_class ] = array(); |
|
360 | - $info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : spl_object_hash( $value ); |
|
361 | - if ( method_exists( $value, 'ID' ) ) { |
|
362 | - $info[ $object_class ][ 'ID' ] = $value->ID(); |
|
353 | + public static function strip_objects($info = array()) { |
|
354 | + foreach ($info as $key => $value) { |
|
355 | + if (is_array($value)) { |
|
356 | + $info[$key] = self::strip_objects($value); |
|
357 | + } else if (is_object($value)) { |
|
358 | + $object_class = get_class($value); |
|
359 | + $info[$object_class] = array(); |
|
360 | + $info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : spl_object_hash($value); |
|
361 | + if (method_exists($value, 'ID')) { |
|
362 | + $info[$object_class]['ID'] = $value->ID(); |
|
363 | 363 | } |
364 | - if ( method_exists( $value, 'status' ) ) { |
|
365 | - $info[ $object_class ][ 'status' ] = $value->status(); |
|
366 | - } else if ( method_exists( $value, 'status_ID' ) ) { |
|
367 | - $info[ $object_class ][ 'status' ] = $value->status_ID(); |
|
364 | + if (method_exists($value, 'status')) { |
|
365 | + $info[$object_class]['status'] = $value->status(); |
|
366 | + } else if (method_exists($value, 'status_ID')) { |
|
367 | + $info[$object_class]['status'] = $value->status_ID(); |
|
368 | 368 | } |
369 | - unset( $info[ $key ] ); |
|
369 | + unset($info[$key]); |
|
370 | 370 | } |
371 | 371 | } |
372 | - return (array)$info; |
|
372 | + return (array) $info; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | |
@@ -386,31 +386,31 @@ discard block |
||
386 | 386 | * @param string $height |
387 | 387 | * @param bool $die |
388 | 388 | */ |
389 | - public static function printr( $var, $var_name = false, $file = __FILE__, $line = __LINE__, $height = 'auto', $die = false ) { |
|
389 | + public static function printr($var, $var_name = false, $file = __FILE__, $line = __LINE__, $height = 'auto', $die = false) { |
|
390 | 390 | //$print_r = false; |
391 | - if ( is_object( $var ) ) { |
|
391 | + if (is_object($var)) { |
|
392 | 392 | $var_name = ! $var_name ? 'object' : $var_name; |
393 | 393 | //$print_r = true; |
394 | - } else if ( is_array( $var ) ) { |
|
394 | + } else if (is_array($var)) { |
|
395 | 395 | $var_name = ! $var_name ? 'array' : $var_name; |
396 | 396 | //$print_r = true; |
397 | - } else if ( is_numeric( $var ) ) { |
|
397 | + } else if (is_numeric($var)) { |
|
398 | 398 | $var_name = ! $var_name ? 'numeric' : $var_name; |
399 | - } else if ( is_string( $var ) ) { |
|
399 | + } else if (is_string($var)) { |
|
400 | 400 | $var_name = ! $var_name ? 'string' : $var_name; |
401 | - } else if ( is_null( $var ) ) { |
|
401 | + } else if (is_null($var)) { |
|
402 | 402 | $var_name = ! $var_name ? 'null' : $var_name; |
403 | 403 | } |
404 | - $var_name = ucwords( str_replace( array( '$', '_' ), array( '', ' ' ), $var_name ) ); |
|
404 | + $var_name = ucwords(str_replace(array('$', '_'), array('', ' '), $var_name)); |
|
405 | 405 | ob_start(); |
406 | - echo '<pre style="display:block; width:100%; height:' . $height . '; border:2px solid light-blue;">'; |
|
407 | - echo '<h5 style="color:#2EA2CC;"><b>' . $var_name . '</b></h5><span style="color:#E76700">'; |
|
406 | + echo '<pre style="display:block; width:100%; height:'.$height.'; border:2px solid light-blue;">'; |
|
407 | + echo '<h5 style="color:#2EA2CC;"><b>'.$var_name.'</b></h5><span style="color:#E76700">'; |
|
408 | 408 | //$print_r ? print_r( $var ) : var_dump( $var ); |
409 | - var_dump( $var ); |
|
410 | - echo '</span><br /><span style="font-size:10px;font-weight:normal;">' . $file . '<br />line no: ' . $line . '</span></pre>'; |
|
409 | + var_dump($var); |
|
410 | + echo '</span><br /><span style="font-size:10px;font-weight:normal;">'.$file.'<br />line no: '.$line.'</span></pre>'; |
|
411 | 411 | $result = ob_get_clean(); |
412 | - if ( $die ) { |
|
413 | - die( $result ); |
|
412 | + if ($die) { |
|
413 | + die($result); |
|
414 | 414 | } else { |
415 | 415 | echo $result; |
416 | 416 | } |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | * borrowed from Kint Debugger |
428 | 428 | * Plugin URI: http://upthemes.com/plugins/kint-debugger/ |
429 | 429 | */ |
430 | -if ( class_exists('Kint') && ! function_exists( 'dump_wp_query' ) ) { |
|
431 | - function dump_wp_query(){ |
|
430 | +if (class_exists('Kint') && ! function_exists('dump_wp_query')) { |
|
431 | + function dump_wp_query() { |
|
432 | 432 | global $wp_query; |
433 | 433 | d($wp_query); |
434 | 434 | } |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | * borrowed from Kint Debugger |
439 | 439 | * Plugin URI: http://upthemes.com/plugins/kint-debugger/ |
440 | 440 | */ |
441 | -if ( class_exists('Kint') && ! function_exists( 'dump_wp' ) ) { |
|
442 | - function dump_wp(){ |
|
441 | +if (class_exists('Kint') && ! function_exists('dump_wp')) { |
|
442 | + function dump_wp() { |
|
443 | 443 | global $wp; |
444 | 444 | d($wp); |
445 | 445 | } |
@@ -449,8 +449,8 @@ discard block |
||
449 | 449 | * borrowed from Kint Debugger |
450 | 450 | * Plugin URI: http://upthemes.com/plugins/kint-debugger/ |
451 | 451 | */ |
452 | -if ( class_exists('Kint') && ! function_exists( 'dump_post' ) ) { |
|
453 | - function dump_post(){ |
|
452 | +if (class_exists('Kint') && ! function_exists('dump_post')) { |
|
453 | + function dump_post() { |
|
454 | 454 | global $post; |
455 | 455 | d($post); |
456 | 456 | } |
@@ -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 | /** |
@@ -30,25 +30,25 @@ discard block |
||
30 | 30 | class Extend_Events_Admin_Page extends Events_Admin_Page { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( $routing = TRUE ) { |
|
34 | - parent::__construct( $routing ); |
|
35 | - define( 'EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/'); |
|
36 | - define( 'EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/'); |
|
37 | - define( 'EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/'); |
|
33 | + public function __construct($routing = TRUE) { |
|
34 | + parent::__construct($routing); |
|
35 | + define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'events/templates/'); |
|
36 | + define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'events/assets/'); |
|
37 | + define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'events/assets/'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
41 | 41 | protected function _extend_page_config() { |
42 | 42 | |
43 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events'; |
|
43 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'events'; |
|
44 | 44 | $default_espresso_boxes = $this->_default_espresso_metaboxes; |
45 | 45 | |
46 | 46 | //is there a evt_id in the request? |
47 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0; |
|
48 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
47 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0; |
|
48 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
49 | 49 | |
50 | 50 | //tkt_id? |
51 | - $tkt_id = !empty( $this->_req_data['TKT_ID'] ) && ! is_array( $this->_req_data['TKT_ID'] ) ? $this->_req_data['TKT_ID'] : 0; |
|
51 | + $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) ? $this->_req_data['TKT_ID'] : 0; |
|
52 | 52 | |
53 | 53 | $new_page_routes = array( |
54 | 54 | 'duplicate_event' => array( |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | 'capability' => 'ee_delete_default_ticket', |
67 | 67 | 'obj_id' => $tkt_id, |
68 | 68 | 'noheader' => TRUE, |
69 | - 'args' => array( 'trash' => TRUE ) |
|
69 | + 'args' => array('trash' => TRUE) |
|
70 | 70 | ), |
71 | 71 | 'trash_tickets' => array( |
72 | 72 | 'func' => '_trash_or_restore_ticket', |
73 | 73 | 'capability' => 'ee_delete_default_tickets', |
74 | 74 | 'noheader' => TRUE, |
75 | - 'args' => array( 'trash' => TRUE ) |
|
75 | + 'args' => array('trash' => TRUE) |
|
76 | 76 | ), |
77 | 77 | 'restore_ticket' => array( |
78 | 78 | 'func' => '_trash_or_restore_ticket', |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | ) |
133 | 133 | ); |
134 | 134 | |
135 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
135 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
136 | 136 | |
137 | 137 | |
138 | 138 | //partial route/config override |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | $this->_page_config['default']['list_table'] = 'Extend_Events_Admin_List_Table'; |
145 | 145 | |
146 | 146 | //add tickets tab but only if there are more than one default ticket! |
147 | - $tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(array( array('TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ); |
|
148 | - if ( $tkt_count > 1 ) { |
|
147 | + $tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(array(array('TKT_is_default' => 1)), 'TKT_ID', TRUE); |
|
148 | + if ($tkt_count > 1) { |
|
149 | 149 | $new_page_config = array( |
150 | 150 | 'ticket_list_table' => array( |
151 | 151 | 'nav' => array( |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | 'label' => __('Templates'), |
165 | 165 | 'order' => 30 |
166 | 166 | ), |
167 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
167 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
168 | 168 | 'help_tabs' => array( |
169 | 169 | 'general_settings_templates_help_tab' => array( |
170 | 170 | 'title' => __('Templates', 'event_espresso'), |
171 | 171 | 'filename' => 'general_settings_templates' |
172 | 172 | ) |
173 | 173 | ), |
174 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
174 | + 'help_tour' => array('Templates_Help_Tour'), |
|
175 | 175 | 'require_nonce' => FALSE |
176 | 176 | ); |
177 | 177 | |
@@ -190,26 +190,26 @@ discard block |
||
190 | 190 | // 'metaboxes' => $default_espresso_boxes, |
191 | 191 | // 'require_nonce' => FALSE |
192 | 192 | // ); |
193 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
193 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
194 | 194 | |
195 | 195 | //add filters and actions |
196 | 196 | //modifying _views |
197 | - add_filter('FHEE_event_datetime_metabox_add_additional_date_time_template', array( $this, 'add_additional_datetime_button' ), 10, 2 ); |
|
198 | - add_filter('FHEE_event_datetime_metabox_clone_button_template', array( $this, 'add_datetime_clone_button' ), 10, 2 ); |
|
199 | - add_filter('FHEE_event_datetime_metabox_timezones_template', array( $this, 'datetime_timezones_template'), 10, 2 ); |
|
197 | + add_filter('FHEE_event_datetime_metabox_add_additional_date_time_template', array($this, 'add_additional_datetime_button'), 10, 2); |
|
198 | + add_filter('FHEE_event_datetime_metabox_clone_button_template', array($this, 'add_datetime_clone_button'), 10, 2); |
|
199 | + add_filter('FHEE_event_datetime_metabox_timezones_template', array($this, 'datetime_timezones_template'), 10, 2); |
|
200 | 200 | |
201 | 201 | |
202 | 202 | //filters for event list table |
203 | - add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array( $this, 'list_table_filters'), 10, 2); |
|
204 | - add_filter('FHEE__Extend_Events_Admin_List_Table__column_actions__action_links', array( $this, 'extra_list_table_actions'), 10, 2 ); |
|
203 | + add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array($this, 'list_table_filters'), 10, 2); |
|
204 | + add_filter('FHEE__Extend_Events_Admin_List_Table__column_actions__action_links', array($this, 'extra_list_table_actions'), 10, 2); |
|
205 | 205 | |
206 | 206 | //legend item |
207 | - add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array( $this, 'additional_legend_items') ); |
|
207 | + add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array($this, 'additional_legend_items')); |
|
208 | 208 | |
209 | - add_action('admin_init', array( $this, 'admin_init') ); |
|
209 | + add_action('admin_init', array($this, 'admin_init')); |
|
210 | 210 | |
211 | 211 | //heartbeat stuff |
212 | - add_filter( 'heartbeat_received', array( $this, 'heartbeat_response' ), 10, 2 ); |
|
212 | + add_filter('heartbeat_received', array($this, 'heartbeat_response'), 10, 2); |
|
213 | 213 | |
214 | 214 | } |
215 | 215 | |
@@ -222,12 +222,12 @@ discard block |
||
222 | 222 | EE_Registry::$i18n_js_strings = array_merge( |
223 | 223 | EE_Registry::$i18n_js_strings, |
224 | 224 | array( |
225 | - 'image_confirm' => __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' ), |
|
226 | - 'event_starts_on' => __( 'Event Starts on', 'event_espresso' ), |
|
227 | - 'event_ends_on' => __( 'Event Ends on', 'event_espresso' ), |
|
228 | - 'event_datetime_actions' => __( 'Actions', 'event_espresso' ), |
|
229 | - 'event_clone_dt_msg' => __( 'Clone this Event Date and Time', 'event_espresso' ), |
|
230 | - 'remove_event_dt_msg' => __( 'Remove this Event Time', 'event_espresso' ) |
|
225 | + 'image_confirm' => __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso'), |
|
226 | + 'event_starts_on' => __('Event Starts on', 'event_espresso'), |
|
227 | + 'event_ends_on' => __('Event Ends on', 'event_espresso'), |
|
228 | + 'event_datetime_actions' => __('Actions', 'event_espresso'), |
|
229 | + 'event_clone_dt_msg' => __('Clone this Event Date and Time', 'event_espresso'), |
|
230 | + 'remove_event_dt_msg' => __('Remove this Event Time', 'event_espresso') |
|
231 | 231 | ) |
232 | 232 | ); |
233 | 233 | } |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @return array possibly appended response. |
244 | 244 | */ |
245 | - public function heartbeat_response( $response, $data ) { |
|
245 | + public function heartbeat_response($response, $data) { |
|
246 | 246 | /** |
247 | 247 | * check whether count of tickets is approaching the potential |
248 | 248 | * limits for the server. |
249 | 249 | */ |
250 | - if ( ! empty( $data['input_count'] ) ) { |
|
250 | + if ( ! empty($data['input_count'])) { |
|
251 | 251 | $response['max_input_vars_check'] = EE_Registry::instance()->CFG->environment->max_input_vars_limit_check($data['input_count']); |
252 | 252 | } |
253 | 253 | |
@@ -262,13 +262,13 @@ discard block |
||
262 | 262 | |
263 | 263 | |
264 | 264 | |
265 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
266 | - $return = parent::extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ); |
|
265 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
266 | + $return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug); |
|
267 | 267 | //make sure this is only when editing |
268 | - if ( !empty( $id ) ) { |
|
269 | - $href = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'duplicate_event', 'EVT_ID' => $id), $this->_admin_base_url ); |
|
268 | + if ( ! empty($id)) { |
|
269 | + $href = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_event', 'EVT_ID' => $id), $this->_admin_base_url); |
|
270 | 270 | $title = esc_attr__('Duplicate Event', 'event_espresso'); |
271 | - $return .= '<a href="' . $href . '" title="' . $title . '" id="ee-duplicate-event-button" class="button button-small" value="duplicate_event">' . $title . '</button>'; |
|
271 | + $return .= '<a href="'.$href.'" title="'.$title.'" id="ee-duplicate-event-button" class="button button-small" value="duplicate_event">'.$title.'</button>'; |
|
272 | 272 | } |
273 | 273 | return $return; |
274 | 274 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | 'label' => __('Trash', 'event_espresso'), |
292 | 292 | 'count' => 0, |
293 | 293 | 'bulk_action' => array( |
294 | - 'restore_tickets' => __('Restore from Trash' , 'event_espresso'), |
|
294 | + 'restore_tickets' => __('Restore from Trash', 'event_espresso'), |
|
295 | 295 | 'delete_tickets' => __('Delete Permanently', 'event_espresso') |
296 | 296 | ) |
297 | 297 | ) |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | |
303 | 303 | public function load_scripts_styles_edit() { |
304 | - wp_register_script( 'ee-event-editor-heartbeat', EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js', array( 'ee_admin_js', 'heartbeat' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
304 | + wp_register_script('ee-event-editor-heartbeat', EVENTS_CAF_ASSETS_URL.'event-editor-heartbeat.js', array('ee_admin_js', 'heartbeat'), EVENT_ESPRESSO_VERSION, TRUE); |
|
305 | 305 | |
306 | 306 | /** |
307 | 307 | * load accounting js. |
@@ -320,20 +320,20 @@ discard block |
||
320 | 320 | |
321 | 321 | |
322 | 322 | |
323 | - public function add_additional_datetime_button( $template, $template_args ) { |
|
324 | - return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php', $template_args, TRUE); |
|
323 | + public function add_additional_datetime_button($template, $template_args) { |
|
324 | + return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_add_additional_time.template.php', $template_args, TRUE); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | |
328 | 328 | |
329 | - public function add_datetime_clone_button( $template, $template_args ) { |
|
330 | - return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php', $template_args, TRUE ); |
|
329 | + public function add_datetime_clone_button($template, $template_args) { |
|
330 | + return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_metabox_clone_button.template.php', $template_args, TRUE); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
334 | 334 | |
335 | - public function datetime_timezones_template( $template, $template_args ) { |
|
336 | - return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php', $template_args, TRUE ); |
|
335 | + public function datetime_timezones_template($template, $template_args) { |
|
336 | + return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_timezones.template.php', $template_args, TRUE); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | protected function _set_list_table_views_default() { |
343 | 343 | parent::_set_list_table_views_default(); |
344 | 344 | $export_label = __('Export Events', 'event_espresso'); |
345 | - if ( EE_Registry::instance()->CAP->current_user_can( 'export', 'espresso_events_export' ) ) { |
|
345 | + if (EE_Registry::instance()->CAP->current_user_can('export', 'espresso_events_export')) { |
|
346 | 346 | // $this->_views['all']['bulk_action']['export_events'] = $export_label; |
347 | 347 | // $this->_views['draft']['bulk_action']['export_events'] = $export_label; |
348 | 348 | |
349 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
349 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
350 | 350 | // $this->_views['trash']['bulk_action']['export_events'] = $export_label; |
351 | 351 | } |
352 | 352 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | ) |
373 | 373 | ); |
374 | 374 | |
375 | - $this->_views = array_merge( $this->_views, $new_views); |
|
375 | + $this->_views = array_merge($this->_views, $new_views); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -386,14 +386,14 @@ discard block |
||
386 | 386 | |
387 | 387 | |
388 | 388 | |
389 | - public function extra_list_table_actions( $actionlinks, $event ) { |
|
390 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_reports', $event->ID() ) ) { |
|
389 | + public function extra_list_table_actions($actionlinks, $event) { |
|
390 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_reports', $event->ID())) { |
|
391 | 391 | $reports_query_args = array( |
392 | 392 | 'action' => 'reports', |
393 | 393 | 'EVT_ID' => $event->ID() |
394 | 394 | ); |
395 | - $reports_link = EE_Admin_Page::add_query_args_and_nonce( $reports_query_args, REG_ADMIN_URL ); |
|
396 | - $actionlinks[] = '<a href="' . $reports_link . '" title="' . esc_attr__('View Report', 'event_espresso') . '"><div class="dashicons dashicons-chart-bar"></div></a>' . "\n\t"; |
|
395 | + $reports_link = EE_Admin_Page::add_query_args_and_nonce($reports_query_args, REG_ADMIN_URL); |
|
396 | + $actionlinks[] = '<a href="'.$reports_link.'" title="'.esc_attr__('View Report', 'event_espresso').'"><div class="dashicons dashicons-chart-bar"></div></a>'."\n\t"; |
|
397 | 397 | } |
398 | 398 | return $actionlinks; |
399 | 399 | } |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | |
402 | 402 | |
403 | 403 | public function additional_legend_items($items) { |
404 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_reports' ) ) { |
|
404 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_reports')) { |
|
405 | 405 | $items['reports'] = array( |
406 | 406 | 'class' => 'dashicons dashicons-chart-bar', |
407 | 407 | 'desc' => __('Event Reports', 'event_espresso') |
@@ -426,17 +426,17 @@ discard block |
||
426 | 426 | */ |
427 | 427 | protected function _duplicate_event() { |
428 | 428 | //first make sure the ID for the event is in the request. If it isnt' then we need to bail and redirect back to overview list table (cause how did we get here?) |
429 | - if ( !isset( $this->_req_data['EVT_ID'] ) ) { |
|
430 | - EE_Error::add_error( __('In order to duplicate an event an Event ID is required. None was given.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
431 | - $this->_redirect_after_action( FALSE, '', '', array(), TRUE ); |
|
429 | + if ( ! isset($this->_req_data['EVT_ID'])) { |
|
430 | + EE_Error::add_error(__('In order to duplicate an event an Event ID is required. None was given.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
431 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
432 | 432 | return; |
433 | 433 | } |
434 | 434 | |
435 | 435 | //k we've got EVT_ID so let's use that to get the event we'll duplicate |
436 | - $orig_event = EEM_Event::instance()->get_one_by_ID( $this->_req_data['EVT_ID'] ); |
|
436 | + $orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']); |
|
437 | 437 | |
438 | - if ( ! $orig_event instanceof EE_Event ) |
|
439 | - throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso '), $this->_req_data['EVT_ID'] ) ); |
|
438 | + if ( ! $orig_event instanceof EE_Event) |
|
439 | + throw new EE_Error(sprintf(__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso '), $this->_req_data['EVT_ID'])); |
|
440 | 440 | |
441 | 441 | //k now let's clone the $orig_event before getting relations |
442 | 442 | $new_event = clone $orig_event; |
@@ -449,43 +449,43 @@ discard block |
||
449 | 449 | |
450 | 450 | |
451 | 451 | //reset the ID and modify other details to make it clear this is a dupe |
452 | - $new_event->set( 'EVT_ID', 0 ); |
|
453 | - $new_name = $new_event->name() . ' ' . __('**DUPLICATE**', 'event_espresso'); |
|
454 | - $new_event->set( 'EVT_name', $new_name ); |
|
455 | - $new_event->set( 'EVT_slug', wp_unique_post_slug( sanitize_title( $orig_event->name() ), 0, 'publish', 'espresso_events', 0 ) ); |
|
456 | - $new_event->set( 'status', 'draft' ); |
|
452 | + $new_event->set('EVT_ID', 0); |
|
453 | + $new_name = $new_event->name().' '.__('**DUPLICATE**', 'event_espresso'); |
|
454 | + $new_event->set('EVT_name', $new_name); |
|
455 | + $new_event->set('EVT_slug', wp_unique_post_slug(sanitize_title($orig_event->name()), 0, 'publish', 'espresso_events', 0)); |
|
456 | + $new_event->set('status', 'draft'); |
|
457 | 457 | |
458 | 458 | //duplicate discussion settings |
459 | - $new_event->set( 'comment_status', $orig_event->get('comment_status') ); |
|
460 | - $new_event->set( 'ping_status', $orig_event->get( 'ping_status' ) ); |
|
459 | + $new_event->set('comment_status', $orig_event->get('comment_status')); |
|
460 | + $new_event->set('ping_status', $orig_event->get('ping_status')); |
|
461 | 461 | |
462 | 462 | //save the new event |
463 | 463 | $new_event->save(); |
464 | 464 | |
465 | 465 | //venues |
466 | - foreach( $orig_ven as $ven ) { |
|
467 | - $new_event->_add_relation_to( $ven, 'Venue' ); |
|
466 | + foreach ($orig_ven as $ven) { |
|
467 | + $new_event->_add_relation_to($ven, 'Venue'); |
|
468 | 468 | } |
469 | 469 | $new_event->save(); |
470 | 470 | |
471 | 471 | |
472 | 472 | //now we need to get the question group relations and handle that |
473 | 473 | //first primary question groups |
474 | - $orig_primary_qgs = $orig_event->get_many_related('Question_Group', array( array('Event_Question_Group.EQG_primary' => 1 ) ) ); |
|
475 | - if ( !empty( $orig_primary_qgs ) ) { |
|
476 | - foreach ( $orig_primary_qgs as $id => $obj ) { |
|
477 | - if ( $obj instanceof EE_Question_Group ) { |
|
478 | - $new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 1 ) ); |
|
474 | + $orig_primary_qgs = $orig_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 1))); |
|
475 | + if ( ! empty($orig_primary_qgs)) { |
|
476 | + foreach ($orig_primary_qgs as $id => $obj) { |
|
477 | + if ($obj instanceof EE_Question_Group) { |
|
478 | + $new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 1)); |
|
479 | 479 | } |
480 | 480 | } |
481 | 481 | } |
482 | 482 | |
483 | 483 | //next additional attendee question groups |
484 | - $orig_additional_qgs = $orig_event->get_many_related('Question_Group', array( array('Event_Question_Group.EQG_primary' => 0 ) ) ); |
|
485 | - if ( !empty( $orig_additional_qgs ) ) { |
|
486 | - foreach ( $orig_additional_qgs as $id => $obj ) { |
|
487 | - if ( $obj instanceof EE_Question_Group ) { |
|
488 | - $new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 0 ) ); |
|
484 | + $orig_additional_qgs = $orig_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0))); |
|
485 | + if ( ! empty($orig_additional_qgs)) { |
|
486 | + foreach ($orig_additional_qgs as $id => $obj) { |
|
487 | + if ($obj instanceof EE_Question_Group) { |
|
488 | + $new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 0)); |
|
489 | 489 | } |
490 | 490 | } |
491 | 491 | } |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | |
497 | 497 | //k now that we have the new event saved we can loop through the datetimes and start adding relations. |
498 | 498 | $cloned_tickets = array(); |
499 | - foreach ( $orig_datetimes as $orig_dtt ) { |
|
499 | + foreach ($orig_datetimes as $orig_dtt) { |
|
500 | 500 | $new_dtt = clone $orig_dtt; |
501 | 501 | $orig_tkts = $orig_dtt->tickets(); |
502 | 502 | |
@@ -504,22 +504,22 @@ discard block |
||
504 | 504 | $new_dtt->set('DTT_ID', 0); |
505 | 505 | $new_dtt->set('DTT_sold', 0); |
506 | 506 | $new_dtt->save(); |
507 | - $new_event->_add_relation_to( $new_dtt, 'Datetime'); |
|
507 | + $new_event->_add_relation_to($new_dtt, 'Datetime'); |
|
508 | 508 | $new_event->save(); |
509 | 509 | |
510 | 510 | //now let's get the ticket relations setup. |
511 | - foreach ( (array) $orig_tkts as $orig_tkt ) { |
|
511 | + foreach ((array) $orig_tkts as $orig_tkt) { |
|
512 | 512 | //it's possible a datetime will have no tickets so let's verify we HAVE a ticket first. |
513 | - if ( ! $orig_tkt instanceof EE_Ticket ) |
|
513 | + if ( ! $orig_tkt instanceof EE_Ticket) |
|
514 | 514 | continue; |
515 | 515 | |
516 | 516 | //is this ticket archived? If it is then let's skip |
517 | - if ( $orig_tkt->get( 'TKT_deleted' ) ) { |
|
517 | + if ($orig_tkt->get('TKT_deleted')) { |
|
518 | 518 | continue; |
519 | 519 | } |
520 | 520 | |
521 | 521 | //does this original ticket already exist in the clone_tickets cache? If so we'll just use the new ticket from it. |
522 | - if ( isset( $cloned_tickets[$orig_tkt->ID()] ) ) { |
|
522 | + if (isset($cloned_tickets[$orig_tkt->ID()])) { |
|
523 | 523 | $new_tkt = $cloned_tickets[$orig_tkt->ID()]; |
524 | 524 | } else { |
525 | 525 | $new_tkt = clone $orig_tkt; |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | $new_tkt->save(); //make sure new ticket has ID. |
532 | 532 | |
533 | 533 | //price relations on new ticket need to be setup. |
534 | - foreach ( $orig_prices as $orig_price ) { |
|
534 | + foreach ($orig_prices as $orig_price) { |
|
535 | 535 | $new_price = clone $orig_price; |
536 | 536 | $new_price->set('PRC_ID', 0); |
537 | 537 | $new_price->save(); |
@@ -548,39 +548,39 @@ discard block |
||
548 | 548 | } |
549 | 549 | |
550 | 550 | //clone taxonomy information |
551 | - $taxonomies_to_clone_with = apply_filters( 'FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', array( 'espresso_event_categories', 'espresso_event_type', 'post_tag' ) ); |
|
551 | + $taxonomies_to_clone_with = apply_filters('FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', array('espresso_event_categories', 'espresso_event_type', 'post_tag')); |
|
552 | 552 | |
553 | 553 | //get terms for original event (notice) |
554 | - $orig_terms = wp_get_object_terms( $orig_event->ID(), $taxonomies_to_clone_with ); |
|
554 | + $orig_terms = wp_get_object_terms($orig_event->ID(), $taxonomies_to_clone_with); |
|
555 | 555 | |
556 | 556 | //loop through terms and add them to new event. |
557 | - foreach ( $orig_terms as $term ) { |
|
558 | - wp_set_object_terms( $new_event->ID(), $term->term_id, $term->taxonomy, true ); |
|
557 | + foreach ($orig_terms as $term) { |
|
558 | + wp_set_object_terms($new_event->ID(), $term->term_id, $term->taxonomy, true); |
|
559 | 559 | } |
560 | 560 | |
561 | 561 | |
562 | - do_action( 'AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event ); |
|
562 | + do_action('AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event); |
|
563 | 563 | |
564 | 564 | //now let's redirect to the edit page for this duplicated event if we have a new event id. |
565 | - if ( $new_event->ID() ) { |
|
565 | + if ($new_event->ID()) { |
|
566 | 566 | $redirect_args = array( |
567 | 567 | 'post' => $new_event->ID(), |
568 | 568 | 'action' => 'edit' |
569 | 569 | ); |
570 | - EE_Error::add_success( __('Event successfully duplicated. Please review the details below and make any necessary edits', 'event_espresso') ); |
|
570 | + EE_Error::add_success(__('Event successfully duplicated. Please review the details below and make any necessary edits', 'event_espresso')); |
|
571 | 571 | } else { |
572 | 572 | $redirect_args = array( |
573 | 573 | 'action' => 'default' |
574 | 574 | ); |
575 | - EE_Error::add_error( __('Not able to duplicate event. Something went wrong.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
575 | + EE_Error::add_error(__('Not able to duplicate event. Something went wrong.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
576 | 576 | } |
577 | 577 | |
578 | - $this->_redirect_after_action(FALSE, '', '', $redirect_args, TRUE ); |
|
578 | + $this->_redirect_after_action(FALSE, '', '', $redirect_args, TRUE); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | |
582 | 582 | |
583 | - protected function _import_page(){ |
|
583 | + protected function _import_page() { |
|
584 | 584 | |
585 | 585 | $title = __('Import', 'event_espresso'); |
586 | 586 | $intro = __('If you have a previously exported Event Espresso 4 information in a Comma Separated Value (CSV) file format, you can upload the file here: ', 'event_espresso'); |
@@ -588,8 +588,8 @@ discard block |
||
588 | 588 | $action = 'import_events'; |
589 | 589 | $type = 'csv'; |
590 | 590 | $this->_template_args['form'] = EE_Import::instance()->upload_form($title, $intro, $form_url, $action, $type); |
591 | - $this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'sample_export_file'),$this->_admin_base_url); |
|
592 | - $content = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php',$this->_template_args,true); |
|
591 | + $this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'sample_export_file'), $this->_admin_base_url); |
|
592 | + $content = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'import_page.template.php', $this->_template_args, true); |
|
593 | 593 | |
594 | 594 | |
595 | 595 | $this->_template_args['admin_page_content'] = $content; |
@@ -602,9 +602,9 @@ discard block |
||
602 | 602 | * @return string html |
603 | 603 | */ |
604 | 604 | protected function _import_events() { |
605 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
605 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
606 | 606 | $success = EE_Import::instance()->import(); |
607 | - $this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'),true); |
|
607 | + $this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'), true); |
|
608 | 608 | |
609 | 609 | } |
610 | 610 | |
@@ -618,24 +618,24 @@ discard block |
||
618 | 618 | * @return file |
619 | 619 | */ |
620 | 620 | protected function _events_export() { |
621 | - if(isset($this->_req_data['EVT_ID'])){ |
|
621 | + if (isset($this->_req_data['EVT_ID'])) { |
|
622 | 622 | $event_ids = $this->_req_data['EVT_ID']; |
623 | - }elseif(isset($this->_req_data['EVT_IDs'])){ |
|
623 | + }elseif (isset($this->_req_data['EVT_IDs'])) { |
|
624 | 624 | $event_ids = $this->_req_data['EVT_IDs']; |
625 | - }else{ |
|
625 | + } else { |
|
626 | 626 | $event_ids = NULL; |
627 | 627 | } |
628 | 628 | //todo: I don't like doing this but it'll do until we modify EE_Export Class. |
629 | 629 | $new_request_args = array( |
630 | 630 | 'export' => 'report', |
631 | 631 | 'action' => 'all_event_data', |
632 | - 'EVT_ID' => $event_ids , |
|
632 | + 'EVT_ID' => $event_ids, |
|
633 | 633 | ); |
634 | 634 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
635 | 635 | |
636 | - EE_Registry::instance()->load_helper( 'File' ); |
|
637 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
638 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
636 | + EE_Registry::instance()->load_helper('File'); |
|
637 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
638 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
639 | 639 | $EE_Export = EE_Export::instance($this->_req_data); |
640 | 640 | $EE_Export->export(); |
641 | 641 | } |
@@ -657,12 +657,12 @@ discard block |
||
657 | 657 | 'category_ids' => $this->_req_data['EVT_CAT_ID'] |
658 | 658 | ); |
659 | 659 | |
660 | - $this->_req_data = array_merge( $this->_req_data, $new_request_args ); |
|
660 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
661 | 661 | |
662 | - EE_Registry::instance()->load_helper( 'File' ); |
|
663 | - if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) { |
|
664 | - require_once( EE_CLASSES . 'EE_Export.class.php'); |
|
665 | - $EE_Export = EE_Export::instance( $this->_req_data ); |
|
662 | + EE_Registry::instance()->load_helper('File'); |
|
663 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
664 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
665 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
666 | 666 | $EE_Export->export(); |
667 | 667 | } |
668 | 668 | |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | /** |
674 | 674 | * Creates a sample CSV file for importing |
675 | 675 | */ |
676 | - protected function _sample_export_file(){ |
|
676 | + protected function _sample_export_file() { |
|
677 | 677 | // require_once(EE_CLASSES . 'EE_Export.class.php'); |
678 | 678 | EE_Export::instance()->export_sample(); |
679 | 679 | } |
@@ -690,10 +690,10 @@ discard block |
||
690 | 690 | * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
691 | 691 | * from General_Settings_Admin_Page to here. |
692 | 692 | */ |
693 | - $this->_template_args = apply_filters( 'FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args ); |
|
694 | - $this->_set_add_edit_form_tags( 'update_template_settings' ); |
|
695 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
696 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php', $this->_template_args, TRUE ); |
|
693 | + $this->_template_args = apply_filters('FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args); |
|
694 | + $this->_set_add_edit_form_tags('update_template_settings'); |
|
695 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
696 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'template_settings.template.php', $this->_template_args, TRUE); |
|
697 | 697 | $this->display_admin_page_with_sidebar(); |
698 | 698 | } |
699 | 699 | |
@@ -705,24 +705,24 @@ discard block |
||
705 | 705 | * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
706 | 706 | * from General_Settings_Admin_Page to here. |
707 | 707 | */ |
708 | - EE_Registry::instance()->CFG->template_settings = apply_filters( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data ); |
|
708 | + EE_Registry::instance()->CFG->template_settings = apply_filters('FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data); |
|
709 | 709 | |
710 | 710 | |
711 | 711 | //update custom post type slugs and detect if we need to flush rewrite rules |
712 | 712 | $old_slug = EE_Registry::instance()->CFG->core->event_cpt_slug; |
713 | - EE_Registry::instance()->CFG->core->event_cpt_slug = empty( $this->_req_data['event_cpt_slug'] ) ? EE_Registry::instance()->CFG->core->event_cpt_slug : sanitize_title_with_dashes( $this->_req_data['event_cpt_slug'] ); |
|
713 | + EE_Registry::instance()->CFG->core->event_cpt_slug = empty($this->_req_data['event_cpt_slug']) ? EE_Registry::instance()->CFG->core->event_cpt_slug : sanitize_title_with_dashes($this->_req_data['event_cpt_slug']); |
|
714 | 714 | |
715 | 715 | |
716 | 716 | $what = 'Template Settings'; |
717 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__ ); |
|
717 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__); |
|
718 | 718 | |
719 | 719 | |
720 | - if ( EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug ) { |
|
721 | - update_option( 'ee_flush_rewrite_rules', true ); |
|
720 | + if (EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug) { |
|
721 | + update_option('ee_flush_rewrite_rules', true); |
|
722 | 722 | } |
723 | 723 | |
724 | 724 | |
725 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'template_settings' ) ); |
|
725 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'template_settings')); |
|
726 | 726 | |
727 | 727 | } |
728 | 728 | |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | |
741 | 741 | $this->verify_cpt_object(); |
742 | 742 | |
743 | - add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array( $this, 'registration_options_meta_box' ), $this->page_slug, 'side', 'core'); |
|
743 | + add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array($this, 'registration_options_meta_box'), $this->page_slug, 'side', 'core'); |
|
744 | 744 | //add_meta_box('espresso_event_types', __('Event Type', 'event_espresso'), array( $this, 'event_type_meta_box' ), $this->page_slug, 'side', 'default' ); //add this back in when the feature is ready. |
745 | 745 | |
746 | 746 | //todo feature in progress |
@@ -764,16 +764,16 @@ discard block |
||
764 | 764 | array('id' => true, 'text' => __('Yes', 'event_espresso')), |
765 | 765 | array('id' => false, 'text' => __('No', 'event_espresso')) |
766 | 766 | ); |
767 | - $default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete ), TRUE); |
|
767 | + $default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete), TRUE); |
|
768 | 768 | $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(FALSE); |
769 | 769 | $template_args['_event'] = $this->_cpt_model_obj; |
770 | 770 | $template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit(); |
771 | 771 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
772 | 772 | $template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description()); |
773 | 773 | $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false); |
774 | - $template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input('EVT_default_registration_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status() ); |
|
775 | - $template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values ); |
|
776 | - $templatepath = EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php'; |
|
774 | + $template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input('EVT_default_registration_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
|
775 | + $template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values); |
|
776 | + $templatepath = EVENTS_CAF_TEMPLATE_PATH.'event_registration_options.template.php'; |
|
777 | 777 | EEH_Template::display_template($templatepath, $template_args); |
778 | 778 | } |
779 | 779 | |
@@ -786,9 +786,9 @@ discard block |
||
786 | 786 | * @param array $box metabox args |
787 | 787 | * @return string metabox contents |
788 | 788 | */ |
789 | - public function event_type_meta_box( $post, $box ) { |
|
790 | - $template_args['radio_list'] = $this->wp_terms_radio($post->ID, array( 'taxonomy' => 'espresso_event_type' ) ); |
|
791 | - $template = EVENTS_CAF_TEMPLATE_PATH . 'event_type_metabox_contents.template.php'; |
|
789 | + public function event_type_meta_box($post, $box) { |
|
790 | + $template_args['radio_list'] = $this->wp_terms_radio($post->ID, array('taxonomy' => 'espresso_event_type')); |
|
791 | + $template = EVENTS_CAF_TEMPLATE_PATH.'event_type_metabox_contents.template.php'; |
|
792 | 792 | EEH_Template::display_template($template, $template_args); |
793 | 793 | } |
794 | 794 | |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | |
799 | 799 | |
800 | 800 | |
801 | - public function wp_terms_radio( $post_id = 0, $args = array() ) { |
|
801 | + public function wp_terms_radio($post_id = 0, $args = array()) { |
|
802 | 802 | $defaults = array( |
803 | 803 | 'descendants_and_self' => 0, |
804 | 804 | 'selected_cats' => false, |
@@ -807,11 +807,11 @@ discard block |
||
807 | 807 | 'taxonomy' => 'category', |
808 | 808 | 'checked_ontop' => true |
809 | 809 | ); |
810 | - $args = apply_filters( 'wp_terms_checklist_args', $args, $post_id ); |
|
810 | + $args = apply_filters('wp_terms_checklist_args', $args, $post_id); |
|
811 | 811 | |
812 | - extract( wp_parse_args($args, $defaults), EXTR_SKIP ); |
|
812 | + extract(wp_parse_args($args, $defaults), EXTR_SKIP); |
|
813 | 813 | |
814 | - if ( empty($walker) || !is_a($walker, 'Walker') ) |
|
814 | + if (empty($walker) || ! is_a($walker, 'Walker')) |
|
815 | 815 | $walker = new Walker_Radio_Checklist; |
816 | 816 | |
817 | 817 | $descendants_and_self = (int) $descendants_and_self; |
@@ -819,37 +819,37 @@ discard block |
||
819 | 819 | $args = array('taxonomy' => $taxonomy); |
820 | 820 | |
821 | 821 | $tax = get_taxonomy($taxonomy); |
822 | - $args['disabled'] = !current_user_can($tax->cap->assign_terms); |
|
822 | + $args['disabled'] = ! current_user_can($tax->cap->assign_terms); |
|
823 | 823 | |
824 | - if ( is_array( $selected_cats ) ) |
|
824 | + if (is_array($selected_cats)) |
|
825 | 825 | $args['selected_cats'] = $selected_cats; |
826 | - elseif ( $post_id ) |
|
826 | + elseif ($post_id) |
|
827 | 827 | $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); |
828 | 828 | else |
829 | 829 | $args['selected_cats'] = array(); |
830 | 830 | |
831 | - if ( is_array( $popular_cats ) ) |
|
831 | + if (is_array($popular_cats)) |
|
832 | 832 | $args['popular_cats'] = $popular_cats; |
833 | 833 | else |
834 | - $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); |
|
834 | + $args['popular_cats'] = get_terms($taxonomy, array('fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false)); |
|
835 | 835 | |
836 | - if ( $descendants_and_self ) { |
|
837 | - $categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) ); |
|
838 | - $self = get_term( $descendants_and_self, $taxonomy ); |
|
839 | - array_unshift( $categories, $self ); |
|
836 | + if ($descendants_and_self) { |
|
837 | + $categories = (array) get_terms($taxonomy, array('child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0)); |
|
838 | + $self = get_term($descendants_and_self, $taxonomy); |
|
839 | + array_unshift($categories, $self); |
|
840 | 840 | } else { |
841 | 841 | $categories = (array) get_terms($taxonomy, array('get' => 'all')); |
842 | 842 | } |
843 | 843 | |
844 | - if ( $checked_ontop ) { |
|
844 | + if ($checked_ontop) { |
|
845 | 845 | // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache) |
846 | 846 | $checked_categories = array(); |
847 | - $keys = array_keys( $categories ); |
|
847 | + $keys = array_keys($categories); |
|
848 | 848 | |
849 | - foreach( $keys as $k ) { |
|
850 | - if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) { |
|
849 | + foreach ($keys as $k) { |
|
850 | + if (in_array($categories[$k]->term_id, $args['selected_cats'])) { |
|
851 | 851 | $checked_categories[] = $categories[$k]; |
852 | - unset( $categories[$k] ); |
|
852 | + unset($categories[$k]); |
|
853 | 853 | } |
854 | 854 | } |
855 | 855 | |
@@ -874,18 +874,18 @@ discard block |
||
874 | 874 | * @param array $list_table_obj the list table object |
875 | 875 | * @return array new filters |
876 | 876 | */ |
877 | - public function list_table_filters( $oldfilters, $list_table_obj ) { |
|
877 | + public function list_table_filters($oldfilters, $list_table_obj) { |
|
878 | 878 | $filters = array(); |
879 | 879 | |
880 | 880 | //first month/year filters |
881 | 881 | $filters[] = $this->espresso_event_months_dropdown(); |
882 | 882 | |
883 | 883 | |
884 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
884 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
885 | 885 | |
886 | 886 | //active status dropdown |
887 | - if ( $status !== 'draft' ) |
|
888 | - $filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' ); |
|
887 | + if ($status !== 'draft') |
|
888 | + $filter[] = $this->active_status_dropdown(isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : ''); |
|
889 | 889 | |
890 | 890 | //category filter |
891 | 891 | $filters[] = $this->category_dropdown(); |
@@ -907,17 +907,17 @@ discard block |
||
907 | 907 | */ |
908 | 908 | public function espresso_event_months_dropdown() { |
909 | 909 | //what we need to do is get all PRIMARY datetimes for all events to filter on. Note we need to include any other filters that are set! |
910 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
910 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
911 | 911 | |
912 | 912 | //categories? |
913 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
913 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
914 | 914 | |
915 | 915 | //active status? |
916 | - $active_status = isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : NULL; |
|
916 | + $active_status = isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : NULL; |
|
917 | 917 | |
918 | 918 | $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
919 | 919 | |
920 | - return EEH_Form_Fields::generate_event_months_dropdown( $cur_date, $status, $category, $active_status ); |
|
920 | + return EEH_Form_Fields::generate_event_months_dropdown($cur_date, $status, $category, $active_status); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | |
@@ -928,12 +928,12 @@ discard block |
||
928 | 928 | * @param string $current_value whatever the ucrrent active status is |
929 | 929 | * @return string html dropdown. |
930 | 930 | */ |
931 | - public function active_status_dropdown( $current_value = '' ) { |
|
931 | + public function active_status_dropdown($current_value = '') { |
|
932 | 932 | $select_name = 'active_status'; |
933 | - $values = array('none' => __('Show Active/Inactive', 'event_espresso'), 'active' => __('Active', 'event_espresso'), 'upcoming' => __('Upcoming', 'event_espresso'), 'expired' => __('Expired', 'event_espresso'), 'inactive' => __('Inactive', 'event_espresso') ); |
|
933 | + $values = array('none' => __('Show Active/Inactive', 'event_espresso'), 'active' => __('Active', 'event_espresso'), 'upcoming' => __('Upcoming', 'event_espresso'), 'expired' => __('Expired', 'event_espresso'), 'inactive' => __('Inactive', 'event_espresso')); |
|
934 | 934 | $id = 'id="espresso-active-status-dropdown-filter"'; |
935 | 935 | $class = 'wide'; |
936 | - echo EEH_Form_Fields::select_input( $select_name, $values, $current_value, $id, $class ); |
|
936 | + echo EEH_Form_Fields::select_input($select_name, $values, $current_value, $id, $class); |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | |
@@ -945,9 +945,9 @@ discard block |
||
945 | 945 | * @return string html |
946 | 946 | */ |
947 | 947 | public function category_dropdown() { |
948 | - $cur_cat = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1; |
|
948 | + $cur_cat = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
949 | 949 | |
950 | - return EEH_Form_Fields::generate_event_category_dropdown( $cur_cat ); |
|
950 | + return EEH_Form_Fields::generate_event_category_dropdown($cur_cat); |
|
951 | 951 | } |
952 | 952 | |
953 | 953 | |
@@ -959,14 +959,14 @@ discard block |
||
959 | 959 | * @return int |
960 | 960 | */ |
961 | 961 | public function total_events_today() { |
962 | - $start = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', date('Y-m-d' ) . ' 00:00:00', 'Y-m-d H:i:s', 'UTC' ); |
|
963 | - $end = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', date('Y-m-d' ) . ' 23:59:59', 'Y-m-d H:i:s', 'UTC' ); |
|
962 | + $start = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', date('Y-m-d').' 00:00:00', 'Y-m-d H:i:s', 'UTC'); |
|
963 | + $end = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', date('Y-m-d').' 23:59:59', 'Y-m-d H:i:s', 'UTC'); |
|
964 | 964 | |
965 | 965 | $where = array( |
966 | - 'Datetime.DTT_EVT_start' => array( 'BETWEEN', array($start, $end ) ) |
|
966 | + 'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)) |
|
967 | 967 | ); |
968 | 968 | |
969 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
969 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
970 | 970 | return $count; |
971 | 971 | } |
972 | 972 | |
@@ -981,14 +981,14 @@ discard block |
||
981 | 981 | $this_year_r = date('Y'); |
982 | 982 | $this_month_r = date('m'); |
983 | 983 | $days_this_month = date('t'); |
984 | - $start = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $this_year_r . '-' . $this_month_r . '-01 00:00:00', 'Y-m-d H:i:s', 'UTC' ); |
|
985 | - $end = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59', 'Y-m-d H:i:s', 'UTC' ); |
|
984 | + $start = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', $this_year_r.'-'.$this_month_r.'-01 00:00:00', 'Y-m-d H:i:s', 'UTC'); |
|
985 | + $end = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' 23:59:59', 'Y-m-d H:i:s', 'UTC'); |
|
986 | 986 | |
987 | 987 | $where = array( |
988 | - 'Datetime.DTT_EVT_start' => array( 'BETWEEN', array($start, $end ) ) |
|
988 | + 'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)) |
|
989 | 989 | ); |
990 | 990 | |
991 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
991 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
992 | 992 | return $count; |
993 | 993 | } |
994 | 994 | |
@@ -1005,53 +1005,53 @@ discard block |
||
1005 | 1005 | |
1006 | 1006 | |
1007 | 1007 | |
1008 | - public function get_default_tickets( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
1008 | + public function get_default_tickets($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
1009 | 1009 | |
1010 | - $orderby= empty( $this->_req_data['orderby'] ) ? 'TKT_name' : $this->_req_data['orderby']; |
|
1011 | - $order = empty( $this->_req_data['order'] ) ? 'ASC' : $this->_req_data['order']; |
|
1010 | + $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby']; |
|
1011 | + $order = empty($this->_req_data['order']) ? 'ASC' : $this->_req_data['order']; |
|
1012 | 1012 | |
1013 | - switch ( $orderby ) { |
|
1013 | + switch ($orderby) { |
|
1014 | 1014 | case 'TKT_name' : |
1015 | - $orderby = array( 'TKT_name' => $order ); |
|
1015 | + $orderby = array('TKT_name' => $order); |
|
1016 | 1016 | break; |
1017 | 1017 | |
1018 | 1018 | case 'TKT_price' : |
1019 | - $orderby = array( 'TKT_price' => $order ); |
|
1019 | + $orderby = array('TKT_price' => $order); |
|
1020 | 1020 | break; |
1021 | 1021 | |
1022 | 1022 | case 'TKT_uses' : |
1023 | - $orderby = array( 'TKT_uses' => $order ); |
|
1023 | + $orderby = array('TKT_uses' => $order); |
|
1024 | 1024 | break; |
1025 | 1025 | |
1026 | 1026 | case 'TKT_min' : |
1027 | - $orderby = array( 'TKT_min' => $order ); |
|
1027 | + $orderby = array('TKT_min' => $order); |
|
1028 | 1028 | break; |
1029 | 1029 | |
1030 | 1030 | case 'TKT_max' : |
1031 | - $orderby = array( 'TKT_max' => $order ); |
|
1031 | + $orderby = array('TKT_max' => $order); |
|
1032 | 1032 | break; |
1033 | 1033 | |
1034 | 1034 | case 'TKT_qty' : |
1035 | - $orderby = array( 'TKT_qty' => $order ); |
|
1035 | + $orderby = array('TKT_qty' => $order); |
|
1036 | 1036 | break; |
1037 | 1037 | } |
1038 | 1038 | |
1039 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1040 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1039 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1040 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1041 | 1041 | |
1042 | 1042 | $_where = array( |
1043 | 1043 | 'TKT_is_default' => 1, |
1044 | 1044 | 'TKT_deleted' => $trashed |
1045 | 1045 | ); |
1046 | 1046 | |
1047 | - $offset = ($current_page-1)*$per_page; |
|
1048 | - $limit = array( $offset, $per_page ); |
|
1047 | + $offset = ($current_page - 1) * $per_page; |
|
1048 | + $limit = array($offset, $per_page); |
|
1049 | 1049 | |
1050 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1051 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1050 | + if (isset($this->_req_data['s'])) { |
|
1051 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1052 | 1052 | $_where['OR'] = array( |
1053 | - 'TKT_name' => array('LIKE',$sstr ), |
|
1054 | - 'TKT_description' => array('LIKE',$sstr ) |
|
1053 | + 'TKT_name' => array('LIKE', $sstr), |
|
1054 | + 'TKT_description' => array('LIKE', $sstr) |
|
1055 | 1055 | ); |
1056 | 1056 | } |
1057 | 1057 | |
@@ -1062,9 +1062,9 @@ discard block |
||
1062 | 1062 | 'group_by'=>'TKT_ID' |
1063 | 1063 | ); |
1064 | 1064 | |
1065 | - if($count){ |
|
1065 | + if ($count) { |
|
1066 | 1066 | return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
1067 | - }else{ |
|
1067 | + } else { |
|
1068 | 1068 | return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
1069 | 1069 | } |
1070 | 1070 | |
@@ -1074,35 +1074,35 @@ discard block |
||
1074 | 1074 | |
1075 | 1075 | |
1076 | 1076 | |
1077 | - protected function _trash_or_restore_ticket( $trash = FALSE ) { |
|
1077 | + protected function _trash_or_restore_ticket($trash = FALSE) { |
|
1078 | 1078 | $success = 1; |
1079 | 1079 | |
1080 | 1080 | $TKT = EEM_Ticket::instance(); |
1081 | 1081 | |
1082 | 1082 | //checkboxes? |
1083 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
1083 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1084 | 1084 | //if array has more than one element then success message should be plural |
1085 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1085 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1086 | 1086 | |
1087 | 1087 | //cycle thru the boxes |
1088 | - while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
1089 | - if ( $trash ) { |
|
1090 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1088 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1089 | + if ($trash) { |
|
1090 | + if ( ! $TKT->delete_by_ID($TKT_ID)) |
|
1091 | 1091 | $success = 0; |
1092 | 1092 | } else { |
1093 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1093 | + if ( ! $TKT->restore_by_ID($TKT_ID)) |
|
1094 | 1094 | $success = 0; |
1095 | 1095 | } |
1096 | 1096 | } |
1097 | 1097 | } else { |
1098 | 1098 | //grab single id and trash |
1099 | - $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
1099 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
1100 | 1100 | |
1101 | - if ( $trash ) { |
|
1102 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1101 | + if ($trash) { |
|
1102 | + if ( ! $TKT->delete_by_ID($TKT_ID)) |
|
1103 | 1103 | $success = 0; |
1104 | 1104 | } else { |
1105 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1105 | + if ( ! $TKT->restore_by_ID($TKT_ID)) |
|
1106 | 1106 | $success = 0; |
1107 | 1107 | } |
1108 | 1108 | } |
@@ -1112,7 +1112,7 @@ discard block |
||
1112 | 1112 | 'action' => 'ticket_list_table', |
1113 | 1113 | 'status' => $trash ? '' : 'trashed' |
1114 | 1114 | ); |
1115 | - $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
|
1115 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
1116 | 1116 | } |
1117 | 1117 | |
1118 | 1118 | |
@@ -1125,21 +1125,21 @@ discard block |
||
1125 | 1125 | $TKT = EEM_Ticket::instance(); |
1126 | 1126 | |
1127 | 1127 | //checkboxes? |
1128 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
1128 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1129 | 1129 | //if array has more than one element then success message should be plural |
1130 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1130 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1131 | 1131 | |
1132 | 1132 | //cycle thru the boxes |
1133 | - while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
1133 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1134 | 1134 | //delete |
1135 | - if ( ! $this->_delete_the_ticket( $TKT_ID ) ) { |
|
1135 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
1136 | 1136 | $success = 0; |
1137 | 1137 | } |
1138 | 1138 | } |
1139 | 1139 | } else { |
1140 | 1140 | //grab single id and trash |
1141 | - $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
1142 | - if ( ! $this->_delete_the_ticket( $TKT_ID ) ) { |
|
1141 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
1142 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
1143 | 1143 | $success = 0; |
1144 | 1144 | } |
1145 | 1145 | } |
@@ -1151,16 +1151,16 @@ discard block |
||
1151 | 1151 | ); |
1152 | 1152 | |
1153 | 1153 | //failsafe. If the default ticket count === 1 then we need to redirect to event overview. |
1154 | - if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) ) |
|
1154 | + if (EEM_Ticket::instance()->count_deleted_and_undeleted(array(array('TKT_is_default' => 1)), 'TKT_ID', TRUE)) |
|
1155 | 1155 | $query_args = array(); |
1156 | - $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
|
1156 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
1157 | 1157 | } |
1158 | 1158 | |
1159 | 1159 | |
1160 | 1160 | |
1161 | 1161 | |
1162 | - protected function _delete_the_ticket( $TKT_ID ) { |
|
1163 | - $tkt = EEM_Ticket::instance()->get_one_by_ID( $TKT_ID ); |
|
1162 | + protected function _delete_the_ticket($TKT_ID) { |
|
1163 | + $tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID); |
|
1164 | 1164 | $tkt->_remove_relations('Datetime'); |
1165 | 1165 | //delete all related prices first |
1166 | 1166 | $tkt->delete_related_permanently('Price'); |
@@ -1,6 +1,7 @@ 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 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -435,8 +436,9 @@ discard block |
||
435 | 436 | //k we've got EVT_ID so let's use that to get the event we'll duplicate |
436 | 437 | $orig_event = EEM_Event::instance()->get_one_by_ID( $this->_req_data['EVT_ID'] ); |
437 | 438 | |
438 | - if ( ! $orig_event instanceof EE_Event ) |
|
439 | - throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso '), $this->_req_data['EVT_ID'] ) ); |
|
439 | + if ( ! $orig_event instanceof EE_Event ) { |
|
440 | + throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso '), $this->_req_data['EVT_ID'] ) ); |
|
441 | + } |
|
440 | 442 | |
441 | 443 | //k now let's clone the $orig_event before getting relations |
442 | 444 | $new_event = clone $orig_event; |
@@ -510,8 +512,9 @@ discard block |
||
510 | 512 | //now let's get the ticket relations setup. |
511 | 513 | foreach ( (array) $orig_tkts as $orig_tkt ) { |
512 | 514 | //it's possible a datetime will have no tickets so let's verify we HAVE a ticket first. |
513 | - if ( ! $orig_tkt instanceof EE_Ticket ) |
|
514 | - continue; |
|
515 | + if ( ! $orig_tkt instanceof EE_Ticket ) { |
|
516 | + continue; |
|
517 | + } |
|
515 | 518 | |
516 | 519 | //is this ticket archived? If it is then let's skip |
517 | 520 | if ( $orig_tkt->get( 'TKT_deleted' ) ) { |
@@ -620,9 +623,9 @@ discard block |
||
620 | 623 | protected function _events_export() { |
621 | 624 | if(isset($this->_req_data['EVT_ID'])){ |
622 | 625 | $event_ids = $this->_req_data['EVT_ID']; |
623 | - }elseif(isset($this->_req_data['EVT_IDs'])){ |
|
626 | + } elseif(isset($this->_req_data['EVT_IDs'])){ |
|
624 | 627 | $event_ids = $this->_req_data['EVT_IDs']; |
625 | - }else{ |
|
628 | + } else{ |
|
626 | 629 | $event_ids = NULL; |
627 | 630 | } |
628 | 631 | //todo: I don't like doing this but it'll do until we modify EE_Export Class. |
@@ -811,8 +814,9 @@ discard block |
||
811 | 814 | |
812 | 815 | extract( wp_parse_args($args, $defaults), EXTR_SKIP ); |
813 | 816 | |
814 | - if ( empty($walker) || !is_a($walker, 'Walker') ) |
|
815 | - $walker = new Walker_Radio_Checklist; |
|
817 | + if ( empty($walker) || !is_a($walker, 'Walker') ) { |
|
818 | + $walker = new Walker_Radio_Checklist; |
|
819 | + } |
|
816 | 820 | |
817 | 821 | $descendants_and_self = (int) $descendants_and_self; |
818 | 822 | |
@@ -821,17 +825,19 @@ discard block |
||
821 | 825 | $tax = get_taxonomy($taxonomy); |
822 | 826 | $args['disabled'] = !current_user_can($tax->cap->assign_terms); |
823 | 827 | |
824 | - if ( is_array( $selected_cats ) ) |
|
825 | - $args['selected_cats'] = $selected_cats; |
|
826 | - elseif ( $post_id ) |
|
827 | - $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); |
|
828 | - else |
|
829 | - $args['selected_cats'] = array(); |
|
828 | + if ( is_array( $selected_cats ) ) { |
|
829 | + $args['selected_cats'] = $selected_cats; |
|
830 | + } elseif ( $post_id ) { |
|
831 | + $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); |
|
832 | + } else { |
|
833 | + $args['selected_cats'] = array(); |
|
834 | + } |
|
830 | 835 | |
831 | - if ( is_array( $popular_cats ) ) |
|
832 | - $args['popular_cats'] = $popular_cats; |
|
833 | - else |
|
834 | - $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); |
|
836 | + if ( is_array( $popular_cats ) ) { |
|
837 | + $args['popular_cats'] = $popular_cats; |
|
838 | + } else { |
|
839 | + $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); |
|
840 | + } |
|
835 | 841 | |
836 | 842 | if ( $descendants_and_self ) { |
837 | 843 | $categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) ); |
@@ -884,8 +890,9 @@ discard block |
||
884 | 890 | $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
885 | 891 | |
886 | 892 | //active status dropdown |
887 | - if ( $status !== 'draft' ) |
|
888 | - $filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' ); |
|
893 | + if ( $status !== 'draft' ) { |
|
894 | + $filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' ); |
|
895 | + } |
|
889 | 896 | |
890 | 897 | //category filter |
891 | 898 | $filters[] = $this->category_dropdown(); |
@@ -1064,7 +1071,7 @@ discard block |
||
1064 | 1071 | |
1065 | 1072 | if($count){ |
1066 | 1073 | return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
1067 | - }else{ |
|
1074 | + } else{ |
|
1068 | 1075 | return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
1069 | 1076 | } |
1070 | 1077 | |
@@ -1087,11 +1094,13 @@ discard block |
||
1087 | 1094 | //cycle thru the boxes |
1088 | 1095 | while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
1089 | 1096 | if ( $trash ) { |
1090 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1091 | - $success = 0; |
|
1097 | + if ( ! $TKT->delete_by_ID( $TKT_ID ) ) { |
|
1098 | + $success = 0; |
|
1099 | + } |
|
1092 | 1100 | } else { |
1093 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1094 | - $success = 0; |
|
1101 | + if ( ! $TKT->restore_by_ID( $TKT_ID ) ) { |
|
1102 | + $success = 0; |
|
1103 | + } |
|
1095 | 1104 | } |
1096 | 1105 | } |
1097 | 1106 | } else { |
@@ -1099,11 +1108,13 @@ discard block |
||
1099 | 1108 | $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
1100 | 1109 | |
1101 | 1110 | if ( $trash ) { |
1102 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1103 | - $success = 0; |
|
1111 | + if ( ! $TKT->delete_by_ID( $TKT_ID ) ) { |
|
1112 | + $success = 0; |
|
1113 | + } |
|
1104 | 1114 | } else { |
1105 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1106 | - $success = 0; |
|
1115 | + if ( ! $TKT->restore_by_ID( $TKT_ID ) ) { |
|
1116 | + $success = 0; |
|
1117 | + } |
|
1107 | 1118 | } |
1108 | 1119 | } |
1109 | 1120 | |
@@ -1151,8 +1162,9 @@ discard block |
||
1151 | 1162 | ); |
1152 | 1163 | |
1153 | 1164 | //failsafe. If the default ticket count === 1 then we need to redirect to event overview. |
1154 | - if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) ) |
|
1155 | - $query_args = array(); |
|
1165 | + if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) ) { |
|
1166 | + $query_args = array(); |
|
1167 | + } |
|
1156 | 1168 | $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
1157 | 1169 | } |
1158 | 1170 |
@@ -5,42 +5,42 @@ |
||
5 | 5 | <table class="admin-primary-mbox-tbl"> |
6 | 6 | <thead> |
7 | 7 | <tr> |
8 | - <th class="jst-left"><?php _e( 'Event Name', 'event_espresso' );?></th> |
|
9 | - <th class="jst-left"><?php _e( 'REG ID', 'event_espresso' );?></th> |
|
10 | - <th class="jst-left"><?php _e( 'TXN ID', 'event_espresso' );?></th> |
|
11 | - <th class="jst-left"><?php _e( 'Reg Code', 'event_espresso' );?></th> |
|
12 | - <th class="jst-rght"><?php _e( 'Ticket Price', 'event_espresso' );?></th> |
|
8 | + <th class="jst-left"><?php _e('Event Name', 'event_espresso'); ?></th> |
|
9 | + <th class="jst-left"><?php _e('REG ID', 'event_espresso'); ?></th> |
|
10 | + <th class="jst-left"><?php _e('TXN ID', 'event_espresso'); ?></th> |
|
11 | + <th class="jst-left"><?php _e('Reg Code', 'event_espresso'); ?></th> |
|
12 | + <th class="jst-rght"><?php _e('Ticket Price', 'event_espresso'); ?></th> |
|
13 | 13 | </tr> |
14 | 14 | </thead> |
15 | 15 | <tbody> |
16 | - <?php foreach( $registrations as $registration ) : ?> |
|
16 | + <?php foreach ($registrations as $registration) : ?> |
|
17 | 17 | <tr> |
18 | 18 | <td class="jst-left"> |
19 | 19 | <?php |
20 | - $event_url = add_query_arg( array( 'action' => 'edit', 'post' => $registration->event_ID() ), admin_url( 'admin.php?page=espresso_events' )); |
|
21 | - echo EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $registration->event_ID() ) ? '<a href="'. $event_url .'" title="'. esc_attr__( 'Edit Event', 'event_espresso' ) .'">' . $registration->event_name() . '</a>' : $registration->event_name(); |
|
20 | + $event_url = add_query_arg(array('action' => 'edit', 'post' => $registration->event_ID()), admin_url('admin.php?page=espresso_events')); |
|
21 | + echo EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $registration->event_ID()) ? '<a href="'.$event_url.'" title="'.esc_attr__('Edit Event', 'event_espresso').'">'.$registration->event_name().'</a>' : $registration->event_name(); |
|
22 | 22 | ?> |
23 | 23 | </td> |
24 | 24 | <td class="jst-left"> |
25 | 25 | <?php |
26 | - $reg_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
|
27 | - echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? ' |
|
28 | - <a href="'.$reg_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . |
|
29 | - sprintf( __( 'View Registration ', 'event_espresso'), $registration->ID() ) . |
|
26 | + $reg_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL); |
|
27 | + echo EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? ' |
|
28 | + <a href="'.$reg_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'. |
|
29 | + sprintf(__('View Registration ', 'event_espresso'), $registration->ID()). |
|
30 | 30 | '</a>' : ''; |
31 | 31 | ?> |
32 | 32 | </td> |
33 | 33 | <td class="jst-left"> |
34 | 34 | <?php |
35 | - $txn_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID() ), TXN_ADMIN_URL ); |
|
36 | - echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? ' |
|
37 | - <a href="'.$txn_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '"> |
|
38 | - View Transaction ' . $registration->transaction_ID() . ' |
|
35 | + $txn_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID()), TXN_ADMIN_URL); |
|
36 | + echo EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? ' |
|
37 | + <a href="'.$txn_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'"> |
|
38 | + View Transaction ' . $registration->transaction_ID().' |
|
39 | 39 | </a>' : ''; |
40 | 40 | ?> |
41 | 41 | </td> |
42 | - <td class="jst-left"><?php echo $registration->reg_code();?></td> |
|
43 | - <td class="jst-rght"><?php echo EEH_Template::format_currency( $registration->final_price() );?></td> |
|
42 | + <td class="jst-left"><?php echo $registration->reg_code(); ?></td> |
|
43 | + <td class="jst-rght"><?php echo EEH_Template::format_currency($registration->final_price()); ?></td> |
|
44 | 44 | </tr> |
45 | 45 | <?php endforeach; ?> |
46 | 46 | </tbody> |
@@ -2,18 +2,18 @@ |
||
2 | 2 | <p> |
3 | 3 | <?php _e('The importer can be used to import event information into Event Espresso using a CSV file.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | -<h3><?php _e("Importing from other Event Espresso 4 Sites", 'event_espresso');?></h3> |
|
5 | +<h3><?php _e("Importing from other Event Espresso 4 Sites", 'event_espresso'); ?></h3> |
|
6 | 6 | <p> |
7 | 7 | <?php _e('To import Event Espresso data from another Event Espresso 4 install, export a CSV file from the admin Events overview page, or anywhere you can generate a CSV export file from. Then upload that file here (regardless of what type of information was exported).', 'event_espresso'); ?> |
8 | 8 | </p> |
9 | 9 | <p> |
10 | 10 | <?php _e('Note: its possible that data from the other site have the same IDs as data in this site. The importer recognizes that this data is from a different database and inserts new items for each item in the CSV file, regardless of whether its ID matches that of an item in this site\'s database or not. However, the importer also remembers the mapping from the old site\'s database to this site\'s database, and on subsequent CSV importers from that site, the data in this database will be updated instead of re-inserting new items.', 'event_espresso'); ?> |
11 | 11 | </p> |
12 | -<h3><?php _e("Importing from this Site", 'event_espresso');?></h3> |
|
13 | -<p><?php _e("You may want to export data from this site, modify it (or modify the database), and re-import it. When this is done, the importer recognizes that the data is from this site\'s database and updates the records (instead of inserting new items like it would have, had the CSV data been from a different site).", 'event_espresso');?></p> |
|
12 | +<h3><?php _e("Importing from this Site", 'event_espresso'); ?></h3> |
|
13 | +<p><?php _e("You may want to export data from this site, modify it (or modify the database), and re-import it. When this is done, the importer recognizes that the data is from this site\'s database and updates the records (instead of inserting new items like it would have, had the CSV data been from a different site).", 'event_espresso'); ?></p> |
|
14 | 14 | |
15 | - <h3><?php _e("Notes about Generating your own CSV Import Files", "event_espresso");?></h3> |
|
16 | - <p><?php _e("If you think you could save time entering data into a CSV file, you can use the sample import file below. Note that creating your own CSV file is more complicated than in Event Espresso 3.1 because of the more advanced data structure, and so we recommend creating/editing your events using the normal web-interface.", "event_espresso");?></p> |
|
17 | - <p><?php _e("The export file is just an export of an event, or if you do not have any events in your system, it will only contain column headers. Do not change those column headers. Add as many rows as you like. ", "event_espresso");?></p> |
|
18 | - <p><?php _e("In the ID columns (columns ending in '_ID'), you should enter 'temporary IDs', which are unique numbers/words that identify that item, which can be used later when you want to refer to that item. (For example, if you assign an event's EVT_ID to be a temporary id of 'my-event-1', then use that same phrase 'my-event-1' to refer to that event in the Datetime model's EVT_ID column)", "event_espresso");?></p> |
|
19 | - <p><?php _e("Also note, you do NOT have to enter info in for each model. (You can, for example, only enter in Term_Taxonomies and Term model data)", "event_espresso");?></p> |
|
20 | 15 | \ No newline at end of file |
16 | + <h3><?php _e("Notes about Generating your own CSV Import Files", "event_espresso"); ?></h3> |
|
17 | + <p><?php _e("If you think you could save time entering data into a CSV file, you can use the sample import file below. Note that creating your own CSV file is more complicated than in Event Espresso 3.1 because of the more advanced data structure, and so we recommend creating/editing your events using the normal web-interface.", "event_espresso"); ?></p> |
|
18 | + <p><?php _e("The export file is just an export of an event, or if you do not have any events in your system, it will only contain column headers. Do not change those column headers. Add as many rows as you like. ", "event_espresso"); ?></p> |
|
19 | + <p><?php _e("In the ID columns (columns ending in '_ID'), you should enter 'temporary IDs', which are unique numbers/words that identify that item, which can be used later when you want to refer to that item. (For example, if you assign an event's EVT_ID to be a temporary id of 'my-event-1', then use that same phrase 'my-event-1' to refer to that event in the Datetime model's EVT_ID column)", "event_espresso"); ?></p> |
|
20 | + <p><?php _e("Also note, you do NOT have to enter info in for each model. (You can, for example, only enter in Term_Taxonomies and Term model data)", "event_espresso"); ?></p> |
|
21 | 21 | \ No newline at end of file |
@@ -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 | /** |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * constructor |
210 | 210 | * @param EE_Admin_Page $admin_page the calling admin_page_object |
211 | 211 | */ |
212 | - public function __construct( EE_Admin_Page $adminpage ) { |
|
212 | + public function __construct(EE_Admin_Page $adminpage) { |
|
213 | 213 | |
214 | 214 | $this->_adminpage_obj = $adminpage; |
215 | 215 | $this->_req_data = array_merge($_GET, $_POST); |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | $this->_set_hooks_properties(); |
218 | 218 | |
219 | 219 | //first let's verify we're on the right page |
220 | - if ( !isset( $this->_req_data['page'] ) || ( isset( $this->_req_data['page'] ) && $this->_adminpage_obj->page_slug != $this->_req_data['page'] ) ) |
|
220 | + if ( ! isset($this->_req_data['page']) || (isset($this->_req_data['page']) && $this->_adminpage_obj->page_slug != $this->_req_data['page'])) |
|
221 | 221 | return; //get out nothing more to be done here. |
222 | 222 | |
223 | 223 | //allow for extends to modify properties |
224 | - if ( method_exists( $this, '_extend_properties' ) ) |
|
224 | + if (method_exists($this, '_extend_properties')) |
|
225 | 225 | $this->_extend_properties(); |
226 | 226 | |
227 | 227 | $this->_set_page_object(); |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | $this->_load_custom_methods(); |
230 | 230 | $this->_load_routed_hooks(); |
231 | 231 | |
232 | - add_action( 'admin_enqueue_scripts', array($this, 'enqueue_scripts_styles' ) ); |
|
233 | - add_action( 'admin_enqueue_scripts', array($this, 'add_metaboxes'), 20 ); |
|
234 | - add_action( 'admin_enqueue_scripts', array($this, 'remove_metaboxes'), 15 ); |
|
232 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
233 | + add_action('admin_enqueue_scripts', array($this, 'add_metaboxes'), 20); |
|
234 | + add_action('admin_enqueue_scripts', array($this, 'remove_metaboxes'), 15); |
|
235 | 235 | |
236 | 236 | $this->_ajax_hooks(); |
237 | 237 | |
@@ -272,15 +272,15 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public function enqueue_scripts_styles() { |
274 | 274 | |
275 | - if ( !empty( $this->_scripts_styles ) ) { |
|
275 | + if ( ! empty($this->_scripts_styles)) { |
|
276 | 276 | //first let's do all the registrations |
277 | - if ( !isset($this->_scripts_styles['registers'] ) ) { |
|
277 | + if ( ! isset($this->_scripts_styles['registers'])) { |
|
278 | 278 | $msg[] = __('There is no "registers" index in the <code>$this->_scripts_styles</code> property.', 'event_espresso'); |
279 | - $msg[] = sprintf ( __('Make sure you read the phpdoc comments above the definition of the $_scripts_styles property in the <code>EE_Admin_Hooks</code> class and modify according in the %s child', 'event_espresso'), '<strong>' . $this->caller . '</strong>' ); |
|
280 | - throw new EE_Error( implode( '||', $msg ) ); |
|
279 | + $msg[] = sprintf(__('Make sure you read the phpdoc comments above the definition of the $_scripts_styles property in the <code>EE_Admin_Hooks</code> class and modify according in the %s child', 'event_espresso'), '<strong>'.$this->caller.'</strong>'); |
|
280 | + throw new EE_Error(implode('||', $msg)); |
|
281 | 281 | } |
282 | 282 | |
283 | - foreach( $this->_scripts_styles['registers'] as $ref => $details ) { |
|
283 | + foreach ($this->_scripts_styles['registers'] as $ref => $details) { |
|
284 | 284 | $defaults = array( |
285 | 285 | 'type' => 'js', |
286 | 286 | 'url' => '', |
@@ -289,48 +289,48 @@ discard block |
||
289 | 289 | 'footer' => TRUE |
290 | 290 | ); |
291 | 291 | $details = wp_parse_args($details, $defaults); |
292 | - extract( $details ); |
|
292 | + extract($details); |
|
293 | 293 | |
294 | 294 | //let's make sure that we set the 'registers' type if it's not set! We need it later to determine whhich enqueu we do |
295 | 295 | $this->_scripts_styles['registers'][$ref]['type'] = $type; |
296 | 296 | |
297 | 297 | //let's make sure we're not missing any REQUIRED parameters |
298 | - if ( empty($url) ) { |
|
299 | - $msg[] = sprintf( __('Missing the url for the requested %s', 'event_espresso'), $type == 'js' ? 'script' : 'stylesheet' ); |
|
300 | - $msg[] = sprintf( __('Doublecheck your <code>$this->_scripts_styles</code> array in %s and make sure that there is a "url" set for the %s ref', 'event_espresso'), '<strong>' . $this->caller . '</strong>', $ref ); |
|
301 | - throw new EE_Error( implode( '||', $msg ) ); |
|
298 | + if (empty($url)) { |
|
299 | + $msg[] = sprintf(__('Missing the url for the requested %s', 'event_espresso'), $type == 'js' ? 'script' : 'stylesheet'); |
|
300 | + $msg[] = sprintf(__('Doublecheck your <code>$this->_scripts_styles</code> array in %s and make sure that there is a "url" set for the %s ref', 'event_espresso'), '<strong>'.$this->caller.'</strong>', $ref); |
|
301 | + throw new EE_Error(implode('||', $msg)); |
|
302 | 302 | } |
303 | 303 | //made it here so let's do the appropriate registration |
304 | - $type == 'js' ? wp_register_script( $ref, $url, $depends, $version, $footer ) : wp_register_style( $ref, $url, $depends, $version ); |
|
304 | + $type == 'js' ? wp_register_script($ref, $url, $depends, $version, $footer) : wp_register_style($ref, $url, $depends, $version); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | //k now lets do the enqueues |
308 | - if( !isset( $this->_scripts_styles['enqueues'] ) ) |
|
309 | - return; //not sure if we should throw an error here or not. |
|
310 | - foreach( $this->_scripts_styles['enqueues'] as $ref => $routes ) { |
|
308 | + if ( ! isset($this->_scripts_styles['enqueues'])) |
|
309 | + return; //not sure if we should throw an error here or not. |
|
310 | + foreach ($this->_scripts_styles['enqueues'] as $ref => $routes) { |
|
311 | 311 | //make sure $routes is an array |
312 | 312 | $routes = (array) $routes; |
313 | 313 | |
314 | - if ( in_array($this->_current_route, $routes ) ) { |
|
314 | + if (in_array($this->_current_route, $routes)) { |
|
315 | 315 | $this->_scripts_styles['registers'][$ref]['type'] == 'js' ? wp_enqueue_script($ref) : wp_enqueue_style($ref); |
316 | 316 | //if we have a localization for the script let's do that too. |
317 | - if ( isset( $this->_scripts_styles['localize'][$ref] ) ) { |
|
318 | - foreach ( $this->_scripts_styles['localize'][$ref] as $object_name => $indexes ) { |
|
319 | - wp_localize_script($ref, $object_name , $this->_scripts_styles['localize'][$ref][$object_name] ); |
|
317 | + if (isset($this->_scripts_styles['localize'][$ref])) { |
|
318 | + foreach ($this->_scripts_styles['localize'][$ref] as $object_name => $indexes) { |
|
319 | + wp_localize_script($ref, $object_name, $this->_scripts_styles['localize'][$ref][$object_name]); |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
325 | 325 | //let's do the deregisters |
326 | - if ( !isset( $this->_scripts_styles['deregisters'] ) ) |
|
326 | + if ( ! isset($this->_scripts_styles['deregisters'])) |
|
327 | 327 | return; |
328 | - foreach ( $this->_scripts_styles['deregisters'] as $ref => $details ) { |
|
328 | + foreach ($this->_scripts_styles['deregisters'] as $ref => $details) { |
|
329 | 329 | $defaults = array( |
330 | 330 | 'type' => 'js' |
331 | 331 | ); |
332 | - $details = wp_parse_args( $details, $defaults ); |
|
333 | - extract( $details ); |
|
332 | + $details = wp_parse_args($details, $defaults); |
|
333 | + extract($details); |
|
334 | 334 | |
335 | 335 | $type == 'js' ? wp_deregister_script($ref) : wp_deregister_style($ref); |
336 | 336 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | */ |
350 | 350 | private function _set_defaults() { |
351 | 351 | $this->_ajax_func = $this->_init_func = $this->_metaboxes = $this->_scripts = $this->_styles = $this->_wp_action_filters_priority = array(); |
352 | - $this->_current_route = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default'; |
|
352 | + $this->_current_route = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default'; |
|
353 | 353 | $this->caller = get_class($this); |
354 | 354 | $this->_extend = stripos($this->caller, 'Extend') ? TRUE : FALSE; |
355 | 355 | } |
@@ -364,34 +364,34 @@ discard block |
||
364 | 364 | */ |
365 | 365 | protected function _set_page_object() { |
366 | 366 | //first make sure $this->_name is set |
367 | - if ( empty( $this->_name ) ) { |
|
367 | + if (empty($this->_name)) { |
|
368 | 368 | $msg[] = __('We can\'t load the page object', 'event_espresso'); |
369 | - $msg[] = sprintf( __("This is because the %s child class has not set the '_name' property", 'event_espresso'), $this->caller ); |
|
370 | - throw new EE_Error( implode( '||', $msg ) ); |
|
369 | + $msg[] = sprintf(__("This is because the %s child class has not set the '_name' property", 'event_espresso'), $this->caller); |
|
370 | + throw new EE_Error(implode('||', $msg)); |
|
371 | 371 | } |
372 | 372 | |
373 | - $ref = str_replace('_' , ' ', $this->_name); //take the_message -> the message |
|
374 | - $ref = str_replace(' ', '_', ucwords($ref) ) . '_Admin_Page'; //take the message -> The_Message |
|
373 | + $ref = str_replace('_', ' ', $this->_name); //take the_message -> the message |
|
374 | + $ref = str_replace(' ', '_', ucwords($ref)).'_Admin_Page'; //take the message -> The_Message |
|
375 | 375 | |
376 | 376 | //first default file (if exists) |
377 | - $decaf_file = EE_ADMIN_PAGES . $this->_name . DS . $ref . '.core.php'; |
|
378 | - if ( is_readable( $decaf_file ) ) |
|
379 | - require_once( $decaf_file ); |
|
377 | + $decaf_file = EE_ADMIN_PAGES.$this->_name.DS.$ref.'.core.php'; |
|
378 | + if (is_readable($decaf_file)) |
|
379 | + require_once($decaf_file); |
|
380 | 380 | |
381 | 381 | //now we have to do require for extended file (if needed) |
382 | - if ( $this->_extend ) { |
|
383 | - require_once( EE_CORE_CAF_ADMIN_EXTEND . $this->_name . DS . 'Extend_' . $ref . '.core.php' ); |
|
382 | + if ($this->_extend) { |
|
383 | + require_once(EE_CORE_CAF_ADMIN_EXTEND.$this->_name.DS.'Extend_'.$ref.'.core.php'); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
387 | 387 | //if we've got an extended class we use that! |
388 | - $ref = $this->_extend ? 'Extend_' . $ref : $ref; |
|
388 | + $ref = $this->_extend ? 'Extend_'.$ref : $ref; |
|
389 | 389 | |
390 | 390 | //let's make sure the class exists |
391 | - if ( !class_exists( $ref ) ) { |
|
391 | + if ( ! class_exists($ref)) { |
|
392 | 392 | $msg[] = __('We can\'t load the page object', 'event_espresso'); |
393 | - $msg[] = sprintf( __('The class name that was given is %s. Check the spelling and make sure its correct, also there needs to be an autoloader setup for the class', 'event_espresso'), $ref ); |
|
394 | - throw new EE_Error( implode( '||', $msg ) ); |
|
393 | + $msg[] = sprintf(__('The class name that was given is %s. Check the spelling and make sure its correct, also there needs to be an autoloader setup for the class', 'event_espresso'), $ref); |
|
394 | + throw new EE_Error(implode('||', $msg)); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | $a = new ReflectionClass($ref); |
@@ -416,27 +416,27 @@ discard block |
||
416 | 416 | $method_callback = $this->_current_route == 'default' ? 'default_callback' : $this->_current_route; |
417 | 417 | |
418 | 418 | //these run before the Admin_Page route executes. |
419 | - if ( method_exists( $this, $method_callback ) ) { |
|
420 | - call_user_func( array( $this, $method_callback) ); |
|
419 | + if (method_exists($this, $method_callback)) { |
|
420 | + call_user_func(array($this, $method_callback)); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | |
424 | 424 | //these run via the _redirect_after_action method in EE_Admin_Page which usually happens after non_UI methods in EE_Admin_Page classes. There are two redirect actions, the first fires before $query_args might be manipulated by "save and close" actions and the seond fires right before the actual redirect happens. |
425 | 425 | //first the actions |
426 | 426 | //note that these action hooks will have the $query_args value available. |
427 | - $admin_class_name = get_class( $this->_adminpage_obj ); |
|
427 | + $admin_class_name = get_class($this->_adminpage_obj); |
|
428 | 428 | |
429 | - if ( method_exists( $this, '_redirect_action_early_' . $this->_current_route ) ) { |
|
430 | - add_action( 'AHEE__' . $admin_class_name . '___redirect_after_action__before_redirect_modification_' . $this->_current_route, array( $this, '_redirect_action_early_' . $this->_current_route ), 10 ); |
|
429 | + if (method_exists($this, '_redirect_action_early_'.$this->_current_route)) { |
|
430 | + add_action('AHEE__'.$admin_class_name.'___redirect_after_action__before_redirect_modification_'.$this->_current_route, array($this, '_redirect_action_early_'.$this->_current_route), 10); |
|
431 | 431 | } |
432 | 432 | |
433 | - if ( method_exists( $this, '_redirect_action_' . $this->_current_route ) ) { |
|
434 | - add_action( 'AHEE_redirect_' . $admin_class_name . $this->_current_route, array( $this, '_redirect_action_' . $this->_current_route ), 10 ); |
|
433 | + if (method_exists($this, '_redirect_action_'.$this->_current_route)) { |
|
434 | + add_action('AHEE_redirect_'.$admin_class_name.$this->_current_route, array($this, '_redirect_action_'.$this->_current_route), 10); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | //let's hook into the _redirect itself and allow for changing where the user goes after redirect. This will have $query_args and $redirect_url available. |
438 | - if ( method_exists( $this, '_redirect_filter_' . $this->_current_route ) ) { |
|
439 | - add_filter( 'FHEE_redirect_' . $admin_class_name . $this->_current_route, array( $this, '_redirect_filter_' . $this->_current_route ), 10, 2 ); |
|
438 | + if (method_exists($this, '_redirect_filter_'.$this->_current_route)) { |
|
439 | + add_filter('FHEE_redirect_'.$admin_class_name.$this->_current_route, array($this, '_redirect_filter_'.$this->_current_route), 10, 2); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | } |
@@ -459,12 +459,12 @@ discard block |
||
459 | 459 | 'argnum' => 1, |
460 | 460 | 'priority' => 10 |
461 | 461 | ), |
462 | - 'FHEE_list_table_views_' . $this->_adminpage_obj->page_slug . '_' . $this->_current_route => array( |
|
462 | + 'FHEE_list_table_views_'.$this->_adminpage_obj->page_slug.'_'.$this->_current_route => array( |
|
463 | 463 | 'type' => 'filter', |
464 | 464 | 'argnum' => 1, |
465 | 465 | 'priority' => 10 |
466 | 466 | ), |
467 | - 'FHEE_list_table_views_' . $this->_adminpage_obj->page_slug => array( |
|
467 | + 'FHEE_list_table_views_'.$this->_adminpage_obj->page_slug => array( |
|
468 | 468 | 'type' => 'filter', |
469 | 469 | 'argnum' => 1, |
470 | 470 | 'priority' => 10 |
@@ -483,14 +483,14 @@ discard block |
||
483 | 483 | |
484 | 484 | |
485 | 485 | |
486 | - foreach ( $hook_filter_array as $hook => $args ) { |
|
487 | - if ( method_exists( $this, $this->_current_route . '_' . $hook ) ) { |
|
488 | - if ( isset( $this->_wp_action_filters_priority[$hook] ) ) |
|
486 | + foreach ($hook_filter_array as $hook => $args) { |
|
487 | + if (method_exists($this, $this->_current_route.'_'.$hook)) { |
|
488 | + if (isset($this->_wp_action_filters_priority[$hook])) |
|
489 | 489 | $args['priority'] = $this->_wp_action_filters_priority[$hook]; |
490 | - if ( $args['type'] == 'action' ) |
|
491 | - add_action( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] ); |
|
490 | + if ($args['type'] == 'action') |
|
491 | + add_action($hook, array($this, $this->_current_route.'_'.$hook), $args['priority'], $args['argnum']); |
|
492 | 492 | else |
493 | - add_filter( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] ); |
|
493 | + add_filter($hook, array($this, $this->_current_route.'_'.$hook), $args['priority'], $args['argnum']); |
|
494 | 494 | } |
495 | 495 | } |
496 | 496 | |
@@ -503,18 +503,18 @@ discard block |
||
503 | 503 | */ |
504 | 504 | private function _ajax_hooks() { |
505 | 505 | |
506 | - if ( empty( $this->_ajax_func) ) |
|
506 | + if (empty($this->_ajax_func)) |
|
507 | 507 | return; //get out there's nothing to take care of. |
508 | 508 | |
509 | - foreach ( $this->_ajax_func as $action => $method ) { |
|
509 | + foreach ($this->_ajax_func as $action => $method) { |
|
510 | 510 | //make sure method exists |
511 | - if ( !method_exists($this, $method) ) { |
|
512 | - $msg[] = __('There is no corresponding method for the hook labeled in the _ajax_func array', 'event_espresso') . '<br />'; |
|
513 | - $msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller ); |
|
514 | - throw new EE_Error( implode('||', $msg ) ); |
|
511 | + if ( ! method_exists($this, $method)) { |
|
512 | + $msg[] = __('There is no corresponding method for the hook labeled in the _ajax_func array', 'event_espresso').'<br />'; |
|
513 | + $msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $method, $this->caller); |
|
514 | + throw new EE_Error(implode('||', $msg)); |
|
515 | 515 | } |
516 | 516 | |
517 | - add_action('wp_ajax_' . $action, array( $this, $method ) ); |
|
517 | + add_action('wp_ajax_'.$action, array($this, $method)); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | } |
@@ -527,21 +527,21 @@ discard block |
||
527 | 527 | * @return void |
528 | 528 | */ |
529 | 529 | protected function _init_hooks() { |
530 | - if ( empty( $this->_init_func) ) |
|
530 | + if (empty($this->_init_func)) |
|
531 | 531 | return; //get out there's nothing to take care of. |
532 | 532 | |
533 | 533 | //We need to determine what page_route we are on! |
534 | - $current_route = isset ( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default'; |
|
534 | + $current_route = isset ($_REQUEST['action']) ? $_REQUEST['action'] : 'default'; |
|
535 | 535 | |
536 | - foreach ( $this->_init_func as $route => $method ) { |
|
536 | + foreach ($this->_init_func as $route => $method) { |
|
537 | 537 | //make sure method exists |
538 | - if ( !method_exists($this, $method) ) { |
|
539 | - $msg[] = __('There is no corresponding method for the hook labeled in the _init_func array', 'event_espresso') . '<br />'; |
|
540 | - $msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller ); |
|
541 | - throw new EE_Error( implode('||', $msg ) ); |
|
538 | + if ( ! method_exists($this, $method)) { |
|
539 | + $msg[] = __('There is no corresponding method for the hook labeled in the _init_func array', 'event_espresso').'<br />'; |
|
540 | + $msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $method, $this->caller); |
|
541 | + throw new EE_Error(implode('||', $msg)); |
|
542 | 542 | } |
543 | - if ( $route == $this->_current_route ) |
|
544 | - add_action('admin_init', array( $this, $method ) ); |
|
543 | + if ($route == $this->_current_route) |
|
544 | + add_action('admin_init', array($this, $method)); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | } |
@@ -556,28 +556,28 @@ discard block |
||
556 | 556 | * @return void |
557 | 557 | */ |
558 | 558 | public function add_metaboxes() { |
559 | - if ( empty( $this->_metaboxes ) ) |
|
559 | + if (empty($this->_metaboxes)) |
|
560 | 560 | return; //get out we don't have any metaboxes to set for this connection |
561 | 561 | |
562 | - $this->_handle_metabox_array( $this->_metaboxes ); |
|
562 | + $this->_handle_metabox_array($this->_metaboxes); |
|
563 | 563 | |
564 | 564 | } |
565 | 565 | |
566 | 566 | |
567 | 567 | |
568 | - private function _handle_metabox_array( $boxes, $add = TRUE ) { |
|
568 | + private function _handle_metabox_array($boxes, $add = TRUE) { |
|
569 | 569 | |
570 | - foreach ( $boxes as $box ) { |
|
571 | - if ( !isset($box['page_route']) ) |
|
570 | + foreach ($boxes as $box) { |
|
571 | + if ( ! isset($box['page_route'])) |
|
572 | 572 | continue; //we dont' have a valid array |
573 | 573 | |
574 | 574 | //let's make sure $box['page_route'] is an array so the "foreach" will work. |
575 | 575 | $box['page_route'] = (array) $box['page_route']; |
576 | 576 | |
577 | - foreach ( $box['page_route'] as $route ) { |
|
578 | - if ( $route != $this->_current_route ) |
|
577 | + foreach ($box['page_route'] as $route) { |
|
578 | + if ($route != $this->_current_route) |
|
579 | 579 | continue; //get out we only add metaboxes for set route. |
580 | - if ( $add ) |
|
580 | + if ($add) |
|
581 | 581 | $this->_add_metabox($box); |
582 | 582 | else |
583 | 583 | $this->_remove_metabox($box); |
@@ -595,10 +595,10 @@ discard block |
||
595 | 595 | */ |
596 | 596 | public function remove_metaboxes() { |
597 | 597 | |
598 | - if ( empty( $this->_remove_metaboxes ) ) |
|
598 | + if (empty($this->_remove_metaboxes)) |
|
599 | 599 | return; //get out there are no metaboxes to remove |
600 | 600 | |
601 | - $this->_handle_metabox_array( $this->_remove_metaboxes, FALSE ); |
|
601 | + $this->_handle_metabox_array($this->_remove_metaboxes, FALSE); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | |
@@ -608,53 +608,53 @@ discard block |
||
608 | 608 | * @access private |
609 | 609 | * @param array $args an array of args that have been set for this metabox by the child class |
610 | 610 | */ |
611 | - private function _add_metabox( $args ) { |
|
611 | + private function _add_metabox($args) { |
|
612 | 612 | $current_screen = get_current_screen(); |
613 | - $screen_id = is_object( $current_screen ) ? $current_screen->id : NULL; |
|
614 | - $func = isset( $args['func'] ) ? $args['func'] : 'some_invalid_callback'; |
|
613 | + $screen_id = is_object($current_screen) ? $current_screen->id : NULL; |
|
614 | + $func = isset($args['func']) ? $args['func'] : 'some_invalid_callback'; |
|
615 | 615 | |
616 | 616 | //set defaults |
617 | 617 | $defaults = array( |
618 | 618 | 'func' => $func, |
619 | - 'id' => $this->caller . '_' . $func . '_metabox', |
|
619 | + 'id' => $this->caller.'_'.$func.'_metabox', |
|
620 | 620 | 'priority' => 'default', |
621 | 621 | 'label' => $this->caller, |
622 | 622 | 'context' => 'advanced', |
623 | 623 | 'callback_args' => array(), |
624 | - 'page' => isset( $args['page'] ) ? $args['page'] : $screen_id |
|
624 | + 'page' => isset($args['page']) ? $args['page'] : $screen_id |
|
625 | 625 | ); |
626 | 626 | |
627 | - $args = wp_parse_args( $args, $defaults ); |
|
627 | + $args = wp_parse_args($args, $defaults); |
|
628 | 628 | extract($args); |
629 | 629 | |
630 | 630 | |
631 | 631 | //make sure method exists |
632 | - if ( !method_exists($this, $func) ) { |
|
633 | - $msg[] = __('There is no corresponding method to display the metabox content', 'event_espresso') . '<br />'; |
|
634 | - $msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $func, $this->caller ); |
|
635 | - throw new EE_Error( implode('||', $msg ) ); |
|
632 | + if ( ! method_exists($this, $func)) { |
|
633 | + $msg[] = __('There is no corresponding method to display the metabox content', 'event_espresso').'<br />'; |
|
634 | + $msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $func, $this->caller); |
|
635 | + throw new EE_Error(implode('||', $msg)); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | //everything checks out so lets add the metabox |
639 | - add_meta_box( $id, $label, array( $this, $func ), $page, $context, $priority, $callback_args); |
|
639 | + add_meta_box($id, $label, array($this, $func), $page, $context, $priority, $callback_args); |
|
640 | 640 | } |
641 | 641 | |
642 | 642 | |
643 | 643 | |
644 | - private function _remove_metabox( $args ) { |
|
644 | + private function _remove_metabox($args) { |
|
645 | 645 | $current_screen = get_current_screen(); |
646 | - $screen_id = is_object( $current_screen ) ? $current_screen->id : NULL; |
|
647 | - $func = isset( $args['func'] ) ? $args['func'] : 'some_invalid_callback'; |
|
646 | + $screen_id = is_object($current_screen) ? $current_screen->id : NULL; |
|
647 | + $func = isset($args['func']) ? $args['func'] : 'some_invalid_callback'; |
|
648 | 648 | |
649 | 649 | //set defaults |
650 | 650 | $defaults = array( |
651 | - 'id' => isset( $args['id'] ) ? $args['id'] : $this->_current_route . '_' . $this->caller . '_' . $func . '_metabox', |
|
651 | + 'id' => isset($args['id']) ? $args['id'] : $this->_current_route.'_'.$this->caller.'_'.$func.'_metabox', |
|
652 | 652 | 'context' => 'default', |
653 | - 'screen' => isset( $args['screen'] ) ? $args['screen'] : $screen_id |
|
653 | + 'screen' => isset($args['screen']) ? $args['screen'] : $screen_id |
|
654 | 654 | ); |
655 | 655 | |
656 | - $args = wp_parse_args( $args, $defaults ); |
|
657 | - extract( $args ); |
|
656 | + $args = wp_parse_args($args, $defaults); |
|
657 | + extract($args); |
|
658 | 658 | |
659 | 659 | //everything checks out so lets remove the box! |
660 | 660 | remove_meta_box($id, $screen, $context); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Class EE_Transaction_Processor |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | * @param array $registration_query_params |
51 | 51 | *@return EE_Transaction_Processor instance |
52 | 52 | */ |
53 | - public static function instance( $registration_query_params = array() ) { |
|
53 | + public static function instance($registration_query_params = array()) { |
|
54 | 54 | // check if class object is instantiated |
55 | - if ( ! self::$_instance instanceof EE_Transaction_Processor ) { |
|
56 | - self::$_instance = new self( $registration_query_params ); |
|
55 | + if ( ! self::$_instance instanceof EE_Transaction_Processor) { |
|
56 | + self::$_instance = new self($registration_query_params); |
|
57 | 57 | } |
58 | 58 | return self::$_instance; |
59 | 59 | } |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | * @param array $registration_query_params |
65 | 65 | * @return EE_Transaction_Processor |
66 | 66 | */ |
67 | - private function __construct( $registration_query_params = array() ) { |
|
67 | + private function __construct($registration_query_params = array()) { |
|
68 | 68 | // make sure some query params are set for retrieving registrations |
69 | - $this->_set_registration_query_params( $registration_query_params ); |
|
69 | + $this->_set_registration_query_params($registration_query_params); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @access private |
76 | 76 | * @param array $registration_query_params |
77 | 77 | */ |
78 | - private function _set_registration_query_params( $registration_query_params ) { |
|
79 | - $this->_registration_query_params = ! empty( $registration_query_params ) ? $registration_query_params : array( 'order_by' => array( 'REG_count' => 'ASC' )); |
|
78 | + private function _set_registration_query_params($registration_query_params) { |
|
79 | + $this->_registration_query_params = ! empty($registration_query_params) ? $registration_query_params : array('order_by' => array('REG_count' => 'ASC')); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | /** |
94 | 94 | * @param string $old_txn_status |
95 | 95 | */ |
96 | - public function set_old_txn_status( $old_txn_status ) { |
|
96 | + public function set_old_txn_status($old_txn_status) { |
|
97 | 97 | // only set the first time |
98 | - if ( $this->_old_txn_status === null ) { |
|
98 | + if ($this->_old_txn_status === null) { |
|
99 | 99 | $this->_old_txn_status = $old_txn_status; |
100 | 100 | } |
101 | 101 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | /** |
115 | 115 | * @param string $new_txn_status |
116 | 116 | */ |
117 | - public function set_new_txn_status( $new_txn_status ) { |
|
117 | + public function set_new_txn_status($new_txn_status) { |
|
118 | 118 | $this->_new_txn_status = $new_txn_status; |
119 | 119 | } |
120 | 120 | |
@@ -145,17 +145,17 @@ discard block |
||
145 | 145 | * @param bool $check_all |
146 | 146 | * @return boolean | int |
147 | 147 | */ |
148 | - private function _reg_steps_completed( EE_Transaction $transaction, $reg_step_slug = '', $check_all = TRUE ) { |
|
148 | + private function _reg_steps_completed(EE_Transaction $transaction, $reg_step_slug = '', $check_all = TRUE) { |
|
149 | 149 | $reg_steps = $transaction->reg_steps(); |
150 | - if ( ! is_array( $reg_steps ) || empty( $reg_steps )) { |
|
150 | + if ( ! is_array($reg_steps) || empty($reg_steps)) { |
|
151 | 151 | return false; |
152 | 152 | } |
153 | 153 | // loop thru reg steps array) |
154 | - foreach ( $reg_steps as $slug => $reg_step_completed ) { |
|
154 | + foreach ($reg_steps as $slug => $reg_step_completed) { |
|
155 | 155 | // if NOT checking ALL steps (only checking one step) |
156 | - if ( ! $check_all ) { |
|
156 | + if ( ! $check_all) { |
|
157 | 157 | // and this is the one |
158 | - if ( $slug == $reg_step_slug ) { |
|
158 | + if ($slug == $reg_step_slug) { |
|
159 | 159 | return $reg_step_completed; |
160 | 160 | } else { |
161 | 161 | // skip to next reg step in loop |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | } |
164 | 164 | } |
165 | 165 | // if any reg step is NOT completed (ignoring any specific steps), then just leave |
166 | - if ( $reg_step_completed !== true && $slug != $reg_step_slug ) { |
|
166 | + if ($reg_step_completed !== true && $slug != $reg_step_slug) { |
|
167 | 167 | return false; |
168 | - } else if ( $slug == $reg_step_slug ) { |
|
168 | + } else if ($slug == $reg_step_slug) { |
|
169 | 169 | // if we reach this point, then we are testing either: |
170 | 170 | // all_reg_steps_completed_except() or |
171 | 171 | // all_reg_steps_completed_except_final_step(), |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | * @param EE_Transaction $transaction |
191 | 191 | * @return boolean |
192 | 192 | */ |
193 | - public function all_reg_steps_completed( EE_Transaction $transaction ) { |
|
194 | - return $this->_reg_steps_completed( $transaction ); |
|
193 | + public function all_reg_steps_completed(EE_Transaction $transaction) { |
|
194 | + return $this->_reg_steps_completed($transaction); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | * @param string $exception |
209 | 209 | * @return boolean |
210 | 210 | */ |
211 | - public function all_reg_steps_completed_except( EE_Transaction $transaction, $exception = '' ) { |
|
212 | - return $this->_reg_steps_completed( $transaction, $exception ); |
|
211 | + public function all_reg_steps_completed_except(EE_Transaction $transaction, $exception = '') { |
|
212 | + return $this->_reg_steps_completed($transaction, $exception); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | * @param EE_Transaction $transaction |
226 | 226 | * @return boolean |
227 | 227 | */ |
228 | - public function all_reg_steps_completed_except_final_step( EE_Transaction $transaction ) { |
|
229 | - return $this->_reg_steps_completed( $transaction, 'finalize_registration' ); |
|
228 | + public function all_reg_steps_completed_except_final_step(EE_Transaction $transaction) { |
|
229 | + return $this->_reg_steps_completed($transaction, 'finalize_registration'); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | * @param string $reg_step_slug |
244 | 244 | * @return boolean | int |
245 | 245 | */ |
246 | - public function reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) { |
|
247 | - return $this->_reg_steps_completed( $transaction, $reg_step_slug, FALSE ); |
|
246 | + public function reg_step_completed(EE_Transaction $transaction, $reg_step_slug) { |
|
247 | + return $this->_reg_steps_completed($transaction, $reg_step_slug, FALSE); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -260,8 +260,8 @@ discard block |
||
260 | 260 | * @param EE_Transaction $transaction |
261 | 261 | * @return boolean | int |
262 | 262 | */ |
263 | - public function final_reg_step_completed( EE_Transaction $transaction ) { |
|
264 | - return $this->_reg_steps_completed( $transaction, 'finalize_registration', FALSE ); |
|
263 | + public function final_reg_step_completed(EE_Transaction $transaction) { |
|
264 | + return $this->_reg_steps_completed($transaction, 'finalize_registration', FALSE); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | * @param string $reg_step_slug |
276 | 276 | * @return boolean |
277 | 277 | */ |
278 | - public function set_reg_step_initiated( EE_Transaction $transaction, $reg_step_slug ) { |
|
278 | + public function set_reg_step_initiated(EE_Transaction $transaction, $reg_step_slug) { |
|
279 | 279 | $current_time = time(); |
280 | - return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, $current_time ); |
|
280 | + return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, $current_time); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -291,8 +291,8 @@ discard block |
||
291 | 291 | * @param string $reg_step_slug |
292 | 292 | * @return boolean |
293 | 293 | */ |
294 | - public function set_reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) { |
|
295 | - return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, TRUE ); |
|
294 | + public function set_reg_step_completed(EE_Transaction $transaction, $reg_step_slug) { |
|
295 | + return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, TRUE); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | |
@@ -306,8 +306,8 @@ discard block |
||
306 | 306 | * @param string $reg_step_slug |
307 | 307 | * @return boolean |
308 | 308 | */ |
309 | - public function set_reg_step_not_completed( EE_Transaction $transaction, $reg_step_slug ) { |
|
310 | - return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, FALSE ); |
|
309 | + public function set_reg_step_not_completed(EE_Transaction $transaction, $reg_step_slug) { |
|
310 | + return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, FALSE); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | |
@@ -323,36 +323,36 @@ discard block |
||
323 | 323 | * @param boolean | int $status |
324 | 324 | * @return boolean |
325 | 325 | */ |
326 | - private function _set_reg_step_completed_status( EE_Transaction $transaction, $reg_step_slug, $status ) { |
|
326 | + private function _set_reg_step_completed_status(EE_Transaction $transaction, $reg_step_slug, $status) { |
|
327 | 327 | // validate status |
328 | - $status = is_bool( $status ) || is_numeric( $status ) ? $status : false; |
|
328 | + $status = is_bool($status) || is_numeric($status) ? $status : false; |
|
329 | 329 | // get reg steps array |
330 | 330 | $txn_reg_steps = $transaction->reg_steps(); |
331 | 331 | // if reg step does NOT exist |
332 | - if ( ! isset( $txn_reg_steps[ $reg_step_slug ] )) { |
|
332 | + if ( ! isset($txn_reg_steps[$reg_step_slug])) { |
|
333 | 333 | return false; |
334 | 334 | } |
335 | 335 | // if we're trying to complete a step that is already completed |
336 | - if ( $txn_reg_steps[ $reg_step_slug ] === true ) { |
|
336 | + if ($txn_reg_steps[$reg_step_slug] === true) { |
|
337 | 337 | return true; |
338 | 338 | } |
339 | 339 | // if we're trying to complete a step that hasn't even started |
340 | - if ( $status === true && $txn_reg_steps[ $reg_step_slug ] === false ) { |
|
340 | + if ($status === true && $txn_reg_steps[$reg_step_slug] === false) { |
|
341 | 341 | return false; |
342 | 342 | } |
343 | 343 | // if current status value matches the incoming value (no change) |
344 | - if ( $txn_reg_steps[ $reg_step_slug ] === $status ) { |
|
344 | + if ($txn_reg_steps[$reg_step_slug] === $status) { |
|
345 | 345 | // this will happen in cases where multiple AJAX requests occur during the same step |
346 | 346 | return true; |
347 | 347 | } |
348 | 348 | // if we're trying to set a start time |
349 | - if ( is_numeric( $status ) && is_numeric( $txn_reg_steps[ $reg_step_slug ] )) { |
|
349 | + if (is_numeric($status) && is_numeric($txn_reg_steps[$reg_step_slug])) { |
|
350 | 350 | // skip the update below, but don't return FALSE so that errors won't be displayed |
351 | 351 | return true; |
352 | 352 | } |
353 | 353 | // update completed status |
354 | - $txn_reg_steps[ $reg_step_slug ] = $status; |
|
355 | - $transaction->set_reg_steps( $txn_reg_steps ); |
|
354 | + $txn_reg_steps[$reg_step_slug] = $status; |
|
355 | + $transaction->set_reg_steps($txn_reg_steps); |
|
356 | 356 | $transaction->save(); |
357 | 357 | // DEBUG LOG |
358 | 358 | //$this->log( |
@@ -378,11 +378,11 @@ discard block |
||
378 | 378 | * @param string $reg_step_slug |
379 | 379 | * @return void |
380 | 380 | */ |
381 | - public function remove_reg_step( EE_Transaction $transaction, $reg_step_slug ) { |
|
381 | + public function remove_reg_step(EE_Transaction $transaction, $reg_step_slug) { |
|
382 | 382 | // get reg steps array |
383 | 383 | $txn_reg_steps = $transaction->reg_steps(); |
384 | - unset( $txn_reg_steps[ $reg_step_slug ] ); |
|
385 | - $transaction->set_reg_steps( $txn_reg_steps ); |
|
384 | + unset($txn_reg_steps[$reg_step_slug]); |
|
385 | + $transaction->set_reg_steps($txn_reg_steps); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -396,14 +396,14 @@ discard block |
||
396 | 396 | * @param EE_Transaction $transaction |
397 | 397 | * @return boolean |
398 | 398 | */ |
399 | - public function toggle_failed_transaction_status( EE_Transaction $transaction ) { |
|
399 | + public function toggle_failed_transaction_status(EE_Transaction $transaction) { |
|
400 | 400 | // set incoming TXN_Status |
401 | - $this->set_old_txn_status( $transaction->status_ID() ); |
|
401 | + $this->set_old_txn_status($transaction->status_ID()); |
|
402 | 402 | // if TXN status is still set as "failed"... |
403 | - if ( $transaction->status_ID() == EEM_Transaction::failed_status_code ) { |
|
403 | + if ($transaction->status_ID() == EEM_Transaction::failed_status_code) { |
|
404 | 404 | // set incoming TXN_Status |
405 | - $this->set_new_txn_status( EEM_Transaction::abandoned_status_code ); |
|
406 | - $transaction->set_status( EEM_Transaction::abandoned_status_code ); |
|
405 | + $this->set_new_txn_status(EEM_Transaction::abandoned_status_code); |
|
406 | + $transaction->set_status(EEM_Transaction::abandoned_status_code); |
|
407 | 407 | return TRUE; |
408 | 408 | } |
409 | 409 | return FALSE; |
@@ -419,20 +419,20 @@ discard block |
||
419 | 419 | * @param EE_Transaction $transaction |
420 | 420 | * @return boolean |
421 | 421 | */ |
422 | - public function toggle_abandoned_transaction_status( EE_Transaction $transaction ) { |
|
422 | + public function toggle_abandoned_transaction_status(EE_Transaction $transaction) { |
|
423 | 423 | // set incoming TXN_Status |
424 | - $this->set_old_txn_status( $transaction->status_ID() ); |
|
424 | + $this->set_old_txn_status($transaction->status_ID()); |
|
425 | 425 | // if TXN status has not been updated already due to a payment, and is still set as "failed" or "abandoned"... |
426 | - if ( $transaction->status_ID() == EEM_Transaction::failed_status_code || $transaction->status_ID() == EEM_Transaction::abandoned_status_code ) { |
|
427 | - $this->set_new_txn_status( EEM_Transaction::incomplete_status_code ); |
|
426 | + if ($transaction->status_ID() == EEM_Transaction::failed_status_code || $transaction->status_ID() == EEM_Transaction::abandoned_status_code) { |
|
427 | + $this->set_new_txn_status(EEM_Transaction::incomplete_status_code); |
|
428 | 428 | // if a contact record for the primary registrant has been created |
429 | - if ( $transaction->primary_registration() instanceof EE_Registration && $transaction->primary_registration()->attendee() instanceof EE_Attendee ) { |
|
430 | - $transaction->set_status( EEM_Transaction::incomplete_status_code ); |
|
431 | - $this->set_new_txn_status( EEM_Transaction::incomplete_status_code ); |
|
429 | + if ($transaction->primary_registration() instanceof EE_Registration && $transaction->primary_registration()->attendee() instanceof EE_Attendee) { |
|
430 | + $transaction->set_status(EEM_Transaction::incomplete_status_code); |
|
431 | + $this->set_new_txn_status(EEM_Transaction::incomplete_status_code); |
|
432 | 432 | } else { |
433 | 433 | // no contact record? yer abandoned! |
434 | - $transaction->set_status( EEM_Transaction::abandoned_status_code ); |
|
435 | - $this->set_new_txn_status( EEM_Transaction::abandoned_status_code ); |
|
434 | + $transaction->set_status(EEM_Transaction::abandoned_status_code); |
|
435 | + $this->set_new_txn_status(EEM_Transaction::abandoned_status_code); |
|
436 | 436 | } |
437 | 437 | return TRUE; |
438 | 438 | } |
@@ -450,16 +450,16 @@ discard block |
||
450 | 450 | * @param array $registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction |
451 | 451 | * @return boolean |
452 | 452 | */ |
453 | - public function manually_update_registration_statuses( EE_Transaction $transaction, $new_reg_status = '', $registration_query_params = array() ) { |
|
454 | - $status_updates = $this->_call_method_on_registrations_via_Registration_Processor( 'manually_update_registration_status', $transaction, $registration_query_params, $new_reg_status ); |
|
453 | + public function manually_update_registration_statuses(EE_Transaction $transaction, $new_reg_status = '', $registration_query_params = array()) { |
|
454 | + $status_updates = $this->_call_method_on_registrations_via_Registration_Processor('manually_update_registration_status', $transaction, $registration_query_params, $new_reg_status); |
|
455 | 455 | // send messages |
456 | 456 | /** @type EE_Registration_Processor $registration_processor */ |
457 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
457 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
458 | 458 | $registration_processor->trigger_registration_update_notifications( |
459 | 459 | $transaction->primary_registration(), |
460 | - array( 'manually_updated' => true ) |
|
460 | + array('manually_updated' => true) |
|
461 | 461 | ); |
462 | - do_action( 'AHEE__EE_Transaction_Processor__manually_update_registration_statuses', $transaction, $status_updates ); |
|
462 | + do_action('AHEE__EE_Transaction_Processor__manually_update_registration_statuses', $transaction, $status_updates); |
|
463 | 463 | return $status_updates; |
464 | 464 | } |
465 | 465 | |
@@ -473,9 +473,9 @@ discard block |
||
473 | 473 | * @param array $registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction |
474 | 474 | * @return boolean |
475 | 475 | */ |
476 | - public function toggle_registration_statuses_for_default_approved_events( EE_Transaction $transaction, $registration_query_params = array() ) { |
|
477 | - $status_updates = $this->_call_method_on_registrations_via_Registration_Processor( 'toggle_registration_status_for_default_approved_events', $transaction, $registration_query_params ); |
|
478 | - do_action( 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events', $transaction, $status_updates ); |
|
476 | + public function toggle_registration_statuses_for_default_approved_events(EE_Transaction $transaction, $registration_query_params = array()) { |
|
477 | + $status_updates = $this->_call_method_on_registrations_via_Registration_Processor('toggle_registration_status_for_default_approved_events', $transaction, $registration_query_params); |
|
478 | + do_action('AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events', $transaction, $status_updates); |
|
479 | 479 | return $status_updates; |
480 | 480 | } |
481 | 481 | |
@@ -489,9 +489,9 @@ discard block |
||
489 | 489 | * @param array $registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction |
490 | 490 | * @return boolean |
491 | 491 | */ |
492 | - public function toggle_registration_statuses_if_no_monies_owing( EE_Transaction $transaction, $registration_query_params = array() ) { |
|
493 | - $status_updates = $this->_call_method_on_registrations_via_Registration_Processor( 'toggle_registration_status_if_no_monies_owing', $transaction, $registration_query_params ); |
|
494 | - do_action( 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing', $transaction, $status_updates ); |
|
492 | + public function toggle_registration_statuses_if_no_monies_owing(EE_Transaction $transaction, $registration_query_params = array()) { |
|
493 | + $status_updates = $this->_call_method_on_registrations_via_Registration_Processor('toggle_registration_status_if_no_monies_owing', $transaction, $registration_query_params); |
|
494 | + do_action('AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing', $transaction, $status_updates); |
|
495 | 495 | return $status_updates; |
496 | 496 | } |
497 | 497 | |
@@ -507,17 +507,17 @@ discard block |
||
507 | 507 | * @throws \EE_Error |
508 | 508 | * @return array |
509 | 509 | */ |
510 | - public function update_transaction_and_registrations_after_checkout_or_payment( EE_Transaction $transaction, $payment = NULL, $registration_query_params = array() ) { |
|
510 | + public function update_transaction_and_registrations_after_checkout_or_payment(EE_Transaction $transaction, $payment = NULL, $registration_query_params = array()) { |
|
511 | 511 | // set incoming TXN_Status, and consider it new since old status should have been set |
512 | - $this->set_new_txn_status( $transaction->status_ID() ); |
|
513 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $transaction->status_ID(), '$transaction->status_ID()' ); |
|
512 | + $this->set_new_txn_status($transaction->status_ID()); |
|
513 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $transaction->status_ID(), '$transaction->status_ID()'); |
|
514 | 514 | // make sure some query params are set for retrieving registrations |
515 | - $this->_set_registration_query_params( $registration_query_params ); |
|
515 | + $this->_set_registration_query_params($registration_query_params); |
|
516 | 516 | // get final reg step status |
517 | - $finalized = $this->final_reg_step_completed( $transaction ); |
|
517 | + $finalized = $this->final_reg_step_completed($transaction); |
|
518 | 518 | // if the 'finalize_registration' step has been initiated (has a timestamp) but has not yet been fully completed (TRUE) |
519 | - if ( is_numeric( $finalized ) && $finalized !== true ) { |
|
520 | - $this->set_reg_step_completed( $transaction, 'finalize_registration' ); |
|
519 | + if (is_numeric($finalized) && $finalized !== true) { |
|
520 | + $this->set_reg_step_completed($transaction, 'finalize_registration'); |
|
521 | 521 | $finalized = true; |
522 | 522 | } |
523 | 523 | $transaction->save(); |
@@ -540,13 +540,13 @@ discard block |
||
540 | 540 | |
541 | 541 | // send messages |
542 | 542 | /** @type EE_Registration_Processor $registration_processor */ |
543 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
543 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
544 | 544 | $registration_processor->trigger_registration_update_notifications( |
545 | 545 | $transaction->primary_registration(), |
546 | 546 | $update_params |
547 | 547 | ); |
548 | 548 | |
549 | - do_action( 'AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment', $transaction, $update_params ); |
|
549 | + do_action('AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment', $transaction, $update_params); |
|
550 | 550 | return $update_params; |
551 | 551 | } |
552 | 552 | |
@@ -564,23 +564,23 @@ discard block |
||
564 | 564 | * @throws \EE_Error |
565 | 565 | * @return boolean |
566 | 566 | */ |
567 | - private function _call_method_on_registrations_via_Registration_Processor( $method_name, EE_Transaction $transaction, $registration_query_params = array(), $additional_param = NULL ) { |
|
567 | + private function _call_method_on_registrations_via_Registration_Processor($method_name, EE_Transaction $transaction, $registration_query_params = array(), $additional_param = NULL) { |
|
568 | 568 | $response = FALSE; |
569 | 569 | /** @type EE_Registration_Processor $registration_processor */ |
570 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
570 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
571 | 571 | // check that method exists |
572 | - if ( ! method_exists( $registration_processor, $method_name )) { |
|
573 | - throw new EE_Error( __( 'Method does not exist.', 'event_espresso' )); |
|
572 | + if ( ! method_exists($registration_processor, $method_name)) { |
|
573 | + throw new EE_Error(__('Method does not exist.', 'event_espresso')); |
|
574 | 574 | } |
575 | 575 | // make sure some query params are set for retrieving registrations |
576 | - $this->_set_registration_query_params( $registration_query_params ); |
|
576 | + $this->_set_registration_query_params($registration_query_params); |
|
577 | 577 | // loop through cached registrations |
578 | - foreach ( $transaction->registrations( $this->_registration_query_params ) as $registration ) { |
|
579 | - if ( $registration instanceof EE_Registration ) { |
|
580 | - if ( $additional_param ) { |
|
581 | - $response = $registration_processor->$method_name( $registration, $additional_param ) ? TRUE : $response; |
|
578 | + foreach ($transaction->registrations($this->_registration_query_params) as $registration) { |
|
579 | + if ($registration instanceof EE_Registration) { |
|
580 | + if ($additional_param) { |
|
581 | + $response = $registration_processor->$method_name($registration, $additional_param) ? TRUE : $response; |
|
582 | 582 | } else { |
583 | - $response = $registration_processor->$method_name( $registration ) ? TRUE : $response; |
|
583 | + $response = $registration_processor->$method_name($registration) ? TRUE : $response; |
|
584 | 584 | } |
585 | 585 | } |
586 | 586 | } |
@@ -605,46 +605,46 @@ discard block |
||
605 | 605 | public function set_transaction_payment_method_based_on_registration_statuses( |
606 | 606 | EE_Registration $edited_registration |
607 | 607 | ) { |
608 | - if ( $edited_registration instanceof EE_Registration ) { |
|
608 | + if ($edited_registration instanceof EE_Registration) { |
|
609 | 609 | $transaction = $edited_registration->transaction(); |
610 | - if ( $transaction instanceof EE_Transaction ) { |
|
610 | + if ($transaction instanceof EE_Transaction) { |
|
611 | 611 | $all_not_approved = true; |
612 | - foreach ( $transaction->registrations() as $registration ) { |
|
613 | - if ( $registration instanceof EE_Registration ) { |
|
612 | + foreach ($transaction->registrations() as $registration) { |
|
613 | + if ($registration instanceof EE_Registration) { |
|
614 | 614 | // if any REG != "Not Approved" then toggle to false |
615 | 615 | $all_not_approved = $registration->is_not_approved() ? $all_not_approved : false; |
616 | 616 | } |
617 | 617 | } |
618 | 618 | // if ALL Registrations are "Not Approved" |
619 | - if ( $all_not_approved ) { |
|
620 | - $transaction->set_payment_method_ID( null ); |
|
619 | + if ($all_not_approved) { |
|
620 | + $transaction->set_payment_method_ID(null); |
|
621 | 621 | $transaction->save(); |
622 | 622 | } else { |
623 | - $available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( $transaction, EEM_Payment_Method::scope_cart ); |
|
624 | - if ( ! empty( $available_payment_methods ) ) { |
|
623 | + $available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction($transaction, EEM_Payment_Method::scope_cart); |
|
624 | + if ( ! empty($available_payment_methods)) { |
|
625 | 625 | $PMD_ID = 0; |
626 | - foreach ( $available_payment_methods as $available_payment_method ) { |
|
627 | - if ( $available_payment_method instanceof EE_Payment_Method && $available_payment_method->open_by_default() ) { |
|
626 | + foreach ($available_payment_methods as $available_payment_method) { |
|
627 | + if ($available_payment_method instanceof EE_Payment_Method && $available_payment_method->open_by_default()) { |
|
628 | 628 | $PMD_ID = $available_payment_method->ID(); |
629 | 629 | break; |
630 | 630 | } |
631 | 631 | } |
632 | - if ( ! $PMD_ID ) { |
|
633 | - $first_payment_method = reset( $available_payment_methods ); |
|
634 | - if ( $first_payment_method instanceof EE_Payment_Method ) { |
|
632 | + if ( ! $PMD_ID) { |
|
633 | + $first_payment_method = reset($available_payment_methods); |
|
634 | + if ($first_payment_method instanceof EE_Payment_Method) { |
|
635 | 635 | $PMD_ID = $first_payment_method->ID(); |
636 | 636 | } else { |
637 | 637 | EE_Error::add_error( |
638 | - __( 'A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso' ), |
|
638 | + __('A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso'), |
|
639 | 639 | __FILE__, __LINE__, __FUNCTION__ |
640 | 640 | ); |
641 | 641 | } |
642 | 642 | } |
643 | - $transaction->set_payment_method_ID( $PMD_ID ); |
|
643 | + $transaction->set_payment_method_ID($PMD_ID); |
|
644 | 644 | $transaction->save(); |
645 | 645 | } else { |
646 | 646 | EE_Error::add_error( |
647 | - __( 'Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso' ), |
|
647 | + __('Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso'), |
|
648 | 648 | __FILE__, __LINE__, __FUNCTION__ |
649 | 649 | ); |
650 | 650 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * EE_Registration class |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | * date_format and the second value is the time format |
42 | 42 | * @return EE_Registration |
43 | 43 | */ |
44 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
45 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
46 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
44 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
45 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
46 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | * the website will be used. |
55 | 55 | * @return EE_Registration |
56 | 56 | */ |
57 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
58 | - return new self( $props_n_values, TRUE, $timezone ); |
|
57 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
58 | + return new self($props_n_values, TRUE, $timezone); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * @access public |
67 | 67 | * @param int $EVT_ID Event ID |
68 | 68 | */ |
69 | - public function set_event( $EVT_ID = 0 ) { |
|
70 | - $this->set( 'EVT_ID', $EVT_ID ); |
|
69 | + public function set_event($EVT_ID = 0) { |
|
70 | + $this->set('EVT_ID', $EVT_ID); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -78,18 +78,18 @@ discard block |
||
78 | 78 | * @param mixed $field_value |
79 | 79 | * @param bool $use_default |
80 | 80 | */ |
81 | - public function set( $field_name, $field_value, $use_default = FALSE ) { |
|
82 | - switch( $field_name ) { |
|
81 | + public function set($field_name, $field_value, $use_default = FALSE) { |
|
82 | + switch ($field_name) { |
|
83 | 83 | case 'REG_code' : |
84 | - if ( ! empty( $field_value ) && $this->reg_code() == '' ) { |
|
85 | - $this->set_reg_code( $field_value, $use_default ); |
|
84 | + if ( ! empty($field_value) && $this->reg_code() == '') { |
|
85 | + $this->set_reg_code($field_value, $use_default); |
|
86 | 86 | } |
87 | 87 | break; |
88 | 88 | case 'STS_ID' : |
89 | - $this->set_status( $field_value, $use_default ); |
|
89 | + $this->set_status($field_value, $use_default); |
|
90 | 90 | break; |
91 | 91 | default : |
92 | - parent::set( $field_name, $field_value, $use_default ); |
|
92 | + parent::set($field_name, $field_value, $use_default); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
@@ -106,30 +106,30 @@ discard block |
||
106 | 106 | * @param boolean $use_default |
107 | 107 | * @return bool |
108 | 108 | */ |
109 | - public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) { |
|
109 | + public function set_status($new_STS_ID = NULL, $use_default = FALSE) { |
|
110 | 110 | // get current REG_Status |
111 | 111 | $old_STS_ID = $this->status_ID(); |
112 | 112 | // if status has changed |
113 | - if ( $old_STS_ID != $new_STS_ID ) { |
|
113 | + if ($old_STS_ID != $new_STS_ID) { |
|
114 | 114 | // TO approved |
115 | - if ( $new_STS_ID == EEM_Registration::status_id_approved ) { |
|
115 | + if ($new_STS_ID == EEM_Registration::status_id_approved) { |
|
116 | 116 | // reserve a space by incrementing ticket and datetime sold values |
117 | 117 | $this->_reserve_registration_space(); |
118 | - do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
118 | + do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID); |
|
119 | 119 | // OR FROM approved |
120 | - } else if ( $old_STS_ID == EEM_Registration::status_id_approved ) { |
|
120 | + } else if ($old_STS_ID == EEM_Registration::status_id_approved) { |
|
121 | 121 | // release a space by decrementing ticket and datetime sold values |
122 | 122 | $this->_release_registration_space(); |
123 | - do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
123 | + do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID); |
|
124 | 124 | } |
125 | 125 | // update status |
126 | - parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
127 | - do_action( 'AHEE__EE_Registration__set_status__after_update', $this ); |
|
126 | + parent::set('STS_ID', $new_STS_ID, $use_default); |
|
127 | + do_action('AHEE__EE_Registration__set_status__after_update', $this); |
|
128 | 128 | return TRUE; |
129 | - }else{ |
|
129 | + } else { |
|
130 | 130 | //even though the old value matches the new value, it's still good to |
131 | 131 | //allow the parent set method to have a say |
132 | - parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
132 | + parent::set('STS_ID', $new_STS_ID, $use_default); |
|
133 | 133 | return TRUE; |
134 | 134 | } |
135 | 135 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @access public |
142 | 142 | */ |
143 | 143 | public function status_ID() { |
144 | - return $this->get( 'STS_ID' ); |
|
144 | + return $this->get('STS_ID'); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | * @param boolean $include_archived whether to include archived tickets or not. |
167 | 167 | * @return EE_Ticket |
168 | 168 | */ |
169 | - public function ticket( $include_archived = TRUE ) { |
|
169 | + public function ticket($include_archived = TRUE) { |
|
170 | 170 | $query_params = array(); |
171 | - if ( $include_archived ) { |
|
172 | - $query_params[ 'default_where_conditions' ] = 'none'; |
|
171 | + if ($include_archived) { |
|
172 | + $query_params['default_where_conditions'] = 'none'; |
|
173 | 173 | } |
174 | - return $this->get_first_related( 'Ticket', $query_params ); |
|
174 | + return $this->get_first_related('Ticket', $query_params); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @return EE_Event |
182 | 182 | */ |
183 | 183 | public function event() { |
184 | - return $this->get_first_related( 'Event' ); |
|
184 | + return $this->get_first_related('Event'); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function wp_user() { |
197 | 197 | $event = $this->event(); |
198 | - if ( $event instanceof EE_Event ) { |
|
198 | + if ($event instanceof EE_Event) { |
|
199 | 199 | return $event->wp_user(); |
200 | 200 | } |
201 | 201 | return 0; |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | * @access public |
222 | 222 | * @param int $ATT_ID Attendee ID |
223 | 223 | */ |
224 | - public function set_attendee_id( $ATT_ID = 0 ) { |
|
225 | - $this->set( 'ATT_ID', $ATT_ID ); |
|
224 | + public function set_attendee_id($ATT_ID = 0) { |
|
225 | + $this->set('ATT_ID', $ATT_ID); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | * @access public |
234 | 234 | * @param int $TXN_ID Transaction ID |
235 | 235 | */ |
236 | - public function set_transaction_id( $TXN_ID = 0 ) { |
|
237 | - $this->set( 'TXN_ID', $TXN_ID ); |
|
236 | + public function set_transaction_id($TXN_ID = 0) { |
|
237 | + $this->set('TXN_ID', $TXN_ID); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | * @access public |
246 | 246 | * @param string $REG_session PHP Session ID |
247 | 247 | */ |
248 | - public function set_session( $REG_session = '' ) { |
|
249 | - $this->set( 'REG_session', $REG_session ); |
|
248 | + public function set_session($REG_session = '') { |
|
249 | + $this->set('REG_session', $REG_session); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | * @access public |
258 | 258 | * @param string $REG_url_link Registration URL Link |
259 | 259 | */ |
260 | - public function set_reg_url_link( $REG_url_link = '' ) { |
|
261 | - $this->set( 'REG_url_link', $REG_url_link ); |
|
260 | + public function set_reg_url_link($REG_url_link = '') { |
|
261 | + $this->set('REG_url_link', $REG_url_link); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | * @access public |
270 | 270 | * @param int $REG_count Primary Attendee |
271 | 271 | */ |
272 | - public function set_count( $REG_count = 1 ) { |
|
273 | - $this->set( 'REG_count', $REG_count ); |
|
272 | + public function set_count($REG_count = 1) { |
|
273 | + $this->set('REG_count', $REG_count); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | * @access public |
282 | 282 | * @param boolean $REG_group_size Group Registration |
283 | 283 | */ |
284 | - public function set_group_size( $REG_group_size = FALSE ) { |
|
285 | - $this->set( 'REG_group_size', $REG_group_size ); |
|
284 | + public function set_group_size($REG_group_size = FALSE) { |
|
285 | + $this->set('REG_group_size', $REG_group_size); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | * @access public |
366 | 366 | * @param mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date |
367 | 367 | */ |
368 | - public function set_reg_date( $REG_date = FALSE ) { |
|
369 | - $this->set( 'REG_date', $REG_date ); |
|
368 | + public function set_reg_date($REG_date = FALSE) { |
|
369 | + $this->set('REG_date', $REG_date); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | * @access public |
378 | 378 | * @param float $REG_final_price |
379 | 379 | */ |
380 | - public function set_final_price( $REG_final_price = 0.00 ) { |
|
381 | - $this->set( 'REG_final_price', $REG_final_price ); |
|
380 | + public function set_final_price($REG_final_price = 0.00) { |
|
381 | + $this->set('REG_final_price', $REG_final_price); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | |
@@ -389,8 +389,8 @@ discard block |
||
389 | 389 | * @access public |
390 | 390 | * @param float $REG_paid |
391 | 391 | */ |
392 | - public function set_paid( $REG_paid = 0.00 ) { |
|
393 | - $this->set( 'REG_paid', $REG_paid ); |
|
392 | + public function set_paid($REG_paid = 0.00) { |
|
393 | + $this->set('REG_paid', $REG_paid); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | * @access public |
402 | 402 | * @param boolean $REG_att_is_going Attendee Is Going |
403 | 403 | */ |
404 | - public function set_att_is_going( $REG_att_is_going = FALSE ) { |
|
405 | - $this->set( 'REG_att_is_going', $REG_att_is_going ); |
|
404 | + public function set_att_is_going($REG_att_is_going = FALSE) { |
|
405 | + $this->set('REG_att_is_going', $REG_att_is_going); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @return EE_Attendee |
413 | 413 | */ |
414 | 414 | public function attendee() { |
415 | - return $this->get_first_related( 'Attendee' ); |
|
415 | + return $this->get_first_related('Attendee'); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * @access public |
423 | 423 | */ |
424 | 424 | public function event_ID() { |
425 | - return $this->get( 'EVT_ID' ); |
|
425 | + return $this->get('EVT_ID'); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | */ |
434 | 434 | public function event_name() { |
435 | 435 | $event = $this->event_obj(); |
436 | - if ( $event ) { |
|
436 | + if ($event) { |
|
437 | 437 | return $event->name(); |
438 | 438 | } else { |
439 | 439 | return NULL; |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * @return EE_Event |
448 | 448 | */ |
449 | 449 | public function event_obj() { |
450 | - return $this->get_first_related( 'Event' ); |
|
450 | + return $this->get_first_related('Event'); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | * @access public |
458 | 458 | */ |
459 | 459 | public function attendee_ID() { |
460 | - return $this->get( 'ATT_ID' ); |
|
460 | + return $this->get('ATT_ID'); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | * @access public |
468 | 468 | */ |
469 | 469 | public function session_ID() { |
470 | - return $this->get( 'REG_session' ); |
|
470 | + return $this->get('REG_session'); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
478 | 478 | * @return string |
479 | 479 | */ |
480 | - public function receipt_url( $messenger = 'html' ) { |
|
480 | + public function receipt_url($messenger = 'html') { |
|
481 | 481 | |
482 | 482 | /** |
483 | 483 | * The below will be deprecated one version after this. We check first if there is a custom receipt template already in use on old system. If there is then we just return the standard url for it. |
@@ -486,12 +486,12 @@ discard block |
||
486 | 486 | */ |
487 | 487 | EE_Registry::instance()->load_helper('Template'); |
488 | 488 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php'; |
489 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
489 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
490 | 490 | |
491 | - if ( $has_custom ) { |
|
492 | - return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) ); |
|
491 | + if ($has_custom) { |
|
492 | + return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch')); |
|
493 | 493 | } |
494 | - return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' ); |
|
494 | + return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt'); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
503 | 503 | * @return string |
504 | 504 | */ |
505 | - public function invoice_url( $messenger = 'html' ) { |
|
505 | + public function invoice_url($messenger = 'html') { |
|
506 | 506 | /** |
507 | 507 | * The below will be deprecated one version after this. We check first if there is a custom invoice template already in use on old system. If there is then we just return the standard url for it. |
508 | 508 | * |
@@ -510,21 +510,21 @@ discard block |
||
510 | 510 | */ |
511 | 511 | EE_Registry::instance()->load_helper('Template'); |
512 | 512 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php'; |
513 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
513 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
514 | 514 | |
515 | - if ( $has_custom ) { |
|
516 | - if ( $messenger == 'html' ) { |
|
517 | - return $this->invoice_url( 'launch' ); |
|
515 | + if ($has_custom) { |
|
516 | + if ($messenger == 'html') { |
|
517 | + return $this->invoice_url('launch'); |
|
518 | 518 | } |
519 | 519 | $route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice'; |
520 | 520 | |
521 | - $query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() ); |
|
522 | - if ( $messenger == 'html' ) { |
|
521 | + $query_args = array('ee' => $route, 'id' => $this->reg_url_link()); |
|
522 | + if ($messenger == 'html') { |
|
523 | 523 | $query_args['html'] = TRUE; |
524 | 524 | } |
525 | - return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) ); |
|
525 | + return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id)); |
|
526 | 526 | } |
527 | - return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' ); |
|
527 | + return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice'); |
|
528 | 528 | } |
529 | 529 | |
530 | 530 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * @access public |
535 | 535 | */ |
536 | 536 | public function reg_url_link() { |
537 | - return $this->get( 'REG_url_link' ); |
|
537 | + return $this->get('REG_url_link'); |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | * @param string $type 'download','launch', or 'html' (default is 'launch') |
545 | 545 | * @return void |
546 | 546 | */ |
547 | - public function e_invoice_url( $type = 'launch' ) { |
|
548 | - echo $this->invoice_url( $type ); |
|
547 | + public function e_invoice_url($type = 'launch') { |
|
548 | + echo $this->invoice_url($type); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | * @return string |
566 | 566 | */ |
567 | 567 | public function payment_overview_url() { |
568 | - return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() ); |
|
568 | + return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url()); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | * @return string |
577 | 577 | */ |
578 | 578 | public function edit_attendee_information_url() { |
579 | - return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() ); |
|
579 | + return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url()); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | |
@@ -586,8 +586,8 @@ discard block |
||
586 | 586 | * @return string |
587 | 587 | */ |
588 | 588 | public function get_admin_edit_url() { |
589 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
590 | - return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) ); |
|
589 | + EE_Registry::instance()->load_helper('URL'); |
|
590 | + return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php')); |
|
591 | 591 | } |
592 | 592 | |
593 | 593 | |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | * @access public |
598 | 598 | */ |
599 | 599 | public function is_primary_registrant() { |
600 | - return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE; |
|
600 | + return $this->get('REG_count') == 1 ? TRUE : FALSE; |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | |
@@ -606,12 +606,12 @@ discard block |
||
606 | 606 | * This returns the primary registration object for this registration group (which may be this object). |
607 | 607 | * @return EE_Registration |
608 | 608 | */ |
609 | - public function get_primary_registration() { |
|
610 | - if ( $this->is_primary_registrant() ) |
|
609 | + public function get_primary_registration() { |
|
610 | + if ($this->is_primary_registrant()) |
|
611 | 611 | return $this; |
612 | 612 | |
613 | 613 | //k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1 |
614 | - $primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) ); |
|
614 | + $primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1))); |
|
615 | 615 | return $primary_registrant; |
616 | 616 | } |
617 | 617 | |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | * @access public |
623 | 623 | */ |
624 | 624 | public function count() { |
625 | - return $this->get( 'REG_count' ); |
|
625 | + return $this->get('REG_count'); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * @access public |
633 | 633 | */ |
634 | 634 | public function group_size() { |
635 | - return $this->get( 'REG_group_size' ); |
|
635 | + return $this->get('REG_group_size'); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | * @access public |
643 | 643 | */ |
644 | 644 | public function date() { |
645 | - return $this->get( 'REG_date' ); |
|
645 | + return $this->get('REG_date'); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | |
@@ -653,8 +653,8 @@ discard block |
||
653 | 653 | * @param string $time_format |
654 | 654 | * @return string |
655 | 655 | */ |
656 | - public function pretty_date( $date_format = NULL, $time_format = NULL ) { |
|
657 | - return $this->get_datetime( 'REG_date', $date_format, $time_format ); |
|
656 | + public function pretty_date($date_format = NULL, $time_format = NULL) { |
|
657 | + return $this->get_datetime('REG_date', $date_format, $time_format); |
|
658 | 658 | } |
659 | 659 | |
660 | 660 | |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | * @return float |
668 | 668 | */ |
669 | 669 | public function final_price() { |
670 | - return $this->get( 'REG_final_price' ); |
|
670 | + return $this->get('REG_final_price'); |
|
671 | 671 | } |
672 | 672 | |
673 | 673 | |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | * @return string |
679 | 679 | */ |
680 | 680 | public function pretty_final_price() { |
681 | - return $this->get_pretty( 'REG_final_price' ); |
|
681 | + return $this->get_pretty('REG_final_price'); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | * @return float |
690 | 690 | */ |
691 | 691 | public function paid() { |
692 | - return $this->get( 'REG_paid' ); |
|
692 | + return $this->get('REG_paid'); |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | * @return float |
701 | 701 | */ |
702 | 702 | public function pretty_paid() { |
703 | - return $this->get_pretty( 'REG_paid' ); |
|
703 | + return $this->get_pretty('REG_paid'); |
|
704 | 704 | } |
705 | 705 | |
706 | 706 | |
@@ -712,11 +712,11 @@ discard block |
||
712 | 712 | * @param array $requires_payment |
713 | 713 | * @return bool |
714 | 714 | */ |
715 | - public function owes_monies_and_can_pay( $requires_payment = array()) { |
|
715 | + public function owes_monies_and_can_pay($requires_payment = array()) { |
|
716 | 716 | // these reg statuses require payment (if event is not free) |
717 | - $requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment(); |
|
717 | + $requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment(); |
|
718 | 718 | if ( |
719 | - in_array( $this->status_ID(), $requires_payment ) && |
|
719 | + in_array($this->status_ID(), $requires_payment) && |
|
720 | 720 | $this->final_price() != 0 && |
721 | 721 | $this->final_price() != $this->paid() |
722 | 722 | ) { |
@@ -733,8 +733,8 @@ discard block |
||
733 | 733 | * @param bool $show_icons |
734 | 734 | * @return void |
735 | 735 | */ |
736 | - public function e_pretty_status( $show_icons = FALSE ) { |
|
737 | - echo $this->pretty_status( $show_icons ); |
|
736 | + public function e_pretty_status($show_icons = FALSE) { |
|
737 | + echo $this->pretty_status($show_icons); |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | |
@@ -745,10 +745,10 @@ discard block |
||
745 | 745 | * @param bool $show_icons |
746 | 746 | * @return string |
747 | 747 | */ |
748 | - public function pretty_status( $show_icons = FALSE ) { |
|
749 | - $status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' ); |
|
748 | + public function pretty_status($show_icons = FALSE) { |
|
749 | + $status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence'); |
|
750 | 750 | $icon = ''; |
751 | - switch ( $this->status_ID() ) { |
|
751 | + switch ($this->status_ID()) { |
|
752 | 752 | case EEM_Registration::status_id_approved: |
753 | 753 | $icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : ''; |
754 | 754 | break; |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | $icon = $show_icons ? '<span class="dashicons dashicons-no ee-icon-size-16 red-text"></span>' : ''; |
769 | 769 | break; |
770 | 770 | } |
771 | - return $icon . $status[ $this->status_ID() ]; |
|
771 | + return $icon.$status[$this->status_ID()]; |
|
772 | 772 | } |
773 | 773 | |
774 | 774 | |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | * @access public |
779 | 779 | */ |
780 | 780 | public function att_is_going() { |
781 | - return $this->get( 'REG_att_is_going' ); |
|
781 | + return $this->get('REG_att_is_going'); |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | |
@@ -788,8 +788,8 @@ discard block |
||
788 | 788 | * @param array $query_params like EEM_Base::get_all |
789 | 789 | * @return EE_Answer[] |
790 | 790 | */ |
791 | - public function answers( $query_params = NULL ) { |
|
792 | - return $this->get_many_related( 'Answer', $query_params ); |
|
791 | + public function answers($query_params = NULL) { |
|
792 | + return $this->get_many_related('Answer', $query_params); |
|
793 | 793 | } |
794 | 794 | |
795 | 795 | |
@@ -803,9 +803,9 @@ discard block |
||
803 | 803 | * (because the answer might be an array of answer values, so passing pretty_value=true |
804 | 804 | * will convert it into some kind of string) |
805 | 805 | */ |
806 | - public function answer_value_to_question( $question, $pretty_value=true ) { |
|
806 | + public function answer_value_to_question($question, $pretty_value = true) { |
|
807 | 807 | $question_id = EEM_Question::instance()->ensure_is_ID($question); |
808 | - return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value); |
|
808 | + return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value); |
|
809 | 809 | } |
810 | 810 | |
811 | 811 | |
@@ -818,13 +818,13 @@ discard block |
||
818 | 818 | */ |
819 | 819 | public function question_groups() { |
820 | 820 | $question_groups = array(); |
821 | - if ( $this->event() instanceof EE_Event ) { |
|
821 | + if ($this->event() instanceof EE_Event) { |
|
822 | 822 | $question_groups = $this->event()->question_groups( |
823 | 823 | array( |
824 | 824 | array( |
825 | 825 | 'Event_Question_Group.EQG_primary' => $this->count() == 1 ? true : false |
826 | 826 | ), |
827 | - 'order_by' => array( 'QSG_order' => 'ASC' ) |
|
827 | + 'order_by' => array('QSG_order' => 'ASC') |
|
828 | 828 | ) |
829 | 829 | ); |
830 | 830 | } |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | */ |
842 | 842 | public function count_question_groups() { |
843 | 843 | $qg_count = 0; |
844 | - if ( $this->event() instanceof EE_Event ) { |
|
844 | + if ($this->event() instanceof EE_Event) { |
|
845 | 845 | $qg_count = $this->event()->count_related( |
846 | 846 | 'Question_Group', |
847 | 847 | array( |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | * @return string |
863 | 863 | */ |
864 | 864 | public function reg_date() { |
865 | - return $this->get_datetime( 'REG_date' ); |
|
865 | + return $this->get_datetime('REG_date'); |
|
866 | 866 | } |
867 | 867 | |
868 | 868 | |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | * @return EE_Datetime_Ticket |
875 | 875 | */ |
876 | 876 | public function datetime_ticket() { |
877 | - return $this->get_first_related( 'Datetime_Ticket' ); |
|
877 | + return $this->get_first_related('Datetime_Ticket'); |
|
878 | 878 | } |
879 | 879 | |
880 | 880 | |
@@ -884,15 +884,15 @@ discard block |
||
884 | 884 | * @param EE_Datetime_Ticket $datetime_ticket |
885 | 885 | * @return EE_Datetime_Ticket |
886 | 886 | */ |
887 | - public function set_datetime_ticket( $datetime_ticket ) { |
|
888 | - return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' ); |
|
887 | + public function set_datetime_ticket($datetime_ticket) { |
|
888 | + return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket'); |
|
889 | 889 | } |
890 | 890 | /** |
891 | 891 | * Gets deleted |
892 | 892 | * @return boolean |
893 | 893 | */ |
894 | 894 | public function deleted() { |
895 | - return $this->get( 'REG_deleted' ); |
|
895 | + return $this->get('REG_deleted'); |
|
896 | 896 | } |
897 | 897 | |
898 | 898 | /** |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | * @return boolean |
902 | 902 | */ |
903 | 903 | public function set_deleted($deleted) { |
904 | - $this->set( 'REG_deleted', $deleted ); |
|
904 | + $this->set('REG_deleted', $deleted); |
|
905 | 905 | } |
906 | 906 | |
907 | 907 | |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | * @return EE_Status |
912 | 912 | */ |
913 | 913 | public function status_obj() { |
914 | - return $this->get_first_related( 'Status' ); |
|
914 | + return $this->get_first_related('Status'); |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | * @return int |
923 | 923 | */ |
924 | 924 | public function count_checkins() { |
925 | - return $this->get_model()->count_related( $this, 'Checkin' ); |
|
925 | + return $this->get_model()->count_related($this, 'Checkin'); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | |
@@ -932,7 +932,7 @@ discard block |
||
932 | 932 | * @return int |
933 | 933 | */ |
934 | 934 | public function count_checkins_not_checkedout() { |
935 | - return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) ); |
|
935 | + return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1))); |
|
936 | 936 | } |
937 | 937 | |
938 | 938 | |
@@ -945,20 +945,20 @@ discard block |
||
945 | 945 | * |
946 | 946 | * @return bool |
947 | 947 | */ |
948 | - public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) { |
|
949 | - $DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID ); |
|
948 | + public function can_checkin($DTT_OR_ID, $check_approved = TRUE) { |
|
949 | + $DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID); |
|
950 | 950 | |
951 | 951 | //first check registration status |
952 | - if ( ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) { |
|
952 | + if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) { |
|
953 | 953 | return false; |
954 | 954 | } |
955 | 955 | //is there a datetime ticket that matches this dtt_ID? |
956 | - if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) { |
|
956 | + if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) { |
|
957 | 957 | return false; |
958 | 958 | } |
959 | 959 | |
960 | 960 | //final check is against TKT_uses |
961 | - return $this->verify_can_checkin_against_TKT_uses( $DTT_ID ); |
|
961 | + return $this->verify_can_checkin_against_TKT_uses($DTT_ID); |
|
962 | 962 | } |
963 | 963 | |
964 | 964 | |
@@ -971,10 +971,10 @@ discard block |
||
971 | 971 | * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against |
972 | 972 | * @return bool true means can checkin. false means cannot checkin. |
973 | 973 | */ |
974 | - public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) { |
|
975 | - $DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID ); |
|
974 | + public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) { |
|
975 | + $DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID); |
|
976 | 976 | |
977 | - if ( ! $DTT_ID ) { |
|
977 | + if ( ! $DTT_ID) { |
|
978 | 978 | return false; |
979 | 979 | } |
980 | 980 | |
@@ -982,23 +982,23 @@ discard block |
||
982 | 982 | |
983 | 983 | // if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in |
984 | 984 | // or not. |
985 | - if ( ! $max_uses || $max_uses === EE_INF ) { |
|
985 | + if ( ! $max_uses || $max_uses === EE_INF) { |
|
986 | 986 | return true; |
987 | 987 | } |
988 | 988 | |
989 | 989 | //does this datetime have a checkin record? If so, then the dtt count has already been verified so we can just |
990 | 990 | //go ahead and toggle. |
991 | - if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) { |
|
991 | + if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) { |
|
992 | 992 | return true; |
993 | 993 | } |
994 | 994 | |
995 | 995 | //made it here so the last check is whether the number of checkins per unique datetime on this registration |
996 | 996 | //disallows further check-ins. |
997 | - $count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true ); |
|
997 | + $count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true); |
|
998 | 998 | // checkins have already reached their max number of uses |
999 | 999 | // so registrant can NOT checkin |
1000 | - if ( $count_unique_dtt_checkins >= $max_uses ) { |
|
1001 | - EE_Error::add_error( __( 'Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1000 | + if ($count_unique_dtt_checkins >= $max_uses) { |
|
1001 | + EE_Error::add_error(__('Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1002 | 1002 | return false; |
1003 | 1003 | } |
1004 | 1004 | return true; |
@@ -1019,15 +1019,15 @@ discard block |
||
1019 | 1019 | * @param bool $verify If true then can_checkin() is used to verify whether the person can be checked in or not. Otherwise this forces change in checkin status. |
1020 | 1020 | * @return int|BOOL the chk_in status toggled to OR false if nothing got changed. |
1021 | 1021 | */ |
1022 | - public function toggle_checkin_status( $DTT_ID = null, $verify = false ) { |
|
1023 | - if ( empty( $DTT_ID ) ) { |
|
1022 | + public function toggle_checkin_status($DTT_ID = null, $verify = false) { |
|
1023 | + if (empty($DTT_ID)) { |
|
1024 | 1024 | $datetime = $this->get_related_primary_datetime(); |
1025 | 1025 | $DTT_ID = $datetime->ID(); |
1026 | 1026 | // verify the registration can checkin for the given DTT_ID |
1027 | - } elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) { |
|
1027 | + } elseif ( ! $this->can_checkin($DTT_ID, $verify)) { |
|
1028 | 1028 | EE_Error::add_error( |
1029 | 1029 | sprintf( |
1030 | - __( 'The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'), |
|
1030 | + __('The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'), |
|
1031 | 1031 | $this->ID(), |
1032 | 1032 | $DTT_ID |
1033 | 1033 | ), |
@@ -1041,8 +1041,8 @@ discard block |
||
1041 | 1041 | EE_Registration::checkin_status_out => EE_Registration::checkin_status_in |
1042 | 1042 | ); |
1043 | 1043 | //start by getting the current status so we know what status we'll be changing to. |
1044 | - $cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL ); |
|
1045 | - $status_to = $status_paths[ $cur_status ]; |
|
1044 | + $cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL); |
|
1045 | + $status_to = $status_paths[$cur_status]; |
|
1046 | 1046 | // database only records true for checked IN or false for checked OUT |
1047 | 1047 | // no record ( null ) means checked in NEVER, but we obviously don't save that |
1048 | 1048 | $new_status = $status_to == EE_Registration::checkin_status_in ? true : false; |
@@ -1050,24 +1050,24 @@ discard block |
||
1050 | 1050 | // because we are keeping track of Check-ins over time. |
1051 | 1051 | // Eventually we'll probably want to show a list table |
1052 | 1052 | // for the individual Check-ins so that they can be managed. |
1053 | - $checkin = EE_Checkin::new_instance( array( |
|
1053 | + $checkin = EE_Checkin::new_instance(array( |
|
1054 | 1054 | 'REG_ID' => $this->ID(), |
1055 | 1055 | 'DTT_ID' => $DTT_ID, |
1056 | 1056 | 'CHK_in' => $new_status |
1057 | - ) ); |
|
1057 | + )); |
|
1058 | 1058 | // if the record could not be saved then return false |
1059 | - if ( $checkin->save() === 0 ) { |
|
1060 | - if ( WP_DEBUG ) { |
|
1059 | + if ($checkin->save() === 0) { |
|
1060 | + if (WP_DEBUG) { |
|
1061 | 1061 | global $wpdb; |
1062 | 1062 | $error = sprintf( |
1063 | - __( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ), |
|
1063 | + __('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'), |
|
1064 | 1064 | '<br />', |
1065 | 1065 | $wpdb->last_error |
1066 | 1066 | ); |
1067 | 1067 | } else { |
1068 | - $error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' ); |
|
1068 | + $error = __('Registration check in update failed because of an unknown database error', 'event_espresso'); |
|
1069 | 1069 | } |
1070 | - EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ ); |
|
1070 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
1071 | 1071 | return false; |
1072 | 1072 | } |
1073 | 1073 | return $status_to; |
@@ -1091,19 +1091,19 @@ discard block |
||
1091 | 1091 | * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id. |
1092 | 1092 | * @return int Integer representing Check-in status. |
1093 | 1093 | */ |
1094 | - public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) { |
|
1095 | - if ( empty( $DTT_ID ) && ! $checkin instanceof EE_Checkin ) { |
|
1094 | + public function check_in_status_for_datetime($DTT_ID = 0, $checkin = NULL) { |
|
1095 | + if (empty($DTT_ID) && ! $checkin instanceof EE_Checkin) { |
|
1096 | 1096 | $datetime = $this->get_related_primary_datetime(); |
1097 | - if ( ! $datetime instanceof EE_Datetime ) { |
|
1097 | + if ( ! $datetime instanceof EE_Datetime) { |
|
1098 | 1098 | return 0; |
1099 | 1099 | } |
1100 | 1100 | $DTT_ID = $datetime->ID(); |
1101 | 1101 | //verify the registration can checkin for the given DTT_ID |
1102 | 1102 | } |
1103 | 1103 | //get checkin object (if exists) |
1104 | - $checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ), 'order_by' => array( 'CHK_timestamp' => 'DESC' ) ) ); |
|
1105 | - if ( $checkin instanceof EE_Checkin ) { |
|
1106 | - if ( $checkin->get( 'CHK_in' ) ) { |
|
1104 | + $checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related('Checkin', array(array('DTT_ID' => $DTT_ID), 'order_by' => array('CHK_timestamp' => 'DESC'))); |
|
1105 | + if ($checkin instanceof EE_Checkin) { |
|
1106 | + if ($checkin->get('CHK_in')) { |
|
1107 | 1107 | return EE_Registration::checkin_status_in; //checked in |
1108 | 1108 | } else { |
1109 | 1109 | return EE_Registration::checkin_status_out; //had checked in but is now checked out. |
@@ -1121,28 +1121,28 @@ discard block |
||
1121 | 1121 | * @param bool $error This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name. |
1122 | 1122 | * @return string internationalized message |
1123 | 1123 | */ |
1124 | - public function get_checkin_msg( $DTT_ID, $error = FALSE ) { |
|
1124 | + public function get_checkin_msg($DTT_ID, $error = FALSE) { |
|
1125 | 1125 | //let's get the attendee first so we can include the name of the attendee |
1126 | - $attendee = $this->get_first_related( 'Attendee' ); |
|
1127 | - if ( $attendee instanceof EE_Attendee ) { |
|
1128 | - if ( $error ) { |
|
1129 | - return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() ); |
|
1126 | + $attendee = $this->get_first_related('Attendee'); |
|
1127 | + if ($attendee instanceof EE_Attendee) { |
|
1128 | + if ($error) { |
|
1129 | + return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name()); |
|
1130 | 1130 | } |
1131 | - $cur_status = $this->check_in_status_for_datetime( $DTT_ID ); |
|
1131 | + $cur_status = $this->check_in_status_for_datetime($DTT_ID); |
|
1132 | 1132 | //what is the status message going to be? |
1133 | - switch ( $cur_status ) { |
|
1133 | + switch ($cur_status) { |
|
1134 | 1134 | case EE_Registration::checkin_status_never : |
1135 | - return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() ); |
|
1135 | + return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name()); |
|
1136 | 1136 | break; |
1137 | 1137 | case EE_Registration::checkin_status_in : |
1138 | - return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() ); |
|
1138 | + return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name()); |
|
1139 | 1139 | break; |
1140 | 1140 | case EE_Registration::checkin_status_out : |
1141 | - return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() ); |
|
1141 | + return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name()); |
|
1142 | 1142 | break; |
1143 | 1143 | } |
1144 | 1144 | } |
1145 | - return __( "The check-in status could not be determined.", "event_espresso" ); |
|
1145 | + return __("The check-in status could not be determined.", "event_espresso"); |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | 1148 | |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | * @return EE_Transaction |
1153 | 1153 | */ |
1154 | 1154 | public function transaction() { |
1155 | - return $this->get_first_related( 'Transaction' ); |
|
1155 | + return $this->get_first_related('Transaction'); |
|
1156 | 1156 | } |
1157 | 1157 | |
1158 | 1158 | |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | * @access public |
1164 | 1164 | */ |
1165 | 1165 | public function reg_code() { |
1166 | - return $this->get( 'REG_code' ); |
|
1166 | + return $this->get('REG_code'); |
|
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | |
@@ -1173,7 +1173,7 @@ discard block |
||
1173 | 1173 | * @access public |
1174 | 1174 | */ |
1175 | 1175 | public function transaction_ID() { |
1176 | - return $this->get( 'TXN_ID' ); |
|
1176 | + return $this->get('TXN_ID'); |
|
1177 | 1177 | } |
1178 | 1178 | |
1179 | 1179 | |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | * @return int |
1183 | 1183 | */ |
1184 | 1184 | public function ticket_ID() { |
1185 | - return $this->get( 'TKT_ID' ); |
|
1185 | + return $this->get('TKT_ID'); |
|
1186 | 1186 | } |
1187 | 1187 | |
1188 | 1188 | |
@@ -1194,17 +1194,17 @@ discard block |
||
1194 | 1194 | * @param string $REG_code Registration Code |
1195 | 1195 | * @param boolean $use_default |
1196 | 1196 | */ |
1197 | - public function set_reg_code( $REG_code, $use_default = FALSE ) { |
|
1198 | - if ( empty( $REG_code )) { |
|
1199 | - EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1197 | + public function set_reg_code($REG_code, $use_default = FALSE) { |
|
1198 | + if (empty($REG_code)) { |
|
1199 | + EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1200 | 1200 | return; |
1201 | 1201 | } |
1202 | - if ( ! $this->reg_code() ) { |
|
1203 | - parent::set( 'REG_code', $REG_code, $use_default ); |
|
1202 | + if ( ! $this->reg_code()) { |
|
1203 | + parent::set('REG_code', $REG_code, $use_default); |
|
1204 | 1204 | } else { |
1205 | 1205 | EE_Error::doing_it_wrong( |
1206 | - __CLASS__ . '::' . __FUNCTION__, |
|
1207 | - __( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ), |
|
1206 | + __CLASS__.'::'.__FUNCTION__, |
|
1207 | + __('Can not change a registration REG_code once it has been set.', 'event_espresso'), |
|
1208 | 1208 | '4.6.0' |
1209 | 1209 | ); |
1210 | 1210 | } |
@@ -1224,17 +1224,17 @@ discard block |
||
1224 | 1224 | * @return EE_Registration[] or empty array if this isn't a group registration. |
1225 | 1225 | */ |
1226 | 1226 | public function get_all_other_registrations_in_group() { |
1227 | - if ( $this->group_size() < 2 ) { |
|
1227 | + if ($this->group_size() < 2) { |
|
1228 | 1228 | return array(); |
1229 | 1229 | } |
1230 | 1230 | |
1231 | 1231 | $query[0] = array( |
1232 | 1232 | 'TXN_ID' => $this->transaction_ID(), |
1233 | - 'REG_ID' => array( '!=', $this->ID() ), |
|
1233 | + 'REG_ID' => array('!=', $this->ID()), |
|
1234 | 1234 | 'TKT_ID' => $this->ticket_ID() |
1235 | 1235 | ); |
1236 | 1236 | |
1237 | - $registrations = $this->get_model()->get_all( $query ); |
|
1237 | + $registrations = $this->get_model()->get_all($query); |
|
1238 | 1238 | return $registrations; |
1239 | 1239 | } |
1240 | 1240 | |
@@ -1246,7 +1246,7 @@ discard block |
||
1246 | 1246 | * @access public |
1247 | 1247 | */ |
1248 | 1248 | public function price_paid() { |
1249 | - EE_Error::doing_it_wrong( 'EE_Registration::price_paid()', __( 'This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso' ), '4.7.0' ); |
|
1249 | + EE_Error::doing_it_wrong('EE_Registration::price_paid()', __('This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso'), '4.7.0'); |
|
1250 | 1250 | return $this->final_price(); |
1251 | 1251 | } |
1252 | 1252 | |
@@ -1258,9 +1258,9 @@ discard block |
||
1258 | 1258 | * @access public |
1259 | 1259 | * @param float $REG_final_price |
1260 | 1260 | */ |
1261 | - public function set_price_paid( $REG_final_price = 0.00 ) { |
|
1262 | - EE_Error::doing_it_wrong( 'EE_Registration::set_price_paid()', __( 'This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso' ), '4.7.0' ); |
|
1263 | - $this->set_final_price( $REG_final_price ); |
|
1261 | + public function set_price_paid($REG_final_price = 0.00) { |
|
1262 | + EE_Error::doing_it_wrong('EE_Registration::set_price_paid()', __('This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso'), '4.7.0'); |
|
1263 | + $this->set_final_price($REG_final_price); |
|
1264 | 1264 | } |
1265 | 1265 | |
1266 | 1266 | |
@@ -1271,7 +1271,7 @@ discard block |
||
1271 | 1271 | * @return string |
1272 | 1272 | */ |
1273 | 1273 | public function pretty_price_paid() { |
1274 | - EE_Error::doing_it_wrong( 'EE_Registration::pretty_price_paid()', __( 'This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso' ), '4.7.0' ); |
|
1274 | + EE_Error::doing_it_wrong('EE_Registration::pretty_price_paid()', __('This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso'), '4.7.0'); |
|
1275 | 1275 | return $this->pretty_final_price(); |
1276 | 1276 | } |
1277 | 1277 |